semaphor 0.0.49 → 0.0.51

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,5 +1,5 @@
1
- import { P as E, b as k, j as e, Q as xs, R as ps, U as z, V as Ps, W as fs, X as gs, Y as js, Z as bs, _ as B, $ as ae, a0 as Us, J as Gs, O as Ee, a1 as qa, a2 as Va, a3 as Ra, a4 as _a, a5 as Ha, a6 as Ba, a7 as As, a8 as _e, a9 as Ke, aa as We, T as ys, e as Js, g as vs, ab as Oe, ac as Me, f as Y, ad as Te, ae as Ae, af as He, ag as Le, ah as X, ai as Ns, G as r, aj as Pe, ak as Ue, al as $a, am as Ge, w as Qs, v as Ws, t as he, an as Ka, r as Pa, N as Ys, s as Ua, ao as Ga, B as Ja, ap as Xs, aq as Qa, L as Be, S as Cs, z as Wa, n as Es, ar as cs, A as ds, u as es, as as Ce, at as ze, au as Zs, av as ea, aw as sa, ax as aa, ay as ta, az as Ya, aA as Xa, aB as na, aC as Za, aD as et, aE as st, aF as at, aG as tt, aH as hs, aI as nt, aJ as Re, aK as ms, aL as Fe, aM as us, aN as Ls, aO as lt, aP as rt, aQ as it, aR as ot, aS as ct, aT as ls, aU as dt, aV as Ds, aW as ht, aX as Is, aY as mt, aZ as ut, a_ as xt, a$ as la, l as pt, C as ft, E as qs, d as gt, h as jt, i as bt, o as yt, b0 as vt, m as Nt, H as Ct, b1 as St, b2 as kt, b3 as wt, b4 as rs, b5 as zt, b6 as is, b7 as Vs, K as Ft, b8 as Ss, b9 as Ot, ba as ra, bb as Ye, bc as ia, bd as Mt, be as Tt, bf as At, bg as Et, bh as Lt, bi as Dt, bj as Se, bk as V, bl as R, bm as ks, bn as _, bo as Rs, bp as It, bq as qt, br as Vt, bs as Rt, bt as _s, bu as _t, bv as Ht, bw as Bt, bx as $t, by as Kt, bz as Pt } from "./index-qjDx7Ig8.js";
2
- import me, { useState as T, useEffect as K, useMemo as Ut, useRef as $e } from "react";
1
+ import { P as E, b as k, j as e, Q as ps, R as fs, U as w, V as Ks, W as gs, X as js, Y as bs, Z as ys, _ as B, $ as ae, a0 as Us, J as Gs, O as Ee, a1 as qa, a2 as Va, a3 as Ra, a4 as _a, a5 as Ha, a6 as Ba, a7 as As, a8 as _e, a9 as Pe, aa as We, T as vs, e as Js, g as Ns, ab as Oe, ac as Me, f as Y, ad as Te, ae as Ae, af as He, ag as Le, ah as X, ai as Cs, G as i, aj as Ke, ak as Ue, al as $a, am as Ge, w as Qs, v as Ws, t as he, an as Pa, r as Ka, N as Ys, s as Ua, ao as Ga, B as Ja, ap as Xs, aq as Qa, L as Be, S as Ss, z as Wa, n as Es, ar as ds, A as hs, u as es, as as Ce, at as ze, au as Zs, av as ea, aw as sa, ax as aa, ay as ta, az as Ya, aA as Xa, aB as na, aC as Za, aD as et, aE as st, aF as at, aG as tt, aH as ms, aI as nt, aJ as Re, aK as us, aL as Fe, aM as xs, aN as Ls, aO as rt, aP as lt, aQ as it, aR as ot, aS as ct, aT as ls, aU as dt, aV as Ds, aW as ht, aX as Is, aY as mt, aZ as ut, a_ as xt, a$ as ra, l as pt, C as ft, E as qs, d as gt, h as jt, i as bt, o as yt, b0 as vt, m as Nt, H as Ct, b1 as St, b2 as kt, b3 as wt, b4 as is, b5 as zt, b6 as os, b7 as Vs, K as Ft, b8 as ks, b9 as Ot, ba as la, bb as Ye, bc as ia, bd as Mt, be as Tt, bf as At, bg as Et, bh as Lt, bi as Dt, bj as Se, bk as V, bl as R, bm as ws, bn as _, bo as Rs, bp as It, bq as qt, br as Vt, bs as Rt, bt as _s, bu as _t, bv as Ht, bw as Bt, bx as $t, by as Pt, bz as Kt } from "./index-MYxGboTj.js";
2
+ import me, { useState as T, useEffect as P, useMemo as Ut, useRef as $e } from "react";
3
3
  /**
4
4
  * @license lucide-react v0.379.0 - ISC
5
5
  *
@@ -31,7 +31,7 @@ const Jt = E("AreaChart", [
31
31
  * This source code is licensed under the ISC license.
32
32
  * See the LICENSE file in the root directory of this source tree.
33
33
  */
34
- const ws = E("BarChart4", [
34
+ const zs = E("BarChart4", [
35
35
  ["path", { d: "M3 3v18h18", key: "1s2lah" }],
36
36
  ["path", { d: "M13 17V9", key: "1fwyjl" }],
37
37
  ["path", { d: "M18 17V5", key: "sfb6ij" }],
@@ -155,7 +155,7 @@ const sn = E("Key", [
155
155
  * This source code is licensed under the ISC license.
156
156
  * See the LICENSE file in the root directory of this source tree.
157
157
  */
158
- const zs = E("LineChart", [
158
+ const Fs = E("LineChart", [
159
159
  ["path", { d: "M3 3v18h18", key: "1s2lah" }],
160
160
  ["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
161
161
  ]);
@@ -204,7 +204,7 @@ const nn = E("ListX", [
204
204
  * This source code is licensed under the ISC license.
205
205
  * See the LICENSE file in the root directory of this source tree.
206
206
  */
207
- const ln = E("MessageSquareMore", [
207
+ const rn = E("MessageSquareMore", [
208
208
  ["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }],
209
209
  ["path", { d: "M8 10h.01", key: "19clt8" }],
210
210
  ["path", { d: "M12 10h.01", key: "1nrarc" }],
@@ -216,7 +216,7 @@ const ln = E("MessageSquareMore", [
216
216
  * This source code is licensed under the ISC license.
217
217
  * See the LICENSE file in the root directory of this source tree.
218
218
  */
219
- const rn = E("Network", [
219
+ const ln = E("Network", [
220
220
  ["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
221
221
  ["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
222
222
  ["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
@@ -388,37 +388,37 @@ const gn = E("User", [
388
388
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
389
389
  ]);
390
390
  function jn() {
391
- const [s, n] = T(""), [a, t] = T(!1), [i, o] = T(!1), l = k((h) => h.dashboard);
392
- function c() {
393
- const h = Gs(l), g = Ee(l.id), m = JSON.parse(localStorage.getItem(g) || "[]");
391
+ const [s, n] = T(""), [a, t] = T(!1), [o, c] = T(!1), r = k((d) => d.dashboard);
392
+ function l() {
393
+ const d = Gs(r), f = Ee(r.id), m = JSON.parse(localStorage.getItem(f) || "[]");
394
394
  if (m.some(
395
- (N) => N.name === s
395
+ (S) => S.name === s
396
396
  )) {
397
397
  t(!0);
398
398
  return;
399
399
  }
400
400
  m.push({
401
401
  name: s,
402
- template: h
403
- }), localStorage.setItem(g, JSON.stringify(m)), o(!1);
402
+ template: d
403
+ }), localStorage.setItem(f, JSON.stringify(m)), c(!1);
404
404
  }
405
- return /* @__PURE__ */ e.jsxs(xs, { open: i, onOpenChange: o, children: [
406
- /* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
407
- z,
405
+ return /* @__PURE__ */ e.jsxs(ps, { open: o, onOpenChange: c, children: [
406
+ /* @__PURE__ */ e.jsx(fs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
407
+ w,
408
408
  {
409
409
  variant: "outline",
410
410
  className: "h-7 p-2",
411
411
  size: "sm",
412
412
  children: [
413
- /* @__PURE__ */ e.jsx(Ps, { className: " mr-2 h-4 w-4", strokeWidth: 1.5 }),
413
+ /* @__PURE__ */ e.jsx(Ks, { className: " mr-2 h-4 w-4", strokeWidth: 1.5 }),
414
414
  "Add Lens"
415
415
  ]
416
416
  }
417
417
  ) }),
418
- /* @__PURE__ */ e.jsxs(fs, { className: "sm:max-w-[425px]", children: [
419
- /* @__PURE__ */ e.jsxs(gs, { children: [
420
- /* @__PURE__ */ e.jsx(js, { children: "Add a Lens" }),
421
- /* @__PURE__ */ e.jsx(bs, { children: "Lenses are private by default and are only visible to you." })
418
+ /* @__PURE__ */ e.jsxs(gs, { className: "sm:max-w-[425px]", children: [
419
+ /* @__PURE__ */ e.jsxs(js, { children: [
420
+ /* @__PURE__ */ e.jsx(bs, { children: "Add a Lens" }),
421
+ /* @__PURE__ */ e.jsx(ys, { children: "Lenses are private by default and are only visible to you." })
422
422
  ] }),
423
423
  /* @__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: [
424
424
  /* @__PURE__ */ e.jsx(B, { className: "text-right", children: "Name" }),
@@ -426,8 +426,8 @@ function jn() {
426
426
  ae,
427
427
  {
428
428
  value: s,
429
- onChange: (h) => {
430
- a && t(!1), n(h.target.value);
429
+ onChange: (d) => {
430
+ a && t(!1), n(d.target.value);
431
431
  },
432
432
  id: "name",
433
433
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -436,12 +436,12 @@ function jn() {
436
436
  ] }) }),
437
437
  a && /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "The bookmark name already exists. Use a differnet name." }),
438
438
  /* @__PURE__ */ e.jsx(Us, { children: /* @__PURE__ */ e.jsx(
439
- z,
439
+ w,
440
440
  {
441
441
  variant: "outline",
442
442
  type: "submit",
443
443
  disabled: !s,
444
- onClick: c,
444
+ onClick: l,
445
445
  children: "Save"
446
446
  }
447
447
  ) })
@@ -449,33 +449,33 @@ function jn() {
449
449
  ] });
450
450
  }
451
451
  function bn() {
452
- const [s, n] = T(!1), [a, t] = T(""), i = k((d) => d.dashboard), o = k((d) => d.bookmarkKey), [l, c] = T([]), h = k((d) => d.actions.setDashboard), g = k(
453
- (d) => d.actions.setFilterValues
452
+ const [s, n] = T(!1), [a, t] = T(""), o = k((h) => h.dashboard), c = k((h) => h.bookmarkKey), [r, l] = T([]), d = k((h) => h.actions.setDashboard), f = k(
453
+ (h) => h.actions.setFilterValues
454
454
  ), m = k(
455
- (d) => d.actions.setBookmarkKey
455
+ (h) => h.actions.setBookmarkKey
456
456
  );
457
- K(() => {
458
- const d = Ee(i.id), x = JSON.parse(localStorage.getItem(d) || "[]");
459
- c(x);
460
- const f = x.find(
461
- (w) => w.default
457
+ P(() => {
458
+ const h = Ee(o.id), x = JSON.parse(localStorage.getItem(h) || "[]");
459
+ l(x);
460
+ const g = x.find(
461
+ (z) => z.default
462
462
  );
463
- f && f.name === o && t(f.name);
464
- }, [s, i, o]);
465
- function u(d) {
466
- if (d === a)
463
+ g && g.name === c && t(g.name);
464
+ }, [s, o, c]);
465
+ function u(h) {
466
+ if (h === a)
467
467
  return;
468
- const x = l.find((w) => w.name === d), f = x == null ? void 0 : x.template;
469
- f && (h(f), g(x.filterValues || []), m(d === "Original" ? "" : d)), t(d);
468
+ const x = r.find((z) => z.name === h), g = x == null ? void 0 : x.template;
469
+ g && (d(g), f(x.filterValues || []), m(h === "Original" ? "" : h)), t(h);
470
470
  }
471
- function N(d) {
472
- const x = Ee(i.id), w = JSON.parse(localStorage.getItem(x) || "[]").filter(
473
- (b) => b.name !== d
471
+ function S(h) {
472
+ const x = Ee(o.id), z = JSON.parse(localStorage.getItem(x) || "[]").filter(
473
+ (b) => b.name !== h
474
474
  );
475
- localStorage.setItem(x, JSON.stringify(w)), c(w);
475
+ localStorage.setItem(x, JSON.stringify(z)), l(z);
476
476
  }
477
477
  return /* @__PURE__ */ e.jsxs(qa, { open: s, onOpenChange: n, children: [
478
- /* @__PURE__ */ e.jsx(Va, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "outline", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(Xt, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
478
+ /* @__PURE__ */ e.jsx(Va, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "outline", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(Xt, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
479
479
  /* @__PURE__ */ e.jsxs(Ra, { className: "w-56", children: [
480
480
  /* @__PURE__ */ e.jsx(_a, { children: "Lenses" }),
481
481
  /* @__PURE__ */ e.jsx(Ha, {}),
@@ -486,19 +486,19 @@ function bn() {
486
486
  onValueChange: u,
487
487
  children: [
488
488
  /* @__PURE__ */ e.jsx(As, { value: "Original", children: "Original" }),
489
- l.filter((d) => d.name != "Original").map((d, x) => /* @__PURE__ */ e.jsxs(
489
+ r.filter((h) => h.name != "Original").map((h, x) => /* @__PURE__ */ e.jsxs(
490
490
  As,
491
491
  {
492
492
  className: "xbg-red-100 flex justify-between",
493
- value: d.name,
494
- defaultChecked: d.name === o,
493
+ value: h.name,
494
+ defaultChecked: h.name === c,
495
495
  children: [
496
- /* @__PURE__ */ e.jsx("p", { children: d.name }),
496
+ /* @__PURE__ */ e.jsx("p", { children: h.name }),
497
497
  /* @__PURE__ */ e.jsx(
498
498
  _e,
499
499
  {
500
- onClick: (f) => {
501
- f.preventDefault(), N(d.name);
500
+ onClick: (g) => {
501
+ g.preventDefault(), S(h.name);
502
502
  },
503
503
  className: "h-3 w-3 hover:cursor-pointer",
504
504
  strokeWidth: 1.5
@@ -515,33 +515,33 @@ function bn() {
515
515
  ] });
516
516
  }
517
517
  function yn() {
518
- const [s, n] = T(!1), a = k((o) => o.dashboard), t = k((o) => o.bookmarkKey);
519
- K(() => {
518
+ const [s, n] = T(!1), a = k((c) => c.dashboard), t = k((c) => c.bookmarkKey);
519
+ P(() => {
520
520
  if (!t) {
521
521
  n(!1);
522
522
  return;
523
523
  }
524
- const o = Ee(a.id), c = JSON.parse(
525
- localStorage.getItem(o) || "[]"
524
+ const c = Ee(a.id), l = JSON.parse(
525
+ localStorage.getItem(c) || "[]"
526
526
  ).find(
527
- (h) => h.name === t
527
+ (d) => d.name === t
528
528
  );
529
- n(c ? c.default : !1);
529
+ n(l ? l.default : !1);
530
530
  }, [t, a.id]);
531
- function i(o) {
532
- if (n(o), !t)
531
+ function o(c) {
532
+ if (n(c), !t)
533
533
  return;
534
- const l = Ee(a.id), h = JSON.parse(
535
- localStorage.getItem(l) || "[]"
536
- ).map((g) => (g.name === t ? g.default = o : g.default = !1, g));
537
- console.log(h), localStorage.setItem(l, JSON.stringify(h));
534
+ const r = Ee(a.id), d = JSON.parse(
535
+ localStorage.getItem(r) || "[]"
536
+ ).map((f) => (f.name === t ? f.default = c : f.default = !1, f));
537
+ console.log(d), localStorage.setItem(r, JSON.stringify(d));
538
538
  }
539
539
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
540
540
  /* @__PURE__ */ e.jsx(
541
- Ke,
541
+ Pe,
542
542
  {
543
543
  checked: s,
544
- onCheckedChange: i,
544
+ onCheckedChange: o,
545
545
  id: "terms"
546
546
  }
547
547
  ),
@@ -560,16 +560,16 @@ function vn() {
560
560
  k((b) => b.selectedSheetId);
561
561
  const a = k(
562
562
  (b) => b.isDashboardEditing
563
- ), t = k((b) => b.filterValues), i = k((b) => b.isVisualEditing), o = k((b) => b.showFilters);
563
+ ), t = k((b) => b.filterValues), o = k((b) => b.isVisualEditing), c = k((b) => b.showFilters);
564
564
  k(
565
565
  (b) => b.showDashboardJSON
566
566
  );
567
- const l = k((b) => b.onSaveFunction), c = k(
567
+ const r = k((b) => b.onSaveFunction), l = k(
568
568
  (b) => b.actions.setShowFilters
569
- ), { addFrame: h, setSelectedFrameId: g } = k(
569
+ ), { addFrame: d, setSelectedFrameId: f } = k(
570
570
  (b) => b.actions
571
- ), { getSelectedSheet: m, setIsDashboardEditing: u, setShowDashboardJSON: N } = k((b) => b.actions), d = m(), x = () => {
572
- if (!a || !d)
571
+ ), { getSelectedSheet: m, setIsDashboardEditing: u, setShowDashboardJSON: S } = k((b) => b.actions), h = m(), x = () => {
572
+ if (!a || !h)
573
573
  return;
574
574
  const b = {
575
575
  id: We(),
@@ -591,34 +591,34 @@ function vn() {
591
591
  cards: [b],
592
592
  activeCardId: b.id
593
593
  };
594
- h(d.id, L), g(L.id);
595
- }, f = () => {
594
+ d(h.id, L), f(L.id);
595
+ }, g = () => {
596
596
  u(!0);
597
597
  };
598
- function w() {
598
+ function z() {
599
599
  if (!s || s === "")
600
600
  return;
601
- const b = Gs(n), L = Ee(n.id), C = JSON.parse(localStorage.getItem(L) || "[]"), O = C.findIndex(
601
+ const b = Gs(n), L = Ee(n.id), N = JSON.parse(localStorage.getItem(L) || "[]"), O = N.findIndex(
602
602
  (j) => j.name === s
603
603
  );
604
- O !== -1 ? C[O] = {
604
+ O !== -1 ? N[O] = {
605
605
  name: s,
606
606
  template: b,
607
- default: C[O].default,
607
+ default: N[O].default,
608
608
  filterValues: t
609
- } : C.push({
609
+ } : N.push({
610
610
  name: s,
611
611
  template: b,
612
612
  filterValues: t
613
- }), localStorage.setItem(L, JSON.stringify(C)), l == null || l(b);
613
+ }), localStorage.setItem(L, JSON.stringify(N)), r == null || r(b);
614
614
  }
615
- return i ? null : /* @__PURE__ */ e.jsxs(
615
+ return o ? null : /* @__PURE__ */ e.jsxs(
616
616
  "div",
617
617
  {
618
618
  className: "flex items-center justify-between gap-2 border-b bg-muted/50 px-2 py-2",
619
619
  role: "dashboard-controls",
620
620
  children: [
621
- !i && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
621
+ !o && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
622
622
  /* @__PURE__ */ e.jsx(B, { children: s }),
623
623
  !!s && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
624
624
  /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "|" }),
@@ -626,10 +626,10 @@ function vn() {
626
626
  ] })
627
627
  ] }),
628
628
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
629
- a && !i && /* @__PURE__ */ e.jsx(jn, {}),
630
- !i && /* @__PURE__ */ e.jsx(bn, {}),
631
- a && !i && /* @__PURE__ */ e.jsxs(
632
- z,
629
+ a && !o && /* @__PURE__ */ e.jsx(jn, {}),
630
+ !o && /* @__PURE__ */ e.jsx(bn, {}),
631
+ a && !o && /* @__PURE__ */ e.jsxs(
632
+ w,
633
633
  {
634
634
  variant: "outline",
635
635
  className: "h-7 p-2",
@@ -637,56 +637,56 @@ function vn() {
637
637
  disabled: !a,
638
638
  onClick: x,
639
639
  children: [
640
- /* @__PURE__ */ e.jsx(Ps, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
640
+ /* @__PURE__ */ e.jsx(Ks, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
641
641
  "Add Frame"
642
642
  ]
643
643
  }
644
644
  ),
645
645
  !a && /* @__PURE__ */ e.jsx(
646
- z,
646
+ w,
647
647
  {
648
648
  variant: "outline",
649
649
  className: "h-7 p-2",
650
- onClick: f,
650
+ onClick: g,
651
651
  size: "sm",
652
652
  children: /* @__PURE__ */ e.jsx(da, { className: "h-4 w-4", strokeWidth: 1.5 })
653
653
  }
654
654
  ),
655
- a && !i && /* @__PURE__ */ e.jsx(
656
- z,
655
+ a && !o && /* @__PURE__ */ e.jsx(
656
+ w,
657
657
  {
658
658
  variant: "outline",
659
659
  role: "close",
660
660
  className: "h-7 p-2",
661
661
  onClick: () => {
662
- u(!1), N(!1);
662
+ u(!1), S(!1);
663
663
  },
664
664
  size: "sm",
665
665
  children: /* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4", strokeWidth: 1.5 })
666
666
  }
667
667
  ),
668
- a && !i && /* @__PURE__ */ e.jsx(
669
- z,
668
+ a && !o && /* @__PURE__ */ e.jsx(
669
+ w,
670
670
  {
671
671
  className: "h-7 p-2",
672
672
  variant: "outline",
673
- onClick: w,
673
+ onClick: z,
674
674
  size: "sm",
675
675
  children: /* @__PURE__ */ e.jsx(dn, { className: "h-4 w-4", strokeWidth: 1.5 })
676
676
  }
677
677
  ),
678
- !o && !i && a && /* @__PURE__ */ e.jsx(
679
- z,
678
+ !c && !o && a && /* @__PURE__ */ e.jsx(
679
+ w,
680
680
  {
681
681
  className: "h-7 p-2",
682
682
  variant: "outline",
683
- onClick: () => c(!0),
683
+ onClick: () => l(!0),
684
684
  size: "sm",
685
685
  children: /* @__PURE__ */ e.jsx(oa, { className: "h-4 w-4", strokeWidth: 1.5 })
686
686
  }
687
687
  ),
688
- !i && a && !1,
689
- !i && !1
688
+ !o && a && !1,
689
+ !o && !1
690
690
  ] })
691
691
  ]
692
692
  }
@@ -697,68 +697,68 @@ function Qe({
697
697
  items: n,
698
698
  value: a,
699
699
  isLoading: t,
700
- isError: i,
701
- connectionTooltip: o,
702
- onChange: l,
703
- className: c,
704
- showIcon: h = !0,
705
- disabled: g = !1
700
+ isError: o,
701
+ connectionTooltip: c,
702
+ onChange: r,
703
+ className: l,
704
+ showIcon: d = !0,
705
+ disabled: f = !1
706
706
  }) {
707
- const m = t ? "Loading..." : i ? "Error" : a;
707
+ const m = t ? "Loading..." : o ? "Error" : a;
708
708
  function u() {
709
709
  if (s === "Connection")
710
710
  return /* @__PURE__ */ e.jsx(cn, { className: "size-4 rotate-90" });
711
711
  if (s === "Database")
712
712
  return /* @__PURE__ */ e.jsx(Wt, { className: "size-4" });
713
713
  if (s === "Schema")
714
- return /* @__PURE__ */ e.jsx(rn, { className: "size-4" });
714
+ return /* @__PURE__ */ e.jsx(ln, { className: "size-4" });
715
715
  if (s === "Table")
716
- return /* @__PURE__ */ e.jsx(Ns, { className: "size-4" });
716
+ return /* @__PURE__ */ e.jsx(Cs, { className: "size-4" });
717
717
  }
718
718
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
719
- h && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: o ? /* @__PURE__ */ e.jsxs(ys, { children: [
719
+ d && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: c ? /* @__PURE__ */ e.jsxs(vs, { children: [
720
720
  /* @__PURE__ */ e.jsx(Js, { children: u() }),
721
- /* @__PURE__ */ e.jsx(vs, { className: "text-xs", align: "start", children: o })
721
+ /* @__PURE__ */ e.jsx(Ns, { className: "text-xs", align: "start", children: c })
722
722
  ] }) : u() }),
723
- /* @__PURE__ */ e.jsxs(Oe, { disabled: g, value: m, onValueChange: l, children: [
723
+ /* @__PURE__ */ e.jsxs(Oe, { disabled: f, value: m, onValueChange: r, children: [
724
724
  /* @__PURE__ */ e.jsx(
725
725
  Me,
726
726
  {
727
727
  className: Y(
728
728
  "h-9 w-full focus:ring-1 focus:ring-offset-0",
729
- c
729
+ l
730
730
  ),
731
731
  children: /* @__PURE__ */ e.jsx(
732
732
  Te,
733
733
  {
734
- placeholder: t ? "Loading..." : i ? "Error" : `Select ${s}`
734
+ placeholder: t ? "Loading..." : o ? "Error" : `Select ${s}`
735
735
  }
736
736
  )
737
737
  }
738
738
  ),
739
739
  /* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
740
740
  t ? /* @__PURE__ */ e.jsx(Le, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(Le, { children: s }),
741
- /* @__PURE__ */ e.jsx(e.Fragment, { children: n && n.map((N, d) => /* @__PURE__ */ e.jsx(X, { value: N.id, children: N.name }, d)) }),
742
- (t || i) && /* @__PURE__ */ e.jsx(X, { value: m, children: m })
741
+ /* @__PURE__ */ e.jsx(e.Fragment, { children: n && n.map((S, h) => /* @__PURE__ */ e.jsx(X, { value: S.id, children: S.name }, h)) }),
742
+ (t || o) && /* @__PURE__ */ e.jsx(X, { value: m, children: m })
743
743
  ] }) })
744
744
  ] })
745
745
  ] });
746
746
  }
747
747
  function Nn({ column: s }) {
748
- const [n, a] = T(!1), t = r((m) => m.selectedTableName), i = r(
748
+ const [n, a] = T(!1), t = i((m) => m.selectedTableName), o = i(
749
749
  (m) => m.selectedSchemaName
750
- ), o = r((m) => m.sqlGen), l = r((m) => m.actions.setSqlGen), c = r((m) => m.actions.setCardSql), h = r((m) => m.actions.setRunSql);
751
- function g(m, u) {
752
- const N = Qs(m, o, u);
753
- l(N);
754
- const d = Ws(
755
- N,
756
- he(i || ""),
750
+ ), c = i((m) => m.sqlGen), r = i((m) => m.actions.setSqlGen), l = i((m) => m.actions.setCardSql), d = i((m) => m.actions.setRunSql);
751
+ function f(m, u) {
752
+ const S = Qs(m, c, u);
753
+ r(S);
754
+ const h = Ws(
755
+ S,
756
+ he(o || ""),
757
757
  he(t)
758
758
  );
759
- d && (c(d), h(!0)), a(!1);
759
+ h && (l(h), d(!0)), a(!1);
760
760
  }
761
- return /* @__PURE__ */ e.jsxs(Pe, { open: n, onOpenChange: a, children: [
761
+ return /* @__PURE__ */ e.jsxs(Ke, { open: n, onOpenChange: a, children: [
762
762
  /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx($a, { className: "h-4 w-4 cursor-pointer text-foreground/40" }) }),
763
763
  /* @__PURE__ */ e.jsx(
764
764
  Ge,
@@ -769,7 +769,7 @@ function Nn({ column: s }) {
769
769
  /* @__PURE__ */ e.jsx(
770
770
  "li",
771
771
  {
772
- onClick: () => g(s, "COUNT"),
772
+ onClick: () => f(s, "COUNT"),
773
773
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
774
774
  children: "Count"
775
775
  }
@@ -777,7 +777,7 @@ function Nn({ column: s }) {
777
777
  /* @__PURE__ */ e.jsx(
778
778
  "li",
779
779
  {
780
- onClick: () => g(s, "AVG"),
780
+ onClick: () => f(s, "AVG"),
781
781
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
782
782
  children: "Avg"
783
783
  }
@@ -785,7 +785,7 @@ function Nn({ column: s }) {
785
785
  /* @__PURE__ */ e.jsx(
786
786
  "li",
787
787
  {
788
- onClick: () => g(s, "SUM"),
788
+ onClick: () => f(s, "SUM"),
789
789
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
790
790
  children: "Sum"
791
791
  }
@@ -793,7 +793,7 @@ function Nn({ column: s }) {
793
793
  /* @__PURE__ */ e.jsx(
794
794
  "li",
795
795
  {
796
- onClick: () => g(s, "MAX"),
796
+ onClick: () => f(s, "MAX"),
797
797
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
798
798
  children: "Max"
799
799
  }
@@ -801,7 +801,7 @@ function Nn({ column: s }) {
801
801
  /* @__PURE__ */ e.jsx(
802
802
  "li",
803
803
  {
804
- onClick: () => g(s, "MIN"),
804
+ onClick: () => f(s, "MIN"),
805
805
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
806
806
  children: "Min"
807
807
  }
@@ -812,15 +812,15 @@ function Nn({ column: s }) {
812
812
  ] });
813
813
  }
814
814
  function ua({ column: s }) {
815
- return /* @__PURE__ */ e.jsxs(ys, { children: [
816
- /* @__PURE__ */ e.jsx(Ka, { asChild: !0, children: Pa.includes(s.data_type.toLowerCase()) ? (
815
+ return /* @__PURE__ */ e.jsxs(vs, { children: [
816
+ /* @__PURE__ */ e.jsx(Pa, { asChild: !0, children: Ka.includes(s.data_type.toLowerCase()) ? (
817
817
  // <span className=" font-thin">T</span>
818
818
  /* @__PURE__ */ e.jsx(fn, { className: "size-3" })
819
819
  ) : Ys.includes(s.data_type.toLowerCase()) ? (
820
820
  //
821
821
  /* @__PURE__ */ e.jsx(en, { className: "size-3" })
822
822
  ) : Ua.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(Ga, { className: "size-3" }) : Ja.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(pn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(hn, { className: "size-3" }) }),
823
- /* @__PURE__ */ e.jsx(vs, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
823
+ /* @__PURE__ */ e.jsx(Ns, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
824
824
  ] });
825
825
  }
826
826
  function Cn({
@@ -829,66 +829,66 @@ function Cn({
829
829
  columns: a,
830
830
  status: t
831
831
  }) {
832
- const i = r((j) => j.sqlGen), o = r(
832
+ const o = i((j) => j.sqlGen), c = i(
833
833
  (j) => j.selectedConnectionId
834
- ), l = r(
834
+ ), r = i(
835
835
  (j) => j.selectedDatabaseName
836
- ), c = r(
836
+ ), l = i(
837
837
  (j) => j.selectedSchemaName
838
- ), h = r((j) => j.selectedTableName), g = k(
838
+ ), d = i((j) => j.selectedTableName), f = k(
839
839
  (j) => j.dashboard.aiScopeTables
840
- ), { setAIScopeTables: m } = k((j) => j.actions), u = r((j) => j.actions.setRunSql), N = r((j) => j.actions.setSqlGen), d = r(
840
+ ), { setAIScopeTables: m } = k((j) => j.actions), u = i((j) => j.actions.setRunSql), S = i((j) => j.actions.setSqlGen), h = i(
841
841
  (j) => j.actions.setIsShowingVisual
842
- ), x = r((j) => j.actions.setCardSql), { connectionType: f } = xa();
843
- function w(j) {
844
- const F = Qs(j, i);
845
- N(F);
842
+ ), x = i((j) => j.actions.setCardSql), { connectionType: g } = xa();
843
+ function z(j) {
844
+ const F = Qs(j, o);
845
+ S(F);
846
846
  const A = Ws(F, he(s), he(n));
847
847
  A && (x(A), u(!0));
848
848
  }
849
849
  function b() {
850
- return (g == null ? void 0 : g.find(
851
- (j) => j.connectinonId === o && j.tableName === h
850
+ return (f == null ? void 0 : f.find(
851
+ (j) => j.connectinonId === c && j.tableName === d
852
852
  )) !== void 0;
853
853
  }
854
854
  function L(j) {
855
- if (j === !0 && h && o) {
855
+ if (j === !0 && d && c) {
856
856
  const F = {
857
- connectinonId: o,
858
- connectionType: f,
859
- databaseName: l,
860
- schemaName: c,
861
- tableName: h
862
- }, q = [...g || [], F].filter(
863
- (P, $, G) => G.findIndex(
864
- (D) => D.connectinonId === P.connectinonId && D.tableName === P.tableName
857
+ connectinonId: c,
858
+ connectionType: g,
859
+ databaseName: r,
860
+ schemaName: l,
861
+ tableName: d
862
+ }, q = [...f || [], F].filter(
863
+ (K, $, G) => G.findIndex(
864
+ (D) => D.connectinonId === K.connectinonId && D.tableName === K.tableName
865
865
  ) === $
866
866
  );
867
- m(q), cs.success(`Added '${h}' to AI Scope`, {
867
+ m(q), ds.success(`Added '${d}' to AI Scope`, {
868
868
  position: "top-right",
869
869
  duration: 2500,
870
870
  richColors: !0
871
871
  });
872
872
  } else {
873
- const F = (g || []).filter(
874
- (A) => A.connectinonId !== o && A.tableName !== h
873
+ const F = (f || []).filter(
874
+ (A) => A.connectinonId !== c && A.tableName !== d
875
875
  );
876
- m(F), cs(`Removed '${h}' from AI Scope`, {
876
+ m(F), ds(`Removed '${d}' from AI Scope`, {
877
877
  position: "top-right",
878
878
  duration: 2e3,
879
879
  richColors: !0
880
880
  });
881
881
  }
882
882
  }
883
- function C() {
884
- let F = ds(s, n);
885
- ((P) => P.charAt(0) === P.charAt(0).toUpperCase())(n) && (F = `"${n}"`), d(!1);
886
- const q = f === "MSSQL" ? `SELECT top 10 * FROM ${F}` : `SELECT * FROM ${F} LIMIT 10`;
883
+ function N() {
884
+ let F = hs(s, n);
885
+ ((K) => K.charAt(0) === K.charAt(0).toUpperCase())(n) && (F = `"${n}"`), h(!1);
886
+ const q = g === "MSSQL" ? `SELECT top 10 * FROM ${F}` : `SELECT * FROM ${F} LIMIT 10`;
887
887
  x(q), u(!0);
888
888
  }
889
889
  function O() {
890
- let F = ds(s, n);
891
- ((q) => q.charAt(0) === q.charAt(0).toUpperCase())(n) && (F = `"${n}"`), d(!1), x(`SELECT COUNT(*) as count FROM ${F}`), u(!0);
890
+ let F = hs(s, n);
891
+ ((q) => q.charAt(0) === q.charAt(0).toUpperCase())(n) && (F = `"${n}"`), h(!1), x(`SELECT COUNT(*) as count FROM ${F}`), u(!0);
892
892
  }
893
893
  return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
894
894
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
@@ -912,10 +912,10 @@ function Cn({
912
912
  }
913
913
  ),
914
914
  /* @__PURE__ */ e.jsxs(
915
- z,
915
+ w,
916
916
  {
917
917
  disabled: t !== "Success",
918
- onClick: C,
918
+ onClick: N,
919
919
  size: "sm",
920
920
  variant: "secondary",
921
921
  className: "flex",
@@ -926,7 +926,7 @@ function Cn({
926
926
  }
927
927
  ),
928
928
  /* @__PURE__ */ e.jsxs(
929
- z,
929
+ w,
930
930
  {
931
931
  disabled: t !== "Success",
932
932
  onClick: O,
@@ -941,18 +941,18 @@ function Cn({
941
941
  )
942
942
  ] }),
943
943
  /* @__PURE__ */ e.jsxs(
944
- Cs,
944
+ Ss,
945
945
  {
946
946
  className: "flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",
947
947
  children: [
948
948
  a == null ? void 0 : a.map((j) => /* @__PURE__ */ e.jsxs(
949
949
  "div",
950
950
  {
951
- onClick: () => w(j),
951
+ onClick: () => z(j),
952
952
  className: Y(
953
953
  "mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
954
954
  {
955
- "bg-muted": Wa(j, i)
955
+ "bg-muted": Wa(j, o)
956
956
  }
957
957
  ),
958
958
  children: [
@@ -980,38 +980,38 @@ function Cn({
980
980
  ] });
981
981
  }
982
982
  function xa(s, n) {
983
- var ss, ve, Je, qe;
983
+ var as, ve, Je, qe;
984
984
  let a = Ut(() => [], []);
985
- const t = es().authToken || s, i = r(
986
- (S) => S.selectedConnectionId
987
- ), o = r(
988
- (S) => S.selectedDatabaseName
989
- ), l = r(
990
- (S) => S.selectedSchemaName
991
- ), c = r((S) => S.selectedTableName), h = r(
992
- (S) => S.actions.setCurrentColumns
993
- ), g = r(
994
- (S) => S.actions.setSelectedConnectionId
995
- ), m = r(
996
- (S) => S.actions.setSelectedDatabaseName
997
- ), u = r(
998
- (S) => S.actions.setSelectedSchemaName
999
- ), N = r(
1000
- (S) => S.actions.setSelectedTableName
1001
- ), d = r((S) => S.actions.setCardSql);
1002
- function x(S) {
1003
- return i && o && l && o !== "NA" ? !0 : i && S === "API" ? !1 : !!(i && S === "S3");
985
+ const t = es().authToken || s, o = i(
986
+ (C) => C.selectedConnectionId
987
+ ), c = i(
988
+ (C) => C.selectedDatabaseName
989
+ ), r = i(
990
+ (C) => C.selectedSchemaName
991
+ ), l = i((C) => C.selectedTableName), d = i(
992
+ (C) => C.actions.setCurrentColumns
993
+ ), f = i(
994
+ (C) => C.actions.setSelectedConnectionId
995
+ ), m = i(
996
+ (C) => C.actions.setSelectedDatabaseName
997
+ ), u = i(
998
+ (C) => C.actions.setSelectedSchemaName
999
+ ), S = i(
1000
+ (C) => C.actions.setSelectedTableName
1001
+ ), h = i((C) => C.actions.setCardSql);
1002
+ function x(C) {
1003
+ return o && c && r && c !== "NA" ? !0 : o && C === "API" ? !1 : !!(o && C === "S3");
1004
1004
  }
1005
- function f(S) {
1006
- return !!(i && o && o !== "NA" && l && c || i && (S === "S3" || S === "API"));
1005
+ function g(C) {
1006
+ return !!(o && c && c !== "NA" && r && l || o && (C === "S3" || C === "API"));
1007
1007
  }
1008
- function w(S) {
1009
- return i && S ? !(S === "API" || S === "S3") : !1;
1008
+ function z(C) {
1009
+ return o && C ? !(C === "API" || C === "S3") : !1;
1010
1010
  }
1011
1011
  const {
1012
1012
  data: b,
1013
1013
  isLoading: L,
1014
- isError: C
1014
+ isError: N
1015
1015
  } = Ce({
1016
1016
  queryKey: ["connections"],
1017
1017
  queryFn: () => ze(
@@ -1021,23 +1021,23 @@ function xa(s, n) {
1021
1021
  enabled: !!(t != null && t.accessToken)
1022
1022
  // Only fetch if authToken is present
1023
1023
  }), O = b == null ? void 0 : b.connections.find(
1024
- (S) => S.id === i
1024
+ (C) => C.id === o
1025
1025
  ), j = O == null ? void 0 : O.type, F = (O == null ? void 0 : O.type) === "API" || (O == null ? void 0 : O.type) === "S3", {
1026
1026
  data: A,
1027
1027
  isLoading: q,
1028
- isFetching: P,
1028
+ isFetching: K,
1029
1029
  isError: $,
1030
1030
  refetch: G
1031
1031
  } = Ce({
1032
- queryKey: ["databases", i],
1032
+ queryKey: ["databases", o],
1033
1033
  queryFn: () => ze(
1034
1034
  "https://semaphor.cloud/api/v1/databases",
1035
1035
  (t == null ? void 0 : t.accessToken) || "",
1036
1036
  {
1037
- connection_id: i
1037
+ connection_id: o
1038
1038
  }
1039
1039
  ),
1040
- enabled: w(j)
1040
+ enabled: z(j)
1041
1041
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
1042
1042
  }), {
1043
1043
  data: D,
@@ -1046,16 +1046,16 @@ function xa(s, n) {
1046
1046
  isError: ee,
1047
1047
  refetch: Z
1048
1048
  } = Ce({
1049
- queryKey: ["schemas", i, o],
1049
+ queryKey: ["schemas", o, c],
1050
1050
  queryFn: () => ze(
1051
1051
  "https://semaphor.cloud/api/v1/schemas",
1052
1052
  (t == null ? void 0 : t.accessToken) || "",
1053
1053
  {
1054
- connection_id: i,
1055
- database_name: o
1054
+ connection_id: o,
1055
+ database_name: c
1056
1056
  }
1057
1057
  ),
1058
- enabled: !!i && !!o && !F && o !== "NA"
1058
+ enabled: !!o && !!c && !F && c !== "NA"
1059
1059
  //currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
1060
1060
  }), {
1061
1061
  data: J,
@@ -1066,17 +1066,17 @@ function xa(s, n) {
1066
1066
  } = Ce({
1067
1067
  queryKey: [
1068
1068
  "tables",
1069
- i,
1070
1069
  o,
1071
- l
1070
+ c,
1071
+ r
1072
1072
  ],
1073
1073
  queryFn: () => ze(
1074
1074
  "https://semaphor.cloud/api/v1/tables",
1075
1075
  (t == null ? void 0 : t.accessToken) || "",
1076
1076
  {
1077
- connection_id: i,
1078
- database_name: o,
1079
- schema_name: l
1077
+ connection_id: o,
1078
+ database_name: c,
1079
+ schema_name: r
1080
1080
  }
1081
1081
  ),
1082
1082
  enabled: x(j)
@@ -1088,22 +1088,22 @@ function xa(s, n) {
1088
1088
  } = Ce({
1089
1089
  queryKey: [
1090
1090
  "columns",
1091
- i,
1092
1091
  o,
1093
- l,
1094
- c
1092
+ c,
1093
+ r,
1094
+ l
1095
1095
  ],
1096
1096
  queryFn: () => ze(
1097
1097
  "https://semaphor.cloud/api/v1/columns",
1098
1098
  (t == null ? void 0 : t.accessToken) || "",
1099
1099
  {
1100
- connection_id: i,
1101
- database_name: o,
1102
- schema_name: l,
1103
- table_name: c
1100
+ connection_id: o,
1101
+ database_name: c,
1102
+ schema_name: r,
1103
+ table_name: l
1104
1104
  }
1105
1105
  ),
1106
- enabled: f(j)
1106
+ enabled: g(j)
1107
1107
  // (!!selectedConnectionId &&
1108
1108
  // !!selectedDatabaseName &&
1109
1109
  // !!selectedSchemaName &&
@@ -1112,55 +1112,55 @@ function xa(s, n) {
1112
1112
  //currentConnection?.type === 'API',
1113
1113
  // && currentConnection?.type !== 'API', // Only fetch if connectionId, database, and table is present
1114
1114
  });
1115
- K(() => {
1116
- h(a);
1117
- }, [H, h, a]), K(() => {
1115
+ P(() => {
1116
+ d(a);
1117
+ }, [H, d, a]), P(() => {
1118
1118
  }, [
1119
1119
  F,
1120
- d,
1121
- N,
1120
+ h,
1121
+ S,
1122
1122
  u,
1123
1123
  m,
1124
1124
  O
1125
1125
  ]);
1126
- const je = (O == null ? void 0 : O.type) === "API" ? (ss = O == null ? void 0 : O.type) == null ? void 0 : ss.toLowerCase() : c || "", be = F ? "" : l || "";
1127
- function xe(S) {
1128
- u(S), N("");
1126
+ const je = (O == null ? void 0 : O.type) === "API" ? (as = O == null ? void 0 : O.type) == null ? void 0 : as.toLowerCase() : l || "", be = F ? "" : r || "";
1127
+ function xe(C) {
1128
+ u(C), S("");
1129
1129
  }
1130
- function U(S) {
1131
- m(S), u(""), N("");
1130
+ function U(C) {
1131
+ m(C), u(""), S("");
1132
1132
  }
1133
- function ne(S) {
1134
- g(S);
1133
+ function ne(C) {
1134
+ f(C);
1135
1135
  }
1136
- A && ((ve = A == null ? void 0 : A.databases) == null ? void 0 : ve.length) > 0, D && ((Je = D == null ? void 0 : D.schemas) == null ? void 0 : Je.length) > 0, H && ((qe = H == null ? void 0 : H.columns) == null ? void 0 : qe.length) > 0 && (a = H.columns.map((S) => ({
1137
- ...S,
1138
- data_type: S.data_type.toLowerCase()
1139
- }))), $ && (a = []), (ge || C) && (a = []);
1140
- const le = b == null ? void 0 : b.connections.map(
1141
- (S) => ({
1142
- id: S.id,
1143
- name: S.name,
1144
- type: S.type
1136
+ A && ((ve = A == null ? void 0 : A.databases) == null ? void 0 : ve.length) > 0, D && ((Je = D == null ? void 0 : D.schemas) == null ? void 0 : Je.length) > 0, H && ((qe = H == null ? void 0 : H.columns) == null ? void 0 : qe.length) > 0 && (a = H.columns.map((C) => ({
1137
+ ...C,
1138
+ data_type: C.data_type.toLowerCase()
1139
+ }))), $ && (a = []), (ge || N) && (a = []);
1140
+ const re = b == null ? void 0 : b.connections.map(
1141
+ (C) => ({
1142
+ id: C.id,
1143
+ name: C.name,
1144
+ type: C.type
1145
1145
  })
1146
- ), ye = A == null ? void 0 : A.databases.map((S) => ({
1147
- id: S.database_name,
1148
- name: S.database_name
1149
- })), re = D == null ? void 0 : D.schemas.map((S) => ({
1150
- id: S.schema_name,
1151
- name: S.schema_name
1152
- })), Ie = J == null ? void 0 : J.tables.map((S) => ({
1153
- id: S.table_name,
1154
- name: S.table_name
1146
+ ), ye = A == null ? void 0 : A.databases.map((C) => ({
1147
+ id: C.database_name,
1148
+ name: C.database_name
1149
+ })), le = D == null ? void 0 : D.schemas.map((C) => ({
1150
+ id: C.schema_name,
1151
+ name: C.schema_name
1152
+ })), Ie = J == null ? void 0 : J.tables.map((C) => ({
1153
+ id: C.table_name,
1154
+ name: C.table_name
1155
1155
  }));
1156
1156
  return {
1157
- connectionItems: le,
1157
+ connectionItems: re,
1158
1158
  isConnectionsLoading: L,
1159
- isConnectionsError: C,
1159
+ isConnectionsError: N,
1160
1160
  databaseItems: ye,
1161
- isDatabasesLoadingOrFetching: q || P,
1161
+ isDatabasesLoadingOrFetching: q || K,
1162
1162
  isDatabaseError: $,
1163
- schemaItems: re,
1163
+ schemaItems: le,
1164
1164
  isSchemaLoadingOrFetching: te || Q,
1165
1165
  isSchemaError: ee,
1166
1166
  tableItems: Ie,
@@ -1182,35 +1182,35 @@ function pa({
1182
1182
  ColumnsComponent: s
1183
1183
  }) {
1184
1184
  var J;
1185
- const n = r(
1185
+ const n = i(
1186
1186
  (I) => I.selectedConnectionId
1187
- ), a = r(
1187
+ ), a = i(
1188
1188
  (I) => I.selectedDatabaseName
1189
- ), t = r(
1189
+ ), t = i(
1190
1190
  (I) => I.selectedSchemaName
1191
- ), i = r((I) => I.selectedTableName), o = r(
1191
+ ), o = i((I) => I.selectedTableName), c = i(
1192
1192
  (I) => I.actions.setSelectedTableName
1193
1193
  ), {
1194
- connectionItems: l,
1195
- schemaItems: c,
1196
- databaseItems: h,
1197
- tableItems: g,
1194
+ connectionItems: r,
1195
+ schemaItems: l,
1196
+ databaseItems: d,
1197
+ tableItems: f,
1198
1198
  columns: m,
1199
1199
  isConnectionsLoading: u,
1200
- isConnectionsError: N,
1201
- isDatabasesLoadingOrFetching: d,
1200
+ isConnectionsError: S,
1201
+ isDatabasesLoadingOrFetching: h,
1202
1202
  isDatabaseError: x,
1203
- isSchemaLoadingOrFetching: f,
1204
- isSchemaError: w,
1203
+ isSchemaLoadingOrFetching: g,
1204
+ isSchemaError: z,
1205
1205
  isColumnsError: b,
1206
1206
  isColumnsLoadingOrFetching: L,
1207
- isTableLoadingOrFetching: C,
1207
+ isTableLoadingOrFetching: N,
1208
1208
  isTableError: O,
1209
1209
  connectionType: j,
1210
1210
  isNonDbConnection: F,
1211
1211
  handleConnectionChange: A,
1212
1212
  handleDatabaseChange: q,
1213
- handleSchemaChange: P,
1213
+ handleSchemaChange: K,
1214
1214
  tableName: $,
1215
1215
  schemaName: G
1216
1216
  } = xa();
@@ -1234,8 +1234,8 @@ function pa({
1234
1234
  {
1235
1235
  onChange: q,
1236
1236
  isError: x,
1237
- isLoading: d,
1238
- items: h,
1237
+ isLoading: h,
1238
+ items: d,
1239
1239
  value: a || "",
1240
1240
  title: "Database"
1241
1241
  }
@@ -1245,10 +1245,10 @@ function pa({
1245
1245
  return j === "S3" || j === "API" ? null : /* @__PURE__ */ e.jsx(
1246
1246
  Qe,
1247
1247
  {
1248
- onChange: P,
1249
- isError: w,
1250
- isLoading: f,
1251
- items: c,
1248
+ onChange: K,
1249
+ isError: z,
1250
+ isLoading: g,
1251
+ items: l,
1252
1252
  value: t || "",
1253
1253
  title: "Schema"
1254
1254
  }
@@ -1258,11 +1258,11 @@ function pa({
1258
1258
  return j === "API" ? null : /* @__PURE__ */ e.jsx(
1259
1259
  Qe,
1260
1260
  {
1261
- onChange: o,
1261
+ onChange: c,
1262
1262
  isError: O,
1263
- items: g,
1264
- isLoading: C,
1265
- value: i || "",
1263
+ items: f,
1264
+ isLoading: N,
1265
+ value: o || "",
1266
1266
  title: "Table"
1267
1267
  }
1268
1268
  );
@@ -1272,13 +1272,13 @@ function pa({
1272
1272
  /* @__PURE__ */ e.jsx(
1273
1273
  Qe,
1274
1274
  {
1275
- items: l,
1275
+ items: r,
1276
1276
  title: "Connection",
1277
1277
  value: n || "",
1278
1278
  onChange: A,
1279
1279
  isLoading: u,
1280
- isError: N,
1281
- connectionTooltip: ((J = l == null ? void 0 : l.find(
1280
+ isError: S,
1281
+ connectionTooltip: ((J = r == null ? void 0 : r.find(
1282
1282
  (I) => I.id === n
1283
1283
  )) == null ? void 0 : J.type) || ""
1284
1284
  }
@@ -1289,14 +1289,14 @@ function pa({
1289
1289
  ] }),
1290
1290
  D(),
1291
1291
  /* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
1292
- z,
1292
+ w,
1293
1293
  {
1294
1294
  onClick: te,
1295
1295
  size: "sm",
1296
1296
  variant: "secondary",
1297
1297
  className: "w-full",
1298
1298
  children: [
1299
- /* @__PURE__ */ e.jsx(ln, { className: "mr-2 size-4" }),
1299
+ /* @__PURE__ */ e.jsx(rn, { className: "mr-2 size-4" }),
1300
1300
  "Help"
1301
1301
  ]
1302
1302
  }
@@ -1304,19 +1304,19 @@ function pa({
1304
1304
  ] });
1305
1305
  }
1306
1306
  function Sn(s) {
1307
- const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), i = s.toUpperCase().indexOf("ORDER BY");
1308
- let o = s.length;
1309
- if (i !== -1 && (o = i), t !== -1 && t < o && (o = t), n !== -1) {
1310
- const l = s.substring(0, n), c = s.substring(n);
1311
- return `${l} {{ filters | where }} AND ${c.substring(
1307
+ const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), o = s.toUpperCase().indexOf("ORDER BY");
1308
+ let c = s.length;
1309
+ if (o !== -1 && (c = o), t !== -1 && t < c && (c = t), n !== -1) {
1310
+ const r = s.substring(0, n), l = s.substring(n);
1311
+ return `${r} {{ filters | where }} AND ${l.substring(
1312
1312
  6
1313
1313
  )}`;
1314
1314
  } else if (a !== -1) {
1315
- const l = s.substring(0, a), c = s.substring(a);
1316
- return `${l} {{ filters | where }} ${c}`;
1315
+ const r = s.substring(0, a), l = s.substring(a);
1316
+ return `${r} {{ filters | where }} ${l}`;
1317
1317
  } else {
1318
- const l = s.substring(0, o), c = s.substring(o);
1319
- return `${l} {{ filters | where }} ${c}`;
1318
+ const r = s.substring(0, c), l = s.substring(c);
1319
+ return `${r} {{ filters | where }} ${l}`;
1320
1320
  }
1321
1321
  }
1322
1322
  function kn({
@@ -1326,10 +1326,10 @@ function kn({
1326
1326
  setTriggerAIRun: t
1327
1327
  }) {
1328
1328
  return /* @__PURE__ */ e.jsxs(Zs, { openDelay: 0, children: [
1329
- /* @__PURE__ */ e.jsx(ea, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "link", className: " p-0 h-5", children: /* @__PURE__ */ e.jsx(Qt, { className: "h-4 w-4 text-red-500" }) }) }),
1329
+ /* @__PURE__ */ e.jsx(ea, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "link", className: " p-0 h-5", children: /* @__PURE__ */ e.jsx(Qt, { className: "h-4 w-4 text-red-500" }) }) }),
1330
1330
  /* @__PURE__ */ e.jsx(sa, { align: "start", className: " min-w-fit max-w-[500px]", children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ e.jsxs("div", { className: "grow space-y-1 flex flex-col ", children: [
1331
1331
  /* @__PURE__ */ e.jsxs(
1332
- z,
1332
+ w,
1333
1333
  {
1334
1334
  onClick: () => {
1335
1335
  n(!0), a(s), t(!0);
@@ -1342,7 +1342,7 @@ function kn({
1342
1342
  ]
1343
1343
  }
1344
1344
  ),
1345
- /* @__PURE__ */ e.jsx(Cs, { className: " min-h-0 max-h-[250px] overflow-scroll ", children: /* @__PURE__ */ e.jsx("p", { className: " overflow-auto text-sm leading-relaxed font-mono ", children: s }) })
1345
+ /* @__PURE__ */ e.jsx(Ss, { className: " min-h-0 max-h-[250px] overflow-scroll ", children: /* @__PURE__ */ e.jsx("p", { className: " overflow-auto text-sm leading-relaxed font-mono ", children: s }) })
1346
1346
  ] }) }) })
1347
1347
  ] });
1348
1348
  }
@@ -1352,29 +1352,29 @@ function wn({
1352
1352
  checked: a
1353
1353
  }) {
1354
1354
  return /* @__PURE__ */ e.jsxs("div", { className: "xbg-red-100 ml-6 flex items-center gap-2", children: [
1355
- /* @__PURE__ */ e.jsx(Ke, { checked: a, onCheckedChange: n }),
1355
+ /* @__PURE__ */ e.jsx(Pe, { checked: a, onCheckedChange: n }),
1356
1356
  /* @__PURE__ */ e.jsx("label", { className: "text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: s })
1357
1357
  ] });
1358
1358
  }
1359
1359
  function zn() {
1360
- const { authToken: s } = es(), n = $e(null), a = r((c) => c.applyFilters), [t, i] = T(""), o = r((c) => c.filterValues), l = r((c) => c.card.sql);
1360
+ const { authToken: s } = es(), n = $e(null), a = i((l) => l.applyFilters), [t, o] = T(""), c = i((l) => l.filterValues), r = i((l) => l.card.sql);
1361
1361
  return /* @__PURE__ */ e.jsxs(
1362
1362
  Zs,
1363
1363
  {
1364
1364
  openDelay: 0,
1365
- onOpenChange: async (c) => {
1366
- if (!c)
1365
+ onOpenChange: async (l) => {
1366
+ if (!l)
1367
1367
  return;
1368
1368
  console.log("onOpenChange");
1369
- const h = await aa(
1369
+ const d = await aa(
1370
1370
  "https://semaphor.cloud/api/v1/filter-sql",
1371
1371
  (s == null ? void 0 : s.accessToken) || "",
1372
1372
  {
1373
- sql: l,
1374
- active_filters: o
1373
+ sql: r,
1374
+ active_filters: c
1375
1375
  }
1376
1376
  );
1377
- console.log(h), h.sql ? (console.log(h.records), i(h.sql)) : i("Error");
1377
+ console.log(d), d.sql ? (console.log(d.records), o(d.sql)) : o("Error");
1378
1378
  },
1379
1379
  children: [
1380
1380
  /* @__PURE__ */ e.jsx(ea, { asChild: !0, children: a && /* @__PURE__ */ e.jsx("p", { className: "p-0 text-xs hover:cursor-pointer", children: "|  Filter Query" }) }),
@@ -1450,24 +1450,24 @@ function On({
1450
1450
  setOpen: n,
1451
1451
  userInput: a,
1452
1452
  setUserInput: t,
1453
- triggerAIRun: i,
1454
- setTriggerAIRun: o
1453
+ triggerAIRun: o,
1454
+ setTriggerAIRun: c
1455
1455
  }) {
1456
- const l = $e(null), c = $e(null), { authToken: h } = es(), [g, m] = T(!1), u = r((y) => y.actions.setCardSql), N = k((y) => y.dashboard.baseQueries), d = r((y) => y.actions.setRunSql), x = r((y) => y.actions.setCardType), [f, w] = T([]), b = r((y) => y.currentColumns), L = r((y) => y.card.sql), C = r((y) => y.selectedTableName), O = `
1456
+ const r = $e(null), l = $e(null), { authToken: d } = es(), [f, m] = T(!1), u = i((y) => y.actions.setCardSql), S = k((y) => y.dashboard.baseQueries), h = i((y) => y.actions.setRunSql), x = i((y) => y.actions.setCardType), [g, z] = T([]), b = i((y) => y.currentColumns), L = i((y) => y.card.sql), N = i((y) => y.selectedTableName), O = `
1457
1457
  ${a}
1458
1458
 
1459
- Database Query Dialect: ${C === "api" || C === "s3" ? "DuckDb" : ""}
1460
- Table Name: ${C}
1459
+ Database Query Dialect: ${N === "api" || N === "s3" ? "DuckDb" : ""}
1460
+ Table Name: ${N}
1461
1461
  Table Columns: ${b == null ? void 0 : b.map((y) => `${y.column_name} | ${y.data_type}`).join(", ")}
1462
1462
  User SQL: ${L}
1463
- ${N && `Base Queries: ${JSON.stringify(N)} `}`, j = ` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
1464
- Visual Query Syntax: ${Fn}`, { data: F, isLoading: A, isFetching: q, isError: P, refetch: $ } = Ce({
1463
+ ${S && `Base Queries: ${JSON.stringify(S)} `}`, j = ` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
1464
+ Visual Query Syntax: ${Fn}`, { data: F, isLoading: A, isFetching: q, isError: K, refetch: $ } = Ce({
1465
1465
  queryKey: ["ai-query"],
1466
1466
  queryFn: () => ze(
1467
1467
  "https://semaphor.cloud/api/v1/ai",
1468
- (h == null ? void 0 : h.accessToken) || "",
1468
+ (d == null ? void 0 : d.accessToken) || "",
1469
1469
  {
1470
- user_content: `userContent: ${O} ${g ? j : ""}`
1470
+ user_content: `userContent: ${O} ${f ? j : ""}`
1471
1471
  }
1472
1472
  ),
1473
1473
  enabled: !1
@@ -1494,24 +1494,24 @@ function On({
1494
1494
  return x("bar"), !1;
1495
1495
  return !0;
1496
1496
  }
1497
- K(() => {
1498
- F && w((y) => [...y, { role: "ai", content: F.response }]);
1499
- }, [F]), K(() => {
1497
+ P(() => {
1498
+ F && z((y) => [...y, { role: "ai", content: F.response }]);
1499
+ }, [F]), P(() => {
1500
1500
  const y = setTimeout(() => {
1501
1501
  var v;
1502
- c.current && (c.current.scroll({
1503
- top: c.current.scrollHeight,
1502
+ l.current && (l.current.scroll({
1503
+ top: l.current.scrollHeight,
1504
1504
  behavior: "smooth"
1505
- }), (v = l.current) == null || v.focus());
1505
+ }), (v = r.current) == null || v.focus());
1506
1506
  }, 100);
1507
1507
  return () => clearTimeout(y);
1508
- }, [f]);
1508
+ }, [g]);
1509
1509
  function D() {
1510
- a && (w((y) => [...y, { role: "user", content: a }]), G(a) && m(!0), t(""), $());
1510
+ a && (z((y) => [...y, { role: "user", content: a }]), G(a) && m(!0), t(""), $());
1511
1511
  }
1512
- K(() => {
1513
- i && (D(), o(!1));
1514
- }, [i, o]);
1512
+ P(() => {
1513
+ o && (D(), c(!1));
1514
+ }, [o, c]);
1515
1515
  const te = {
1516
1516
  //seleect a darker color
1517
1517
  // color: '#000',
@@ -1544,13 +1544,13 @@ function On({
1544
1544
  pre: ({ node: y, ...v }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style: Q, children: [
1545
1545
  /* @__PURE__ */ e.jsx("code", { className: "whitespace-normal text-sm", children: v.children }),
1546
1546
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-start gap-2", children: [
1547
- /* @__PURE__ */ e.jsx(z, { onClick: J, size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(ta, {}) }),
1547
+ /* @__PURE__ */ e.jsx(w, { onClick: J, size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(ta, {}) }),
1548
1548
  /* @__PURE__ */ e.jsx(
1549
- z,
1549
+ w,
1550
1550
  {
1551
1551
  onClick: (M) => {
1552
1552
  const H = J(M);
1553
- H && (n(!1), u(H), d(!0));
1553
+ H && (n(!1), u(H), h(!0));
1554
1554
  },
1555
1555
  size: "sm",
1556
1556
  variant: "outline",
@@ -1570,7 +1570,7 @@ function On({
1570
1570
  return navigator.clipboard.writeText(M).then(() => console.log("Text copied to clipboard")).catch((H) => console.error("Error in copying text: ", H)), M;
1571
1571
  }
1572
1572
  function I() {
1573
- return f == null ? void 0 : f.map((y, v) => y.role === "user" ? /* @__PURE__ */ e.jsxs(
1573
+ return g == null ? void 0 : g.map((y, v) => y.role === "user" ? /* @__PURE__ */ e.jsxs(
1574
1574
  "div",
1575
1575
  {
1576
1576
  className: "flex items-start rounded-md bg-muted p-3 text-sm",
@@ -1590,9 +1590,9 @@ function On({
1590
1590
  v
1591
1591
  ) : /* @__PURE__ */ e.jsx("div", {}, v));
1592
1592
  }
1593
- return /* @__PURE__ */ e.jsxs(xs, { open: s, onOpenChange: n, children: [
1594
- /* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1595
- z,
1593
+ return /* @__PURE__ */ e.jsxs(ps, { open: s, onOpenChange: n, children: [
1594
+ /* @__PURE__ */ e.jsx(fs, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1595
+ w,
1596
1596
  {
1597
1597
  size: "sm",
1598
1598
  className: "w-full justify-start border font-normal text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",
@@ -1601,18 +1601,18 @@ function On({
1601
1601
  }
1602
1602
  ) }),
1603
1603
  /* @__PURE__ */ e.jsxs(
1604
- fs,
1604
+ gs,
1605
1605
  {
1606
1606
  className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",
1607
1607
  children: [
1608
- /* @__PURE__ */ e.jsxs(gs, { children: [
1609
- /* @__PURE__ */ e.jsx(js, { children: "Assistant" }),
1610
- /* @__PURE__ */ e.jsx(bs, { children: "What can I help you with?" })
1608
+ /* @__PURE__ */ e.jsxs(js, { children: [
1609
+ /* @__PURE__ */ e.jsx(bs, { children: "Assistant" }),
1610
+ /* @__PURE__ */ e.jsx(ys, { children: "What can I help you with?" })
1611
1611
  ] }),
1612
1612
  /* @__PURE__ */ e.jsx(
1613
1613
  "div",
1614
1614
  {
1615
- ref: c,
1615
+ ref: l,
1616
1616
  className: "h-[625px] w-full overflow-auto border-t border-t-muted",
1617
1617
  children: /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2 pr-3", role: "messages", children: I() })
1618
1618
  }
@@ -1625,7 +1625,7 @@ function On({
1625
1625
  na,
1626
1626
  {
1627
1627
  autoFocus: !0,
1628
- ref: l,
1628
+ ref: r,
1629
1629
  onKeyDown: (y) => {
1630
1630
  y.key === "Enter" && !y.shiftKey && (y.preventDefault(), t(""), D());
1631
1631
  },
@@ -1644,7 +1644,7 @@ function On({
1644
1644
  ),
1645
1645
  " ",
1646
1646
  /* @__PURE__ */ e.jsx(
1647
- z,
1647
+ w,
1648
1648
  {
1649
1649
  className: "h-8",
1650
1650
  size: "sm",
@@ -1671,20 +1671,20 @@ var fa = {
1671
1671
  function Tn(s, n) {
1672
1672
  if (s == null)
1673
1673
  return {};
1674
- var a = An(s, n), t, i;
1674
+ var a = An(s, n), t, o;
1675
1675
  if (Object.getOwnPropertySymbols) {
1676
- var o = Object.getOwnPropertySymbols(s);
1677
- for (i = 0; i < o.length; i++)
1678
- t = o[i], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(s, t) && (a[t] = s[t]);
1676
+ var c = Object.getOwnPropertySymbols(s);
1677
+ for (o = 0; o < c.length; o++)
1678
+ t = c[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(s, t) && (a[t] = s[t]);
1679
1679
  }
1680
1680
  return a;
1681
1681
  }
1682
1682
  function An(s, n) {
1683
1683
  if (s == null)
1684
1684
  return {};
1685
- var a = {}, t = Object.keys(s), i, o;
1686
- for (o = 0; o < t.length; o++)
1687
- i = t[o], !(n.indexOf(i) >= 0) && (a[i] = s[i]);
1685
+ var a = {}, t = Object.keys(s), o, c;
1686
+ for (c = 0; c < t.length; c++)
1687
+ o = t[c], !(n.indexOf(o) >= 0) && (a[o] = s[o]);
1688
1688
  return a;
1689
1689
  }
1690
1690
  function Xe() {
@@ -1701,8 +1701,8 @@ function Bs(s, n) {
1701
1701
  var a = Object.keys(s);
1702
1702
  if (Object.getOwnPropertySymbols) {
1703
1703
  var t = Object.getOwnPropertySymbols(s);
1704
- n && (t = t.filter(function(i) {
1705
- return Object.getOwnPropertyDescriptor(s, i).enumerable;
1704
+ n && (t = t.filter(function(o) {
1705
+ return Object.getOwnPropertyDescriptor(s, o).enumerable;
1706
1706
  })), a.push.apply(a, t);
1707
1707
  }
1708
1708
  return a;
@@ -1751,22 +1751,22 @@ function In(s) {
1751
1751
  var n = (a) => {
1752
1752
  var {
1753
1753
  attr: t,
1754
- size: i,
1755
- title: o
1756
- } = s, l = Tn(s, Mn), c = i || a.size || "1em", h;
1757
- return a.className && (h = a.className), s.className && (h = (h ? h + " " : "") + s.className), /* @__PURE__ */ me.createElement("svg", Xe({
1754
+ size: o,
1755
+ title: c
1756
+ } = s, r = Tn(s, Mn), l = o || a.size || "1em", d;
1757
+ return a.className && (d = a.className), s.className && (d = (d ? d + " " : "") + s.className), /* @__PURE__ */ me.createElement("svg", Xe({
1758
1758
  stroke: "currentColor",
1759
1759
  fill: "currentColor",
1760
1760
  strokeWidth: "0"
1761
- }, a.attr, t, l, {
1762
- className: h,
1761
+ }, a.attr, t, r, {
1762
+ className: d,
1763
1763
  style: Ze(Ze({
1764
1764
  color: s.color || a.color
1765
1765
  }, a.style), s.style),
1766
- height: c,
1767
- width: c,
1766
+ height: l,
1767
+ width: l,
1768
1768
  xmlns: "http://www.w3.org/2000/svg"
1769
- }), o && /* @__PURE__ */ me.createElement("title", null, o), s.children);
1769
+ }), c && /* @__PURE__ */ me.createElement("title", null, c), s.children);
1770
1770
  };
1771
1771
  return Hs !== void 0 ? /* @__PURE__ */ me.createElement(Hs.Consumer, null, (a) => n(a)) : n(fa);
1772
1772
  }
@@ -1774,19 +1774,19 @@ function qn(s) {
1774
1774
  return fe({ 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);
1775
1775
  }
1776
1776
  function Vn() {
1777
- const { theme: s } = at(), n = $e(), a = $e(), [t, i] = T(!1), [o, l] = T(!1), [c, h] = T(!1), [g, m] = T(""), [u, N] = T(!1), { authToken: d } = es();
1777
+ const { theme: s } = at(), n = $e(), a = $e(), [t, o] = T(!1), [c, r] = T(!1), [l, d] = T(!1), [f, m] = T(""), [u, S] = T(!1), { authToken: h } = es();
1778
1778
  k((p) => p.selectedSheetId);
1779
- const x = k((p) => p.dashboard.baseQueries), f = r((p) => p.card), w = k((p) => p.theme), b = r((p) => p.isShowingVisual), L = r(
1779
+ const x = k((p) => p.dashboard.baseQueries), g = i((p) => p.card), z = k((p) => p.theme), b = i((p) => p.isShowingVisual), L = i(
1780
1780
  (p) => p.selectedConnectionId
1781
- ), C = r(
1781
+ ), N = i(
1782
1782
  (p) => p.selectedDatabaseName
1783
- ), O = r(
1783
+ ), O = i(
1784
1784
  (p) => p.selectedSchemaName
1785
1785
  );
1786
1786
  k(
1787
1787
  (p) => p.actions.updateFrameCard
1788
1788
  );
1789
- const j = r((p) => p.selectedTableName), F = r((p) => p.card.sql), A = r((p) => p.card.python), q = tt(F, x), P = r((p) => p.selectedConnectionId), $ = r((p) => p.frame), G = r((p) => p.filterValues), D = r((p) => p.applyFilters), {
1789
+ const j = i((p) => p.selectedTableName), F = i((p) => p.card.sql), A = i((p) => p.card.python), q = tt(F, x), K = i((p) => p.selectedConnectionId), $ = i((p) => p.frame), G = i((p) => p.filterValues), D = i((p) => p.applyFilters), {
1790
1790
  setCardCustomCfg: te,
1791
1791
  setQueryResultColumns: Q,
1792
1792
  setFilterValues: ee,
@@ -1795,26 +1795,26 @@ function Vn() {
1795
1795
  setQueryError: I,
1796
1796
  setPythonStdOut: y,
1797
1797
  setCardPreferences: v
1798
- } = r((p) => p.actions), M = r((p) => p.onSave), H = r(
1798
+ } = i((p) => p.actions), M = i((p) => p.onSave), H = i(
1799
1799
  (p) => p.actions.setApplyFilters
1800
- ), ue = r((p) => p.onClose), se = r((p) => p.actions.setCardData), ge = r((p) => p.actions.setSqlGen), je = r((p) => p.runSql), be = r((p) => p.actions.setRunSql), xe = r(
1800
+ ), ue = i((p) => p.onClose), se = i((p) => p.actions.setCardData), ge = i((p) => p.actions.setSqlGen), je = i((p) => p.runSql), be = i((p) => p.actions.setRunSql), xe = i(
1801
1801
  (p) => p.actions.setIsSqlRunning
1802
1802
  ), {
1803
1803
  data: U,
1804
1804
  isLoading: ne,
1805
- isFetching: le,
1805
+ isFetching: re,
1806
1806
  isSuccess: ye,
1807
- isError: re,
1807
+ isError: le,
1808
1808
  error: Ie,
1809
- status: ss,
1809
+ status: as,
1810
1810
  refetch: ve
1811
1811
  } = Ce({
1812
1812
  queryKey: [q, A],
1813
1813
  queryFn: () => aa(
1814
1814
  "https://semaphor.cloud/api/v1/query",
1815
- (d == null ? void 0 : d.accessToken) || "",
1815
+ (h == null ? void 0 : h.accessToken) || "",
1816
1816
  {
1817
- connection_id: P,
1817
+ connection_id: K,
1818
1818
  sql: q,
1819
1819
  python: A === Ls ? "" : A,
1820
1820
  active_filters: D ? G : []
@@ -1823,24 +1823,24 @@ function Vn() {
1823
1823
  enabled: !1,
1824
1824
  retry: !1
1825
1825
  });
1826
- K(() => {
1827
- if (U && (se(U.records), U.rowLimitExceeded && cs.error("Row limit (10,000) exceeded. Refine your query.", {
1826
+ P(() => {
1827
+ if (U && (se(U.records), U.rowLimitExceeded && ds.error("Row limit (10,000) exceeded. Refine your query.", {
1828
1828
  position: "top-center",
1829
1829
  richColors: !0
1830
1830
  }), y((U == null ? void 0 : U.output) || ""), U.records.length > 0)) {
1831
- const { dimensionKeys: p } = hs(U.records);
1831
+ const { dimensionKeys: p } = ms(U.records);
1832
1832
  Q(p);
1833
1833
  }
1834
- }, [U, se, Q, y]), K(() => {
1834
+ }, [U, se, Q, y]), P(() => {
1835
1835
  je && (ve(), be(!1));
1836
- }, [je, ve, be]), K(() => {
1837
- (ne || le) && xe(!0), (re || ye) && xe(!1), re ? (I(Ie.message), se([]), Q([]), y("")) : I("");
1836
+ }, [je, ve, be]), P(() => {
1837
+ (ne || re) && xe(!0), (le || ye) && xe(!1), le ? (I(Ie.message), se([]), Q([]), y("")) : I("");
1838
1838
  }, [
1839
1839
  ne,
1840
- le,
1840
+ re,
1841
1841
  U,
1842
1842
  y,
1843
- re,
1843
+ le,
1844
1844
  ye,
1845
1845
  xe,
1846
1846
  se,
@@ -1854,20 +1854,20 @@ function Vn() {
1854
1854
  const qe = (p) => {
1855
1855
  a.current = p;
1856
1856
  };
1857
- function S() {
1857
+ function C() {
1858
1858
  let p = F;
1859
1859
  F && !F.includes("{{") && (p = Sn(F), Z(p));
1860
1860
  const ie = {
1861
- ...f,
1861
+ ...g,
1862
1862
  lastSelectedSchema: O,
1863
- lastSelectedDatabase: C,
1863
+ lastSelectedDatabase: N,
1864
1864
  lastSelectedTable: j,
1865
1865
  connectionId: L,
1866
- type: b ? f.type : "table",
1866
+ type: b ? g.type : "table",
1867
1867
  sql: p,
1868
- customCfg: b ? f.customCfg : null
1868
+ customCfg: b ? g.customCfg : null
1869
1869
  }, Ve = $.cards.map(
1870
- (Ne) => Ne.id === f.id ? ie : Ne
1870
+ (Ne) => Ne.id === g.id ? ie : Ne
1871
1871
  );
1872
1872
  M == null || M({
1873
1873
  ...$,
@@ -1884,19 +1884,19 @@ function Vn() {
1884
1884
  return Ma(ie);
1885
1885
  }
1886
1886
  function Ma(p) {
1887
- const [ie, Ve, Ne] = p.split(" "), W = parseFloat(ie), Ea = parseFloat(Ve), La = parseFloat(Ne), Da = Ea / 100, Ts = La / 100, pe = (1 - Math.abs(2 * Ts - 1)) * Da, ke = pe * (1 - Math.abs(W / 60 % 2 - 1)), as = Ts - pe / 2;
1887
+ const [ie, Ve, Ne] = p.split(" "), W = parseFloat(ie), Ea = parseFloat(Ve), La = parseFloat(Ne), Da = Ea / 100, Ts = La / 100, pe = (1 - Math.abs(2 * Ts - 1)) * Da, ke = pe * (1 - Math.abs(W / 60 % 2 - 1)), ts = Ts - pe / 2;
1888
1888
  let oe = 0, ce = 0, de = 0;
1889
- 0 <= W && W < 60 ? (oe = pe, ce = ke, de = 0) : 60 <= W && W < 120 ? (oe = ke, ce = pe, de = 0) : 120 <= W && W < 180 ? (oe = 0, ce = pe, de = ke) : 180 <= W && W < 240 ? (oe = 0, ce = ke, de = pe) : 240 <= W && W < 300 ? (oe = ke, ce = 0, de = pe) : 300 <= W && W < 360 && (oe = pe, ce = 0, de = ke), oe = Math.round((oe + as) * 255), ce = Math.round((ce + as) * 255), de = Math.round((de + as) * 255);
1890
- const ts = (Ia) => {
1891
- const ns = Ia.toString(16);
1892
- return ns.length == 1 ? "0" + ns : ns;
1889
+ 0 <= W && W < 60 ? (oe = pe, ce = ke, de = 0) : 60 <= W && W < 120 ? (oe = ke, ce = pe, de = 0) : 120 <= W && W < 180 ? (oe = 0, ce = pe, de = ke) : 180 <= W && W < 240 ? (oe = 0, ce = ke, de = pe) : 240 <= W && W < 300 ? (oe = ke, ce = 0, de = pe) : 300 <= W && W < 360 && (oe = pe, ce = 0, de = ke), oe = Math.round((oe + ts) * 255), ce = Math.round((ce + ts) * 255), de = Math.round((de + ts) * 255);
1890
+ const ns = (Ia) => {
1891
+ const rs = Ia.toString(16);
1892
+ return rs.length == 1 ? "0" + rs : rs;
1893
1893
  };
1894
- return `#${ts(oe)}${ts(ce)}${ts(de)}`;
1894
+ return `#${ns(oe)}${ns(ce)}${ns(de)}`;
1895
1895
  }
1896
- K(() => {
1896
+ P(() => {
1897
1897
  const p = n.current, ie = a.current;
1898
1898
  if (p) {
1899
- const Ve = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", Ne = w === "system" ? Ve : w;
1899
+ const Ve = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", Ne = z === "system" ? Ve : z;
1900
1900
  p.editor.defineTheme("default", {
1901
1901
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
1902
1902
  base: Ne === "light" ? "vs" : "vs-dark",
@@ -1915,13 +1915,13 @@ function Vn() {
1915
1915
  }
1916
1916
  ), () => {
1917
1917
  };
1918
- }, [s, w, n.current]);
1918
+ }, [s, z, n.current]);
1919
1919
  function Ms(p) {
1920
1920
  n.current = p;
1921
1921
  }
1922
1922
  function Ta() {
1923
1923
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1924
- o && /* @__PURE__ */ e.jsx(
1924
+ c && /* @__PURE__ */ e.jsx(
1925
1925
  "div",
1926
1926
  {
1927
1927
  className: "xbg-yellow-100 relative flex w-1/3 min-w-0 grow overflow-hidden border-l p-1 text-xs",
@@ -1937,10 +1937,10 @@ function Vn() {
1937
1937
  }
1938
1938
  ),
1939
1939
  /* @__PURE__ */ e.jsx(zn, {}),
1940
- G && o && /* @__PURE__ */ e.jsx(
1940
+ G && c && /* @__PURE__ */ e.jsx(
1941
1941
  _e,
1942
1942
  {
1943
- onClick: () => l(!1),
1943
+ onClick: () => r(!1),
1944
1944
  className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
1945
1945
  }
1946
1946
  )
@@ -1979,10 +1979,10 @@ function Vn() {
1979
1979
  ] })
1980
1980
  }
1981
1981
  ),
1982
- G && !o && /* @__PURE__ */ e.jsx(
1982
+ G && !c && /* @__PURE__ */ e.jsx(
1983
1983
  oa,
1984
1984
  {
1985
- onClick: () => l(!0),
1985
+ onClick: () => r(!0),
1986
1986
  className: Y(
1987
1987
  "absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
1988
1988
  {
@@ -1995,7 +1995,7 @@ function Vn() {
1995
1995
  }
1996
1996
  function Aa() {
1997
1997
  return /* @__PURE__ */ e.jsxs(
1998
- ms,
1998
+ us,
1999
1999
  {
2000
2000
  className: "flex grow pb-1",
2001
2001
  direction: "vertical",
@@ -2048,7 +2048,7 @@ function Vn() {
2048
2048
  }
2049
2049
  ),
2050
2050
  t && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2051
- /* @__PURE__ */ e.jsx(us, { withHandle: !0, className: "border" }),
2051
+ /* @__PURE__ */ e.jsx(xs, { withHandle: !0, className: "border" }),
2052
2052
  /* @__PURE__ */ e.jsxs(
2053
2053
  Fe,
2054
2054
  {
@@ -2126,10 +2126,10 @@ function Vn() {
2126
2126
  children: [
2127
2127
  /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
2128
2128
  /* @__PURE__ */ e.jsxs(
2129
- z,
2129
+ w,
2130
2130
  {
2131
2131
  title: "Shift + Enter",
2132
- disabled: ne || le,
2132
+ disabled: ne || re,
2133
2133
  onClick: () => {
2134
2134
  ve();
2135
2135
  },
@@ -2137,22 +2137,22 @@ function Vn() {
2137
2137
  size: "sm",
2138
2138
  variant: "outline",
2139
2139
  children: [
2140
- ne || le ? /* @__PURE__ */ e.jsx(Be, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(on, { className: "mr-2 h-4 w-4" }),
2140
+ ne || re ? /* @__PURE__ */ e.jsx(Be, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(on, { className: "mr-2 h-4 w-4" }),
2141
2141
  "Run"
2142
2142
  ]
2143
2143
  }
2144
2144
  ),
2145
- re && /* @__PURE__ */ e.jsx(
2145
+ le && /* @__PURE__ */ e.jsx(
2146
2146
  kn,
2147
2147
  {
2148
2148
  error: Ie.message,
2149
- setShowAIDialog: h,
2150
- setTriggerAIRun: N,
2149
+ setShowAIDialog: d,
2150
+ setTriggerAIRun: S,
2151
2151
  setUserInputforAI: m
2152
2152
  }
2153
2153
  ),
2154
2154
  /* @__PURE__ */ e.jsxs(
2155
- z,
2155
+ w,
2156
2156
  {
2157
2157
  onClick: Je,
2158
2158
  className: "",
@@ -2168,7 +2168,7 @@ function Vn() {
2168
2168
  Xs,
2169
2169
  {
2170
2170
  pressed: t,
2171
- onPressedChange: (p) => i(p),
2171
+ onPressedChange: (p) => o(p),
2172
2172
  className: "",
2173
2173
  size: "sm",
2174
2174
  variant: "outline",
@@ -2178,20 +2178,20 @@ function Vn() {
2178
2178
  /* @__PURE__ */ e.jsx(
2179
2179
  On,
2180
2180
  {
2181
- open: c,
2182
- setOpen: h,
2183
- userInput: g,
2181
+ open: l,
2182
+ setOpen: d,
2183
+ userInput: f,
2184
2184
  triggerAIRun: u,
2185
- setTriggerAIRun: N,
2185
+ setTriggerAIRun: S,
2186
2186
  setUserInput: (p) => m(p)
2187
2187
  }
2188
2188
  )
2189
2189
  ] }),
2190
2190
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-end gap-2", children: [
2191
2191
  /* @__PURE__ */ e.jsxs(
2192
- z,
2192
+ w,
2193
2193
  {
2194
- onClick: S,
2194
+ onClick: C,
2195
2195
  size: "sm",
2196
2196
  variant: "outline",
2197
2197
  children: [
@@ -2201,7 +2201,7 @@ function Vn() {
2201
2201
  }
2202
2202
  ),
2203
2203
  /* @__PURE__ */ e.jsxs(
2204
- z,
2204
+ w,
2205
2205
  {
2206
2206
  onClick: Fa,
2207
2207
  className: "w-full",
@@ -2223,27 +2223,27 @@ function Vn() {
2223
2223
  );
2224
2224
  }
2225
2225
  function Rn({ data: s }) {
2226
- var l;
2227
- const [n, a] = me.useState([]), i = Object.keys(s[0]).map((c) => ({
2226
+ var r;
2227
+ const [n, a] = me.useState([]), o = Object.keys(s[0]).map((l) => ({
2228
2228
  // header: key,
2229
- accessorKey: c,
2230
- header: ({ column: h }) => {
2231
- const g = h.getIsSorted();
2229
+ accessorKey: l,
2230
+ header: ({ column: d }) => {
2231
+ const f = d.getIsSorted();
2232
2232
  return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
2233
2233
  "div",
2234
2234
  {
2235
2235
  className: "flex cursor-pointer items-center",
2236
- onClick: () => h.toggleSorting(h.getIsSorted() === "asc"),
2236
+ onClick: () => d.toggleSorting(d.getIsSorted() === "asc"),
2237
2237
  children: [
2238
- c,
2239
- g === "asc" ? /* @__PURE__ */ e.jsx(lt, { className: "ml-2 h-5 w-5" }) : g === "desc" ? /* @__PURE__ */ e.jsx(rt, { className: "ml-2 h-5 w-5" }) : null
2238
+ l,
2239
+ f === "asc" ? /* @__PURE__ */ e.jsx(rt, { className: "ml-2 h-5 w-5" }) : f === "desc" ? /* @__PURE__ */ e.jsx(lt, { className: "ml-2 h-5 w-5" }) : null
2240
2240
  ]
2241
2241
  }
2242
2242
  ) });
2243
2243
  }
2244
- })), o = it({
2244
+ })), c = it({
2245
2245
  data: s,
2246
- columns: i,
2246
+ columns: o,
2247
2247
  getCoreRowModel: mt(),
2248
2248
  getPaginationRowModel: ut(),
2249
2249
  onSortingChange: a,
@@ -2254,19 +2254,19 @@ function Rn({ data: s }) {
2254
2254
  }
2255
2255
  });
2256
2256
  return /* @__PURE__ */ e.jsxs(ot, { children: [
2257
- /* @__PURE__ */ e.jsx(ct, { children: o.getHeaderGroups().map((c) => /* @__PURE__ */ e.jsx(ls, { children: c.headers.map((h) => /* @__PURE__ */ e.jsx(dt, { className: "sticky top-0 bg-muted", children: h.isPlaceholder ? null : Ds(
2258
- h.column.columnDef.header,
2259
- h.getContext()
2260
- ) }, h.id)) }, c.id)) }),
2261
- /* @__PURE__ */ e.jsx(ht, { children: (l = o.getRowModel().rows) != null && l.length ? o.getRowModel().rows.map((c) => /* @__PURE__ */ e.jsx(
2257
+ /* @__PURE__ */ e.jsx(ct, { children: c.getHeaderGroups().map((l) => /* @__PURE__ */ e.jsx(ls, { children: l.headers.map((d) => /* @__PURE__ */ e.jsx(dt, { className: "sticky top-0 bg-muted", children: d.isPlaceholder ? null : Ds(
2258
+ d.column.columnDef.header,
2259
+ d.getContext()
2260
+ ) }, d.id)) }, l.id)) }),
2261
+ /* @__PURE__ */ e.jsx(ht, { children: (r = c.getRowModel().rows) != null && r.length ? c.getRowModel().rows.map((l) => /* @__PURE__ */ e.jsx(
2262
2262
  ls,
2263
2263
  {
2264
2264
  className: "whitespace-nowrap py-2",
2265
- "data-state": c.getIsSelected() && "selected",
2266
- children: c.getVisibleCells().map((h) => /* @__PURE__ */ e.jsx(Is, { children: Ds(h.column.columnDef.cell, h.getContext()) }, h.id))
2265
+ "data-state": l.getIsSelected() && "selected",
2266
+ children: l.getVisibleCells().map((d) => /* @__PURE__ */ e.jsx(Is, { children: Ds(d.column.columnDef.cell, d.getContext()) }, d.id))
2267
2267
  },
2268
- c.id
2269
- )) : /* @__PURE__ */ e.jsx(ls, { children: /* @__PURE__ */ e.jsx(Is, { colSpan: i.length, className: "h-24 text-center", children: "No results." }) }) })
2268
+ l.id
2269
+ )) : /* @__PURE__ */ e.jsx(ls, { children: /* @__PURE__ */ e.jsx(Is, { colSpan: o.length, className: "h-24 text-center", children: "No results." }) }) })
2270
2270
  ] });
2271
2271
  }
2272
2272
  function ja({
@@ -2274,10 +2274,10 @@ function ja({
2274
2274
  className: s,
2275
2275
  ...n
2276
2276
  }) {
2277
- var l;
2277
+ var r;
2278
2278
  me.useState(0);
2279
- const a = k((c) => c.themeStyle), t = r((c) => c.card), i = r((c) => c.actions.setCard);
2280
- if (K(() => {
2279
+ const a = k((l) => l.themeStyle), t = i((l) => l.card), o = i((l) => l.actions.setCard);
2280
+ if (P(() => {
2281
2281
  }, [
2282
2282
  t.data,
2283
2283
  t.type,
@@ -2287,8 +2287,8 @@ function ja({
2287
2287
  t.preferences
2288
2288
  ]), !t.id)
2289
2289
  return null;
2290
- let o;
2291
- return t.data && t.data.length > 0 && (o = la({
2290
+ let c;
2291
+ return t.data && t.data.length > 0 && (c = ra({
2292
2292
  data: t.data,
2293
2293
  cardType: t.type,
2294
2294
  cfg: t.cfg,
@@ -2306,7 +2306,7 @@ function ja({
2306
2306
  qs,
2307
2307
  {
2308
2308
  text: t.title,
2309
- onSave: (c) => i({ ...t, title: c }),
2309
+ onSave: (l) => o({ ...t, title: l }),
2310
2310
  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(gt, { className: "text-base", children: t.title }) })
2311
2311
  },
2312
2312
  t.title
@@ -2315,7 +2315,7 @@ function ja({
2315
2315
  qs,
2316
2316
  {
2317
2317
  text: t.description || "",
2318
- onSave: (c) => i({ ...t, description: c }),
2318
+ onSave: (l) => o({ ...t, description: l }),
2319
2319
  children: /* @__PURE__ */ e.jsxs(jt, { children: [
2320
2320
  " ",
2321
2321
  t.description
@@ -2325,13 +2325,13 @@ function ja({
2325
2325
  )
2326
2326
  ] }),
2327
2327
  /* @__PURE__ */ e.jsxs(bt, { className: "flex grow flex-col pb-3", children: [
2328
- t.type !== "table" && o && // <ChartJsVisual key={visualKey} cfg={cfg} />
2328
+ t.type !== "table" && c && // <ChartJsVisual key={visualKey} cfg={cfg} />
2329
2329
  /* @__PURE__ */ e.jsx(
2330
2330
  yt,
2331
2331
  {
2332
- cfg: o
2332
+ cfg: c
2333
2333
  },
2334
- JSON.stringify(o) + JSON.stringify(t.preferences) + ((l = t == null ? void 0 : t.preferences) == null ? void 0 : l.customVisualCode)
2334
+ JSON.stringify(c) + JSON.stringify(t.preferences) + ((r = t == null ? void 0 : t.preferences) == null ? void 0 : r.customVisualCode)
2335
2335
  ),
2336
2336
  t.type === "table" && t.data && t.data.length > 0 && // All of the below css classes are #IMPORTANT for the table to scroll properly
2337
2337
  /* @__PURE__ */ e.jsx(vt, { className: "flex min-h-0 flex-1 grow basis-0", children: /* @__PURE__ */ e.jsx(Nt, { card: t, data: t == null ? void 0 : t.data }) })
@@ -2341,16 +2341,16 @@ function ja({
2341
2341
  );
2342
2342
  }
2343
2343
  function _n() {
2344
- const [s, n] = T(!1), [a, t] = T(""), [i, o] = T(""), [l, c] = T(""), [h, g] = T(""), m = r((C) => C.card), u = r(
2345
- (C) => C.card.customCfg
2346
- ), { setCardCustomCfg: N, setCustomVisualCode: d } = Ct();
2347
- function x(C) {
2344
+ const [s, n] = T(!1), [a, t] = T(""), [o, c] = T(""), [r, l] = T(""), [d, f] = T(""), m = i((N) => N.card), u = i(
2345
+ (N) => N.card.customCfg
2346
+ ), { setCardCustomCfg: S, setCustomVisualCode: h } = Ct();
2347
+ function x(N) {
2348
2348
  var F, A;
2349
2349
  const O = {
2350
- ...C,
2350
+ ...N,
2351
2351
  data: {
2352
- ...C == null ? void 0 : C.data,
2353
- datasets: (A = (F = C == null ? void 0 : C.data) == null ? void 0 : F.datasets) == null ? void 0 : A.map((q) => ({
2352
+ ...N == null ? void 0 : N.data,
2353
+ datasets: (A = (F = N == null ? void 0 : N.data) == null ? void 0 : F.datasets) == null ? void 0 : A.map((q) => ({
2354
2354
  ...q,
2355
2355
  data: []
2356
2356
  }))
@@ -2358,43 +2358,43 @@ function _n() {
2358
2358
  };
2359
2359
  return JSON.stringify(O, null, 1);
2360
2360
  }
2361
- function f() {
2361
+ function g() {
2362
2362
  var O, j;
2363
2363
  if (!m.data || m.data.length === 0)
2364
2364
  return;
2365
- const C = la({
2365
+ const N = ra({
2366
2366
  data: m.data,
2367
2367
  cardType: m.type,
2368
2368
  cfg: m.cfg,
2369
2369
  preferences: m.preferences
2370
2370
  });
2371
- C && (t(JSON.stringify(C, null, 1)), (O = m == null ? void 0 : m.preferences) != null && O.customVisualCode && c((j = m == null ? void 0 : m.preferences) == null ? void 0 : j.customVisualCode), u && o(JSON.stringify(u, null, 1)));
2371
+ N && (t(JSON.stringify(N, null, 1)), (O = m == null ? void 0 : m.preferences) != null && O.customVisualCode && l((j = m == null ? void 0 : m.preferences) == null ? void 0 : j.customVisualCode), u && c(JSON.stringify(u, null, 1)));
2372
2372
  }
2373
- function w() {
2374
- if (l && d(l), !!i)
2373
+ function z() {
2374
+ if (r && h(r), !!o)
2375
2375
  try {
2376
- const C = JSON.parse(i);
2377
- return C ? (N(C), g(""), o(""), C) : void 0;
2378
- } catch (C) {
2379
- console.log(C), g("Invalid JSON");
2376
+ const N = JSON.parse(o);
2377
+ return N ? (S(N), f(""), c(""), N) : void 0;
2378
+ } catch (N) {
2379
+ console.log(N), f("Invalid JSON");
2380
2380
  }
2381
2381
  }
2382
2382
  function b() {
2383
- o(""), N(null);
2383
+ c(""), S(null);
2384
2384
  }
2385
2385
  function L() {
2386
- let C;
2386
+ let N;
2387
2387
  if (u) {
2388
2388
  const O = Vs.cloneDeep(m.cfg), j = Vs.merge(O, u);
2389
- return C = x(j), C;
2389
+ return N = x(j), N;
2390
2390
  }
2391
- return a ? (C = x(JSON.parse(a)), C) : "";
2391
+ return a ? (N = x(JSON.parse(a)), N) : "";
2392
2392
  }
2393
- return /* @__PURE__ */ e.jsxs(xs, { open: s, onOpenChange: n, children: [
2394
- /* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2395
- z,
2393
+ return /* @__PURE__ */ e.jsxs(ps, { open: s, onOpenChange: n, children: [
2394
+ /* @__PURE__ */ e.jsx(fs, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2395
+ w,
2396
2396
  {
2397
- onClick: f,
2397
+ onClick: g,
2398
2398
  className: ` ${u && "border-foreground/50 dark:border-foreground/70"}`,
2399
2399
  size: "sm",
2400
2400
  variant: "outline",
@@ -2402,14 +2402,14 @@ function _n() {
2402
2402
  }
2403
2403
  ) }),
2404
2404
  /* @__PURE__ */ e.jsxs(
2405
- fs,
2405
+ gs,
2406
2406
  {
2407
2407
  className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",
2408
2408
  children: [
2409
- /* @__PURE__ */ e.jsxs(gs, { className: "", children: [
2409
+ /* @__PURE__ */ e.jsxs(js, { className: "", children: [
2410
2410
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2411
- /* @__PURE__ */ e.jsx(js, { children: "Customize Card" }),
2412
- /* @__PURE__ */ e.jsxs(ys, { children: [
2411
+ /* @__PURE__ */ e.jsx(bs, { children: "Customize Card" }),
2412
+ /* @__PURE__ */ e.jsxs(vs, { children: [
2413
2413
  /* @__PURE__ */ e.jsx(Js, { children: /* @__PURE__ */ e.jsx(
2414
2414
  sn,
2415
2415
  {
@@ -2419,10 +2419,10 @@ function _n() {
2419
2419
  className: "size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"
2420
2420
  }
2421
2421
  ) }),
2422
- /* @__PURE__ */ e.jsx(vs, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
2422
+ /* @__PURE__ */ e.jsx(Ns, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
2423
2423
  ] })
2424
2424
  ] }),
2425
- /* @__PURE__ */ e.jsxs(bs, { children: [
2425
+ /* @__PURE__ */ e.jsxs(ys, { children: [
2426
2426
  "See the configuration options and documentation",
2427
2427
  /* @__PURE__ */ e.jsx(
2428
2428
  "a",
@@ -2439,15 +2439,15 @@ function _n() {
2439
2439
  /* @__PURE__ */ e.jsx(ja, { className: "w-1/2 rounded shadow-none" }),
2440
2440
  /* @__PURE__ */ e.jsxs(kt, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
2441
2441
  /* @__PURE__ */ e.jsxs(wt, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
2442
- /* @__PURE__ */ e.jsxs(rs, { value: "custom-config", children: [
2442
+ /* @__PURE__ */ e.jsxs(is, { value: "custom-config", children: [
2443
2443
  u && /* @__PURE__ */ e.jsx(zt, { className: "mr-1 h-5 w-5 text-green-600" }),
2444
2444
  u ? "Custom Config" : "Default Config"
2445
2445
  ] }),
2446
- /* @__PURE__ */ e.jsx(rs, { className: "", value: "output", children: "Output" }),
2447
- /* @__PURE__ */ e.jsx(rs, { className: "", value: "custom-code", children: "Custom Code" })
2446
+ /* @__PURE__ */ e.jsx(is, { className: "", value: "output", children: "Output" }),
2447
+ /* @__PURE__ */ e.jsx(is, { className: "", value: "custom-code", children: "Custom Code" })
2448
2448
  ] }),
2449
2449
  /* @__PURE__ */ e.jsx(
2450
- is,
2450
+ os,
2451
2451
  {
2452
2452
  className: "bg-red-x mt-0 grow rounded-b border border-t-0 p-2",
2453
2453
  value: "output",
@@ -2462,7 +2462,7 @@ function _n() {
2462
2462
  }
2463
2463
  ),
2464
2464
  /* @__PURE__ */ e.jsx(
2465
- is,
2465
+ os,
2466
2466
  {
2467
2467
  className: "mt-0 grow rounded-b border border-t-0",
2468
2468
  value: "custom-config",
@@ -2485,13 +2485,13 @@ function _n() {
2485
2485
  },
2486
2486
  defaultLanguage: "json",
2487
2487
  value: L(),
2488
- onChange: (C) => o(C)
2488
+ onChange: (N) => c(N)
2489
2489
  }
2490
2490
  )
2491
2491
  }
2492
2492
  ),
2493
2493
  /* @__PURE__ */ e.jsx(
2494
- is,
2494
+ os,
2495
2495
  {
2496
2496
  className: "mt-0 grow rounded-b border border-t-0",
2497
2497
  value: "custom-code",
@@ -2513,8 +2513,8 @@ function _n() {
2513
2513
  renderLineHighlight: "none"
2514
2514
  },
2515
2515
  defaultLanguage: "javascript",
2516
- value: l,
2517
- onChange: (C) => c(C || "")
2516
+ value: r,
2517
+ onChange: (N) => l(N || "")
2518
2518
  }
2519
2519
  )
2520
2520
  }
@@ -2522,9 +2522,9 @@ function _n() {
2522
2522
  ] })
2523
2523
  ] }),
2524
2524
  /* @__PURE__ */ e.jsxs(Us, { className: "flex items-center", children: [
2525
- /* @__PURE__ */ e.jsx(B, { className: "mr-2 text-red-500", children: h }),
2525
+ /* @__PURE__ */ e.jsx(B, { className: "mr-2 text-red-500", children: d }),
2526
2526
  /* @__PURE__ */ e.jsx(
2527
- z,
2527
+ w,
2528
2528
  {
2529
2529
  disabled: !u,
2530
2530
  onClick: b,
@@ -2532,8 +2532,8 @@ function _n() {
2532
2532
  children: "Reset"
2533
2533
  }
2534
2534
  ),
2535
- /* @__PURE__ */ e.jsx(z, { onClick: w, variant: "outline", children: "Apply" }),
2536
- /* @__PURE__ */ e.jsx(z, { onClick: () => n(!1), variant: "outline", children: "Close" })
2535
+ /* @__PURE__ */ e.jsx(w, { onClick: z, variant: "outline", children: "Apply" }),
2536
+ /* @__PURE__ */ e.jsx(w, { onClick: () => n(!1), variant: "outline", children: "Close" })
2537
2537
  ] })
2538
2538
  ]
2539
2539
  }
@@ -2562,36 +2562,34 @@ function ka(s) {
2562
2562
  return fe({ 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);
2563
2563
  }
2564
2564
  function Hn() {
2565
- const [s, n] = T(!1), a = r((c) => c.card.type), { setCardType: t, setCardPreferences: i } = r(
2566
- (c) => c.actions
2567
- ), o = r(
2568
- (c) => c.actions.setCardCustomCfg
2565
+ const [s, n] = T(!1), a = i((d) => d.card.type), { setCardType: t, setCardPreferences: o, setChartOrientation: c } = i((d) => d.actions), r = i(
2566
+ (d) => d.actions.setCardCustomCfg
2569
2567
  );
2570
- function l(c) {
2571
- t(c), o(null), i({}), n(!1);
2568
+ function l(d) {
2569
+ r(null), o({}), t(d), n(!1);
2572
2570
  }
2573
- return /* @__PURE__ */ e.jsxs(Pe, { open: s, onOpenChange: n, children: [
2574
- /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Bn, { className: "h-4 w-4", chartType: a }) }) }),
2571
+ return /* @__PURE__ */ e.jsxs(Ke, { open: s, onOpenChange: n, children: [
2572
+ /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Bn, { className: "h-4 w-4", chartType: a }) }) }),
2575
2573
  /* @__PURE__ */ e.jsx(Ge, { className: "w-50", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 place-items-center", children: [
2576
2574
  /* @__PURE__ */ e.jsx(
2577
- z,
2575
+ w,
2578
2576
  {
2579
2577
  onClick: () => l("bar"),
2580
2578
  className: "font-normal",
2581
2579
  variant: "ghost",
2582
- children: /* @__PURE__ */ e.jsx(ws, { className: "size-5" })
2580
+ children: /* @__PURE__ */ e.jsx(zs, { className: "size-5" })
2583
2581
  }
2584
2582
  ),
2585
2583
  /* @__PURE__ */ e.jsx(
2586
- z,
2584
+ w,
2587
2585
  {
2588
2586
  onClick: () => l("line"),
2589
2587
  variant: "ghost",
2590
- children: /* @__PURE__ */ e.jsx(zs, { className: "size-5" })
2588
+ children: /* @__PURE__ */ e.jsx(Fs, { className: "size-5" })
2591
2589
  }
2592
2590
  ),
2593
2591
  /* @__PURE__ */ e.jsx(
2594
- z,
2592
+ w,
2595
2593
  {
2596
2594
  onClick: () => l("stackedBar"),
2597
2595
  variant: "ghost",
@@ -2599,7 +2597,7 @@ function Hn() {
2599
2597
  }
2600
2598
  ),
2601
2599
  /* @__PURE__ */ e.jsx(
2602
- z,
2600
+ w,
2603
2601
  {
2604
2602
  onClick: () => l("scatter"),
2605
2603
  variant: "ghost",
@@ -2607,7 +2605,7 @@ function Hn() {
2607
2605
  }
2608
2606
  ),
2609
2607
  /* @__PURE__ */ e.jsx(
2610
- z,
2608
+ w,
2611
2609
  {
2612
2610
  onClick: () => l("bubble"),
2613
2611
  variant: "ghost",
@@ -2615,7 +2613,7 @@ function Hn() {
2615
2613
  }
2616
2614
  ),
2617
2615
  /* @__PURE__ */ e.jsx(
2618
- z,
2616
+ w,
2619
2617
  {
2620
2618
  onClick: () => l("pie"),
2621
2619
  variant: "ghost",
@@ -2623,7 +2621,7 @@ function Hn() {
2623
2621
  }
2624
2622
  ),
2625
2623
  /* @__PURE__ */ e.jsx(
2626
- z,
2624
+ w,
2627
2625
  {
2628
2626
  onClick: () => l("doughnut"),
2629
2627
  variant: "ghost",
@@ -2631,7 +2629,7 @@ function Hn() {
2631
2629
  }
2632
2630
  ),
2633
2631
  /* @__PURE__ */ e.jsx(
2634
- z,
2632
+ w,
2635
2633
  {
2636
2634
  onClick: () => l("radar"),
2637
2635
  variant: "ghost",
@@ -2645,7 +2643,7 @@ function Hn() {
2645
2643
  }
2646
2644
  ),
2647
2645
  /* @__PURE__ */ e.jsx(
2648
- z,
2646
+ w,
2649
2647
  {
2650
2648
  onClick: () => l("polarArea"),
2651
2649
  variant: "ghost",
@@ -2653,7 +2651,7 @@ function Hn() {
2653
2651
  }
2654
2652
  ),
2655
2653
  /* @__PURE__ */ e.jsx(
2656
- z,
2654
+ w,
2657
2655
  {
2658
2656
  onClick: () => l("pyramid"),
2659
2657
  variant: "ghost",
@@ -2661,7 +2659,7 @@ function Hn() {
2661
2659
  }
2662
2660
  ),
2663
2661
  /* @__PURE__ */ e.jsx(
2664
- z,
2662
+ w,
2665
2663
  {
2666
2664
  onClick: () => l("range"),
2667
2665
  variant: "ghost",
@@ -2669,15 +2667,15 @@ function Hn() {
2669
2667
  }
2670
2668
  ),
2671
2669
  /* @__PURE__ */ e.jsx(
2672
- z,
2670
+ w,
2673
2671
  {
2674
2672
  onClick: () => l("table"),
2675
2673
  variant: "ghost",
2676
- children: /* @__PURE__ */ e.jsx(Ns, { className: "size-5" })
2674
+ children: /* @__PURE__ */ e.jsx(Cs, { className: "size-5" })
2677
2675
  }
2678
2676
  ),
2679
2677
  /* @__PURE__ */ e.jsx(
2680
- z,
2678
+ w,
2681
2679
  {
2682
2680
  onClick: () => l("kpi"),
2683
2681
  variant: "ghost",
@@ -2690,9 +2688,9 @@ function Hn() {
2690
2688
  function Bn({ chartType: s, className: n }) {
2691
2689
  switch (s) {
2692
2690
  case "bar":
2693
- return /* @__PURE__ */ e.jsx(ws, { className: n });
2694
- case "line":
2695
2691
  return /* @__PURE__ */ e.jsx(zs, { className: n });
2692
+ case "line":
2693
+ return /* @__PURE__ */ e.jsx(Fs, { className: n });
2696
2694
  case "pie":
2697
2695
  return /* @__PURE__ */ e.jsx(ha, { className: n });
2698
2696
  case "radar":
@@ -2714,17 +2712,17 @@ function Bn({ chartType: s, className: n }) {
2714
2712
  case "kpi":
2715
2713
  return /* @__PURE__ */ e.jsx(Sa, { className: n });
2716
2714
  default:
2717
- return /* @__PURE__ */ e.jsx(Ns, { className: n });
2715
+ return /* @__PURE__ */ e.jsx(Cs, { className: n });
2718
2716
  }
2719
2717
  }
2720
2718
  function $n() {
2721
- const s = r(
2719
+ const s = i(
2722
2720
  (a) => a.card.refreshInterval
2723
- ), n = r(
2721
+ ), n = i(
2724
2722
  (a) => a.actions.setCardRefreshInterval
2725
2723
  );
2726
- return /* @__PURE__ */ e.jsxs(Pe, { children: [
2727
- /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Gt, { className: "w-4 h-4" }) }) }),
2724
+ return /* @__PURE__ */ e.jsxs(Ke, { children: [
2725
+ /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Gt, { className: "w-4 h-4" }) }) }),
2728
2726
  /* @__PURE__ */ e.jsx(Ge, { className: "w-[200px]", children: /* @__PURE__ */ e.jsx("div", { className: "grid gap-4", children: /* @__PURE__ */ e.jsx("div", { className: "grid gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-5 items-center gap-1", children: [
2729
2727
  /* @__PURE__ */ e.jsx(B, { className: "col-span-3", htmlFor: "width", children: "Refresh Every" }),
2730
2728
  /* @__PURE__ */ e.jsx(
@@ -2741,9 +2739,9 @@ function $n() {
2741
2739
  ] });
2742
2740
  }
2743
2741
  function $s() {
2744
- r((l) => l.frame);
2745
- const s = r((l) => l.card), n = r((l) => l.card.data), a = r((l) => l.isShowingVisual), t = r((l) => l.isSqlRunning), i = r((l) => l.queryError), o = r((l) => l.pythonStdOut);
2746
- return r((l) => l.onSave), r((l) => l.onClose), r((l) => l.actions.setCardSql), r((l) => l.actions.setCardType), r((l) => l.actions.setSqlGen), s ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col pt-3", children: [
2742
+ i((r) => r.frame);
2743
+ const s = i((r) => r.card), n = i((r) => r.card.data), a = i((r) => r.isShowingVisual), t = i((r) => r.isSqlRunning), o = i((r) => r.queryError), c = i((r) => r.pythonStdOut);
2744
+ return i((r) => r.onSave), i((r) => r.onClose), i((r) => r.actions.setCardSql), i((r) => r.actions.setCardType), i((r) => r.actions.setSqlGen), s ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col pt-3", children: [
2747
2745
  t && /* @__PURE__ */ e.jsx(Be, { className: "absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10" }),
2748
2746
  /* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
2749
2747
  a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
@@ -2751,17 +2749,17 @@ function $s() {
2751
2749
  s.type !== "table" && /* @__PURE__ */ e.jsx(_n, {}),
2752
2750
  /* @__PURE__ */ e.jsx($n, {})
2753
2751
  ] }),
2754
- /* @__PURE__ */ e.jsx(Pn, {})
2752
+ /* @__PURE__ */ e.jsx(Kn, {})
2755
2753
  ] }),
2756
2754
  a ? s.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex grow items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Ft, { isLoading: t, card: s }) }) }) : /* @__PURE__ */ e.jsx(ja, { className: "grow border-none shadow-none" }) : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
2757
- o && /* @__PURE__ */ e.jsx(Kn, {}),
2755
+ c && /* @__PURE__ */ e.jsx(Pn, {}),
2758
2756
  s.data && s.data.length > 0 && /* @__PURE__ */ e.jsx(Rn, { data: n || [] }),
2759
- i && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: i })
2757
+ o && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: o })
2760
2758
  ] })
2761
2759
  ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
2762
2760
  }
2763
- function Kn() {
2764
- const s = r((a) => a.pythonStdOut);
2761
+ function Pn() {
2762
+ const s = i((a) => a.pythonStdOut);
2765
2763
  if (!s)
2766
2764
  return null;
2767
2765
  const n = s.replace(/\n/g, "<br>");
@@ -2774,11 +2772,11 @@ function Kn() {
2774
2772
  className: "bg-muted p-2 font-mono text-sm"
2775
2773
  }
2776
2774
  ),
2777
- /* @__PURE__ */ e.jsx(Ss, { className: "mb-2" })
2775
+ /* @__PURE__ */ e.jsx(ks, { className: "mb-2" })
2778
2776
  ] });
2779
2777
  }
2780
- function Pn() {
2781
- const s = r((a) => a.isShowingVisual), n = r(
2778
+ function Kn() {
2779
+ const s = i((a) => a.isShowingVisual), n = i(
2782
2780
  (a) => a.actions.setIsShowingVisual
2783
2781
  );
2784
2782
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
@@ -2796,23 +2794,23 @@ function Pn() {
2796
2794
  }
2797
2795
  function De() {
2798
2796
  const [s, n] = T([]);
2799
- r(
2797
+ i(
2800
2798
  (m) => m.card.cfg
2801
2799
  );
2802
- const a = r((m) => m.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: i, setCardPreferences: o } = r((m) => m.actions), l = r(
2800
+ const a = i((m) => m.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: o, setCardPreferences: c } = i((m) => m.actions), r = i(
2803
2801
  (m) => m.queryResultColumns
2804
2802
  );
2805
- r(
2803
+ i(
2806
2804
  (m) => {
2807
2805
  var u;
2808
2806
  return (u = m.card.preferences) == null ? void 0 : u.filterOnClickColumnIndex;
2809
2807
  }
2810
- ), K(() => {
2811
- l && n(new Array(l.length).fill(!1));
2812
- }, [l]);
2813
- function c(m, u) {
2814
- var N, d;
2815
- u ? a != null && a.onClickFilter && ((N = a == null ? void 0 : a.onClickFilter) == null ? void 0 : N.length) > 0 ? o({
2808
+ ), P(() => {
2809
+ r && n(new Array(r.length).fill(!1));
2810
+ }, [r]);
2811
+ function l(m, u) {
2812
+ var S, h;
2813
+ u ? a != null && a.onClickFilter && ((S = a == null ? void 0 : a.onClickFilter) == null ? void 0 : S.length) > 0 ? c({
2816
2814
  ...a,
2817
2815
  onClickFilter: [
2818
2816
  ...a.onClickFilter,
@@ -2821,7 +2819,7 @@ function De() {
2821
2819
  expression: ""
2822
2820
  }
2823
2821
  ]
2824
- }) : o({
2822
+ }) : c({
2825
2823
  ...a,
2826
2824
  onClickFilter: [
2827
2825
  {
@@ -2829,43 +2827,43 @@ function De() {
2829
2827
  expression: ""
2830
2828
  }
2831
2829
  ]
2832
- }) : (o({
2830
+ }) : (c({
2833
2831
  ...a,
2834
- onClickFilter: (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.filter(
2832
+ onClickFilter: (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.filter(
2835
2833
  (x) => x.columnIndex !== m
2836
2834
  )
2837
2835
  }), n((x) => {
2838
- const f = [...x];
2839
- return f[m] = !1, f;
2836
+ const g = [...x];
2837
+ return g[m] = !1, g;
2840
2838
  }));
2841
2839
  }
2842
- function h(m, u) {
2843
- var d;
2844
- const N = (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.map((x) => x.columnIndex === m ? {
2840
+ function d(m, u) {
2841
+ var h;
2842
+ const S = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.map((x) => x.columnIndex === m ? {
2845
2843
  ...x,
2846
2844
  expression: u.target.value
2847
2845
  } : x);
2848
- o({
2846
+ c({
2849
2847
  ...a,
2850
- onClickFilter: N
2848
+ onClickFilter: S
2851
2849
  });
2852
2850
  }
2853
- function g(m) {
2854
- var u, N, d, x;
2855
- if (s != null && s[m] || (N = (u = a == null ? void 0 : a.onClickFilter) == null ? void 0 : u.find((f) => f.columnIndex === m)) != null && N.expression)
2851
+ function f(m) {
2852
+ var u, S, h, x;
2853
+ if (s != null && s[m] || (S = (u = a == null ? void 0 : a.onClickFilter) == null ? void 0 : u.find((g) => g.columnIndex === m)) != null && S.expression)
2856
2854
  return /* @__PURE__ */ e.jsx(
2857
2855
  ae,
2858
2856
  {
2859
- value: (x = (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.find((f) => f.columnIndex === m)) == null ? void 0 : x.expression,
2860
- onChange: (f) => h(m, f),
2857
+ value: (x = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find((g) => g.columnIndex === m)) == null ? void 0 : x.expression,
2858
+ onChange: (g) => d(m, g),
2861
2859
  type: "text",
2862
2860
  className: " h-9 w-full focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 font-mono text-xs",
2863
2861
  placeholder: "Expression"
2864
2862
  }
2865
2863
  );
2866
2864
  }
2867
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: l == null ? void 0 : l.map((m, u) => {
2868
- var N, d;
2865
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: r == null ? void 0 : r.map((m, u) => {
2866
+ var S, h;
2869
2867
  return /* @__PURE__ */ e.jsx(
2870
2868
  "div",
2871
2869
  {
@@ -2873,12 +2871,12 @@ function De() {
2873
2871
  children: /* @__PURE__ */ e.jsxs("div", { className: " grow", children: [
2874
2872
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center py-2 space-x-2", children: [
2875
2873
  /* @__PURE__ */ e.jsx(
2876
- Ke,
2874
+ Pe,
2877
2875
  {
2878
- checked: !!((N = a == null ? void 0 : a.onClickFilter) != null && N.find(
2876
+ checked: !!((S = a == null ? void 0 : a.onClickFilter) != null && S.find(
2879
2877
  (x) => x.columnIndex === u
2880
2878
  )),
2881
- onCheckedChange: (x) => c(u, x)
2879
+ onCheckedChange: (x) => l(u, x)
2882
2880
  }
2883
2881
  ),
2884
2882
  /* @__PURE__ */ e.jsx(
@@ -2888,61 +2886,42 @@ function De() {
2888
2886
  children: m
2889
2887
  }
2890
2888
  ),
2891
- /* @__PURE__ */ e.jsx("div", { className: "flex gap-2 items-center ", children: ((d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.find(
2889
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-2 items-center ", children: ((h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find(
2892
2890
  (x) => x.columnIndex === u
2893
2891
  )) && /* @__PURE__ */ e.jsx(
2894
2892
  da,
2895
2893
  {
2896
2894
  onClick: () => {
2897
2895
  n((x) => {
2898
- const f = [...x];
2899
- return f[u] = !x[u], f;
2896
+ const g = [...x];
2897
+ return g[u] = !x[u], g;
2900
2898
  });
2901
2899
  },
2902
2900
  className: " invisible group-hover:visible size-3 text-gray-400 cursor-pointer"
2903
2901
  }
2904
2902
  ) })
2905
2903
  ] }),
2906
- g(u)
2904
+ f(u)
2907
2905
  ] })
2908
2906
  },
2909
2907
  m
2910
2908
  );
2911
2909
  }) });
2912
2910
  }
2913
- function Fs() {
2914
- var o, l, c;
2915
- const s = r((h) => h.card.preferences), n = r(
2916
- (h) => h.card.cfg
2917
- ), { setCardCfg: a, setCardPreferences: t } = r(
2918
- (h) => h.actions
2919
- );
2920
- (o = n == null ? void 0 : n.options) != null && o.indexAxis;
2921
- function i(h) {
2922
- var u, N, d, x, f, w;
2923
- let g = {};
2924
- (u = s == null ? void 0 : s.chartOptions) != null && u.scales && (g = {
2925
- x: (d = (N = s == null ? void 0 : s.chartOptions) == null ? void 0 : N.scales) == null ? void 0 : d.y,
2926
- y: (f = (x = s == null ? void 0 : s.chartOptions) == null ? void 0 : x.scales) == null ? void 0 : f.x
2927
- });
2928
- const m = {
2929
- ...s,
2930
- chartOptions: {
2931
- ...s == null ? void 0 : s.chartOptions,
2932
- scales: {
2933
- ...(w = s == null ? void 0 : s.chartOptions) == null ? void 0 : w.scales,
2934
- ...g
2935
- },
2936
- indexAxis: h
2937
- }
2938
- };
2939
- t(m);
2911
+ function ss() {
2912
+ var r, l, d;
2913
+ const s = i((f) => f.card.preferences), n = i(
2914
+ (f) => f.card.cfg
2915
+ ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: o } = i((f) => f.actions);
2916
+ (r = n == null ? void 0 : n.options) != null && r.indexAxis;
2917
+ function c(f) {
2918
+ o(f);
2940
2919
  }
2941
2920
  return /* @__PURE__ */ e.jsxs(
2942
- ra,
2921
+ la,
2943
2922
  {
2944
- value: ((l = s == null ? void 0 : s.chartOptions) == null ? void 0 : l.indexAxis) || ((c = n == null ? void 0 : n.options) == null ? void 0 : c.indexAxis) || "x",
2945
- onValueChange: i,
2923
+ value: ((l = s == null ? void 0 : s.chartOptions) == null ? void 0 : l.indexAxis) || ((d = n == null ? void 0 : n.options) == null ? void 0 : d.indexAxis) || "x",
2924
+ onValueChange: c,
2946
2925
  className: "flex gap-3",
2947
2926
  defaultValue: "x",
2948
2927
  children: [
@@ -2959,39 +2938,39 @@ function Fs() {
2959
2938
  );
2960
2939
  }
2961
2940
  const we = "focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";
2962
- function Ks(s, n) {
2963
- var t, i, o;
2941
+ function Ps(s, n) {
2942
+ var t, o, c;
2964
2943
  const a = ia(s, n);
2965
- return ((o = (i = (t = s == null ? void 0 : s.chartOptions) == null ? void 0 : t.scales) == null ? void 0 : i[a]) == null ? void 0 : o.type) || "linear";
2944
+ return ((c = (o = (t = s == null ? void 0 : s.chartOptions) == null ? void 0 : t.scales) == null ? void 0 : o[a]) == null ? void 0 : c.type) || "linear";
2966
2945
  }
2967
2946
  function wa() {
2968
2947
  var Q, ee, Z, J, I, y;
2969
- const [s, n] = T(!1), a = r((v) => {
2948
+ const [s, n] = T(!1), a = i((v) => {
2970
2949
  var M;
2971
2950
  return (M = v.card) == null ? void 0 : M.preferences;
2972
- }), t = r((v) => {
2951
+ }), t = i((v) => {
2973
2952
  var M;
2974
2953
  return (M = v.card) == null ? void 0 : M.cfg;
2975
- }), i = ia(a, t), [o, l] = T(
2976
- Ks(a)
2977
- ), [c, h] = T(
2978
- ((Z = (ee = (Q = a == null ? void 0 : a.chartOptions) == null ? void 0 : Q.scales) == null ? void 0 : ee[i]) == null ? void 0 : Z.min) || ""
2979
- ), [g, m] = T(
2980
- ((y = (I = (J = a == null ? void 0 : a.chartOptions) == null ? void 0 : J.scales) == null ? void 0 : I[i]) == null ? void 0 : y.max) || ""
2981
- ), [u, N] = T(c || g ? "custom" : "auto"), [d, x] = T(""), [f, w] = T(0), [b, L] = T(""), [C, O] = T(""), [j, F] = T(""), A = r(
2954
+ }), o = ia(a, t), [c, r] = T(
2955
+ Ps(a)
2956
+ ), [l, d] = T(
2957
+ ((Z = (ee = (Q = a == null ? void 0 : a.chartOptions) == null ? void 0 : Q.scales) == null ? void 0 : ee[o]) == null ? void 0 : Z.min) || ""
2958
+ ), [f, m] = T(
2959
+ ((y = (I = (J = a == null ? void 0 : a.chartOptions) == null ? void 0 : J.scales) == null ? void 0 : I[o]) == null ? void 0 : y.max) || ""
2960
+ ), [u, S] = T(l || f ? "custom" : "auto"), [h, x] = T(""), [g, z] = T(0), [b, L] = T(""), [N, O] = T(""), [j, F] = T(""), A = i(
2982
2961
  (v) => v.actions.setCardPreferences
2983
- ), q = r((v) => {
2962
+ ), q = i((v) => {
2984
2963
  var M;
2985
2964
  return (M = v.card) == null ? void 0 : M.type;
2986
- }), P = ["pie", "doughnut", "polarArea"].includes(q);
2987
- K(() => {
2988
- var v, M, H, ue, se, ge, je, be, xe, U, ne, le, ye, re;
2989
- l(Ks(a)), h(
2990
- ((H = (M = (v = a == null ? void 0 : a.chartOptions) == null ? void 0 : v.scales) == null ? void 0 : M[i]) == null ? void 0 : H.min) === 0 ? 0 : ""
2991
- ), m(((ge = (se = (ue = a == null ? void 0 : a.chartOptions) == null ? void 0 : ue.scales) == null ? void 0 : se[i]) == null ? void 0 : ge.max) || ""), x(
2992
- ((U = (xe = (be = (je = a == null ? void 0 : a.chartOptions) == null ? void 0 : je.scales) == null ? void 0 : be[i]) == null ? void 0 : xe.ticks) == null ? void 0 : U.stepSize) || ""
2993
- ), w(((ne = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ne.decimalPlaces) || 0), L(((le = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : le.suffix) || ""), O(((ye = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ye.currency) || ""), F(((re = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : re.locale) || "");
2994
- }, [s, a, i]);
2965
+ }), K = ["pie", "doughnut", "polarArea"].includes(q);
2966
+ P(() => {
2967
+ var v, M, H, ue, se, ge, je, be, xe, U, ne, re, ye, le;
2968
+ r(Ps(a)), d(
2969
+ ((H = (M = (v = a == null ? void 0 : a.chartOptions) == null ? void 0 : v.scales) == null ? void 0 : M[o]) == null ? void 0 : H.min) === 0 ? 0 : ""
2970
+ ), m(((ge = (se = (ue = a == null ? void 0 : a.chartOptions) == null ? void 0 : ue.scales) == null ? void 0 : se[o]) == null ? void 0 : ge.max) || ""), x(
2971
+ ((U = (xe = (be = (je = a == null ? void 0 : a.chartOptions) == null ? void 0 : je.scales) == null ? void 0 : be[o]) == null ? void 0 : xe.ticks) == null ? void 0 : U.stepSize) || ""
2972
+ ), z(((ne = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ne.decimalPlaces) || 0), L(((re = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : re.suffix) || ""), O(((ye = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ye.currency) || ""), F(((le = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : le.locale) || "");
2973
+ }, [s, a, o]);
2995
2974
  function $(v, M) {
2996
2975
  return M === "" || /^[0-9\b]+$/.test(M) ? Number(M) : Number(v);
2997
2976
  }
@@ -3016,7 +2995,7 @@ function wa() {
3016
2995
  /* @__PURE__ */ e.jsx(
3017
2996
  ae,
3018
2997
  {
3019
- value: C,
2998
+ value: N,
3020
2999
  placeholder: "USD",
3021
3000
  onChange: (v) => O(v.target.value),
3022
3001
  id: "currency",
@@ -3039,8 +3018,8 @@ function wa() {
3039
3018
  /* @__PURE__ */ e.jsx(
3040
3019
  ae,
3041
3020
  {
3042
- value: f,
3043
- onChange: (v) => w(Number(v.target.value)),
3021
+ value: g,
3022
+ onChange: (v) => z(Number(v.target.value)),
3044
3023
  id: "format",
3045
3024
  className: `col-span-6 h-8 w-full tracking-wide ${we}`
3046
3025
  }
@@ -3056,15 +3035,15 @@ function wa() {
3056
3035
  ae,
3057
3036
  {
3058
3037
  id: "min",
3059
- value: c,
3060
- onChange: (v) => h((M) => $(M, v.target.value)),
3038
+ value: l,
3039
+ onChange: (v) => d((M) => $(M, v.target.value)),
3061
3040
  className: `col-span-1 h-8 w-full ${we}`
3062
3041
  }
3063
3042
  ),
3064
3043
  /* @__PURE__ */ e.jsx(
3065
3044
  ae,
3066
3045
  {
3067
- value: g,
3046
+ value: f,
3068
3047
  onChange: (v) => m((M) => $(M, v.target.value)),
3069
3048
  id: "max",
3070
3049
  className: `col-span-1 h-8 w-full ${we}`
@@ -3076,7 +3055,7 @@ function wa() {
3076
3055
  /* @__PURE__ */ e.jsx(
3077
3056
  ae,
3078
3057
  {
3079
- value: d,
3058
+ value: h,
3080
3059
  onChange: (v) => x((M) => $(M, v.target.value)),
3081
3060
  id: "step-size",
3082
3061
  className: `col-span-1 h-8 w-full ${we}`
@@ -3089,10 +3068,10 @@ function wa() {
3089
3068
  var H;
3090
3069
  let v = {};
3091
3070
  u === "custom" && (v = {
3092
- min: c,
3093
- max: g,
3071
+ min: l,
3072
+ max: f,
3094
3073
  ticks: {
3095
- stepSize: d
3074
+ stepSize: h
3096
3075
  }
3097
3076
  });
3098
3077
  const M = {
@@ -3101,23 +3080,23 @@ function wa() {
3101
3080
  ...a == null ? void 0 : a.chartOptions,
3102
3081
  scales: {
3103
3082
  ...(H = a == null ? void 0 : a.chartOptions) == null ? void 0 : H.scales,
3104
- [i]: {
3083
+ [o]: {
3105
3084
  // ...cardPreferences?.chartOptions?.scales?.[axis],
3106
- type: o,
3107
- ...o === "linear" ? v : {}
3085
+ type: c,
3086
+ ...c === "linear" ? v : {}
3108
3087
  }
3109
3088
  }
3110
3089
  },
3111
3090
  numberAxisFormat: {
3112
- decimalPlaces: f,
3091
+ decimalPlaces: g,
3113
3092
  suffix: b,
3114
- currency: C,
3093
+ currency: N,
3115
3094
  locale: j
3116
3095
  }
3117
3096
  };
3118
- A(M);
3097
+ console.log(M), A(M);
3119
3098
  }
3120
- return /* @__PURE__ */ e.jsxs(Pe, { onOpenChange: (v) => n(v), children: [
3099
+ return /* @__PURE__ */ e.jsxs(Ke, { onOpenChange: (v) => n(v), children: [
3121
3100
  /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(Mt, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
3122
3101
  /* @__PURE__ */ e.jsx(Ge, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
3123
3102
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
@@ -3130,9 +3109,9 @@ function wa() {
3130
3109
  /* @__PURE__ */ e.jsxs(
3131
3110
  Oe,
3132
3111
  {
3133
- disabled: P,
3134
- value: o,
3135
- onValueChange: (v) => l(v),
3112
+ disabled: K,
3113
+ value: c,
3114
+ onValueChange: (v) => r(v),
3136
3115
  children: [
3137
3116
  /* @__PURE__ */ e.jsx(Me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
3138
3117
  /* @__PURE__ */ e.jsx(Ae, { id: "type", children: /* @__PURE__ */ e.jsxs(He, { children: [
@@ -3144,15 +3123,15 @@ function wa() {
3144
3123
  }
3145
3124
  )
3146
3125
  ] }),
3147
- o == "linear" && /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2 py-1", children: [
3126
+ c == "linear" && /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2 py-1", children: [
3148
3127
  /* @__PURE__ */ e.jsx(B, { htmlFor: "scale-option", children: "Setup" }),
3149
3128
  /* @__PURE__ */ e.jsxs(
3150
- ra,
3129
+ la,
3151
3130
  {
3152
- disabled: P,
3131
+ disabled: K,
3153
3132
  id: "scale-option",
3154
3133
  value: u,
3155
- onValueChange: (v) => N(v),
3134
+ onValueChange: (v) => S(v),
3156
3135
  className: "col-span-2 flex gap-3",
3157
3136
  defaultValue: "x",
3158
3137
  children: [
@@ -3168,11 +3147,11 @@ function wa() {
3168
3147
  }
3169
3148
  )
3170
3149
  ] }),
3171
- u === "custom" && o == "linear" && D(),
3150
+ u === "custom" && c == "linear" && D(),
3172
3151
  G(),
3173
3152
  /* @__PURE__ */ e.jsx(Tt, {}),
3174
3153
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
3175
- z,
3154
+ w,
3176
3155
  {
3177
3156
  onClick: te,
3178
3157
  variant: "secondary",
@@ -3185,56 +3164,56 @@ function wa() {
3185
3164
  ] });
3186
3165
  }
3187
3166
  function Un({ idx: s }) {
3188
- var c;
3189
- const n = r((h) => {
3190
- var g;
3191
- return (g = h.card) == null ? void 0 : g.preferences;
3192
- }), a = r(
3193
- (h) => {
3194
- var g;
3195
- return (g = h.card.preferences) == null ? void 0 : g.datasetOptions;
3167
+ var l;
3168
+ const n = i((d) => {
3169
+ var f;
3170
+ return (f = d.card) == null ? void 0 : f.preferences;
3171
+ }), a = i(
3172
+ (d) => {
3173
+ var f;
3174
+ return (f = d.card.preferences) == null ? void 0 : f.datasetOptions;
3196
3175
  }
3197
- ), t = r(
3198
- (h) => h.actions.setCardPreferences
3199
- ), i = (c = n == null ? void 0 : n.chartOptions) == null ? void 0 : c.indexAxis, o = a == null ? void 0 : a.find((h) => h.idx === s);
3200
- function l(h, g) {
3201
- (h === "end" || h === "start") && Et(Lt());
3176
+ ), t = i(
3177
+ (d) => d.actions.setCardPreferences
3178
+ ), o = (l = n == null ? void 0 : n.chartOptions) == null ? void 0 : l.indexAxis, c = a == null ? void 0 : a.find((d) => d.idx === s);
3179
+ function r(d, f) {
3180
+ (d === "end" || d === "start") && Et(Lt());
3202
3181
  const m = {
3203
- display: h !== "none",
3204
- align: h,
3205
- anchor: h,
3182
+ display: d !== "none",
3183
+ align: d,
3184
+ anchor: d,
3206
3185
  clamp: !0
3207
3186
  };
3208
- if (!o)
3187
+ if (!c)
3209
3188
  t({
3210
3189
  ...n,
3211
3190
  datasetOptions: [
3212
3191
  ...a || [],
3213
3192
  {
3214
- idx: g,
3193
+ idx: f,
3215
3194
  datalabels: m
3216
3195
  }
3217
3196
  ]
3218
3197
  });
3219
3198
  else {
3220
- const u = { ...o };
3199
+ const u = { ...c };
3221
3200
  u.datalabels = m;
3222
- const N = a == null ? void 0 : a.map(
3223
- (d) => d.idx === g ? u : d
3201
+ const S = a == null ? void 0 : a.map(
3202
+ (h) => h.idx === f ? u : h
3224
3203
  );
3225
3204
  t({
3226
3205
  ...n,
3227
- datasetOptions: N
3206
+ datasetOptions: S
3228
3207
  });
3229
3208
  }
3230
3209
  }
3231
- return /* @__PURE__ */ e.jsxs(Pe, { children: [
3210
+ return /* @__PURE__ */ e.jsxs(Ke, { children: [
3232
3211
  /* @__PURE__ */ e.jsx(Ue, { children: /* @__PURE__ */ e.jsx(xn, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
3233
3212
  /* @__PURE__ */ e.jsx(Ge, { className: "w-fit p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
3234
3213
  /* @__PURE__ */ e.jsx(
3235
- z,
3214
+ w,
3236
3215
  {
3237
- onClick: () => l("none", s),
3216
+ onClick: () => r("none", s),
3238
3217
  size: "sm",
3239
3218
  variant: "secondary",
3240
3219
  className: "h-7 p-1 text-xs font-normal",
@@ -3242,9 +3221,9 @@ function Un({ idx: s }) {
3242
3221
  }
3243
3222
  ),
3244
3223
  /* @__PURE__ */ e.jsx(
3245
- z,
3224
+ w,
3246
3225
  {
3247
- onClick: () => l("start", s),
3226
+ onClick: () => r("start", s),
3248
3227
  size: "sm",
3249
3228
  variant: "secondary",
3250
3229
  className: "h-7 p-1 text-xs font-normal",
@@ -3252,16 +3231,16 @@ function Un({ idx: s }) {
3252
3231
  an,
3253
3232
  {
3254
3233
  className: Y("h-4 w-4", {
3255
- "rotate-90": i === "y"
3234
+ "rotate-90": o === "y"
3256
3235
  })
3257
3236
  }
3258
3237
  )
3259
3238
  }
3260
3239
  ),
3261
3240
  /* @__PURE__ */ e.jsx(
3262
- z,
3241
+ w,
3263
3242
  {
3264
- onClick: () => l("center", s),
3243
+ onClick: () => r("center", s),
3265
3244
  size: "sm",
3266
3245
  variant: "secondary",
3267
3246
  className: "h-7 p-1 text-xs font-normal",
@@ -3269,16 +3248,16 @@ function Un({ idx: s }) {
3269
3248
  nn,
3270
3249
  {
3271
3250
  className: Y("h-4 w-4", {
3272
- "rotate-90": i === "y"
3251
+ "rotate-90": o === "y"
3273
3252
  })
3274
3253
  }
3275
3254
  )
3276
3255
  }
3277
3256
  ),
3278
3257
  /* @__PURE__ */ e.jsx(
3279
- z,
3258
+ w,
3280
3259
  {
3281
- onClick: () => l("end", s),
3260
+ onClick: () => r("end", s),
3282
3261
  size: "sm",
3283
3262
  variant: "secondary",
3284
3263
  className: "h-7 p-1 text-xs font-normal",
@@ -3286,7 +3265,7 @@ function Un({ idx: s }) {
3286
3265
  tn,
3287
3266
  {
3288
3267
  className: Y("h-4 w-4", {
3289
- "rotate-90": i === "y"
3268
+ "rotate-90": o === "y"
3290
3269
  })
3291
3270
  }
3292
3271
  )
@@ -3296,72 +3275,72 @@ function Un({ idx: s }) {
3296
3275
  ] });
3297
3276
  }
3298
3277
  function za() {
3299
- const s = r((h) => h.card), n = r(
3300
- (h) => {
3301
- var g, m, u;
3302
- return (u = (m = (g = h == null ? void 0 : h.card) == null ? void 0 : g.preferences) == null ? void 0 : m.chartOptions) == null ? void 0 : u.indexAxis;
3278
+ const s = i((d) => d.card), n = i(
3279
+ (d) => {
3280
+ var f, m, u;
3281
+ return (u = (m = (f = d == null ? void 0 : d.card) == null ? void 0 : f.preferences) == null ? void 0 : m.chartOptions) == null ? void 0 : u.indexAxis;
3303
3282
  }
3304
3283
  ), a = n === "y" ? "Y axis" : "X axis", t = n === "y" ? "X axis" : "Y axis", {
3305
- keys: i,
3306
- metricKeys: o,
3307
- dimensionKeys: l
3308
- } = hs(s.data || []);
3309
- let c = o;
3284
+ keys: o,
3285
+ metricKeys: c,
3286
+ dimensionKeys: r
3287
+ } = ms(s.data || []);
3288
+ let l = c;
3310
3289
  if (s.type === "stackedBar") {
3311
- const h = Dt({
3290
+ const d = Dt({
3312
3291
  dataArray: s.data || [],
3313
- groupKey: l[0],
3314
- pivotKey: l[1],
3315
- valueKey: c[0]
3316
- }), { metricKeys: g } = hs(h);
3317
- c = g;
3292
+ groupKey: r[0],
3293
+ pivotKey: r[1],
3294
+ valueKey: l[0]
3295
+ }), { metricKeys: f } = ms(d);
3296
+ l = f;
3318
3297
  }
3319
- return i.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
3298
+ return o.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
3320
3299
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3321
3300
  /* @__PURE__ */ e.jsx(B, { children: a }),
3322
- /* @__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: l[0] }) }) })
3301
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: r[0] }) }) })
3323
3302
  ] }),
3324
3303
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3325
3304
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
3326
3305
  /* @__PURE__ */ e.jsx(B, { children: t }),
3327
3306
  /* @__PURE__ */ e.jsx(wa, {})
3328
3307
  ] }),
3329
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: c.map((h, g) => /* @__PURE__ */ e.jsx(Gn, { col: h, idx: g }, h)) })
3308
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: l.map((d, f) => /* @__PURE__ */ e.jsx(Gn, { col: d, idx: f }, d)) })
3330
3309
  ] })
3331
3310
  ] });
3332
3311
  }
3333
3312
  function Gn({ col: s, idx: n }) {
3334
- const a = r((c) => {
3335
- var h;
3336
- return (h = c.card) == null ? void 0 : h.preferences;
3337
- }), t = r(
3338
- (c) => {
3339
- var h;
3340
- return (h = c.card.preferences) == null ? void 0 : h.datasetOptions;
3313
+ const a = i((l) => {
3314
+ var d;
3315
+ return (d = l.card) == null ? void 0 : d.preferences;
3316
+ }), t = i(
3317
+ (l) => {
3318
+ var d;
3319
+ return (d = l.card.preferences) == null ? void 0 : d.datasetOptions;
3341
3320
  }
3342
- ), i = t == null ? void 0 : t.find((c) => c.idx === n), { setCardPreferences: o } = r((c) => c.actions);
3343
- function l(c) {
3344
- if (!i)
3345
- o({
3321
+ ), o = t == null ? void 0 : t.find((l) => l.idx === n), { setCardPreferences: c } = i((l) => l.actions);
3322
+ function r(l) {
3323
+ if (!o)
3324
+ c({
3346
3325
  ...a,
3347
3326
  datasetOptions: [
3348
3327
  ...t || [],
3349
3328
  {
3350
3329
  idx: n,
3351
- type: c === "area" ? "line" : c,
3352
- fill: c === "area" ? "origin" : ""
3330
+ type: l === "area" ? "line" : l,
3331
+ fill: l === "area" ? "origin" : ""
3353
3332
  }
3354
3333
  ]
3355
3334
  });
3356
3335
  else {
3357
- const h = { ...i };
3358
- h.type = c === "area" ? "line" : c, h.fill = c === "area" ? "origin" : "";
3359
- const g = t == null ? void 0 : t.map(
3360
- (m) => m.idx === n ? h : m
3336
+ const d = { ...o };
3337
+ d.type = l === "area" ? "line" : l, d.fill = l === "area" ? "origin" : "";
3338
+ const f = t == null ? void 0 : t.map(
3339
+ (m) => m.idx === n ? d : m
3361
3340
  );
3362
- o({
3341
+ c({
3363
3342
  ...a,
3364
- datasetOptions: g
3343
+ datasetOptions: f
3365
3344
  });
3366
3345
  }
3367
3346
  }
@@ -3369,28 +3348,28 @@ function Gn({ col: s, idx: n }) {
3369
3348
  /* @__PURE__ */ e.jsx("p", { children: s }),
3370
3349
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
3371
3350
  /* @__PURE__ */ e.jsx(
3372
- ws,
3351
+ zs,
3373
3352
  {
3374
- onClick: () => l("bar"),
3353
+ onClick: () => r("bar"),
3375
3354
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
3376
3355
  }
3377
3356
  ),
3378
3357
  /* @__PURE__ */ e.jsx(
3379
- zs,
3358
+ Fs,
3380
3359
  {
3381
- onClick: () => l("line"),
3360
+ onClick: () => r("line"),
3382
3361
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
3383
3362
  }
3384
3363
  ),
3385
3364
  /* @__PURE__ */ e.jsx(
3386
3365
  Jt,
3387
3366
  {
3388
- onClick: () => l("area"),
3367
+ onClick: () => r("area"),
3389
3368
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
3390
3369
  }
3391
3370
  ),
3392
3371
  /* @__PURE__ */ e.jsx(
3393
- Ss,
3372
+ ks,
3394
3373
  {
3395
3374
  orientation: "vertical",
3396
3375
  className: "invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"
@@ -3405,7 +3384,7 @@ function Jn({
3405
3384
  }) {
3406
3385
  return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
3407
3386
  /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
3408
- /* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
3387
+ /* @__PURE__ */ e.jsx(R, { children: `${ws(s)} Chart` }),
3409
3388
  /* @__PURE__ */ e.jsxs(_, { className: "space-y-4 font-mono text-xs", children: [
3410
3389
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, y-axis-1, y-axis-2,... FROM table" }),
3411
3390
  /* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
@@ -3432,7 +3411,7 @@ function Jn({
3432
3411
  /* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
3433
3412
  /* @__PURE__ */ e.jsx(R, { children: "Settings" }),
3434
3413
  /* @__PURE__ */ e.jsxs(_, { className: "space-y-4 px-2", children: [
3435
- /* @__PURE__ */ e.jsx(Fs, {}),
3414
+ /* @__PURE__ */ e.jsx(ss, {}),
3436
3415
  /* @__PURE__ */ e.jsx(za, {})
3437
3416
  ] })
3438
3417
  ] }),
@@ -3443,40 +3422,40 @@ function Jn({
3443
3422
  ] }) });
3444
3423
  }
3445
3424
  function Os() {
3446
- var i, o, l;
3447
- const s = r(
3448
- (c) => c.card.cfg
3449
- ), n = r((c) => c.actions.setCardCfg), a = r((c) => c.card.type);
3450
- function t(c) {
3425
+ var o, c, r;
3426
+ const s = i(
3427
+ (l) => l.card.cfg
3428
+ ), n = i((l) => l.actions.setCardCfg), a = i((l) => l.card.type);
3429
+ function t(l) {
3451
3430
  var m;
3452
- const h = {
3431
+ const d = {
3453
3432
  datalabels: {
3454
- display: c !== "none",
3455
- align: c,
3456
- anchor: c,
3433
+ display: l !== "none",
3434
+ align: l,
3435
+ anchor: l,
3457
3436
  clamp: !0
3458
3437
  }
3459
- }, g = {
3438
+ }, f = {
3460
3439
  ...s,
3461
3440
  options: {
3462
3441
  ...s == null ? void 0 : s.options,
3463
3442
  plugins: {
3464
3443
  ...(m = s == null ? void 0 : s.options) == null ? void 0 : m.plugins,
3465
- ...h
3444
+ ...d
3466
3445
  }
3467
3446
  }
3468
3447
  };
3469
- n(g), console.log(c);
3448
+ n(f), console.log(l);
3470
3449
  }
3471
3450
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3472
3451
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
3473
3452
  /* @__PURE__ */ e.jsx("label", { className: "font-medium", children: "Data Labels" }),
3474
- !["pyramid", "range"].includes(a) && /* @__PURE__ */ e.jsx(wa, {})
3453
+ !["pyramid"].includes(a) && /* @__PURE__ */ e.jsx(wa, {})
3475
3454
  ] }),
3476
3455
  /* @__PURE__ */ e.jsxs(
3477
3456
  Oe,
3478
3457
  {
3479
- value: (l = (o = (i = s == null ? void 0 : s.options) == null ? void 0 : i.plugins) == null ? void 0 : o.datalabels) == null ? void 0 : l.anchor,
3458
+ value: (r = (c = (o = s == null ? void 0 : s.options) == null ? void 0 : o.plugins) == null ? void 0 : c.datalabels) == null ? void 0 : r.anchor,
3480
3459
  onValueChange: t,
3481
3460
  defaultValue: "none",
3482
3461
  children: [
@@ -3497,9 +3476,9 @@ function Qn({
3497
3476
  cardType: s
3498
3477
  }) {
3499
3478
  function n(a) {
3500
- const t = "SELECT label, [group], x-axis, y-axis, radius FROM table", i = "SELECT label, [group], x-axis, y-axis FROM table";
3479
+ const t = "SELECT label, [group], x-axis, y-axis, radius FROM table", o = "SELECT label, [group], x-axis, y-axis FROM table";
3501
3480
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3502
- /* @__PURE__ */ e.jsx("div", { className: "bg-muted px-2 py-1 rounded text-xs", children: a === "bubble" ? t : i }),
3481
+ /* @__PURE__ */ e.jsx("div", { className: "bg-muted px-2 py-1 rounded text-xs", children: a === "bubble" ? t : o }),
3503
3482
  /* @__PURE__ */ e.jsxs("ul", { className: " ml-6 list-disc [&>li]:mt-2 text-xs", children: [
3504
3483
  /* @__PURE__ */ e.jsx("li", { children: "label - category" }),
3505
3484
  /* @__PURE__ */ e.jsx("li", { children: "group - category" }),
@@ -3513,7 +3492,7 @@ function Qn({
3513
3492
  "a",
3514
3493
  {
3515
3494
  target: "_blank",
3516
- onClick: (o) => o.stopPropagation(),
3495
+ onClick: (c) => c.stopPropagation(),
3517
3496
  className: "text-blue-700",
3518
3497
  href: "https://docs.semaphor.cloud/concepts/visuals#pie-chart",
3519
3498
  children: "example"
@@ -3525,7 +3504,7 @@ function Qn({
3525
3504
  }
3526
3505
  return /* @__PURE__ */ e.jsx("div", { className: "px-6 py-2 space-y-6", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
3527
3506
  /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
3528
- /* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
3507
+ /* @__PURE__ */ e.jsx(R, { children: `${ws(s)} Chart` }),
3529
3508
  /* @__PURE__ */ e.jsx(_, { className: " space-y-4 font-mono text-xs ", children: n(s) })
3530
3509
  ] }),
3531
3510
  /* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
@@ -3562,7 +3541,7 @@ const Wn = {
3562
3541
  ]
3563
3542
  };
3564
3543
  function Xn() {
3565
- const s = r((n) => n.card.type);
3544
+ const s = i((n) => n.card.type);
3566
3545
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
3567
3546
  /* @__PURE__ */ e.jsx(
3568
3547
  Se,
@@ -3573,7 +3552,7 @@ function Xn() {
3573
3552
  children: Zn(s)
3574
3553
  }
3575
3554
  ),
3576
- /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(Fs, {}) }),
3555
+ /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(ss, {}) }),
3577
3556
  /* @__PURE__ */ e.jsx("div", { children: !["kpi"].includes(s) && /* @__PURE__ */ e.jsx(Os, {}) }),
3578
3557
  /* @__PURE__ */ e.jsx("div", { children: !["kpi"].includes(s) && /* @__PURE__ */ e.jsx(De, {}) })
3579
3558
  ] });
@@ -3675,53 +3654,53 @@ function Zn(s) {
3675
3654
  ] })
3676
3655
  ] }) });
3677
3656
  }
3678
- function el() {
3679
- var h, g, m, u, N;
3680
- const s = r((d) => d.card.preferences), n = r(
3681
- (d) => d.actions.setCardPreferences
3682
- ), a = r(
3683
- (d) => d.actions.setNumberFormat
3657
+ function er() {
3658
+ var d, f, m, u, S;
3659
+ const s = i((h) => h.card.preferences), n = i(
3660
+ (h) => h.actions.setCardPreferences
3661
+ ), a = i(
3662
+ (h) => h.actions.setNumberFormat
3684
3663
  );
3685
- r(
3686
- (d) => {
3687
- var x, f;
3688
- return (f = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : f.decimalPlaces;
3664
+ i(
3665
+ (h) => {
3666
+ var x, g;
3667
+ return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.decimalPlaces;
3689
3668
  }
3690
3669
  );
3691
- const t = r(
3692
- (d) => {
3693
- var x, f;
3694
- return (f = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : f.locale;
3670
+ const t = i(
3671
+ (h) => {
3672
+ var x, g;
3673
+ return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.locale;
3695
3674
  }
3696
- ), i = r(
3697
- (d) => {
3698
- var x, f;
3699
- return (f = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : f.currency;
3675
+ ), o = i(
3676
+ (h) => {
3677
+ var x, g;
3678
+ return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.currency;
3700
3679
  }
3701
3680
  );
3702
- r(
3703
- (d) => d.actions.setFilterOnClickField
3681
+ i(
3682
+ (h) => h.actions.setFilterOnClickField
3704
3683
  );
3705
- const o = r(
3706
- (d) => {
3707
- var x, f;
3708
- return (f = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : f.colorRanges;
3684
+ const c = i(
3685
+ (h) => {
3686
+ var x, g;
3687
+ return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.colorRanges;
3709
3688
  }
3710
- ) || [], l = r(
3711
- (d) => d.actions.setColorRanges
3712
- ), c = [...new Set(Rs.map((d) => d.currency))];
3689
+ ) || [], r = i(
3690
+ (h) => h.actions.setColorRanges
3691
+ ), l = [...new Set(Rs.map((h) => h.currency))];
3713
3692
  return /* @__PURE__ */ e.jsxs("div", { children: [
3714
3693
  /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
3715
3694
  /* @__PURE__ */ e.jsx(
3716
- Ke,
3695
+ Pe,
3717
3696
  {
3718
- checked: !!((h = s == null ? void 0 : s.formatNumber) != null && h.enabled),
3719
- onCheckedChange: (d) => {
3697
+ checked: !!((d = s == null ? void 0 : s.formatNumber) != null && d.enabled),
3698
+ onCheckedChange: (h) => {
3720
3699
  n({
3721
3700
  ...s,
3722
3701
  formatNumber: {
3723
3702
  ...s == null ? void 0 : s.formatNumber,
3724
- enabled: d
3703
+ enabled: h
3725
3704
  }
3726
3705
  });
3727
3706
  }
@@ -3729,7 +3708,7 @@ function el() {
3729
3708
  ),
3730
3709
  /* @__PURE__ */ e.jsx(B, { children: "Format Number" })
3731
3710
  ] }),
3732
- ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
3711
+ ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
3733
3712
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 p-2", children: [
3734
3713
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
3735
3714
  /* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
@@ -3738,20 +3717,20 @@ function el() {
3738
3717
  Oe,
3739
3718
  {
3740
3719
  value: t || "en-US",
3741
- onValueChange: (d) => {
3742
- var x, f, w;
3720
+ onValueChange: (h) => {
3721
+ var x, g, z;
3743
3722
  return a(
3744
3723
  ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
3745
- ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.currency) || "",
3746
- d || "en-US",
3747
- ((w = s == null ? void 0 : s.formatNumber) == null ? void 0 : w.suffix) || ""
3724
+ ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.currency) || "",
3725
+ h || "en-US",
3726
+ ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
3748
3727
  );
3749
3728
  },
3750
3729
  children: [
3751
3730
  /* @__PURE__ */ e.jsx(Me, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
3752
3731
  /* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
3753
3732
  /* @__PURE__ */ e.jsx(Le, { children: "Format" }),
3754
- Rs.map((d) => /* @__PURE__ */ e.jsx(X, { value: d.locale, children: d.locale }, d.locale))
3733
+ Rs.map((h) => /* @__PURE__ */ e.jsx(X, { value: h.locale, children: h.locale }, h.locale))
3755
3734
  ] }) })
3756
3735
  ]
3757
3736
  }
@@ -3762,14 +3741,14 @@ function el() {
3762
3741
  /* @__PURE__ */ e.jsxs(
3763
3742
  Oe,
3764
3743
  {
3765
- value: i || "none",
3766
- onValueChange: (d) => {
3767
- var x, f, w;
3744
+ value: o || "none",
3745
+ onValueChange: (h) => {
3746
+ var x, g, z;
3768
3747
  return a(
3769
3748
  ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
3770
- d === "none" ? "" : d,
3771
- ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.locale) || "",
3772
- ((w = s == null ? void 0 : s.formatNumber) == null ? void 0 : w.suffix) || ""
3749
+ h === "none" ? "" : h,
3750
+ ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.locale) || "",
3751
+ ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
3773
3752
  );
3774
3753
  },
3775
3754
  children: [
@@ -3777,7 +3756,7 @@ function el() {
3777
3756
  /* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
3778
3757
  /* @__PURE__ */ e.jsx(Le, { children: "Currency" }),
3779
3758
  /* @__PURE__ */ e.jsx(X, { value: "none", children: "None" }, "none"),
3780
- c.map((d) => /* @__PURE__ */ e.jsx(X, { value: d, children: d }, d))
3759
+ l.map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h))
3781
3760
  ] }) })
3782
3761
  ]
3783
3762
  }
@@ -3791,18 +3770,18 @@ function el() {
3791
3770
  Oe,
3792
3771
  {
3793
3772
  value: ((u = (m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.decimalPlaces) == null ? void 0 : u.toString()) || "0",
3794
- onValueChange: (d) => {
3795
- var x, f, w;
3773
+ onValueChange: (h) => {
3774
+ var x, g, z;
3796
3775
  return a(
3797
- Number(d),
3776
+ Number(h),
3798
3777
  ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.currency) || "",
3799
- ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.locale) || "",
3800
- ((w = s == null ? void 0 : s.formatNumber) == null ? void 0 : w.suffix) || ""
3778
+ ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.locale) || "",
3779
+ ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
3801
3780
  );
3802
3781
  },
3803
3782
  children: [
3804
3783
  /* @__PURE__ */ e.jsx(Me, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
3805
- /* @__PURE__ */ e.jsx(Ae, { children: ["0", "1", "2", "3", "4"].map((d) => /* @__PURE__ */ e.jsx(X, { value: d, children: d }, d)) })
3784
+ /* @__PURE__ */ e.jsx(Ae, { children: ["0", "1", "2", "3", "4"].map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h)) })
3806
3785
  ]
3807
3786
  }
3808
3787
  )
@@ -3812,16 +3791,16 @@ function el() {
3812
3791
  /* @__PURE__ */ e.jsx(
3813
3792
  ae,
3814
3793
  {
3815
- value: ((N = s == null ? void 0 : s.formatNumber) == null ? void 0 : N.suffix) || "",
3794
+ value: ((S = s == null ? void 0 : s.formatNumber) == null ? void 0 : S.suffix) || "",
3816
3795
  className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
3817
3796
  placeholder: "K, M, B, %",
3818
- onChange: (d) => {
3819
- var x, f, w;
3797
+ onChange: (h) => {
3798
+ var x, g, z;
3820
3799
  return a(
3821
3800
  ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
3822
- ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.currency) || "",
3823
- ((w = s == null ? void 0 : s.formatNumber) == null ? void 0 : w.locale) || "",
3824
- d.target.value
3801
+ ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.currency) || "",
3802
+ ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.locale) || "",
3803
+ h.target.value
3825
3804
  );
3826
3805
  }
3827
3806
  }
@@ -3829,18 +3808,18 @@ function el() {
3829
3808
  ] })
3830
3809
  ] })
3831
3810
  ] }) }),
3832
- /* @__PURE__ */ e.jsx(Ss, { className: "my-3" }),
3811
+ /* @__PURE__ */ e.jsx(ks, { className: "my-3" }),
3833
3812
  /* @__PURE__ */ e.jsx(
3834
3813
  It,
3835
3814
  {
3836
- colorRanges: o,
3837
- setColorRanges: l
3815
+ colorRanges: c,
3816
+ setColorRanges: r
3838
3817
  }
3839
3818
  )
3840
3819
  ] })
3841
3820
  ] });
3842
3821
  }
3843
- function sl() {
3822
+ function sr() {
3844
3823
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
3845
3824
  /* @__PURE__ */ e.jsx(Se, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
3846
3825
  /* @__PURE__ */ e.jsx(R, { className: "", children: "KPI Query" }),
@@ -3866,18 +3845,18 @@ function sl() {
3866
3845
  ] })
3867
3846
  ] })
3868
3847
  ] }) }),
3869
- /* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(el, {}) }),
3848
+ /* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(er, {}) }),
3870
3849
  /* @__PURE__ */ e.jsx("div", {}),
3871
3850
  /* @__PURE__ */ e.jsx("div", {})
3872
3851
  ] });
3873
3852
  }
3874
- function os({
3853
+ function cs({
3875
3854
  cardType: s,
3876
3855
  docContent: n
3877
3856
  }) {
3878
3857
  return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
3879
3858
  /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
3880
- /* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
3859
+ /* @__PURE__ */ e.jsx(R, { children: `${ws(s)} Chart` }),
3881
3860
  /* @__PURE__ */ e.jsx(_, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
3882
3861
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT label, measure FROM table" }),
3883
3862
  /* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
@@ -3902,7 +3881,10 @@ function os({
3902
3881
  ] }),
3903
3882
  /* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
3904
3883
  /* @__PURE__ */ e.jsx(R, { children: "Settings" }),
3905
- /* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(Os, {}) })
3884
+ /* @__PURE__ */ e.jsxs(_, { className: "space-y-4 px-2", children: [
3885
+ s === "range" && /* @__PURE__ */ e.jsx(ss, {}),
3886
+ /* @__PURE__ */ e.jsx(Os, {})
3887
+ ] })
3906
3888
  ] }),
3907
3889
  s !== "range" && /* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
3908
3890
  /* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
@@ -3910,7 +3892,7 @@ function os({
3910
3892
  ] })
3911
3893
  ] }) });
3912
3894
  }
3913
- function al() {
3895
+ function ar() {
3914
3896
  return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
3915
3897
  /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
3916
3898
  /* @__PURE__ */ e.jsx(R, { children: "Stacked Chart" }),
@@ -3940,7 +3922,7 @@ function al() {
3940
3922
  /* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
3941
3923
  /* @__PURE__ */ e.jsx(R, { children: "Settings" }),
3942
3924
  /* @__PURE__ */ e.jsxs(_, { className: "space-y-4 px-2", children: [
3943
- /* @__PURE__ */ e.jsx(Fs, {}),
3925
+ /* @__PURE__ */ e.jsx(ss, {}),
3944
3926
  /* @__PURE__ */ e.jsx(za, {})
3945
3927
  ] })
3946
3928
  ] }),
@@ -3950,11 +3932,11 @@ function al() {
3950
3932
  ] })
3951
3933
  ] }) });
3952
3934
  }
3953
- function tl({}) {
3954
- const s = r((t) => {
3955
- var i;
3956
- return (i = t.card) == null ? void 0 : i.preferences;
3957
- }), n = r(
3935
+ function tr({}) {
3936
+ const s = i((t) => {
3937
+ var o;
3938
+ return (o = t.card) == null ? void 0 : o.preferences;
3939
+ }), n = i(
3958
3940
  (t) => t.actions.setCardPreferences
3959
3941
  ), a = (t) => {
3960
3942
  n({
@@ -3968,7 +3950,7 @@ function tl({}) {
3968
3950
  /* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
3969
3951
  ] }) }),
3970
3952
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3971
- /* @__PURE__ */ e.jsx(Ke, { onCheckedChange: a, id: "allow-download" }),
3953
+ /* @__PURE__ */ e.jsx(Pe, { onCheckedChange: a, id: "allow-download" }),
3972
3954
  /* @__PURE__ */ e.jsx(
3973
3955
  "label",
3974
3956
  {
@@ -3980,7 +3962,7 @@ function tl({}) {
3980
3962
  ] })
3981
3963
  ] });
3982
3964
  }
3983
- const nl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
3965
+ const nr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
3984
3966
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT dimension, cohort, metric FROM table" }),
3985
3967
  /* @__PURE__ */ e.jsxs("div", { children: [
3986
3968
  "See ",
@@ -3996,7 +3978,7 @@ const nl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
3996
3978
  ),
3997
3979
  " in the docs."
3998
3980
  ] })
3999
- ] }), ll = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
3981
+ ] }), rr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
4000
3982
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT y-axis, label, range-from, range-to, range-value FROM table" }),
4001
3983
  /* @__PURE__ */ e.jsxs("div", { children: [
4002
3984
  "See ",
@@ -4013,44 +3995,44 @@ const nl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
4013
3995
  " in the docs."
4014
3996
  ] })
4015
3997
  ] });
4016
- function rl() {
4017
- const s = r((a) => a.card.type);
3998
+ function lr() {
3999
+ const s = i((a) => a.card.type);
4018
4000
  function n(a) {
4019
4001
  switch (a) {
4020
4002
  case "stackedBar":
4021
- return /* @__PURE__ */ e.jsx(al, {});
4003
+ return /* @__PURE__ */ e.jsx(ar, {});
4022
4004
  case "pyramid":
4023
- return /* @__PURE__ */ e.jsx(os, { docContent: nl, cardType: a });
4005
+ return /* @__PURE__ */ e.jsx(cs, { docContent: nr, cardType: a });
4024
4006
  case "kpi":
4025
- return /* @__PURE__ */ e.jsx(sl, {});
4007
+ return /* @__PURE__ */ e.jsx(sr, {});
4026
4008
  case "line":
4027
4009
  case "bar":
4028
4010
  return /* @__PURE__ */ e.jsx(Jn, { cardType: a });
4029
4011
  case "range":
4030
- return /* @__PURE__ */ e.jsx(os, { docContent: ll, cardType: a });
4012
+ return /* @__PURE__ */ e.jsx(cs, { docContent: rr, cardType: a });
4031
4013
  case "pie":
4032
4014
  case "doughnut":
4033
4015
  case "polarArea":
4034
4016
  case "radar":
4035
- return /* @__PURE__ */ e.jsx(os, { cardType: a });
4017
+ return /* @__PURE__ */ e.jsx(cs, { cardType: a });
4036
4018
  case "bubble":
4037
4019
  case "scatter":
4038
4020
  return /* @__PURE__ */ e.jsx(Qn, { cardType: a });
4039
4021
  case "table":
4040
- return /* @__PURE__ */ e.jsx(tl, { cardType: a });
4022
+ return /* @__PURE__ */ e.jsx(tr, { cardType: a });
4041
4023
  default:
4042
4024
  return /* @__PURE__ */ e.jsx(Xn, {});
4043
4025
  }
4044
4026
  }
4045
- return /* @__PURE__ */ e.jsx(Cs, { className: "h-full w-full text-sm", children: n(s) });
4027
+ return /* @__PURE__ */ e.jsx(Ss, { className: "h-full w-full text-sm", children: n(s) });
4046
4028
  }
4047
- function il() {
4048
- const s = r((n) => n.isShowingVisual);
4029
+ function ir() {
4030
+ const s = i((n) => n.isShowingVisual);
4049
4031
  return /* @__PURE__ */ e.jsxs(
4050
- ms,
4032
+ us,
4051
4033
  {
4052
4034
  direction: "vertical",
4053
- className: "min-w-full max-w-lg min-h-[250px]",
4035
+ className: "min-h-[250px] min-w-full max-w-lg",
4054
4036
  children: [
4055
4037
  /* @__PURE__ */ e.jsx(
4056
4038
  Fe,
@@ -4062,7 +4044,7 @@ function il() {
4062
4044
  children: /* @__PURE__ */ e.jsx(Vn, {})
4063
4045
  }
4064
4046
  ),
4065
- /* @__PURE__ */ e.jsx(us, { withHandle: !0, className: "border " }),
4047
+ /* @__PURE__ */ e.jsx(xs, { withHandle: !0, className: "border" }),
4066
4048
  /* @__PURE__ */ e.jsx(
4067
4049
  Fe,
4068
4050
  {
@@ -4070,7 +4052,7 @@ function il() {
4070
4052
  role: "visual-section",
4071
4053
  minSize: 0,
4072
4054
  defaultSize: 60,
4073
- children: s ? /* @__PURE__ */ e.jsxs(ms, { direction: "horizontal", children: [
4055
+ children: s ? /* @__PURE__ */ e.jsxs(us, { direction: "horizontal", children: [
4074
4056
  /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
4075
4057
  Fe,
4076
4058
  {
@@ -4078,10 +4060,10 @@ function il() {
4078
4060
  minSize: 20,
4079
4061
  defaultSize: 25,
4080
4062
  maxSize: 30,
4081
- children: /* @__PURE__ */ e.jsx(rl, {})
4063
+ children: /* @__PURE__ */ e.jsx(lr, {})
4082
4064
  }
4083
4065
  ) }),
4084
- /* @__PURE__ */ e.jsx(us, { className: "border " }),
4066
+ /* @__PURE__ */ e.jsx(xs, { className: "border" }),
4085
4067
  /* @__PURE__ */ e.jsx(Fe, { minSize: 40, defaultSize: 75, maxSize: 100, children: /* @__PURE__ */ e.jsx($s, {}) })
4086
4068
  ] }) : /* @__PURE__ */ e.jsx($s, {})
4087
4069
  }
@@ -4090,24 +4072,24 @@ function il() {
4090
4072
  }
4091
4073
  );
4092
4074
  }
4093
- function ol({ authToken: s, onSave: n, onClose: a }) {
4094
- const t = r((l) => l.actions.setOnSave), i = r((l) => l.actions.setOnClose), o = k((l) => l.actions.setAuthToken);
4095
- return K(() => {
4096
- n && t(n), a && i(a);
4097
- }, [n, t, a, i]), K(() => {
4098
- s && s.accessToken && o(s);
4099
- }, [s, o]), /* @__PURE__ */ e.jsxs(qt, { className: "rounded-none", role: "editor-panel", children: [
4075
+ function or({ authToken: s, onSave: n, onClose: a }) {
4076
+ const t = i((r) => r.actions.setOnSave), o = i((r) => r.actions.setOnClose), c = k((r) => r.actions.setAuthToken);
4077
+ return P(() => {
4078
+ n && t(n), a && o(a);
4079
+ }, [n, t, a, o]), P(() => {
4080
+ s && s.accessToken && c(s);
4081
+ }, [s, c]), /* @__PURE__ */ e.jsxs(qt, { className: "rounded-none", role: "editor-panel", children: [
4100
4082
  /* @__PURE__ */ e.jsx(Vt, { className: "rounded-none border-r-[1.5px]", children: /* @__PURE__ */ e.jsx(pa, {}) }),
4101
- /* @__PURE__ */ e.jsx(Rt, { children: /* @__PURE__ */ e.jsx(il, {}) })
4083
+ /* @__PURE__ */ e.jsx(Rt, { children: /* @__PURE__ */ e.jsx(ir, {}) })
4102
4084
  ] });
4103
4085
  }
4104
- function cl() {
4105
- k((l) => l.selectedCardId);
4106
- const s = k((l) => l.selectedSheetId), { setIsVisualEditing: n } = k((l) => l.actions), a = k((l) => l.isVisualEditing), t = k((l) => l.actions.updateFrame);
4107
- function i(l) {
4108
- s && (t(s, l), n(!1));
4086
+ function cr() {
4087
+ k((r) => r.selectedCardId);
4088
+ const s = k((r) => r.selectedSheetId), { setIsVisualEditing: n } = k((r) => r.actions), a = k((r) => r.isVisualEditing), t = k((r) => r.actions.updateFrame);
4089
+ function o(r) {
4090
+ s && (t(s, r), n(!1));
4109
4091
  }
4110
- function o() {
4092
+ function c() {
4111
4093
  n(!1);
4112
4094
  }
4113
4095
  return /* @__PURE__ */ e.jsx(
@@ -4118,36 +4100,36 @@ function cl() {
4118
4100
  block: a,
4119
4101
  hidden: !a
4120
4102
  }),
4121
- children: /* @__PURE__ */ e.jsx(ol, { onSave: i, onClose: o })
4103
+ children: /* @__PURE__ */ e.jsx(or, { onSave: o, onClose: c })
4122
4104
  }
4123
4105
  );
4124
4106
  }
4125
- function dl({
4107
+ function dr({
4126
4108
  columns: s,
4127
4109
  tableName: n
4128
4110
  }) {
4129
- const a = r((u) => u.selectedConnectionId), t = r((u) => u.selectedDatabaseName), i = r((u) => u.selectedSchemaName), o = r((u) => u.selectedTableName), l = k((u) => u.dashboard.filters) || [], c = k((u) => u.actions.addFilter), h = k((u) => u.actions.removeFilter), g = k(
4111
+ const a = i((u) => u.selectedConnectionId), t = i((u) => u.selectedDatabaseName), o = i((u) => u.selectedSchemaName), c = i((u) => u.selectedTableName), r = k((u) => u.dashboard.filters) || [], l = k((u) => u.actions.addFilter), d = k((u) => u.actions.removeFilter), f = k(
4130
4112
  (u) => u.actions.removeFilterValue
4131
4113
  );
4132
4114
  function m(u) {
4133
- const N = he(u.column_name), d = he(t || ""), x = he(i || ""), f = he(n), w = ds(
4115
+ const S = he(u.column_name), h = he(t || ""), x = he(o || ""), g = he(n), z = hs(
4134
4116
  x,
4135
- f
4136
- ), b = `${w}.${N}`;
4117
+ g
4118
+ ), b = `${z}.${S}`;
4137
4119
  console.log(
4138
4120
  "find",
4139
4121
  b,
4140
- f,
4141
- d
4122
+ g,
4123
+ h
4142
4124
  );
4143
- const L = l == null ? void 0 : l.find(
4144
- (C) => C.column === b && C.table === f && (C.database === d || C.database === t)
4125
+ const L = r == null ? void 0 : r.find(
4126
+ (N) => N.column === b && N.table === g && (N.database === h || N.database === t)
4145
4127
  );
4146
4128
  if (L)
4147
- g(L.id), h(L.id);
4129
+ f(L.id), d(L.id);
4148
4130
  else {
4149
4131
  if (n === "api" && a) {
4150
- c({
4132
+ l({
4151
4133
  id: We(),
4152
4134
  column: b,
4153
4135
  title: u.column_name,
@@ -4159,34 +4141,34 @@ function dl({
4159
4141
  operation: "in",
4160
4142
  sql: _s(
4161
4143
  u.data_type,
4162
- w,
4163
- N
4144
+ z,
4145
+ S
4164
4146
  )
4165
4147
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4166
4148
  });
4167
4149
  return;
4168
4150
  }
4169
- c({
4151
+ l({
4170
4152
  id: We(),
4171
- column: `${w}.${N}`,
4153
+ column: `${z}.${S}`,
4172
4154
  title: u.column_name,
4173
4155
  dataType: u.data_type,
4174
- table: o || "",
4156
+ table: c || "",
4175
4157
  database: t || "",
4176
4158
  connectionId: a || "",
4177
4159
  operation: "in",
4178
4160
  sql: _s(
4179
4161
  u.data_type,
4180
- w,
4181
- N
4162
+ z,
4163
+ S
4182
4164
  )
4183
4165
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4184
4166
  });
4185
4167
  }
4186
4168
  }
4187
4169
  return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: s == null ? void 0 : s.map((u) => {
4188
- const N = l == null ? void 0 : l.find(
4189
- (d) => d.column === he(u.column_name) && d.table === o && d.database === t
4170
+ const S = r == null ? void 0 : r.find(
4171
+ (h) => h.column === he(u.column_name) && h.table === c && h.database === t
4190
4172
  );
4191
4173
  return /* @__PURE__ */ e.jsx(
4192
4174
  "div",
@@ -4195,7 +4177,7 @@ function dl({
4195
4177
  className: Y(
4196
4178
  "group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",
4197
4179
  {
4198
- "bg-muted": N
4180
+ "bg-muted": S
4199
4181
  }
4200
4182
  ),
4201
4183
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -4207,7 +4189,7 @@ function dl({
4207
4189
  );
4208
4190
  }) });
4209
4191
  }
4210
- function hl() {
4192
+ function hr() {
4211
4193
  k((n) => n.showFilters);
4212
4194
  const s = k(
4213
4195
  (n) => n.actions.setShowFilters
@@ -4216,7 +4198,7 @@ function hl() {
4216
4198
  /* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex items-center justify-between gap-2 px-3", children: [
4217
4199
  /* @__PURE__ */ e.jsx(B, { className: "text-lg", children: "Filters" }),
4218
4200
  /* @__PURE__ */ e.jsx(
4219
- z,
4201
+ w,
4220
4202
  {
4221
4203
  onClick: () => s(!1),
4222
4204
  className: "h-7 w-7 p-0",
@@ -4229,7 +4211,7 @@ function hl() {
4229
4211
  pa,
4230
4212
  {
4231
4213
  ColumnsComponent: (n, a, t) => /* @__PURE__ */ e.jsx(
4232
- dl,
4214
+ dr,
4233
4215
  {
4234
4216
  schemaName: n,
4235
4217
  tableName: a,
@@ -4240,7 +4222,7 @@ function hl() {
4240
4222
  ) })
4241
4223
  ] });
4242
4224
  }
4243
- function ml() {
4225
+ function mr() {
4244
4226
  k((a) => a.dashboard);
4245
4227
  const s = k((a) => a.showFilters), n = k((a) => a.isVisualEditing);
4246
4228
  return k((a) => a.bookmarkKey), /* @__PURE__ */ e.jsxs(
@@ -4253,12 +4235,12 @@ function ml() {
4253
4235
  }),
4254
4236
  children: [
4255
4237
  /* @__PURE__ */ e.jsx(_t, {}),
4256
- s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(hl, {}) })
4238
+ s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(hr, {}) })
4257
4239
  ]
4258
4240
  }
4259
4241
  );
4260
4242
  }
4261
- function ul() {
4243
+ function ur() {
4262
4244
  const s = k((t) => t.dashboard), n = k((t) => t.actions.setDashboard), a = k(
4263
4245
  (t) => t.showDashboardJSON
4264
4246
  );
@@ -4302,25 +4284,25 @@ function ul() {
4302
4284
  }
4303
4285
  );
4304
4286
  }
4305
- function fl({
4287
+ function fr({
4306
4288
  showControls: s = !1,
4307
4289
  showFooter: n = !0,
4308
4290
  ...a
4309
4291
  }) {
4310
4292
  return /* @__PURE__ */ e.jsxs(Bt, { dashboardProps: a, children: [
4311
4293
  /* @__PURE__ */ e.jsx($t, {}),
4312
- /* @__PURE__ */ e.jsxs(Kt, { children: [
4313
- /* @__PURE__ */ e.jsx(ul, {}),
4314
- /* @__PURE__ */ e.jsxs(Pt, { ...a, children: [
4294
+ /* @__PURE__ */ e.jsxs(Pt, { children: [
4295
+ /* @__PURE__ */ e.jsx(ur, {}),
4296
+ /* @__PURE__ */ e.jsxs(Kt, { ...a, children: [
4315
4297
  s && /* @__PURE__ */ e.jsx(vn, {}),
4316
- /* @__PURE__ */ e.jsx(cl, {}),
4317
- /* @__PURE__ */ e.jsx(ml, {})
4298
+ /* @__PURE__ */ e.jsx(cr, {}),
4299
+ /* @__PURE__ */ e.jsx(mr, {})
4318
4300
  ] })
4319
4301
  ] })
4320
4302
  ] });
4321
4303
  }
4322
4304
  export {
4323
- fl as D,
4305
+ fr as D,
4324
4306
  Qe as S,
4325
4307
  xa as u
4326
4308
  };