react-semaphor 0.0.544 → 0.0.545

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.
@@ -4,7 +4,7 @@ var Xs = (t) => {
4
4
  var Ra = (t, a, n) => a.has(t) || Xs("Cannot " + n);
5
5
  var Ce = (t, a, n) => (Ra(t, a, "read from private field"), n ? n.call(t) : a.get(t)), nn = (t, a, n) => a.has(t) ? Xs("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(t) : a.set(t, n), an = (t, a, n, r) => (Ra(t, a, "write to private field"), r ? r.call(t, n) : a.set(t, n), n), sn = (t, a, n) => (Ra(t, a, "access private method"), n);
6
6
  import { jsxs as s, jsx as e, Fragment as ne } from "react/jsx-runtime";
7
- import { E as ki, F as Di, G as er, H as Ti, I as Er, J as He, K as Mi, L as Ei, M as H, N as ss, w as Y, A as yt, O as Ee, P as In, Q as Or, R as V, T as ze, U as Rn, V as zn, W as Fn, X as Ln, Y as Q, Z as je, _ as ya, $ as _n, a0 as Pn, a1 as le, a2 as Vn, a3 as Ar, a4 as rn, a5 as Oi, a6 as tr, a7 as Ir, a8 as G, a9 as rs, aa as Me, ab as Ai, ac as ge, ad as ye, ae as ve, af as xe, ag as Pt, ah as Vt, ai as te, aj as Rr, ak as at, al as st, am as Ii, an as Kt, ao as St, ap as Ft, aq as Ue, ar as qe, as as Ge, at as ht, au as ls, av as jn, aw as Un, ax as zr, ay as vt, az as ln, aA as un, aB as rt, aC as De, aD as Ye, aE as is, aF as Ri, aG as ia, aH as Fr, aI as dt, aJ as Lr, aK as on, aL as os, aM as _r, aN as Re, aO as ie, aP as Ne, aQ as mn, aR as lt, aS as hn, aT as zi, aU as Lt, aV as tt, aW as Bn, aX as va, aY as Nn, aZ as cs, a_ as Cn, a$ as it, b0 as Jt, b1 as $n, b2 as qn, b3 as Pr, b4 as Wt, b5 as ds, b6 as us, b7 as ms, b8 as hs, b9 as pn, ba as Gn, bb as Vr, bc as ps, bd as xa, be as fs, bf as Fi, bg as gs, bh as Li, bi as _i, bj as Yt, bk as Qt, bl as Le, bm as Et, bn as jr, C as se, bo as Gt, B as E, bp as Ur, bq as Br, br as $r, bs as qr, bt as Gr, bu as Hr, bv as Kr, bw as Jr, bx as Pi, by as Vi, bz as qa, bA as ys, bB as ji, bC as Ui, bD as Bi, bE as Wr, bF as vs, bG as fn, bH as Hn, bI as Kn, bJ as Jn, bK as Wn, bL as jt, bM as gn, bN as wn, v as ot, bO as Yr, m as Qr, l as Zr, f as Xe, bP as $i, g as ut, bQ as qi, h as Ht, j as mt, k as Gi, bR as Hi, bS as Ki, bT as At, bU as Ot, bV as Xr, bW as Ji, e as el, bX as Sn, bY as kt, bZ as Wi, b_ as Ga, b$ as xs, c0 as Yn, c1 as ft, c2 as tl, r as oa, q as nr, c3 as Fe, c4 as aa, c5 as nl, c6 as Yi, c7 as Qi, c8 as Zi, c9 as al, ca as Xi, cb as ba, cc as eo, cd as ca, ce as to, cf as Ha, cg as Dt, ch as Ve, ci as Tt, cj as no, ck as ao, cl as so, cm as ro, cn as lo, co as za, cp as io, cq as ar, cr as oo, cs as sr, ct as co, cu as uo, cv as mo, cw as ho, cx as bs, cy as po, cz as sl, cA as Ns, cB as rl, cC as sa, cD as ll, cE as fo, cF as go, cG as yo, cH as il, cI as Qn, cJ as vo, cK as ol, cL as cl, cM as xo, cN as bo, cO as No, cP as dl, cQ as Cs, cR as ul, cS as Co, cT as rr, cU as Na, cV as Ca, cW as wa, cX as wo, cY as So, cZ as ko, c_ as xt, c$ as we, d0 as Se, d1 as ke, d2 as Do, d3 as To, d4 as Mo, d5 as Eo, s as Oo, d6 as lr, d7 as ml, d8 as Ao, d9 as Io, da as Ro, db as hl, dc as ws, dd as yn, de as Ss, df as It, dg as zo, dh as Zn, di as pl, dj as Fo, dk as Lo, dl as _o, dm as Po, dn as Vo, dp as ir, dq as jo, dr as Uo, ds as Bo, dt as $o, du as qo, dv as Go, dw as Ho, dx as fl, dy as Ko, dz as Jo, dA as Wo, dB as Yo, dC as Qo, dD as gl, dE as Fa, dF as or, dG as Zo, dH as Xo, dI as Ka, dJ as et, dK as Sa, dL as ec, dM as tc, dN as nc, dO as yl, dP as ks, dQ as ac, dR as sc, dS as kn, dT as Ja, dU as rc, dV as lc, dW as cr, dX as Wa, dY as Ya, dZ as da, d_ as cn, d$ as Dn, e0 as ic, e1 as oc, e2 as vl, e3 as cc, e4 as dc, S as uc, e5 as mc, e6 as hc, e7 as pc } from "./index-DdiZhL-n.js";
7
+ import { E as ki, F as Di, G as er, H as Ti, I as Er, J as He, K as Mi, L as Ei, M as H, N as ss, w as Y, A as yt, O as Ee, P as In, Q as Or, R as V, T as ze, U as Rn, V as zn, W as Fn, X as Ln, Y as Q, Z as je, _ as ya, $ as _n, a0 as Pn, a1 as le, a2 as Vn, a3 as Ar, a4 as rn, a5 as Oi, a6 as tr, a7 as Ir, a8 as G, a9 as rs, aa as Me, ab as Ai, ac as ge, ad as ye, ae as ve, af as xe, ag as Pt, ah as Vt, ai as te, aj as Rr, ak as at, al as st, am as Ii, an as Kt, ao as St, ap as Ft, aq as Ue, ar as qe, as as Ge, at as ht, au as ls, av as jn, aw as Un, ax as zr, ay as vt, az as ln, aA as un, aB as rt, aC as De, aD as Ye, aE as is, aF as Ri, aG as ia, aH as Fr, aI as dt, aJ as Lr, aK as on, aL as os, aM as _r, aN as Re, aO as ie, aP as Ne, aQ as mn, aR as lt, aS as hn, aT as zi, aU as Lt, aV as tt, aW as Bn, aX as va, aY as Nn, aZ as cs, a_ as Cn, a$ as it, b0 as Jt, b1 as $n, b2 as qn, b3 as Pr, b4 as Wt, b5 as ds, b6 as us, b7 as ms, b8 as hs, b9 as pn, ba as Gn, bb as Vr, bc as ps, bd as xa, be as fs, bf as Fi, bg as gs, bh as Li, bi as _i, bj as Yt, bk as Qt, bl as Le, bm as Et, bn as jr, C as se, bo as Gt, B as M, bp as Ur, bq as Br, br as $r, bs as qr, bt as Gr, bu as Hr, bv as Kr, bw as Jr, bx as Pi, by as Vi, bz as qa, bA as ys, bB as ji, bC as Ui, bD as Bi, bE as Wr, bF as vs, bG as fn, bH as Hn, bI as Kn, bJ as Jn, bK as Wn, bL as jt, bM as gn, bN as wn, v as ot, bO as Yr, m as Qr, l as Zr, f as Xe, bP as $i, g as ut, bQ as qi, h as Ht, j as mt, k as Gi, bR as Hi, bS as Ki, bT as At, bU as Ot, bV as Xr, bW as Ji, e as el, bX as Sn, bY as kt, bZ as Wi, b_ as Ga, b$ as xs, c0 as Yn, c1 as ft, c2 as tl, r as oa, q as nr, c3 as Fe, c4 as aa, c5 as nl, c6 as Yi, c7 as Qi, c8 as Zi, c9 as al, ca as Xi, cb as ba, cc as eo, cd as ca, ce as to, cf as Ha, cg as Dt, ch as Ve, ci as Tt, cj as no, ck as ao, cl as so, cm as ro, cn as lo, co as za, cp as io, cq as ar, cr as oo, cs as sr, ct as co, cu as uo, cv as mo, cw as ho, cx as bs, cy as po, cz as sl, cA as Ns, cB as rl, cC as sa, cD as ll, cE as fo, cF as go, cG as yo, cH as il, cI as Qn, cJ as vo, cK as ol, cL as cl, cM as xo, cN as bo, cO as No, cP as dl, cQ as Cs, cR as ul, cS as Co, cT as rr, cU as Na, cV as Ca, cW as wa, cX as wo, cY as So, cZ as ko, c_ as xt, c$ as we, d0 as Se, d1 as ke, d2 as Do, d3 as To, d4 as Mo, d5 as Eo, s as Oo, d6 as lr, d7 as ml, d8 as Ao, d9 as Io, da as Ro, db as hl, dc as ws, dd as yn, de as Ss, df as It, dg as zo, dh as Zn, di as pl, dj as Fo, dk as Lo, dl as _o, dm as Po, dn as Vo, dp as ir, dq as jo, dr as Uo, ds as Bo, dt as $o, du as qo, dv as Go, dw as Ho, dx as fl, dy as Ko, dz as Jo, dA as Wo, dB as Yo, dC as Qo, dD as gl, dE as Fa, dF as or, dG as Zo, dH as Xo, dI as Ka, dJ as et, dK as Sa, dL as ec, dM as tc, dN as nc, dO as yl, dP as ks, dQ as ac, dR as sc, dS as kn, dT as Ja, dU as rc, dV as lc, dW as cr, dX as Wa, dY as Ya, dZ as da, d_ as cn, d$ as Dn, e0 as ic, e1 as oc, e2 as vl, e3 as cc, e4 as dc, S as uc, e5 as mc, e6 as hc, e7 as pc } from "./index-DdiZhL-n.js";
8
8
  import * as Ke from "react";
9
9
  import Ae, { useState as P, useCallback as me, useEffect as Te, useRef as nt, useMemo as $e, Suspense as xl, useContext as fc } from "react";
10
10
  import "react-dom";
@@ -1292,16 +1292,16 @@ async function pd(t, a) {
1292
1292
  }) : null;
1293
1293
  }
1294
1294
  function fd() {
1295
- const [t, a] = P(""), [n, r] = P(!1), l = Y((p) => p.lenses), { setLenses: o, setSelectedLensId: c } = yt(), [i, d] = P(!1), [u, h] = P(!1), m = Y((p) => p.dashboard), g = Y((p) => p.filterValues), { authToken: f } = Ee();
1295
+ const [t, a] = P(""), [n, r] = P(!1), l = Y((f) => f.lenses), { setLenses: o, setSelectedLensId: c } = yt(), [i, d] = P(!1), [u, h] = P(!1), m = Y((f) => f.dashboard), g = Y((f) => f.filterValues), { authToken: p } = Ee();
1296
1296
  async function y() {
1297
1297
  d(!0);
1298
- const p = Ol(
1298
+ const f = Ol(
1299
1299
  m
1300
1300
  ), b = await hd(
1301
1301
  t,
1302
- p,
1302
+ f,
1303
1303
  g,
1304
- f == null ? void 0 : f.accessToken
1304
+ p == null ? void 0 : p.accessToken
1305
1305
  );
1306
1306
  b && (o([...l || [], b]), c(b.id), h(!1)), d(!1);
1307
1307
  }
@@ -1329,8 +1329,8 @@ function fd() {
1329
1329
  je,
1330
1330
  {
1331
1331
  value: t,
1332
- onChange: (p) => {
1333
- a(p.target.value);
1332
+ onChange: (f) => {
1333
+ a(f.target.value);
1334
1334
  },
1335
1335
  id: "name",
1336
1336
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -1359,7 +1359,7 @@ function gd() {
1359
1359
  }
1360
1360
  async function d(h) {
1361
1361
  if (await pd(h, c == null ? void 0 : c.accessToken)) {
1362
- const g = n == null ? void 0 : n.filter((f) => f.id !== h);
1362
+ const g = n == null ? void 0 : n.filter((p) => p.id !== h);
1363
1363
  l(g || []), o("original");
1364
1364
  }
1365
1365
  }
@@ -1377,10 +1377,10 @@ function gd() {
1377
1377
  isDefault: !h.isDefault
1378
1378
  };
1379
1379
  await Za(g, c == null ? void 0 : c.accessToken);
1380
- const f = n == null ? void 0 : n.find((y) => y.isDefault);
1381
- if (f && f.id !== h.id) {
1380
+ const p = n == null ? void 0 : n.find((y) => y.isDefault);
1381
+ if (p && p.id !== h.id) {
1382
1382
  const y = {
1383
- ...f,
1383
+ ...p,
1384
1384
  isDefault: !1
1385
1385
  };
1386
1386
  await Za(y, c == null ? void 0 : c.accessToken);
@@ -1545,7 +1545,7 @@ function xd({
1545
1545
  status: l,
1546
1546
  error: o,
1547
1547
  isDeleting: c
1548
- } = bd(), [i, d] = P(""), [u, h] = P(fr[0].value), [m, g] = P("06:00"), [f, y] = P("");
1548
+ } = bd(), [i, d] = P(""), [u, h] = P(fr[0].value), [m, g] = P("06:00"), [p, y] = P("");
1549
1549
  return /* @__PURE__ */ e(Rr, { delayDuration: 0, children: /* @__PURE__ */ s(at, { children: [
1550
1550
  /* @__PURE__ */ e(st, { asChild: !0, children: /* @__PURE__ */ e(
1551
1551
  le,
@@ -1568,7 +1568,7 @@ function xd({
1568
1568
  {
1569
1569
  id: "email",
1570
1570
  value: i,
1571
- onChange: (p) => d(p.target.value),
1571
+ onChange: (f) => d(f.target.value),
1572
1572
  className: `col-span-2 h-8 ${St}`
1573
1573
  }
1574
1574
  )
@@ -1580,9 +1580,9 @@ function xd({
1580
1580
  {
1581
1581
  id: "subject",
1582
1582
  placeholder: "Monthly Sales Report",
1583
- value: f,
1584
- onChange: (p) => {
1585
- y(p.target.value.replace(/[^a-zA-Z0-9\s-_]/g, ""));
1583
+ value: p,
1584
+ onChange: (f) => {
1585
+ y(f.target.value.replace(/[^a-zA-Z0-9\s-_]/g, ""));
1586
1586
  },
1587
1587
  className: `col-span-2 h-8 ${St}`
1588
1588
  }
@@ -1597,7 +1597,7 @@ function xd({
1597
1597
  label: "Select Frequency",
1598
1598
  options: fr,
1599
1599
  value: u,
1600
- onValueChange: (p) => h(p)
1600
+ onValueChange: (f) => h(f)
1601
1601
  }
1602
1602
  )
1603
1603
  ] }),
@@ -1609,7 +1609,7 @@ function xd({
1609
1609
  id: "time",
1610
1610
  type: "time",
1611
1611
  value: m,
1612
- onChange: (p) => g(p.target.value),
1612
+ onChange: (f) => g(f.target.value),
1613
1613
  className: `col-span-2 h-8 ${St}`
1614
1614
  }
1615
1615
  )
@@ -1622,7 +1622,7 @@ function xd({
1622
1622
  email: i,
1623
1623
  frequency: u,
1624
1624
  time: m,
1625
- subject: f
1625
+ subject: p
1626
1626
  }), g("00:00"), d(""), y("");
1627
1627
  },
1628
1628
  className: "h-8 p-2",
@@ -1647,38 +1647,38 @@ function xd({
1647
1647
  ] }),
1648
1648
  ls
1649
1649
  ] }) }),
1650
- /* @__PURE__ */ e("div", { className: "grid gap-2", children: a == null ? void 0 : a.map((p) => /* @__PURE__ */ s(
1650
+ /* @__PURE__ */ e("div", { className: "grid gap-2", children: a == null ? void 0 : a.map((f) => /* @__PURE__ */ s(
1651
1651
  "div",
1652
1652
  {
1653
1653
  className: "group grid grid-cols-5 gap-3",
1654
1654
  children: [
1655
1655
  /* @__PURE__ */ e("div", { className: "col-span-3 text-sm", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
1656
1656
  /* @__PURE__ */ s("div", { className: "boder-border rounded-md border bg-muted px-2 py-1", children: [
1657
- jn(p.frequency),
1657
+ jn(f.frequency),
1658
1658
  " "
1659
1659
  ] }),
1660
- /* @__PURE__ */ e(Q, { children: p.time })
1660
+ /* @__PURE__ */ e(Q, { children: f.time })
1661
1661
  ] }) }),
1662
1662
  /* @__PURE__ */ s("div", { className: "col-span-2 flex items-center justify-end gap-4", children: [
1663
1663
  /* @__PURE__ */ e(
1664
1664
  gr,
1665
1665
  {
1666
- tooltip: `Next Run: ${new Date(p.nextRun).toLocaleString()} ${p.timezone}`,
1666
+ tooltip: `Next Run: ${new Date(f.nextRun).toLocaleString()} ${f.timezone}`,
1667
1667
  children: /* @__PURE__ */ e(Ic, { className: "size-3.5" })
1668
1668
  }
1669
1669
  ),
1670
- /* @__PURE__ */ e(gr, { tooltip: `${p.endUserEmail}`, children: /* @__PURE__ */ e(Zc, { className: "size-3.5" }) }),
1671
- c === p.id ? /* @__PURE__ */ e(Me, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ e(
1670
+ /* @__PURE__ */ e(gr, { tooltip: `${f.endUserEmail}`, children: /* @__PURE__ */ e(Zc, { className: "size-3.5" }) }),
1671
+ c === f.id ? /* @__PURE__ */ e(Me, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ e(
1672
1672
  Un,
1673
1673
  {
1674
- onClick: () => r(p.id),
1674
+ onClick: () => r(f.id),
1675
1675
  className: "size-3.5 cursor-pointer"
1676
1676
  }
1677
1677
  )
1678
1678
  ] })
1679
1679
  ]
1680
1680
  },
1681
- p.id
1681
+ f.id
1682
1682
  )) })
1683
1683
  ] })
1684
1684
  ] })
@@ -1696,7 +1696,7 @@ function bd() {
1696
1696
  const [t, a] = P("idle"), [n, r] = P(""), [l, o] = P(null), c = Y((w) => w.authToken), i = Y((w) => w.dashboard.id), d = Y((w) => w.dashboard.title), { endUserId: u } = zr((c == null ? void 0 : c.accessToken) || ""), h = "https://semaphor.cloud/api/v1/subscriptions/get", m = {
1697
1697
  dashboardId: i,
1698
1698
  endUserId: u
1699
- }, { data: g, isLoading: f, isError: y, isFetching: p, refetch: b } = vt({
1699
+ }, { data: g, isLoading: p, isError: y, isFetching: f, refetch: b } = vt({
1700
1700
  queryKey: ["subscriptions", i, u],
1701
1701
  queryFn: () => un(h, (c == null ? void 0 : c.accessToken) || "", m),
1702
1702
  enabled: !!(c != null && c.accessToken) && !!i && !!u
@@ -1704,12 +1704,12 @@ function bd() {
1704
1704
  async function v({
1705
1705
  email: w,
1706
1706
  subject: z,
1707
- frequency: M,
1707
+ frequency: E,
1708
1708
  time: S
1709
1709
  }) {
1710
1710
  const { authToken: C, ...T } = Al(), k = Intl.DateTimeFormat().resolvedOptions().timeZone, R = {
1711
1711
  email: w,
1712
- frequency: M,
1712
+ frequency: E,
1713
1713
  time: S,
1714
1714
  timezone: k,
1715
1715
  endUserId: u,
@@ -1742,14 +1742,14 @@ function bd() {
1742
1742
  await ln(z, (c == null ? void 0 : c.accessToken) || "", { id: w }), b(), setTimeout(() => {
1743
1743
  o(null);
1744
1744
  }, 2e3);
1745
- } catch (M) {
1746
- console.error(M), o(null), a("error"), r(M.message);
1745
+ } catch (E) {
1746
+ console.error(E), o(null), a("error"), r(E.message);
1747
1747
  }
1748
1748
  }
1749
1749
  return {
1750
1750
  data: g,
1751
- isLoading: f,
1752
- isFetching: p,
1751
+ isLoading: p,
1752
+ isFetching: f,
1753
1753
  isError: y,
1754
1754
  isDeleting: l,
1755
1755
  refetch: b,
@@ -2256,10 +2256,10 @@ function qd({
2256
2256
  onShareVisual: h,
2257
2257
  formatDate: m
2258
2258
  }) {
2259
- var M;
2260
- const { selectVisual: g } = is(), f = Ri(t.id), [y, p] = P(!1), [b, v] = P(!1);
2259
+ var E;
2260
+ const { selectVisual: g } = is(), p = Ri(t.id), [y, f] = P(!1), [b, v] = P(!1);
2261
2261
  Te(() => {
2262
- n ? (p(!0), v(!0)) : b && (p(!1), v(!1));
2262
+ n ? (f(!0), v(!0)) : b && (f(!1), v(!1));
2263
2263
  }, [n, b]);
2264
2264
  const N = () => t.ownership.isOwner ? t.ownership.status === "private" ? /* @__PURE__ */ e(kl, { className: "h-3 w-3 text-purple-500" }) : /* @__PURE__ */ e(gt, { className: "h-3.5 w-3.5 text-blue-600" }) : /* @__PURE__ */ e(Rt, { className: "h-3.5 w-3.5 text-slate-500" }), w = () => /* @__PURE__ */ e(os, { className: "h-4 w-4 text-slate-400" }), z = () => {
2265
2265
  g(t), c == null || c(t);
@@ -2271,7 +2271,7 @@ function qd({
2271
2271
  "group relative flex cursor-pointer items-start gap-3 px-4 py-3 dark:border-slate-800",
2272
2272
  "cursor-pointer transition-colors duration-150 hover:bg-slate-50 dark:hover:bg-slate-900/50",
2273
2273
  t.ownership.isOwner && "border-blue-200 dark:border-blue-800",
2274
- f && "rounded-md bg-slate-50 ring-1 ring-inset ring-border dark:bg-slate-900/50"
2274
+ p && "rounded-md bg-slate-50 ring-1 ring-inset ring-border dark:bg-slate-900/50"
2275
2275
  ),
2276
2276
  tabIndex: 0,
2277
2277
  onClick: z,
@@ -2286,7 +2286,7 @@ function qd({
2286
2286
  inputClassName: "text-sm font-medium text-slate-900 dark:text-slate-100",
2287
2287
  value: t.title,
2288
2288
  onSave: (S) => i == null ? void 0 : i(t.id, { title: S }),
2289
- isEditable: t.ownership.isOwner && f,
2289
+ isEditable: t.ownership.isOwner && p,
2290
2290
  isPending: r,
2291
2291
  placeholder: "Untitled Visual",
2292
2292
  displayClassName: "line-clamp-1 max-w-[150px] text-sm font-medium text-slate-900 dark:text-slate-100"
@@ -2300,7 +2300,7 @@ function qd({
2300
2300
  inputClassName: "line-clamp-1 text-xs text-slate-500 dark:text-slate-400",
2301
2301
  value: t.description || "",
2302
2302
  onSave: (S) => i == null ? void 0 : i(t.id, { description: S }),
2303
- isEditable: t.ownership.isOwner && f,
2303
+ isEditable: t.ownership.isOwner && p,
2304
2304
  isPending: l,
2305
2305
  placeholder: "No description",
2306
2306
  displayClassName: "mt-0.5 max-w-[220px] line-clamp-1 text-xs text-slate-500 dark:text-slate-400"
@@ -2332,7 +2332,7 @@ function qd({
2332
2332
  {
2333
2333
  modal: !1,
2334
2334
  open: y,
2335
- onOpenChange: p,
2335
+ onOpenChange: f,
2336
2336
  children: [
2337
2337
  /* @__PURE__ */ e(Pn, { asChild: !0, children: /* @__PURE__ */ e(
2338
2338
  V,
@@ -2415,7 +2415,7 @@ function qd({
2415
2415
  /* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
2416
2416
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
2417
2417
  /* @__PURE__ */ e(Rt, { className: "h-3 w-3" }),
2418
- /* @__PURE__ */ e("span", { children: ((M = t.ownership.createdBy) == null ? void 0 : M.name) || "Unknown" })
2418
+ /* @__PURE__ */ e("span", { children: ((E = t.ownership.createdBy) == null ? void 0 : E.name) || "Unknown" })
2419
2419
  ] }),
2420
2420
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
2421
2421
  /* @__PURE__ */ e(on, { className: "h-3 w-3" }),
@@ -2790,15 +2790,15 @@ function Qd({
2790
2790
  ")"
2791
2791
  ] }),
2792
2792
  /* @__PURE__ */ s("div", { className: "grid grid-cols-1 gap-1", children: [
2793
- i.slice(0, 3).map((g, f) => {
2793
+ i.slice(0, 3).map((g, p) => {
2794
2794
  var v, N;
2795
2795
  const y = ((v = a.find(
2796
2796
  (w) => w.id === g.orgUserId
2797
- )) == null ? void 0 : v.name) || "Unknown User", p = ((N = a.find(
2797
+ )) == null ? void 0 : v.name) || "Unknown User", f = ((N = a.find(
2798
2798
  (w) => w.id === g.orgUserId
2799
2799
  )) == null ? void 0 : N.type) || "", b = Qe(
2800
2800
  g.role,
2801
- n(p)
2801
+ n(f)
2802
2802
  );
2803
2803
  return /* @__PURE__ */ s(
2804
2804
  "div",
@@ -2816,7 +2816,7 @@ function Qd({
2816
2816
  )
2817
2817
  ]
2818
2818
  },
2819
- f
2819
+ p
2820
2820
  );
2821
2821
  }),
2822
2822
  i.length > 3 && /* @__PURE__ */ s("div", { className: "text-xs italic text-muted-foreground", children: [
@@ -2833,15 +2833,15 @@ function Qd({
2833
2833
  ")"
2834
2834
  ] }),
2835
2835
  /* @__PURE__ */ s("div", { className: "grid grid-cols-1 gap-1", children: [
2836
- d.slice(0, 3).map((g, f) => {
2836
+ d.slice(0, 3).map((g, p) => {
2837
2837
  var v, N;
2838
2838
  const y = ((v = a.find(
2839
2839
  (w) => w.id === g.tenantUserId
2840
- )) == null ? void 0 : v.name) || "Unknown User", p = ((N = a.find(
2840
+ )) == null ? void 0 : v.name) || "Unknown User", f = ((N = a.find(
2841
2841
  (w) => w.id === g.tenantUserId
2842
2842
  )) == null ? void 0 : N.type) || "", b = Qe(
2843
2843
  g.role,
2844
- n(p)
2844
+ n(f)
2845
2845
  );
2846
2846
  return /* @__PURE__ */ s(
2847
2847
  "div",
@@ -2859,7 +2859,7 @@ function Qd({
2859
2859
  )
2860
2860
  ]
2861
2861
  },
2862
- f
2862
+ p
2863
2863
  );
2864
2864
  }),
2865
2865
  d.length > 3 && /* @__PURE__ */ s("div", { className: "text-xs italic text-muted-foreground", children: [
@@ -2871,7 +2871,7 @@ function Qd({
2871
2871
  ] }),
2872
2872
  u.length > 0 && /* @__PURE__ */ s("div", { className: "space-y-1", children: [
2873
2873
  /* @__PURE__ */ e("div", { className: "text-xs font-medium text-purple-600", children: "All Org Users" }),
2874
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: u.map((g, f) => {
2874
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: u.map((g, p) => {
2875
2875
  const y = Qe(
2876
2876
  g.role,
2877
2877
  n("")
@@ -2892,13 +2892,13 @@ function Qd({
2892
2892
  )
2893
2893
  ]
2894
2894
  },
2895
- f
2895
+ p
2896
2896
  );
2897
2897
  }) })
2898
2898
  ] }),
2899
2899
  h.length > 0 && /* @__PURE__ */ s("div", { className: "space-y-1", children: [
2900
2900
  /* @__PURE__ */ e("div", { className: "text-xs font-medium text-orange-600", children: "Org Users Only" }),
2901
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: h.map((g, f) => {
2901
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: h.map((g, p) => {
2902
2902
  const y = Qe(
2903
2903
  g.role,
2904
2904
  n("")
@@ -2919,13 +2919,13 @@ function Qd({
2919
2919
  )
2920
2920
  ]
2921
2921
  },
2922
- f
2922
+ p
2923
2923
  );
2924
2924
  }) })
2925
2925
  ] }),
2926
2926
  m.length > 0 && /* @__PURE__ */ s("div", { className: "space-y-1", children: [
2927
2927
  /* @__PURE__ */ e("div", { className: "text-xs font-medium text-indigo-600", children: "All Tenants" }),
2928
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: m.map((g, f) => {
2928
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-1", children: m.map((g, p) => {
2929
2929
  const y = Qe(
2930
2930
  g.role,
2931
2931
  n("")
@@ -2946,7 +2946,7 @@ function Qd({
2946
2946
  )
2947
2947
  ]
2948
2948
  },
2949
- f
2949
+ p
2950
2950
  );
2951
2951
  }) })
2952
2952
  ] }),
@@ -2966,11 +2966,11 @@ function Qd({
2966
2966
  ] }),
2967
2967
  /* @__PURE__ */ s("div", { className: "grid grid-cols-1 gap-1", children: [
2968
2968
  c.slice(0, 3).map((d, u) => {
2969
- var f, y;
2970
- const h = ((f = a.find(
2971
- (p) => p.id === d.tenantUserId
2972
- )) == null ? void 0 : f.name) || "Unknown User", m = ((y = a.find(
2973
- (p) => p.id === d.tenantUserId
2969
+ var p, y;
2970
+ const h = ((p = a.find(
2971
+ (f) => f.id === d.tenantUserId
2972
+ )) == null ? void 0 : p.name) || "Unknown User", m = ((y = a.find(
2973
+ (f) => f.id === d.tenantUserId
2974
2974
  )) == null ? void 0 : y.type) || "", g = Qe(
2975
2975
  d.role,
2976
2976
  n(m)
@@ -3045,12 +3045,12 @@ function Qd({
3045
3045
  ] }),
3046
3046
  /* @__PURE__ */ s("div", { className: "grid grid-cols-1 gap-1", children: [
3047
3047
  o.slice(0, 3).map((i, d) => {
3048
- var g, f;
3048
+ var g, p;
3049
3049
  const u = ((g = a.find(
3050
3050
  (y) => y.id === i.tenantUserId
3051
- )) == null ? void 0 : g.name) || "Unknown User", h = ((f = a.find(
3051
+ )) == null ? void 0 : g.name) || "Unknown User", h = ((p = a.find(
3052
3052
  (y) => y.id === i.tenantUserId
3053
- )) == null ? void 0 : f.type) || "", m = Qe(
3053
+ )) == null ? void 0 : p.type) || "", m = Qe(
3054
3054
  i.role,
3055
3055
  n(h)
3056
3056
  );
@@ -3136,7 +3136,7 @@ function Xd({
3136
3136
  handleUserToggle: h,
3137
3137
  handleRemoveAccess: m,
3138
3138
  handleUpdateAccess: g,
3139
- handleUserRoleChange: f
3139
+ handleUserRoleChange: p
3140
3140
  }) {
3141
3141
  return /* @__PURE__ */ s(
3142
3142
  "div",
@@ -3187,7 +3187,7 @@ function Xd({
3187
3187
  ma,
3188
3188
  {
3189
3189
  currentRole: (c == null ? void 0 : c.role) || "VIEWER",
3190
- onRoleChange: (y) => f(t.id, y),
3190
+ onRoleChange: (y) => p(t.id, y),
3191
3191
  roleOptions: i,
3192
3192
  disabled: !1
3193
3193
  }
@@ -3231,11 +3231,11 @@ function Ul({
3231
3231
  handleRemoveAccess: d,
3232
3232
  handleUpdateAccess: u
3233
3233
  }) {
3234
- const h = mn(), m = lt(), g = hn(), f = zi(), y = Lt(), p = c || ((M) => {
3235
- const S = h.some((T) => T.id === M), C = m.includes(M);
3236
- S ? y.removeSelectedUser(M) : C ? y.removeUserFromRemove(M) : y.addSelectedUser({ id: M, role: "VIEWER" });
3237
- }), b = i || y.updateSelectedUserRole, v = d || y.addUserToRemove, N = u || ((M, S, C) => {
3238
- y.addUserToUpdate({ id: M, currentRole: S, newRole: C });
3234
+ const h = mn(), m = lt(), g = hn(), p = zi(), y = Lt(), f = c || ((E) => {
3235
+ const S = h.some((T) => T.id === E), C = m.includes(E);
3236
+ S ? y.removeSelectedUser(E) : C ? y.removeUserFromRemove(E) : y.addSelectedUser({ id: E, role: "VIEWER" });
3237
+ }), b = i || y.updateSelectedUserRole, v = d || y.addUserToRemove, N = u || ((E, S, C) => {
3238
+ y.addUserToUpdate({ id: E, currentRole: S, newRole: C });
3239
3239
  }), w = l, z = m;
3240
3240
  return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
3241
3241
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
@@ -3265,7 +3265,7 @@ function Ul({
3265
3265
  size: "sm",
3266
3266
  onClick: () => {
3267
3267
  h.length === w.length ? y.setSelectedUsers([]) : y.setSelectedUsers(
3268
- w.map((M) => ({ id: M.id, role: "VIEWER" }))
3268
+ w.map((E) => ({ id: E.id, role: "VIEWER" }))
3269
3269
  );
3270
3270
  },
3271
3271
  className: "h-auto p-1 text-xs",
@@ -3279,20 +3279,20 @@ function Ul({
3279
3279
  {
3280
3280
  isInitialLoading: a,
3281
3281
  isSearching: n,
3282
- searchQuery: f,
3282
+ searchQuery: p,
3283
3283
  availableUsers: w || []
3284
3284
  }
3285
3285
  ),
3286
- !a && !n && (w == null ? void 0 : w.length) > 0 && w.map((M) => {
3287
- const S = t ? Hd(M, t, o) : void 0, C = z.includes(M.id), T = !!S, k = T && !C, R = h.some(
3288
- (I) => I.id === M.id
3286
+ !a && !n && (w == null ? void 0 : w.length) > 0 && w.map((E) => {
3287
+ const S = t ? Hd(E, t, o) : void 0, C = z.includes(E.id), T = !!S, k = T && !C, R = h.some(
3288
+ (I) => I.id === E.id
3289
3289
  ), D = h.find(
3290
- (I) => I.id === M.id
3291
- ), F = r(M.type);
3290
+ (I) => I.id === E.id
3291
+ ), F = r(E.type);
3292
3292
  return /* @__PURE__ */ e(
3293
3293
  Xd,
3294
3294
  {
3295
- user: M,
3295
+ user: E,
3296
3296
  userShare: S,
3297
3297
  isUserRemoving: C,
3298
3298
  hasAccess: k,
@@ -3302,12 +3302,12 @@ function Ul({
3302
3302
  roleOptions: F,
3303
3303
  currentUser: o,
3304
3304
  usersToUpdate: g,
3305
- handleUserToggle: p,
3305
+ handleUserToggle: f,
3306
3306
  handleRemoveAccess: v,
3307
3307
  handleUpdateAccess: N,
3308
3308
  handleUserRoleChange: b
3309
3309
  },
3310
- M.id
3310
+ E.id
3311
3311
  );
3312
3312
  })
3313
3313
  ] })
@@ -3387,7 +3387,7 @@ function eu({
3387
3387
  }) {
3388
3388
  const d = it(), u = Ut().filter(
3389
3389
  (N) => N.value === "VIEWER" || N.value === "EDITOR" || N.value === "CONTRIBUTOR"
3390
- ), h = a.role !== "NONE" ? a.role : "NONE", m = l ? l.newRole : h, g = a.role !== "NONE" && !o && (!l || l.newRole === h), f = l !== null && l.newRole !== h, y = o, p = h === "NONE" || !h, b = (N) => {
3390
+ ), h = a.role !== "NONE" ? a.role : "NONE", m = l ? l.newRole : h, g = a.role !== "NONE" && !o && (!l || l.newRole === h), p = l !== null && l.newRole !== h, y = o, f = h === "NONE" || !h, b = (N) => {
3391
3391
  switch (N) {
3392
3392
  case "VIEWER":
3393
3393
  return /* @__PURE__ */ e(Nn, { className: "h-4 w-4" });
@@ -3406,7 +3406,7 @@ function eu({
3406
3406
  {
3407
3407
  className: G(
3408
3408
  "pb-6",
3409
- f && !y && !p ? "border-orange-300 bg-orange-50" : g ? "border-green-300 bg-green-50" : y || p ? "border-destructive bg-destructive/10" : ""
3409
+ p && !y && !f ? "border-orange-300 bg-orange-50" : g ? "border-green-300 bg-green-50" : y || f ? "border-destructive bg-destructive/10" : ""
3410
3410
  ),
3411
3411
  children: [
3412
3412
  /* @__PURE__ */ s($n, { children: [
@@ -3425,7 +3425,7 @@ function eu({
3425
3425
  children: "Active"
3426
3426
  }
3427
3427
  ),
3428
- f && /* @__PURE__ */ e(
3428
+ p && /* @__PURE__ */ e(
3429
3429
  ie,
3430
3430
  {
3431
3431
  variant: "secondary",
@@ -3433,9 +3433,9 @@ function eu({
3433
3433
  children: "Pending Update"
3434
3434
  }
3435
3435
  ),
3436
- (y || p) && /* @__PURE__ */ e(ie, { variant: "destructive", className: "ml-2", children: "No Access" })
3436
+ (y || f) && /* @__PURE__ */ e(ie, { variant: "destructive", className: "ml-2", children: "No Access" })
3437
3437
  ] }),
3438
- /* @__PURE__ */ e(Pr, { children: y || p ? "No access for all users." : "This will share the dashboard with all users in your " + ((t == null ? void 0 : t.type) === "organization" ? "organization" : "tenant") + ". Select an access level below." })
3438
+ /* @__PURE__ */ e(Pr, { children: y || f ? "No access for all users." : "This will share the dashboard with all users in your " + ((t == null ? void 0 : t.type) === "organization" ? "organization" : "tenant") + ". Select an access level below." })
3439
3439
  ] }),
3440
3440
  /* @__PURE__ */ e(Wt, { className: "space-y-4", children: /* @__PURE__ */ s("div", { className: "space-y-3", children: [
3441
3441
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
@@ -3512,7 +3512,7 @@ function $l({
3512
3512
  allUsersToUpdate: i,
3513
3513
  allUsersToRemove: d
3514
3514
  }) {
3515
- const u = (p) => p === "OWNER" ? "CONTRIBUTOR" : p, m = a ? { role: u(a.role) } : { role: "NONE" }, g = i ? {
3515
+ const u = (f) => f === "OWNER" ? "CONTRIBUTOR" : f, m = a ? { role: u(a.role) } : { role: "NONE" }, g = i ? {
3516
3516
  currentRole: u(i.currentRole),
3517
3517
  newRole: u(i.newRole)
3518
3518
  } : null;
@@ -3524,8 +3524,8 @@ function $l({
3524
3524
  isSharing: n,
3525
3525
  isUpdating: r,
3526
3526
  isRemoving: l,
3527
- onUpdateAccess: (p, b) => {
3528
- o(p, b);
3527
+ onUpdateAccess: (f, b) => {
3528
+ o(f, b);
3529
3529
  },
3530
3530
  onRemoveAccess: () => {
3531
3531
  c();
@@ -3601,10 +3601,10 @@ function au({
3601
3601
  isRemoving: c = !1
3602
3602
  }) {
3603
3603
  var ae, $;
3604
- const i = pn(), d = Gn(), { searchQuery: u, setSearchQuery: h, debouncedSearchQuery: m } = Vr(), g = mn(), f = lt(), y = hn(), p = it(), b = ps(), v = Lt(), [N, w] = Ae.useState("specific_users"), z = () => {
3604
+ const i = pn(), d = Gn(), { searchQuery: u, setSearchQuery: h, debouncedSearchQuery: m } = Vr(), g = mn(), p = lt(), y = hn(), f = it(), b = ps(), v = Lt(), [N, w] = Ae.useState("specific_users"), z = () => {
3605
3605
  if (i === "org") return "organization";
3606
3606
  if (i === "tenant") return "tenant";
3607
- }, M = () => {
3607
+ }, E = () => {
3608
3608
  if (i === "tenant" && d)
3609
3609
  return d;
3610
3610
  }, { allUsers: S, existingShares: C, isLoadingUsers: T } = zt({
@@ -3612,7 +3612,7 @@ function au({
3612
3612
  resourceId: (t == null ? void 0 : t.id) || "",
3613
3613
  resourceType: a,
3614
3614
  userType: z(),
3615
- tenantId: M()
3615
+ tenantId: E()
3616
3616
  });
3617
3617
  Ae.useEffect(() => {
3618
3618
  v.setCurrentContext("org-tab"), v.setCurrentMode(
@@ -3635,7 +3635,7 @@ function au({
3635
3635
  (K) => g.some((J) => J.id === K.id)
3636
3636
  ), F = (K) => {
3637
3637
  var ee, W;
3638
- const J = g.some((de) => de.id === K), q = f.includes(K), Z = (W = (ee = C == null ? void 0 : C.shares) == null ? void 0 : ee.specificOrgUsers) == null ? void 0 : W.some(
3638
+ const J = g.some((de) => de.id === K), q = p.includes(K), Z = (W = (ee = C == null ? void 0 : C.shares) == null ? void 0 : ee.specificOrgUsers) == null ? void 0 : W.some(
3639
3639
  (de) => de.orgUserId === K
3640
3640
  );
3641
3641
  J ? v.removeSelectedUser(K) : q ? v.removeUserFromRemove(K) : Z || v.addSelectedUser({ id: K, role: "VIEWER" });
@@ -3700,7 +3700,7 @@ function au({
3700
3700
  /* @__PURE__ */ e(
3701
3701
  _l,
3702
3702
  {
3703
- usersToRemove: f,
3703
+ usersToRemove: p,
3704
3704
  allUsers: R,
3705
3705
  onRemove: x
3706
3706
  }
@@ -3744,11 +3744,11 @@ function au({
3744
3744
  isRemoving: c,
3745
3745
  onUpdateAccess: _,
3746
3746
  onRemoveAccess: j,
3747
- allUsersToUpdate: p === "allOrgUsers" && b !== ((B == null ? void 0 : B.role) || "NONE") ? {
3747
+ allUsersToUpdate: f === "allOrgUsers" && b !== ((B == null ? void 0 : B.role) || "NONE") ? {
3748
3748
  currentRole: (B == null ? void 0 : B.role) || "NONE",
3749
3749
  newRole: b
3750
3750
  } : null,
3751
- allUsersToRemove: p === "allOrgUsers" && (B == null ? void 0 : B.role) === void 0
3751
+ allUsersToRemove: f === "allOrgUsers" && (B == null ? void 0 : B.role) === void 0
3752
3752
  }
3753
3753
  ) })
3754
3754
  ] }) : null;
@@ -3763,9 +3763,9 @@ function yr({
3763
3763
  isRemoving: c = !1
3764
3764
  }) {
3765
3765
  var ee;
3766
- const { searchQuery: i, debouncedSearchQuery: d, setSearchQuery: u } = Vr(), h = mn(), m = lt(), g = hn(), f = it(), y = xa(), p = fs(), b = Gn(), v = Lt(), { data: N, isLoading: w } = Od({
3766
+ const { searchQuery: i, debouncedSearchQuery: d, setSearchQuery: u } = Vr(), h = mn(), m = lt(), g = hn(), p = it(), y = xa(), f = fs(), b = Gn(), v = Lt(), { data: N, isLoading: w } = Od({
3767
3767
  enabled: (n == null ? void 0 : n.type) === "organization"
3768
- }), [z, M] = P(
3768
+ }), [z, E] = P(
3769
3769
  (n == null ? void 0 : n.type) === "organization" ? "all_tenants" : "specific_tenant_users"
3770
3770
  );
3771
3771
  Ae.useEffect(() => {
@@ -3773,7 +3773,7 @@ function yr({
3773
3773
  }, [v, n == null ? void 0 : n.type]);
3774
3774
  const S = (W) => {
3775
3775
  var pe, be, he, Oe;
3776
- M(
3776
+ E(
3777
3777
  W
3778
3778
  );
3779
3779
  let de;
@@ -3822,7 +3822,7 @@ function yr({
3822
3822
  z === "all_tenant_users" ? v.setTenantWideRole("VIEWER") : z === "all_tenants" && v.setAllTenantsRole("VIEWER");
3823
3823
  }, $ = (() => {
3824
3824
  var W, de, pe, be;
3825
- return f === "allTenants" ? (de = (W = k == null ? void 0 : k.shares) == null ? void 0 : W.allTenantsOnly) == null ? void 0 : de[0] : f === "allTenantUsers" ? (be = (pe = k == null ? void 0 : k.shares) == null ? void 0 : pe.tenantWide) == null ? void 0 : be[0] : null;
3825
+ return p === "allTenants" ? (de = (W = k == null ? void 0 : k.shares) == null ? void 0 : W.allTenantsOnly) == null ? void 0 : de[0] : p === "allTenantUsers" ? (be = (pe = k == null ? void 0 : k.shares) == null ? void 0 : pe.tenantWide) == null ? void 0 : be[0] : null;
3826
3826
  })();
3827
3827
  Ae.useEffect(() => {
3828
3828
  var W, de, pe, be;
@@ -3976,11 +3976,11 @@ function yr({
3976
3976
  isRemoving: c,
3977
3977
  onUpdateAccess: U,
3978
3978
  onRemoveAccess: oe,
3979
- allUsersToUpdate: f === "allTenantUsers" && (($ == null ? void 0 : $.role) === void 0 || y !== $.role) || f === "allTenants" && (($ == null ? void 0 : $.role) === void 0 || p !== $.role) ? {
3979
+ allUsersToUpdate: p === "allTenantUsers" && (($ == null ? void 0 : $.role) === void 0 || y !== $.role) || p === "allTenants" && (($ == null ? void 0 : $.role) === void 0 || f !== $.role) ? {
3980
3980
  currentRole: ($ == null ? void 0 : $.role) || "VIEWER",
3981
- newRole: f === "allTenantUsers" ? y : p
3981
+ newRole: p === "allTenantUsers" ? y : f
3982
3982
  } : null,
3983
- allUsersToRemove: f === "allTenantUsers" && ($ == null ? void 0 : $.role) === void 0 || f === "allTenants" && ($ == null ? void 0 : $.role) === void 0
3983
+ allUsersToRemove: p === "allTenantUsers" && ($ == null ? void 0 : $.role) === void 0 || p === "allTenants" && ($ == null ? void 0 : $.role) === void 0
3984
3984
  }
3985
3985
  ) }) : null }) : (
3986
3986
  /* Show message for org users when no tenant is selected */
@@ -4066,9 +4066,9 @@ function vr({
4066
4066
  }) {
4067
4067
  const h = mn(), m = lt(), g = hn();
4068
4068
  it(), gs();
4069
- const f = Gn();
4069
+ const p = Gn();
4070
4070
  pn();
4071
- const y = ps(), p = fs(), b = xa(), { buildShareData: v, validateShareData: N, isCurrentStateValid: w } = ql(), z = n || r || l, M = () => {
4071
+ const y = ps(), f = fs(), b = xa(), { buildShareData: v, validateShareData: N, isCurrentStateValid: w } = ql(), z = n || r || l, E = () => {
4072
4072
  var R, D, F, I;
4073
4073
  if (z) return "Updating...";
4074
4074
  if (i === "specific_users") {
@@ -4086,7 +4086,7 @@ function vr({
4086
4086
  if (!A || A.role === void 0)
4087
4087
  return "Share with All Tenants";
4088
4088
  const x = A.role;
4089
- return p === x ? "Remove Access" : "Update Access";
4089
+ return f === x ? "Remove Access" : "Update Access";
4090
4090
  } else if (i === "all_tenant_users") {
4091
4091
  const A = (I = (F = a == null ? void 0 : a.shares) == null ? void 0 : F.tenantWide) == null ? void 0 : I[0];
4092
4092
  if (!A || A.role === void 0)
@@ -4100,7 +4100,7 @@ function vr({
4100
4100
  return A === 0 ? "Select users to share with" : h.length > 0 && m.length > 0 ? `Update access for ${A} user${A !== 1 ? "s" : ""}` : m.length > 0 && h.length === 0 && g.length === 0 ? `Remove access for ${m.length} user${m.length !== 1 ? "s" : ""}` : h.length > 0 && m.length === 0 && g.length === 0 ? `Share with ${h.length} user${h.length !== 1 ? "s" : ""}` : g.length > 0 && h.length === 0 && m.length === 0 ? `Update access for ${g.length} user${g.length !== 1 ? "s" : ""}` : `Update access for ${A} user${A !== 1 ? "s" : ""}`;
4101
4101
  }
4102
4102
  return "Share";
4103
- }, S = () => z || !t || i === "all_tenant_users" && !f || i === "specific_tenant_users" && !f ? !0 : !w, C = () => {
4103
+ }, S = () => z || !t || i === "all_tenant_users" && !p || i === "specific_tenant_users" && !p ? !0 : !w, C = () => {
4104
4104
  const R = v();
4105
4105
  R && N(R) && o(R);
4106
4106
  }, T = () => {
@@ -4131,7 +4131,7 @@ function vr({
4131
4131
  x && N(x) && o(x);
4132
4132
  } else {
4133
4133
  const x = A.role;
4134
- if (p === x)
4134
+ if (f === x)
4135
4135
  u == null || u();
4136
4136
  else {
4137
4137
  const _ = v();
@@ -4177,7 +4177,7 @@ function vr({
4177
4177
  if (!A || A.role === void 0)
4178
4178
  return "default";
4179
4179
  const x = A.role;
4180
- return p === x ? "destructive" : "default";
4180
+ return f === x ? "destructive" : "default";
4181
4181
  } else if (i === "all_tenant_users") {
4182
4182
  const A = (I = (F = a == null ? void 0 : a.shares) == null ? void 0 : F.tenantWide) == null ? void 0 : I[0];
4183
4183
  if (!A || A.role === void 0)
@@ -4200,7 +4200,7 @@ function vr({
4200
4200
  /* @__PURE__ */ e(Me, { className: "mr-2 h-4 w-4 animate-spin" }),
4201
4201
  "Updating..."
4202
4202
  ] }) : /* @__PURE__ */ e(En, { className: "mr-2 h-4 w-4" }),
4203
- !z && M()
4203
+ !z && E()
4204
4204
  ]
4205
4205
  }
4206
4206
  ) }),
@@ -4215,7 +4215,7 @@ function vr({
4215
4215
  /* @__PURE__ */ e(Me, { className: "mr-2 h-4 w-4 animate-spin" }),
4216
4216
  "Updating..."
4217
4217
  ] }) : /* @__PURE__ */ e(gt, { className: "mr-2 h-4 w-4" }),
4218
- !z && M()
4218
+ !z && E()
4219
4219
  ]
4220
4220
  }
4221
4221
  )
@@ -4235,32 +4235,32 @@ function su({
4235
4235
  it(), gs();
4236
4236
  const m = xa();
4237
4237
  Gn();
4238
- const { buildShareData: g, validateShareData: f, isCurrentStateValid: y } = ql(), p = a || n || r, b = () => {
4239
- if (p) return "Updating...";
4238
+ const { buildShareData: g, validateShareData: p, isCurrentStateValid: y } = ql(), f = a || n || r, b = () => {
4239
+ if (f) return "Updating...";
4240
4240
  if (c === "specific_users") {
4241
4241
  if (d.length === 0 && u.length === 0 && h.length === 0)
4242
4242
  return "Select users to share with";
4243
- const M = d.length + u.length + h.length;
4244
- return M === 0 ? "Select users to share with" : d.length > 0 && u.length > 0 ? `Update access for ${M} user${M !== 1 ? "s" : ""}` : u.length > 0 && d.length === 0 && h.length === 0 ? `Remove access for ${u.length} user${u.length !== 1 ? "s" : ""}` : d.length > 0 && u.length === 0 && h.length === 0 ? `Share with ${d.length} user${d.length !== 1 ? "s" : ""}` : h.length > 0 && d.length === 0 && u.length === 0 ? `Update access for ${h.length} user${h.length !== 1 ? "s" : ""}` : `Update access for ${M} user${M !== 1 ? "s" : ""}`;
4243
+ const E = d.length + u.length + h.length;
4244
+ return E === 0 ? "Select users to share with" : d.length > 0 && u.length > 0 ? `Update access for ${E} user${E !== 1 ? "s" : ""}` : u.length > 0 && d.length === 0 && h.length === 0 ? `Remove access for ${u.length} user${u.length !== 1 ? "s" : ""}` : d.length > 0 && u.length === 0 && h.length === 0 ? `Share with ${d.length} user${d.length !== 1 ? "s" : ""}` : h.length > 0 && d.length === 0 && u.length === 0 ? `Update access for ${h.length} user${h.length !== 1 ? "s" : ""}` : `Update access for ${E} user${E !== 1 ? "s" : ""}`;
4245
4245
  } else if (c === "all_users") {
4246
4246
  if (!i || i.role === "NONE")
4247
4247
  return "Share with All Users";
4248
- const M = i.role;
4249
- return m === M ? "Remove Access" : "Update Access";
4248
+ const E = i.role;
4249
+ return m === E ? "Remove Access" : "Update Access";
4250
4250
  }
4251
4251
  return "Share";
4252
- }, v = () => p || !t ? !0 : !y, N = () => {
4253
- const M = g();
4254
- M && f(M) && l(M);
4252
+ }, v = () => f || !t ? !0 : !y, N = () => {
4253
+ const E = g();
4254
+ E && p(E) && l(E);
4255
4255
  }, w = () => {
4256
4256
  if (!i || i.role === "NONE") {
4257
- const M = g();
4258
- M && f(M) && l(M);
4257
+ const E = g();
4258
+ E && p(E) && l(E);
4259
4259
  } else {
4260
- const M = i.role;
4261
- if (m === M) {
4260
+ const E = i.role;
4261
+ if (m === E) {
4262
4262
  const C = g();
4263
- if (C && f(C)) {
4263
+ if (C && p(C)) {
4264
4264
  const T = {
4265
4265
  ...C,
4266
4266
  removeAccess: !0
@@ -4269,7 +4269,7 @@ function su({
4269
4269
  }
4270
4270
  } else {
4271
4271
  const C = g();
4272
- if (C && f(C)) {
4272
+ if (C && p(C)) {
4273
4273
  const T = {
4274
4274
  ...C,
4275
4275
  updateAccess: !0
@@ -4280,19 +4280,19 @@ function su({
4280
4280
  }
4281
4281
  }, z = () => !i || i.role === "NONE" ? "default" : "destructive";
4282
4282
  return /* @__PURE__ */ s(ya, { children: [
4283
- /* @__PURE__ */ e(V, { variant: "outline", onClick: o, disabled: p, children: "Close" }),
4283
+ /* @__PURE__ */ e(V, { variant: "outline", onClick: o, disabled: f, children: "Close" }),
4284
4284
  c === "specific_users" && /* @__PURE__ */ e(ne, { children: (d.length > 0 || u.length > 0 || h.length > 0) && /* @__PURE__ */ s(
4285
4285
  V,
4286
4286
  {
4287
4287
  onClick: N,
4288
- disabled: !t || p,
4288
+ disabled: !t || f,
4289
4289
  variant: "default",
4290
4290
  children: [
4291
- p ? /* @__PURE__ */ s(ne, { children: [
4291
+ f ? /* @__PURE__ */ s(ne, { children: [
4292
4292
  /* @__PURE__ */ e(Me, { className: "mr-2 h-4 w-4 animate-spin" }),
4293
4293
  "Updating..."
4294
4294
  ] }) : /* @__PURE__ */ e(En, { className: "mr-2 h-4 w-4" }),
4295
- !p && b()
4295
+ !f && b()
4296
4296
  ]
4297
4297
  }
4298
4298
  ) }),
@@ -4303,11 +4303,11 @@ function su({
4303
4303
  disabled: v(),
4304
4304
  variant: z(),
4305
4305
  children: [
4306
- p ? /* @__PURE__ */ s(ne, { children: [
4306
+ f ? /* @__PURE__ */ s(ne, { children: [
4307
4307
  /* @__PURE__ */ e(Me, { className: "mr-2 h-4 w-4 animate-spin" }),
4308
4308
  "Updating..."
4309
4309
  ] }) : /* @__PURE__ */ e(En, { className: "mr-2 h-4 w-4" }),
4310
- !p && b()
4310
+ !f && b()
4311
4311
  ]
4312
4312
  }
4313
4313
  )
@@ -4324,7 +4324,7 @@ function Gl({
4324
4324
  onRemoveAccess: i
4325
4325
  }) {
4326
4326
  var C, T, k, R;
4327
- const { currentUser: d } = Ea(), [u, h] = Ae.useState("specific_users"), [m, g] = Ae.useState("specific_users"), f = Lt(), y = pn(), p = it(), { existingShares: b } = zt({
4327
+ const { currentUser: d } = Ea(), [u, h] = Ae.useState("specific_users"), [m, g] = Ae.useState("specific_users"), p = Lt(), y = pn(), f = it(), { existingShares: b } = zt({
4328
4328
  debouncedSearchQuery: "",
4329
4329
  resourceId: (t == null ? void 0 : t.id) || "",
4330
4330
  resourceType: a,
@@ -4337,7 +4337,7 @@ function Gl({
4337
4337
  }), N = (T = (C = b == null ? void 0 : b.shares) == null ? void 0 : C.tenantWide) == null ? void 0 : T[0], w = (R = (k = v == null ? void 0 : v.shares) == null ? void 0 : k.orgUsersOnly) == null ? void 0 : R[0], z = () => {
4338
4338
  if (y === "org")
4339
4339
  return m;
4340
- switch (p) {
4340
+ switch (f) {
4341
4341
  case "specificTenantUsers":
4342
4342
  return "specific_tenant_users";
4343
4343
  case "allTenantUsers":
@@ -4347,10 +4347,10 @@ function Gl({
4347
4347
  default:
4348
4348
  return "specific_tenant_users";
4349
4349
  }
4350
- }, M = Ae.useCallback(() => {
4351
- f.resetShareState(), o();
4352
- }, [f, o]), S = (d == null ? void 0 : d.type) === "organization";
4353
- return /* @__PURE__ */ e(In, { open: !0, onOpenChange: M, children: /* @__PURE__ */ s(Rn, { className: "z-[51] flex max-h-[80vh] max-w-3xl flex-col", children: [
4350
+ }, E = Ae.useCallback(() => {
4351
+ p.resetShareState(), o();
4352
+ }, [p, o]), S = (d == null ? void 0 : d.type) === "organization";
4353
+ return /* @__PURE__ */ e(In, { open: !0, onOpenChange: E, children: /* @__PURE__ */ s(Rn, { className: "z-[51] flex max-h-[80vh] max-w-3xl flex-col", children: [
4354
4354
  /* @__PURE__ */ s(zn, { children: [
4355
4355
  /* @__PURE__ */ e(Fn, { children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
4356
4356
  /* @__PURE__ */ e(En, { className: "h-5 w-5" }),
@@ -4368,7 +4368,7 @@ function Gl({
4368
4368
  value: y,
4369
4369
  onValueChange: (D) => {
4370
4370
  const F = D;
4371
- f.setSelectedTab(F), f.resetUserSelections();
4371
+ p.setSelectedTab(F), p.resetUserSelections();
4372
4372
  },
4373
4373
  className: "mb-4 min-h-0 flex-1",
4374
4374
  children: [
@@ -4541,14 +4541,14 @@ function Hl(t, a) {
4541
4541
  n,
4542
4542
  r,
4543
4543
  u.map((g) => {
4544
- var y, p;
4545
- const f = (p = (y = c == null ? void 0 : c.shares) == null ? void 0 : y.specificOrgUsers) == null ? void 0 : p.find(
4544
+ var y, f;
4545
+ const p = (f = (y = c == null ? void 0 : c.shares) == null ? void 0 : y.specificOrgUsers) == null ? void 0 : f.find(
4546
4546
  (b) => b.orgUserId === g
4547
4547
  );
4548
4548
  return {
4549
4549
  scope: "specific_org_user",
4550
4550
  orgUserId: g,
4551
- role: (f == null ? void 0 : f.role) || "VIEWER"
4551
+ role: (p == null ? void 0 : p.role) || "VIEWER"
4552
4552
  };
4553
4553
  })
4554
4554
  );
@@ -4606,14 +4606,14 @@ function Hl(t, a) {
4606
4606
  const g = Mt(
4607
4607
  n,
4608
4608
  r,
4609
- u.map((f) => {
4610
- var p, b;
4611
- const y = (b = (p = c == null ? void 0 : c.shares) == null ? void 0 : p.specificTenantUsers) == null ? void 0 : b.find(
4612
- (v) => v.tenantUserId === f
4609
+ u.map((p) => {
4610
+ var f, b;
4611
+ const y = (b = (f = c == null ? void 0 : c.shares) == null ? void 0 : f.specificTenantUsers) == null ? void 0 : b.find(
4612
+ (v) => v.tenantUserId === p
4613
4613
  );
4614
4614
  return {
4615
4615
  scope: "specific_tenant_user",
4616
- tenantUserId: f,
4616
+ tenantUserId: p,
4617
4617
  tenantId: m,
4618
4618
  role: (y == null ? void 0 : y.role) || "VIEWER"
4619
4619
  };
@@ -4626,7 +4626,7 @@ function Hl(t, a) {
4626
4626
  });
4627
4627
  }
4628
4628
  if (h && h.length > 0 && h.forEach((g) => {
4629
- const f = Je(n, r, [
4629
+ const p = Je(n, r, [
4630
4630
  {
4631
4631
  scope: "specific_tenant_user",
4632
4632
  tenantUserId: g.id,
@@ -4634,7 +4634,7 @@ function Hl(t, a) {
4634
4634
  role: g.newRole
4635
4635
  }
4636
4636
  ]);
4637
- l(f, {
4637
+ l(p, {
4638
4638
  onSuccess: () => {
4639
4639
  i();
4640
4640
  }
@@ -4643,11 +4643,11 @@ function Hl(t, a) {
4643
4643
  const g = Je(
4644
4644
  n,
4645
4645
  r,
4646
- d.map((f) => ({
4646
+ d.map((p) => ({
4647
4647
  scope: "specific_tenant_user",
4648
- tenantUserId: f.id,
4648
+ tenantUserId: p.id,
4649
4649
  tenantId: m,
4650
- role: f.role
4650
+ role: p.role
4651
4651
  }))
4652
4652
  );
4653
4653
  l(g, {
@@ -4721,14 +4721,14 @@ function Hl(t, a) {
4721
4721
  n,
4722
4722
  r,
4723
4723
  u.map((g) => {
4724
- var y, p;
4725
- const f = (p = (y = c == null ? void 0 : c.shares) == null ? void 0 : y.specificTenantUsers) == null ? void 0 : p.find(
4724
+ var y, f;
4725
+ const p = (f = (y = c == null ? void 0 : c.shares) == null ? void 0 : y.specificTenantUsers) == null ? void 0 : f.find(
4726
4726
  (b) => b.tenantUserId === g
4727
4727
  );
4728
4728
  return {
4729
4729
  scope: "specific_tenant_user",
4730
4730
  tenantUserId: g,
4731
- role: (f == null ? void 0 : f.role) || "VIEWER"
4731
+ role: (p == null ? void 0 : p.role) || "VIEWER"
4732
4732
  };
4733
4733
  })
4734
4734
  );
@@ -4757,7 +4757,7 @@ function Hl(t, a) {
4757
4757
  }
4758
4758
  }
4759
4759
  function Kl(t, a, n, r) {
4760
- var u, h, m, g, f, y;
4760
+ var u, h, m, g, p, y;
4761
4761
  const {
4762
4762
  resourceType: l,
4763
4763
  resourceId: o,
@@ -4767,7 +4767,7 @@ function Kl(t, a, n, r) {
4767
4767
  } = r;
4768
4768
  if (o)
4769
4769
  if (t.length > 0) {
4770
- const p = Mt(
4770
+ const f = Mt(
4771
4771
  l,
4772
4772
  o,
4773
4773
  t.map((b) => {
@@ -4782,7 +4782,7 @@ function Kl(t, a, n, r) {
4782
4782
  };
4783
4783
  })
4784
4784
  );
4785
- c(p, {
4785
+ c(f, {
4786
4786
  onSuccess: () => {
4787
4787
  d();
4788
4788
  },
@@ -4791,8 +4791,8 @@ function Kl(t, a, n, r) {
4791
4791
  }
4792
4792
  });
4793
4793
  } else {
4794
- const p = a === "tenant" && n === "allTenants", b = a === "tenant" && n === "allTenantUsers";
4795
- if (p) {
4794
+ const f = a === "tenant" && n === "allTenants", b = a === "tenant" && n === "allTenantUsers";
4795
+ if (f) {
4796
4796
  const v = (h = (u = i == null ? void 0 : i.shares) == null ? void 0 : u.allTenantsOnly) == null ? void 0 : h[0];
4797
4797
  if (v) {
4798
4798
  const N = Mt(l, o, [
@@ -4829,7 +4829,7 @@ function Kl(t, a, n, r) {
4829
4829
  });
4830
4830
  }
4831
4831
  } else {
4832
- const v = (y = (f = i == null ? void 0 : i.shares) == null ? void 0 : f.orgUsersOnly) == null ? void 0 : y[0];
4832
+ const v = (y = (p = i == null ? void 0 : i.shares) == null ? void 0 : p.orgUsersOnly) == null ? void 0 : y[0];
4833
4833
  if (v) {
4834
4834
  const N = Mt(l, o, [
4835
4835
  {
@@ -5075,21 +5075,21 @@ function cu(t, a, n, r, l) {
5075
5075
  }
5076
5076
  function du() {
5077
5077
  var g;
5078
- const { setCardSql: t } = se(), a = E((f) => f.frame), n = E((f) => f.card), r = Rs(
5078
+ const { setCardSql: t } = se(), a = M((p) => p.frame), n = M((p) => p.card), r = Rs(
5079
5079
  ((g = n.customCardPreferences) == null ? void 0 : g.url) || ""
5080
- ), l = E(
5081
- (f) => f.selectedSchemaName
5082
- ), o = E(
5083
- (f) => f.selectedDatamodelId
5084
- ), c = E(
5085
- (f) => f.selectedDatabaseName
5086
- ), i = E((f) => f.selectedTableName), d = E(
5087
- (f) => f.selectedConnectionId
5088
- ), u = E((f) => f.isShowingVisual), h = n.sql, m = me(() => {
5080
+ ), l = M(
5081
+ (p) => p.selectedSchemaName
5082
+ ), o = M(
5083
+ (p) => p.selectedDatamodelId
5084
+ ), c = M(
5085
+ (p) => p.selectedDatabaseName
5086
+ ), i = M((p) => p.selectedTableName), d = M(
5087
+ (p) => p.selectedConnectionId
5088
+ ), u = M((p) => p.isShowingVisual), h = n.sql, m = me(() => {
5089
5089
  var v;
5090
- let f = h;
5091
- h && !h.includes("{{") && (f = iu(h), t(f));
5092
- const y = (v = r == null ? void 0 : r.getState()) == null ? void 0 : v.settings, p = {
5090
+ let p = h;
5091
+ h && !h.includes("{{") && (p = iu(h), t(p));
5092
+ const y = (v = r == null ? void 0 : r.getState()) == null ? void 0 : v.settings, f = {
5093
5093
  ...n,
5094
5094
  dataSource: n.dataSource || { mode: "directSource" },
5095
5095
  lastSelectedSchema: l,
@@ -5098,7 +5098,7 @@ function du() {
5098
5098
  lastSelectedTable: i,
5099
5099
  connectionId: d,
5100
5100
  // type: isShowingVisual ? card.type : 'table', /// CHECK THIS!!!!
5101
- sql: f,
5101
+ sql: p,
5102
5102
  customCfg: u ? n.customCfg : null,
5103
5103
  ...y && {
5104
5104
  customCardPreferences: {
@@ -5107,7 +5107,7 @@ function du() {
5107
5107
  }
5108
5108
  }
5109
5109
  }, b = a.cards.map(
5110
- (N) => N.id === n.id ? p : N
5110
+ (N) => N.id === n.id ? f : N
5111
5111
  );
5112
5112
  return {
5113
5113
  ...a,
@@ -5136,15 +5136,15 @@ function zs() {
5136
5136
  setSelectedFrameId: d,
5137
5137
  addFrame: u,
5138
5138
  setIsDashboardPanelOpen: h
5139
- } = yt(), m = Y((p) => p.selectedSheetId), g = jd((n == null ? void 0 : n.id) || "", {
5139
+ } = yt(), m = Y((f) => f.selectedSheetId), g = jd((n == null ? void 0 : n.id) || "", {
5140
5140
  enabled: !!(n != null && n.id) && !!(t != null && t.accessToken)
5141
- }), f = me(
5142
- async (p) => {
5141
+ }), p = me(
5142
+ async (f) => {
5143
5143
  try {
5144
- r(p);
5144
+ r(f);
5145
5145
  const { data: b, fromCache: v } = await xr(
5146
5146
  (t == null ? void 0 : t.accessToken) || "",
5147
- p.id,
5147
+ f.id,
5148
5148
  a
5149
5149
  );
5150
5150
  return cu(
@@ -5168,16 +5168,16 @@ function zs() {
5168
5168
  i
5169
5169
  ]
5170
5170
  ), y = me(
5171
- async (p) => {
5171
+ async (f) => {
5172
5172
  try {
5173
- if (r(p), !m)
5173
+ if (r(f), !m)
5174
5174
  return {
5175
5175
  success: !1,
5176
5176
  error: "No sheet selected. Please select a sheet first."
5177
5177
  };
5178
5178
  const { data: b, fromCache: v } = await xr(
5179
5179
  (t == null ? void 0 : t.accessToken) || "",
5180
- p.id,
5180
+ f.id,
5181
5181
  a
5182
5182
  ), N = b.frameObject;
5183
5183
  if (!N)
@@ -5207,7 +5207,7 @@ function zs() {
5207
5207
  isLoading: g.isLoading,
5208
5208
  isError: g.isError,
5209
5209
  error: g.error,
5210
- handleEditLibraryVisual: f,
5210
+ handleEditLibraryVisual: p,
5211
5211
  handleAddLibraryVisual: y,
5212
5212
  getUpdatedFrame: du().getUpdatedFrame,
5213
5213
  refetch: g.refetch
@@ -5216,7 +5216,7 @@ function zs() {
5216
5216
  function uu() {
5217
5217
  const [t, a] = P(""), [n, r] = P(!1), [l, o] = P(""), [c, i] = P(""), [d, u] = P(!1), [h, m] = P(
5218
5218
  null
5219
- ), [g, f] = P(!1), [y, p] = P(null), [b, v] = P(null), { setIsDashboardEditing: N, setIsVisualEditing: w } = yt(), { handleEditLibraryVisual: z, handleAddLibraryVisual: M } = zs(), {
5219
+ ), [g, p] = P(!1), [y, f] = P(null), [b, v] = P(null), { setIsDashboardEditing: N, setIsVisualEditing: w } = yt(), { handleEditLibraryVisual: z, handleAddLibraryVisual: E } = zs(), {
5220
5220
  resources: S,
5221
5221
  isLoading: C,
5222
5222
  isError: T,
@@ -5233,7 +5233,7 @@ function uu() {
5233
5233
  isUpdatingShares: B
5234
5234
  } = Bd(
5235
5235
  () => {
5236
- f(!1), p(null);
5236
+ p(!1), f(null);
5237
5237
  },
5238
5238
  () => {
5239
5239
  r(!1), o(""), i("");
@@ -5260,7 +5260,7 @@ function uu() {
5260
5260
  isPrivate: !1
5261
5261
  });
5262
5262
  }, J = (L) => {
5263
- p(L), f(!0);
5263
+ f(L), p(!0);
5264
5264
  }, q = () => {
5265
5265
  y && D(y.id);
5266
5266
  }, {
@@ -5290,7 +5290,7 @@ function uu() {
5290
5290
  }, be = (L) => {
5291
5291
  z(L);
5292
5292
  }, he = (L) => {
5293
- M(L);
5293
+ E(L);
5294
5294
  }, Oe = (L) => {
5295
5295
  const re = S.find((Ie) => Ie.id === L);
5296
5296
  re && R({
@@ -5440,7 +5440,7 @@ function uu() {
5440
5440
  {
5441
5441
  open: g,
5442
5442
  onOpenChange: (L) => {
5443
- !L && x || (f(L), L || p(null));
5443
+ !L && x || (p(L), L || f(null));
5444
5444
  },
5445
5445
  children: /* @__PURE__ */ s(Br, { children: [
5446
5446
  /* @__PURE__ */ s($r, { children: [
@@ -5486,10 +5486,10 @@ function mu({
5486
5486
  formatDate: h,
5487
5487
  onDashboardItemClick: m
5488
5488
  }) {
5489
- var M;
5490
- const { selectDashboard: g } = is(), f = Pi(t.id), [y, p] = P(!1), [b, v] = P(!1);
5489
+ var E;
5490
+ const { selectDashboard: g } = is(), p = Pi(t.id), [y, f] = P(!1), [b, v] = P(!1);
5491
5491
  Te(() => {
5492
- n ? (p(!0), v(!0)) : b && (p(!1), v(!1));
5492
+ n ? (f(!0), v(!0)) : b && (f(!1), v(!1));
5493
5493
  }, [n, b]);
5494
5494
  const N = () => t.ownership.isOwner ? t.ownership.status === "private" ? /* @__PURE__ */ e(kl, { className: "h-3 w-3 text-purple-500" }) : /* @__PURE__ */ e(gt, { className: "h-3.5 w-3.5 text-blue-600" }) : /* @__PURE__ */ e(Rt, { className: "h-3.5 w-3.5 text-slate-500" }), w = () => /* @__PURE__ */ e(Vi, { className: "h-4 w-4 text-slate-400" }), z = () => {
5495
5495
  g(t), o(t.id), m == null || m(t.id);
@@ -5501,7 +5501,7 @@ function mu({
5501
5501
  "group relative flex cursor-pointer items-start gap-3 px-4 py-3 dark:border-slate-800",
5502
5502
  "cursor-pointer transition-colors duration-150 hover:bg-slate-50 dark:hover:bg-slate-900/50",
5503
5503
  t.ownership.isOwner && "border-blue-200 dark:border-blue-800",
5504
- f && "rounded-md bg-slate-50 ring-1 ring-inset ring-border dark:bg-slate-900/50"
5504
+ p && "rounded-md bg-slate-50 ring-1 ring-inset ring-border dark:bg-slate-900/50"
5505
5505
  ),
5506
5506
  tabIndex: 0,
5507
5507
  onClick: z,
@@ -5516,7 +5516,7 @@ function mu({
5516
5516
  inputClassName: "text-sm font-medium text-slate-900 dark:text-slate-100",
5517
5517
  value: t.title,
5518
5518
  onSave: (S) => c == null ? void 0 : c(t.id, { title: S }),
5519
- isEditable: t.permissions.canEdit && f,
5519
+ isEditable: t.permissions.canEdit && p,
5520
5520
  isPending: r,
5521
5521
  placeholder: "Untitled Dashboard",
5522
5522
  displayClassName: "line-clamp-1 max-w-[220px] text-sm font-medium text-slate-900 dark:text-slate-100"
@@ -5532,7 +5532,7 @@ function mu({
5532
5532
  onSave: (S) => c == null ? void 0 : c(t.id, {
5533
5533
  description: S
5534
5534
  }),
5535
- isEditable: t.permissions.canEdit && f,
5535
+ isEditable: t.permissions.canEdit && p,
5536
5536
  isPending: l,
5537
5537
  placeholder: "No description",
5538
5538
  displayClassName: "mt-0.5 max-w-[250px] line-clamp-1 text-xs text-slate-500 dark:text-slate-400"
@@ -5550,7 +5550,7 @@ function mu({
5550
5550
  {
5551
5551
  modal: !1,
5552
5552
  open: y,
5553
- onOpenChange: p,
5553
+ onOpenChange: f,
5554
5554
  children: [
5555
5555
  /* @__PURE__ */ e(Pn, { asChild: !0, children: /* @__PURE__ */ e(
5556
5556
  V,
@@ -5609,7 +5609,7 @@ function mu({
5609
5609
  /* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
5610
5610
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
5611
5611
  /* @__PURE__ */ e(Rt, { className: "h-3 w-3" }),
5612
- /* @__PURE__ */ e("span", { children: ((M = t.ownership.createdBy) == null ? void 0 : M.name) || "Unknown" })
5612
+ /* @__PURE__ */ e("span", { children: ((E = t.ownership.createdBy) == null ? void 0 : E.name) || "Unknown" })
5613
5613
  ] }),
5614
5614
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
5615
5615
  /* @__PURE__ */ e(on, { className: "h-3 w-3" }),
@@ -5637,14 +5637,14 @@ function hu({ onRetry: t }) {
5637
5637
  function pu(t) {
5638
5638
  const [a, n] = P(""), [r, l] = P(!1), [o, c] = P(""), [i, d] = P(""), [u, h] = P(!1), [m, g] = P(
5639
5639
  null
5640
- ), [f, y] = P(!1), [p, b] = P(null), [v, N] = P(null), w = qa(
5640
+ ), [p, y] = P(!1), [f, b] = P(null), [v, N] = P(null), w = qa(
5641
5641
  (X) => X.lastSelectedDashboard
5642
5642
  ), z = qa(
5643
5643
  (X) => X.actions.selectDashboard
5644
5644
  );
5645
5645
  Lt(), lt(), pn(), it();
5646
5646
  const {
5647
- resources: M,
5647
+ resources: E,
5648
5648
  isLoading: S,
5649
5649
  isError: C,
5650
5650
  createResource: T,
@@ -5669,7 +5669,7 @@ function pu(t) {
5669
5669
  (m == null ? void 0 : m.id) || null,
5670
5670
  _,
5671
5671
  j
5672
- ), { currentUser: oe } = Ea(), ae = M.filter(
5672
+ ), { currentUser: oe } = Ea(), ae = E.filter(
5673
5673
  (X) => {
5674
5674
  var L, re;
5675
5675
  return ((L = X == null ? void 0 : X.title) == null ? void 0 : L.toLowerCase().includes(a.toLowerCase())) || ((re = X == null ? void 0 : X.description) == null ? void 0 : re.toLowerCase().includes(a.toLowerCase()));
@@ -5690,7 +5690,7 @@ function pu(t) {
5690
5690
  }, q = (X) => {
5691
5691
  b(X), y(!0);
5692
5692
  }, Z = () => {
5693
- p && R(p.id);
5693
+ f && R(f.id);
5694
5694
  }, ee = (X) => {
5695
5695
  N(X), D(X, {
5696
5696
  onSettled: () => N(null)
@@ -5716,7 +5716,7 @@ function pu(t) {
5716
5716
  }
5717
5717
  );
5718
5718
  }, he = (X) => {
5719
- const L = M.find(
5719
+ const L = E.find(
5720
5720
  (re) => re.id === X
5721
5721
  );
5722
5722
  L && k({
@@ -5856,7 +5856,7 @@ function pu(t) {
5856
5856
  /* @__PURE__ */ e(
5857
5857
  Ur,
5858
5858
  {
5859
- open: f,
5859
+ open: p,
5860
5860
  onOpenChange: (X) => {
5861
5861
  !X && I || (y(X), X || b(null));
5862
5862
  },
@@ -5865,7 +5865,7 @@ function pu(t) {
5865
5865
  /* @__PURE__ */ e(qr, { children: "Delete Dashboard" }),
5866
5866
  /* @__PURE__ */ s(Gr, { children: [
5867
5867
  'Are you sure you want to delete "',
5868
- p == null ? void 0 : p.title,
5868
+ f == null ? void 0 : f.title,
5869
5869
  '"? This action cannot be undone.'
5870
5870
  ] })
5871
5871
  ] }),
@@ -5894,9 +5894,9 @@ function fu({
5894
5894
  className: n,
5895
5895
  onDashboardItemClick: r
5896
5896
  }) {
5897
- Y((f) => f.dashboard);
5897
+ Y((p) => p.dashboard);
5898
5898
  const { setDashboard: l, addSheet: o } = Y(
5899
- (f) => f.actions
5899
+ (p) => p.actions
5900
5900
  ), {
5901
5901
  currentUser: c
5902
5902
  } = Ea(), i = c, [d, u] = ys(
@@ -5904,9 +5904,9 @@ function fu({
5904
5904
  "dashboards"
5905
5905
  ), h = Vl(a, {
5906
5906
  enabled: t
5907
- }), m = (f) => {
5908
- }, g = (f) => {
5909
- console.log("Editing dashboard:", f);
5907
+ }), m = (p) => {
5908
+ }, g = (p) => {
5909
+ console.log("Editing dashboard:", p);
5910
5910
  };
5911
5911
  return /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ s(
5912
5912
  "div",
@@ -5992,11 +5992,11 @@ function gu() {
5992
5992
  Y((O) => O.selectedSheetId);
5993
5993
  const c = Y(
5994
5994
  (O) => O.isDashboardEditing
5995
- ), i = E((O) => O.card), d = E(
5995
+ ), i = M((O) => O.card), d = M(
5996
5996
  (O) => O.selectedConnectionId
5997
5997
  ), [u, h] = P(!1), m = Y((O) => O.isDashboardPanelOpen), g = Y(
5998
5998
  (O) => O.actions.setIsDashboardPanelOpen
5999
- ), f = Y((O) => O.filterValues), y = Y((O) => O.isVisualEditing), p = Y((O) => O.showFilters);
5999
+ ), p = Y((O) => O.filterValues), y = Y((O) => O.isVisualEditing), f = Y((O) => O.showFilters);
6000
6000
  Y(
6001
6001
  (O) => O.showDashboardJSON
6002
6002
  );
@@ -6004,7 +6004,7 @@ function gu() {
6004
6004
  (O) => O.actions.setShowFilters
6005
6005
  ), { addFrame: N, setSelectedFrameId: w } = Y(
6006
6006
  (O) => O.actions
6007
- ), { getSelectedSheet: z, setIsDashboardEditing: M, setShowDashboardJSON: S } = Y((O) => O.actions), C = z(), { tenantId: T, endUserId: k } = $e(
6007
+ ), { getSelectedSheet: z, setIsDashboardEditing: E, setShowDashboardJSON: S } = Y((O) => O.actions), C = z(), { tenantId: T, endUserId: k } = $e(
6008
6008
  () => zr(t == null ? void 0 : t.accessToken),
6009
6009
  [t == null ? void 0 : t.accessToken]
6010
6010
  ), R = $e(() => T || k, [T, k]), D = () => {
@@ -6034,7 +6034,7 @@ function gu() {
6034
6034
  };
6035
6035
  N(C.id, _), w(_.id);
6036
6036
  }, F = () => {
6037
- M(!0);
6037
+ E(!0);
6038
6038
  };
6039
6039
  async function I() {
6040
6040
  if (h(!0), !r || !l) return;
@@ -6043,7 +6043,7 @@ function gu() {
6043
6043
  ), _ = JSON.stringify(O), j = {
6044
6044
  ...l,
6045
6045
  template: _,
6046
- filterValues: f
6046
+ filterValues: p
6047
6047
  };
6048
6048
  await Za(j, t == null ? void 0 : t.accessToken), De.success("Lens saved"), b == null || b(O), h(!1);
6049
6049
  }
@@ -6103,7 +6103,7 @@ function gu() {
6103
6103
  {
6104
6104
  className: "h-7 p-2",
6105
6105
  onClick: () => {
6106
- M(!1), S(!1);
6106
+ E(!1), S(!1);
6107
6107
  },
6108
6108
  children: /* @__PURE__ */ e(rs, { className: "h-4 w-4" })
6109
6109
  }
@@ -6119,7 +6119,7 @@ function gu() {
6119
6119
  children: /* @__PURE__ */ e(Tl, { className: "h-4 w-4" })
6120
6120
  }
6121
6121
  ),
6122
- !p && !y && c && /* @__PURE__ */ e(
6122
+ !f && !y && c && /* @__PURE__ */ e(
6123
6123
  V,
6124
6124
  {
6125
6125
  className: "h-7 p-2",
@@ -6155,7 +6155,7 @@ function yu({
6155
6155
  icon: d,
6156
6156
  showNone: u = !1
6157
6157
  }) {
6158
- const h = Ke.useRef(null), [m, g] = Ke.useState(!1), [f, y] = Ke.useState("100%"), p = u ? [...a || [], { id: "none", name: "None" }] : a;
6158
+ const h = Ke.useRef(null), [m, g] = Ke.useState(!1), [p, y] = Ke.useState("100%"), f = u ? [...a || [], { id: "none", name: "None" }] : a;
6159
6159
  Ke.useLayoutEffect(() => {
6160
6160
  h.current && y(h.current.offsetWidth);
6161
6161
  }, []);
@@ -6188,7 +6188,7 @@ function yu({
6188
6188
  Kt,
6189
6189
  {
6190
6190
  className: "w-full p-0",
6191
- style: { minWidth: f },
6191
+ style: { minWidth: p },
6192
6192
  children: /* @__PURE__ */ s(Hn, { children: [
6193
6193
  /* @__PURE__ */ s("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
6194
6194
  /* @__PURE__ */ e(Kn, { className: "h-9", placeholder: "Search..." }),
@@ -6208,7 +6208,7 @@ function yu({
6208
6208
  t == null ? void 0 : t.toLowerCase(),
6209
6209
  " found."
6210
6210
  ] }),
6211
- /* @__PURE__ */ e(jt, { children: p == null ? void 0 : p.map((N) => /* @__PURE__ */ e(
6211
+ /* @__PURE__ */ e(jt, { children: f == null ? void 0 : f.map((N) => /* @__PURE__ */ e(
6212
6212
  gn,
6213
6213
  {
6214
6214
  className: "overflow-x-auto",
@@ -6262,7 +6262,7 @@ function xn({
6262
6262
  if (t === "Model")
6263
6263
  return /* @__PURE__ */ e(Ec, { className: "size-4" });
6264
6264
  }
6265
- function f() {
6265
+ function p() {
6266
6266
  return /* @__PURE__ */ s(ge, { disabled: u, value: m, onValueChange: c, children: [
6267
6267
  /* @__PURE__ */ e(
6268
6268
  ye,
@@ -6295,7 +6295,7 @@ function xn({
6295
6295
  ] }),
6296
6296
  /* @__PURE__ */ s(ne, { children: [
6297
6297
  i && /* @__PURE__ */ e(te, { value: "none", children: "None" }, "none"),
6298
- a && a.map((p, b) => /* @__PURE__ */ e(te, { value: p.id, children: p.name }, b))
6298
+ a && a.map((f, b) => /* @__PURE__ */ e(te, { value: f.id, children: f.name }, b))
6299
6299
  ] }),
6300
6300
  (r || l) && /* @__PURE__ */ e(te, { value: m, children: m })
6301
6301
  ] }) })
@@ -6318,20 +6318,20 @@ function xn({
6318
6318
  }
6319
6319
  );
6320
6320
  }
6321
- return /* @__PURE__ */ e(tt, { delayDuration: 0, children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: h === "select" ? f() : y() }) });
6321
+ return /* @__PURE__ */ e(tt, { delayDuration: 0, children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: h === "select" ? p() : y() }) });
6322
6322
  }
6323
6323
  function vu({ column: t }) {
6324
- const [a, n] = P(!1), r = E((p) => p.selectedTableName), l = E(
6325
- (p) => p.selectedSchemaName
6326
- ), o = E(
6327
- (p) => p.selectedDatabaseName
6328
- ), c = E(
6329
- (p) => p.selectedDatamodelId
6330
- ), i = E((p) => p.sqlGen), { modelItems: d, connectionType: u } = ot(), h = E((p) => p.actions.setSqlGen), m = E((p) => p.actions.setCardSql), g = E((p) => p.actions.setRunSql);
6331
- function f(p, b) {
6324
+ const [a, n] = P(!1), r = M((f) => f.selectedTableName), l = M(
6325
+ (f) => f.selectedSchemaName
6326
+ ), o = M(
6327
+ (f) => f.selectedDatabaseName
6328
+ ), c = M(
6329
+ (f) => f.selectedDatamodelId
6330
+ ), i = M((f) => f.sqlGen), { modelItems: d, connectionType: u } = ot(), h = M((f) => f.actions.setSqlGen), m = M((f) => f.actions.setCardSql), g = M((f) => f.actions.setRunSql);
6331
+ function p(f, b) {
6332
6332
  var z;
6333
- const v = Qr(p, i, b), N = (z = d == null ? void 0 : d.find(
6334
- (M) => M.id === c
6333
+ const v = Qr(f, i, b), N = (z = d == null ? void 0 : d.find(
6334
+ (E) => E.id === c
6335
6335
  )) == null ? void 0 : z.name;
6336
6336
  h(v);
6337
6337
  const w = Zr(
@@ -6349,7 +6349,7 @@ function vu({ column: t }) {
6349
6349
  /* @__PURE__ */ e(
6350
6350
  "li",
6351
6351
  {
6352
- onClick: () => f(t, "COUNT"),
6352
+ onClick: () => p(t, "COUNT"),
6353
6353
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
6354
6354
  children: "Count"
6355
6355
  }
@@ -6357,7 +6357,7 @@ function vu({ column: t }) {
6357
6357
  /* @__PURE__ */ e(
6358
6358
  "li",
6359
6359
  {
6360
- onClick: () => f(t, "AVG"),
6360
+ onClick: () => p(t, "AVG"),
6361
6361
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
6362
6362
  children: "Avg"
6363
6363
  }
@@ -6365,7 +6365,7 @@ function vu({ column: t }) {
6365
6365
  /* @__PURE__ */ e(
6366
6366
  "li",
6367
6367
  {
6368
- onClick: () => f(t, "SUM"),
6368
+ onClick: () => p(t, "SUM"),
6369
6369
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
6370
6370
  children: "Sum"
6371
6371
  }
@@ -6373,7 +6373,7 @@ function vu({ column: t }) {
6373
6373
  /* @__PURE__ */ e(
6374
6374
  "li",
6375
6375
  {
6376
- onClick: () => f(t, "MAX"),
6376
+ onClick: () => p(t, "MAX"),
6377
6377
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
6378
6378
  children: "Max"
6379
6379
  }
@@ -6381,7 +6381,7 @@ function vu({ column: t }) {
6381
6381
  /* @__PURE__ */ e(
6382
6382
  "li",
6383
6383
  {
6384
- onClick: () => f(t, "MIN"),
6384
+ onClick: () => p(t, "MIN"),
6385
6385
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
6386
6386
  children: "Min"
6387
6387
  }
@@ -6448,17 +6448,17 @@ function bu({
6448
6448
  onClick: t,
6449
6449
  column: a
6450
6450
  }) {
6451
- const n = Ot((h) => h.activeId), r = E(
6451
+ const n = Ot((h) => h.activeId), r = M(
6452
6452
  (h) => {
6453
6453
  var m;
6454
6454
  return (m = h.card.queryConfig) == null ? void 0 : m.groupByColumns;
6455
6455
  }
6456
- ), l = E(
6456
+ ), l = M(
6457
6457
  (h) => {
6458
6458
  var m;
6459
6459
  return (m = h.card.queryConfig) == null ? void 0 : m.metricColumns;
6460
6460
  }
6461
- ), o = E(
6461
+ ), o = M(
6462
6462
  (h) => {
6463
6463
  var m;
6464
6464
  return (m = h.card.queryConfig) == null ? void 0 : m.filterColumns;
@@ -6524,27 +6524,27 @@ const _a = {
6524
6524
  id: "__placeholder__"
6525
6525
  }, Bt = "droppable-group-by", $t = "droppable-metrics", qt = "droppable-pivot-by", ha = "sortable-group-by", Xa = "sortable-metrics", pa = "sortable-pivot-by", es = "droppable-filters", ts = "sortable-filters", Ls = "sortable-order-by";
6526
6526
  function Nu() {
6527
- const t = Ot((A) => A.insertIndex), a = E(
6527
+ const t = Ot((A) => A.insertIndex), a = M(
6528
6528
  (A) => {
6529
6529
  var x;
6530
6530
  return ((x = A.card.queryConfig) == null ? void 0 : x.groupByColumns) || [];
6531
6531
  }
6532
- ), n = E(
6532
+ ), n = M(
6533
6533
  (A) => {
6534
6534
  var x;
6535
6535
  return ((x = A.card.queryConfig) == null ? void 0 : x.metricColumns) || [];
6536
6536
  }
6537
- ), r = E(
6537
+ ), r = M(
6538
6538
  (A) => {
6539
6539
  var x;
6540
6540
  return ((x = A.card.queryConfig) == null ? void 0 : x.filterColumns) || [];
6541
6541
  }
6542
- ), l = E(
6542
+ ), l = M(
6543
6543
  (A) => {
6544
6544
  var x;
6545
6545
  return ((x = A.card.queryConfig) == null ? void 0 : x.orderBy) || [];
6546
6546
  }
6547
- ), o = E(
6547
+ ), o = M(
6548
6548
  (A) => {
6549
6549
  var x;
6550
6550
  return ((x = A.card.queryConfig) == null ? void 0 : x.pivotColumns) || [];
@@ -6558,9 +6558,9 @@ function Nu() {
6558
6558
  setPreviewPivotColumns: m
6559
6559
  } = Ji(), {
6560
6560
  setGroupByColumns: g,
6561
- setMetricColumns: f,
6561
+ setMetricColumns: p,
6562
6562
  setFilterColumns: y,
6563
- setOrderByColumns: p,
6563
+ setOrderByColumns: f,
6564
6564
  setPivotByColumns: b
6565
6565
  } = se(), { columns: v } = el(), { formattedTableName: N } = ot(), w = Sn(
6566
6566
  kt(Wi, {
@@ -6650,7 +6650,7 @@ function Nu() {
6650
6650
  } else
6651
6651
  d(a), u(n), h(r), m(o);
6652
6652
  };
6653
- function M(A) {
6653
+ function E(A) {
6654
6654
  i(A.active.id), c(null), d(a), u(n), h(r), m(o);
6655
6655
  }
6656
6656
  function S(A) {
@@ -6667,7 +6667,7 @@ function Nu() {
6667
6667
  role: "metric",
6668
6668
  aggregate: x
6669
6669
  };
6670
- j.splice(B, 0, U), f(j);
6670
+ j.splice(B, 0, U), p(j);
6671
6671
  }
6672
6672
  function T(A) {
6673
6673
  const x = ut(A.data_type);
@@ -6762,7 +6762,7 @@ function Nu() {
6762
6762
  const q = n.findIndex((ee) => ee.id === x.id), Z = n.findIndex((ee) => ee.id === O.id);
6763
6763
  if (q !== -1 && Z !== -1 && q !== Z) {
6764
6764
  const ee = [...n], [W] = ee.splice(q, 1);
6765
- ee.splice(Z, 0, W), f(ee);
6765
+ ee.splice(Z, 0, W), p(ee);
6766
6766
  }
6767
6767
  }
6768
6768
  if (O && ((J = O.data.current) == null ? void 0 : J.type) === ts && r.some((q) => q.id === x.id)) {
@@ -6784,7 +6784,7 @@ function Nu() {
6784
6784
  );
6785
6785
  if (j !== -1 && B !== -1 && j !== B) {
6786
6786
  const U = [...l], [oe] = U.splice(j, 1);
6787
- U.splice(B, 0, oe), p(U);
6787
+ U.splice(B, 0, oe), f(U);
6788
6788
  }
6789
6789
  }
6790
6790
  }
@@ -6794,7 +6794,7 @@ function Nu() {
6794
6794
  return {
6795
6795
  handleDragOver: z,
6796
6796
  handleDragEnd: D,
6797
- handleDragStart: M,
6797
+ handleDragStart: E,
6798
6798
  handleDragCancel: I,
6799
6799
  sensors: w
6800
6800
  };
@@ -6845,36 +6845,36 @@ function Cu({
6845
6845
  columns: n,
6846
6846
  status: r
6847
6847
  }) {
6848
- const l = E((x) => x.sqlGen), o = E((x) => x.isDevMode), c = E(
6848
+ const l = M((x) => x.sqlGen), o = M((x) => x.isDevMode), c = M(
6849
6849
  (x) => x.selectedConnectionId
6850
- ), i = E(
6850
+ ), i = M(
6851
6851
  (x) => {
6852
6852
  var O, _;
6853
6853
  return (_ = (O = x.card) == null ? void 0 : O.queryConfig) == null ? void 0 : _.metricColumns;
6854
6854
  }
6855
6855
  );
6856
- E(
6856
+ M(
6857
6857
  (x) => {
6858
6858
  var O, _;
6859
6859
  return (_ = (O = x.card) == null ? void 0 : O.queryConfig) == null ? void 0 : _.groupByColumns;
6860
6860
  }
6861
6861
  );
6862
- const d = E(
6862
+ const d = M(
6863
6863
  (x) => x.selectedDatabaseName
6864
- ), u = E(
6864
+ ), u = M(
6865
6865
  (x) => x.selectedSchemaName
6866
- ), h = E((x) => x.selectedTableName), m = E(
6866
+ ), h = M((x) => x.selectedTableName), m = M(
6867
6867
  (x) => x.selectedDatamodelId
6868
6868
  ), g = Y(
6869
6869
  (x) => x.dashboard.aiScopeTables
6870
- ), { addToAIScope: f, removeFromAIScope: y } = yt(), {
6871
- addColumnToMetricColumns: p,
6870
+ ), { addToAIScope: p, removeFromAIScope: y } = yt(), {
6871
+ addColumnToMetricColumns: f,
6872
6872
  addColumnToGroupBy: b,
6873
6873
  setCardSql: v,
6874
6874
  setRunSql: N,
6875
6875
  setSqlGen: w,
6876
6876
  setIsShowingVisual: z
6877
- } = se(), { connectionType: M, modelItems: S, selectedDatamodelName: C } = ot();
6877
+ } = se(), { connectionType: E, modelItems: S, selectedDatamodelName: C } = ot();
6878
6878
  function T(x) {
6879
6879
  var O;
6880
6880
  if (o) {
@@ -6887,7 +6887,7 @@ function Cu({
6887
6887
  Xe(t),
6888
6888
  Xe(a),
6889
6889
  j || "",
6890
- M,
6890
+ E,
6891
6891
  d || ""
6892
6892
  );
6893
6893
  B && (v(B), N(!0));
@@ -6913,7 +6913,7 @@ function Cu({
6913
6913
  type: x.data_type,
6914
6914
  aggregate: "COUNT"
6915
6915
  };
6916
- p(_);
6916
+ f(_);
6917
6917
  }
6918
6918
  if (mt(x.data_type)) {
6919
6919
  const _ = {
@@ -6937,14 +6937,14 @@ function Cu({
6937
6937
  type: x.data_type,
6938
6938
  aggregate: "SUM"
6939
6939
  };
6940
- p(_);
6940
+ f(_);
6941
6941
  }
6942
6942
  }
6943
6943
  }
6944
6944
  function k(x) {
6945
- x === !0 && (h || C) && c ? (f({
6945
+ x === !0 && (h || C) && c ? (p({
6946
6946
  connectionId: c,
6947
- connectionType: M === "S3" || M === "API" ? "DuckDb" : M || "",
6947
+ connectionType: E === "S3" || E === "API" ? "DuckDb" : E || "",
6948
6948
  databaseName: d || "",
6949
6949
  schemaName: u || "",
6950
6950
  tableName: h || "",
@@ -6956,7 +6956,7 @@ function Cu({
6956
6956
  richColors: !0
6957
6957
  })) : (y({
6958
6958
  connectionId: c || "",
6959
- connectionType: M || "",
6959
+ connectionType: E || "",
6960
6960
  tableName: h || "",
6961
6961
  datamodelName: oa(C),
6962
6962
  datamodelId: m || "",
@@ -6973,11 +6973,11 @@ function Cu({
6973
6973
  schemaName: t,
6974
6974
  tableName: a,
6975
6975
  modelName: C,
6976
- connectionType: M,
6976
+ connectionType: E,
6977
6977
  databaseName: d || ""
6978
6978
  });
6979
6979
  z(!1);
6980
- const O = M === "MSSQL" ? `SELECT top 10 * FROM ${x}` : `SELECT * FROM ${x} LIMIT 10`;
6980
+ const O = E === "MSSQL" ? `SELECT top 10 * FROM ${x}` : `SELECT * FROM ${x} LIMIT 10`;
6981
6981
  v(O), N(!0);
6982
6982
  }
6983
6983
  function D() {
@@ -6985,7 +6985,7 @@ function Cu({
6985
6985
  schemaName: t,
6986
6986
  tableName: a,
6987
6987
  modelName: C,
6988
- connectionType: M,
6988
+ connectionType: E,
6989
6989
  databaseName: d || ""
6990
6990
  });
6991
6991
  v(`SELECT COUNT(*) as count FROM ${x}`), N(!0);
@@ -7108,24 +7108,24 @@ function Wl({
7108
7108
  type: a
7109
7109
  }) {
7110
7110
  var _t;
7111
- const n = E((fe) => fe.card), r = E(
7111
+ const n = M((fe) => fe.card), r = M(
7112
7112
  (fe) => fe.selectedConnectionId
7113
- ), l = Y((fe) => fe.showFilters), o = E(
7113
+ ), l = Y((fe) => fe.showFilters), o = M(
7114
7114
  (fe) => fe.selectedDatamodelId
7115
- ), c = E(
7115
+ ), c = M(
7116
7116
  (fe) => fe.selectedDatabaseName
7117
- ), i = E(
7117
+ ), i = M(
7118
7118
  (fe) => fe.selectedSchemaName
7119
- ), d = E((fe) => fe.selectedTableName), u = E((fe) => fe.isDevMode), { setSelectedTableName: h, setIsDevMode: m, setCardSql: g } = se(), {
7120
- connectionItems: f,
7119
+ ), d = M((fe) => fe.selectedTableName), u = M((fe) => fe.isDevMode), { setSelectedTableName: h, setIsDevMode: m, setCardSql: g } = se(), {
7120
+ connectionItems: p,
7121
7121
  modelItems: y,
7122
- schemaItems: p,
7122
+ schemaItems: f,
7123
7123
  databaseItems: b,
7124
7124
  tableItems: v,
7125
7125
  columns: N,
7126
7126
  isConnectionsLoading: w,
7127
7127
  isModelsLoading: z,
7128
- isConnectionsError: M,
7128
+ isConnectionsError: E,
7129
7129
  isModelsError: S,
7130
7130
  isDatabasesLoadingOrFetching: C,
7131
7131
  isDatabaseError: T,
@@ -7222,7 +7222,7 @@ function Wl({
7222
7222
  onChange: J,
7223
7223
  isError: R,
7224
7224
  isLoading: k,
7225
- items: p,
7225
+ items: f,
7226
7226
  value: i || "",
7227
7227
  title: "Schema",
7228
7228
  type: "combobox"
@@ -7263,14 +7263,14 @@ function Wl({
7263
7263
  xn,
7264
7264
  {
7265
7265
  refetch: ae,
7266
- items: f,
7266
+ items: p,
7267
7267
  title: "Connection",
7268
7268
  value: r || "",
7269
7269
  onChange: $,
7270
7270
  isLoading: w,
7271
- isError: M,
7271
+ isError: E,
7272
7272
  type: "combobox",
7273
- connectionTooltip: ((_t = f == null ? void 0 : f.find(
7273
+ connectionTooltip: ((_t = p == null ? void 0 : p.find(
7274
7274
  (fe) => fe.id === r
7275
7275
  )) == null ? void 0 : _t.type) || ""
7276
7276
  }
@@ -7329,8 +7329,8 @@ function Yl({
7329
7329
  function h() {
7330
7330
  const g = window.getSelection();
7331
7331
  if (g && g.toString().trim() !== "") {
7332
- const f = g.toString();
7333
- navigator.clipboard.writeText(f), o(!0), i.current = !0, setTimeout(() => {
7332
+ const p = g.toString();
7333
+ navigator.clipboard.writeText(p), o(!0), i.current = !0, setTimeout(() => {
7334
7334
  o(!1), i.current = !1;
7335
7335
  }, 1e3);
7336
7336
  } else
@@ -7377,7 +7377,7 @@ function Ql({
7377
7377
  error: a,
7378
7378
  onDebugWithAssistant: n
7379
7379
  }) {
7380
- const r = E((d) => d.isDevMode), { setIsDevMode: l, setCardSql: o, setRunSql: c } = se();
7380
+ const r = M((d) => d.isDevMode), { setIsDevMode: l, setCardSql: o, setRunSql: c } = se();
7381
7381
  function i() {
7382
7382
  l(!r), o(t), setTimeout(() => {
7383
7383
  c(!0);
@@ -7535,18 +7535,18 @@ function Ou(t) {
7535
7535
  return Xt({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z" }, child: [] }] })(t);
7536
7536
  }
7537
7537
  function ti(t) {
7538
- const { theme: a } = Qi(), n = Y((p) => p.theme), r = E((p) => p.frame), l = E((p) => p.card), o = E((p) => p.activeTabCardId), c = Zi(), { refetch: i } = Fe(l), { updateCardTab: d, setRunSql: u } = se(), h = nt(), m = nt({}), g = r.cards.find((p) => p.id === o), f = me(() => {
7539
- let p = "";
7540
- return t === "python" && (p = (g == null ? void 0 : g.python) || al), t === "sql" && (p = (g == null ? void 0 : g.sql) || ""), p;
7538
+ const { theme: a } = Qi(), n = Y((f) => f.theme), r = M((f) => f.frame), l = M((f) => f.card), o = M((f) => f.activeTabCardId), c = Zi(), { refetch: i } = Fe(l), { updateCardTab: d, setRunSql: u } = se(), h = nt(), m = nt({}), g = r.cards.find((f) => f.id === o), p = me(() => {
7539
+ let f = "";
7540
+ return t === "python" && (f = (g == null ? void 0 : g.python) || al), t === "sql" && (f = (g == null ? void 0 : g.sql) || ""), f;
7541
7541
  }, [t, g]);
7542
7542
  Te(() => {
7543
7543
  if (o && l.id && l.id !== o) {
7544
7544
  if (h.current && c) {
7545
- const p = h.current.getModel();
7546
- p && (m.current[l.id] = p);
7545
+ const f = h.current.getModel();
7546
+ f && (m.current[l.id] = f);
7547
7547
  let b = m.current[o];
7548
7548
  if (!b) {
7549
- const v = f();
7549
+ const v = p();
7550
7550
  b = c.editor.createModel(v, t), m.current[o] = b;
7551
7551
  }
7552
7552
  h.current.setModel(b);
@@ -7560,10 +7560,10 @@ function ti(t) {
7560
7560
  c,
7561
7561
  u,
7562
7562
  t,
7563
- f
7563
+ p
7564
7564
  ]), Te(() => {
7565
7565
  if (!c) return;
7566
- const p = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", b = n === "system" ? p : n;
7566
+ const f = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", b = n === "system" ? f : n;
7567
7567
  c.editor.defineTheme("default", {
7568
7568
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
7569
7569
  base: b === "light" ? "vs" : "vs-dark",
@@ -7578,25 +7578,25 @@ function ti(t) {
7578
7578
  }
7579
7579
  }), c.editor.setTheme("default");
7580
7580
  }, [a, n, c]), Te(() => {
7581
- const p = h.current;
7582
- p && c && l && p.addCommand(
7581
+ const f = h.current;
7582
+ f && c && l && f.addCommand(
7583
7583
  c.KeyMod.Shift | c.KeyCode.Enter,
7584
7584
  function() {
7585
7585
  return i(), !1;
7586
7586
  }
7587
7587
  );
7588
7588
  }, [c, i, l]);
7589
- function y(p, b) {
7590
- if (h.current = p, !m.current[l.id]) {
7591
- const v = p.getModel(), N = f();
7592
- m.current[l.id] = v || (b == null ? void 0 : b.editor.createModel(N, t)) || p.getModel();
7589
+ function y(f, b) {
7590
+ if (h.current = f, !m.current[l.id]) {
7591
+ const v = f.getModel(), N = p();
7592
+ m.current[l.id] = v || (b == null ? void 0 : b.editor.createModel(N, t)) || f.getModel();
7593
7593
  }
7594
- p.setModel(m.current[l.id]);
7594
+ f.setModel(m.current[l.id]);
7595
7595
  }
7596
7596
  return { handleEditorDidMount: y };
7597
7597
  }
7598
7598
  function Au() {
7599
- const t = E((c) => c.card.sql), a = E((c) => c.sqlGen), { setCardSql: n, setSqlGen: r } = se(), { handleEditorDidMount: l } = ti("sql");
7599
+ const t = M((c) => c.card.sql), a = M((c) => c.sqlGen), { setCardSql: n, setSqlGen: r } = se(), { handleEditorDidMount: l } = ti("sql");
7600
7600
  function o(c) {
7601
7601
  n(c), eo(a) || r({});
7602
7602
  }
@@ -7628,7 +7628,7 @@ function Au() {
7628
7628
  ] });
7629
7629
  }
7630
7630
  function Iu() {
7631
- const t = E((l) => l.card.python), { setCardPython: a } = se(), { handleEditorDidMount: n } = ti("python");
7631
+ const t = M((l) => l.card.python), { setCardPython: a } = se(), { handleEditorDidMount: n } = ti("python");
7632
7632
  function r(l) {
7633
7633
  a(l);
7634
7634
  }
@@ -7687,20 +7687,20 @@ function _s({
7687
7687
  }) {
7688
7688
  var c;
7689
7689
  const { setCardSql: a } = se();
7690
- E((i) => i.frame);
7691
- const n = E((i) => i.card);
7690
+ M((i) => i.frame);
7691
+ const n = M((i) => i.card);
7692
7692
  Rs(
7693
7693
  ((c = n.customCardPreferences) == null ? void 0 : c.url) || ""
7694
- ), E(
7694
+ ), M(
7695
7695
  (i) => i.selectedSchemaName
7696
- ), E(
7696
+ ), M(
7697
7697
  (i) => i.selectedDatamodelId
7698
- ), E(
7698
+ ), M(
7699
7699
  (i) => i.selectedDatabaseName
7700
- ), E((i) => i.selectedTableName), E(
7700
+ ), M((i) => i.selectedTableName), M(
7701
7701
  (i) => i.selectedConnectionId
7702
- ), E((i) => i.isShowingVisual), n.sql;
7703
- const r = E((i) => i.onSave), { getUpdatedFrame: l } = zs();
7702
+ ), M((i) => i.isShowingVisual), n.sql;
7703
+ const r = M((i) => i.onSave), { getUpdatedFrame: l } = zs();
7704
7704
  function o() {
7705
7705
  const i = l();
7706
7706
  r == null || r(i);
@@ -7760,7 +7760,7 @@ function zu() {
7760
7760
  ] });
7761
7761
  }
7762
7762
  function Ps() {
7763
- const { setTempQueryData: t, setSqlGen: a } = se(), n = He(), r = E((d) => d.tempQueryData), l = E((d) => d.onClose), o = E((d) => d.card), { queryKey: c } = Fe(o);
7763
+ const { setTempQueryData: t, setSqlGen: a } = se(), n = He(), r = M((d) => d.tempQueryData), l = M((d) => d.onClose), o = M((d) => d.card), { queryKey: c } = Fe(o);
7764
7764
  function i() {
7765
7765
  if (r) {
7766
7766
  const { queryKey: d, queryData: u } = r;
@@ -7783,7 +7783,7 @@ function Ps() {
7783
7783
  );
7784
7784
  }
7785
7785
  function Oa() {
7786
- const { setTempQueryData: t } = se(), a = He(), n = E((b) => b.isDevMode), r = E((b) => b.tempQueryData), l = E((b) => b.card), { queryKey: o } = Fe(l), {
7786
+ const { setTempQueryData: t } = se(), a = He(), n = M((b) => b.isDevMode), r = M((b) => b.tempQueryData), l = M((b) => b.card), { queryKey: o } = Fe(l), {
7787
7787
  setCardSql: c,
7788
7788
  setSqlGen: i,
7789
7789
  setCardPython: d,
@@ -7791,20 +7791,20 @@ function Oa() {
7791
7791
  setCardPreferences: h,
7792
7792
  updateDataSource: m,
7793
7793
  clearQueryConfig: g,
7794
- setCardConfig: f,
7794
+ setCardConfig: p,
7795
7795
  setCardType: y
7796
7796
  } = se();
7797
- function p() {
7797
+ function f() {
7798
7798
  const b = a.getQueryData(o);
7799
7799
  r != null && r.queryData || t({
7800
7800
  queryKey: o,
7801
7801
  queryData: b
7802
- }), a.setQueryData(o, null), a.removeQueries({ queryKey: o, exact: !0 }), n && m(ca), c(""), i({}), g(), f(void 0), d(""), u(""), h({}), y("bar");
7802
+ }), a.setQueryData(o, null), a.removeQueries({ queryKey: o, exact: !0 }), n && m(ca), c(""), i({}), g(), p(void 0), d(""), u(""), h({}), y("bar");
7803
7803
  }
7804
7804
  return /* @__PURE__ */ s(
7805
7805
  V,
7806
7806
  {
7807
- onClick: p,
7807
+ onClick: f,
7808
7808
  className: "h-8",
7809
7809
  size: "sm",
7810
7810
  variant: "secondary",
@@ -7817,40 +7817,40 @@ function Oa() {
7817
7817
  }
7818
7818
  function Fu() {
7819
7819
  const t = He(), [a, n] = P(!1), [r, l] = P(!1);
7820
- E((U) => U.frame);
7821
- const o = E((U) => U.card);
7822
- E((U) => U.isShowingVisual), E(
7820
+ M((U) => U.frame);
7821
+ const o = M((U) => U.card);
7822
+ M((U) => U.isShowingVisual), M(
7823
7823
  (U) => U.selectedConnectionId
7824
- ), E((U) => U.tempQueryData), E(
7824
+ ), M((U) => U.tempQueryData), M(
7825
7825
  (U) => U.selectedDatabaseName
7826
- ), E(
7826
+ ), M(
7827
7827
  (U) => U.selectedDatamodelId
7828
- ), E(
7828
+ ), M(
7829
7829
  (U) => U.selectedSchemaName
7830
7830
  );
7831
- const c = E((U) => U.showAIDialog);
7832
- E((U) => U.selectedTableName);
7833
- const i = E((U) => {
7831
+ const c = M((U) => U.showAIDialog);
7832
+ M((U) => U.selectedTableName);
7833
+ const i = M((U) => {
7834
7834
  var oe;
7835
7835
  return (oe = U == null ? void 0 : U.card) == null ? void 0 : oe.sql;
7836
- }), d = E((U) => {
7836
+ }), d = M((U) => {
7837
7837
  var oe;
7838
7838
  return (oe = U == null ? void 0 : U.card) == null ? void 0 : oe.python;
7839
7839
  }), { sheetFilterValues: u } = to(), {
7840
7840
  setCardCustomCfg: h,
7841
7841
  setQueryResultColumns: m,
7842
7842
  setCardSql: g,
7843
- setTempQueryData: f,
7843
+ setTempQueryData: p,
7844
7844
  // setQueryError,
7845
7845
  setPythonStdOut: y,
7846
- setCardPreferences: p,
7846
+ setCardPreferences: f,
7847
7847
  setCardType: b,
7848
7848
  setCardPython: v,
7849
7849
  runAssistant: N,
7850
7850
  setShowAIDialog: w
7851
7851
  } = se();
7852
- E((U) => U.onSave), E((U) => U.onClose), E((U) => U.actions.setSqlGen);
7853
- const z = E((U) => U.runSql), M = E((U) => U.actions.setRunSql), S = E(
7852
+ M((U) => U.onSave), M((U) => U.onClose), M((U) => U.actions.setSqlGen);
7853
+ const z = M((U) => U.runSql), E = M((U) => U.actions.setRunSql), S = M(
7854
7854
  (U) => U.actions.setIsSqlRunning
7855
7855
  ), {
7856
7856
  data: C,
@@ -7885,8 +7885,8 @@ function Fu() {
7885
7885
  // setQueryError,
7886
7886
  F
7887
7887
  ]), Te(() => {
7888
- z && (t.getQueryData(I) || A(), M(!1));
7889
- }, [z, A, M, I, t]);
7888
+ z && (t.getQueryData(I) || A(), E(!1));
7889
+ }, [z, A, E, I, t]);
7890
7890
  async function O() {
7891
7891
  const U = `Can you help me debug this query in the current table scope?
7892
7892
 
@@ -8123,14 +8123,14 @@ function Lu({ data: t }) {
8123
8123
  ] });
8124
8124
  }
8125
8125
  function _u({ card: t }) {
8126
- var N, w, z, M, S, C, T, k, R, D, F;
8126
+ var N, w, z, E, S, C, T, k, R, D, F;
8127
8127
  const [a, n] = P(!1), [r, l] = P(
8128
8128
  []
8129
8129
  ), { authToken: o } = Ee(), c = ho(o == null ? void 0 : o.accessToken), i = Y((I) => I.themeStyle), d = {
8130
8130
  colors: ((w = (N = i == null ? void 0 : i.chart) == null ? void 0 : N.dataset) == null ? void 0 : w.backgroundColor) || []
8131
8131
  };
8132
8132
  (z = t.customCardPreferences) != null && z.inputData;
8133
- const { getCard: u } = bs(((M = t.customCardPreferences) == null ? void 0 : M.url) || ""), h = ((S = t.customCardPreferences) == null ? void 0 : S.visualType) || "single", m = E((I) => I.frame), { setCustomCardPreferences: g } = se(), { data: f } = Fe(t), y = me((I, A) => {
8133
+ const { getCard: u } = bs(((E = t.customCardPreferences) == null ? void 0 : E.url) || ""), h = ((S = t.customCardPreferences) == null ? void 0 : S.visualType) || "single", m = M((I) => I.frame), { setCustomCardPreferences: g } = se(), { data: p } = Fe(t), y = me((I, A) => {
8134
8134
  l((x) => ({
8135
8135
  ...x,
8136
8136
  [I]: A
@@ -8138,7 +8138,7 @@ function _u({ card: t }) {
8138
8138
  }, []);
8139
8139
  if (!((C = t.customCardPreferences) != null && C.componentName))
8140
8140
  return null;
8141
- const p = u(
8141
+ const f = u(
8142
8142
  (T = t.customCardPreferences) == null ? void 0 : T.componentName
8143
8143
  );
8144
8144
  function b(I) {
@@ -8156,18 +8156,18 @@ function _u({ card: t }) {
8156
8156
  {
8157
8157
  fallback: /* @__PURE__ */ e(ne, {}),
8158
8158
  children: [
8159
- p && h === "single" && /* @__PURE__ */ e(
8160
- p,
8159
+ f && h === "single" && /* @__PURE__ */ e(
8160
+ f,
8161
8161
  {
8162
8162
  editing: !0,
8163
8163
  params: c,
8164
8164
  theme: d,
8165
8165
  settings: (R = t.customCardPreferences) == null ? void 0 : R.settings,
8166
8166
  onDataChange: y,
8167
- data: (f == null ? void 0 : f.records) || []
8167
+ data: (p == null ? void 0 : p.records) || []
8168
8168
  }
8169
8169
  ),
8170
- p && h === "multiple" && /* @__PURE__ */ s(ne, { children: [
8170
+ f && h === "multiple" && /* @__PURE__ */ s(ne, { children: [
8171
8171
  Object.keys(
8172
8172
  ((D = t.customCardPreferences) == null ? void 0 : D.dataInputCardIds) || {}
8173
8173
  ).map((I) => {
@@ -8188,7 +8188,7 @@ function _u({ card: t }) {
8188
8188
  );
8189
8189
  }),
8190
8190
  /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e(
8191
- p,
8191
+ f,
8192
8192
  {
8193
8193
  theme: d,
8194
8194
  onDataChange: y,
@@ -8214,9 +8214,9 @@ function ni({
8214
8214
  ...a
8215
8215
  }) {
8216
8216
  var N;
8217
- const n = E((w) => w.card), r = sl(n), l = ((N = n.customCardPreferences) == null ? void 0 : N.showCardHeader) ?? !0, o = E((w) => w.frame), c = Y((w) => w.dashboard.filters);
8218
- E((w) => w.actions.setRunSql);
8219
- const { updateFilter: i } = yt(), d = c == null ? void 0 : c.find((w) => w.id === o.filterId), { data: u, isLoading: h, isFetching: m, errorMessage: g } = Fe(n), { setCard: f } = se(), { data: y } = Ns(n), p = $e(() => !n.id || !(u != null && u.records) ? null : rl({
8217
+ const n = M((w) => w.card), r = sl(n), l = ((N = n.customCardPreferences) == null ? void 0 : N.showCardHeader) ?? !0, o = M((w) => w.frame), c = Y((w) => w.dashboard.filters);
8218
+ M((w) => w.actions.setRunSql);
8219
+ const { updateFilter: i } = yt(), d = c == null ? void 0 : c.find((w) => w.id === o.filterId), { data: u, isLoading: h, isFetching: m, errorMessage: g } = Fe(n), { setCard: p } = se(), { data: y } = Ns(n), f = $e(() => !n.id || !(u != null && u.records) ? null : rl({
8220
8220
  card: n,
8221
8221
  data: u == null ? void 0 : u.records,
8222
8222
  cardType: n.type,
@@ -8249,11 +8249,11 @@ function ni({
8249
8249
  if (!n.id) return null;
8250
8250
  if (n.type === "custom")
8251
8251
  return b(n);
8252
- if (!["table", "custom"].includes(n.type) && p)
8252
+ if (!["table", "custom"].includes(n.type) && f)
8253
8253
  return /* @__PURE__ */ e(ne, { children: h || m ? /* @__PURE__ */ e(ne, {}) : /* @__PURE__ */ e(
8254
8254
  yo,
8255
8255
  {
8256
- cfg: p
8256
+ cfg: f
8257
8257
  }
8258
8258
  ) });
8259
8259
  if (n.type === "table" && (u != null && u.records) && (u == null ? void 0 : u.records.length) > 0)
@@ -8273,7 +8273,7 @@ function ni({
8273
8273
  {
8274
8274
  enabled: !0,
8275
8275
  text: n.title,
8276
- onSave: (w) => f({ ...n, title: w }),
8276
+ onSave: (w) => p({ ...n, title: w }),
8277
8277
  children: /* @__PURE__ */ e("div", { className: "flex items-center gap-5", children: /* @__PURE__ */ e(qn, { className: "text-base", children: n.title || "Add title" }) })
8278
8278
  },
8279
8279
  n.title
@@ -8283,7 +8283,7 @@ function ni({
8283
8283
  {
8284
8284
  enabled: !0,
8285
8285
  text: n.description || "",
8286
- onSave: (w) => f({ ...n, description: w }),
8286
+ onSave: (w) => p({ ...n, description: w }),
8287
8287
  children: /* @__PURE__ */ e(Pr, { children: n.description || "Add description" })
8288
8288
  },
8289
8289
  n.description
@@ -8421,14 +8421,14 @@ const Ua = ({
8421
8421
  /* @__PURE__ */ e(V, { onClick: l, variant: "outline", children: "Close" })
8422
8422
  ] });
8423
8423
  function Uu() {
8424
- const [t, a] = P(!1), [n, r] = P(""), [l, o] = P(""), [c, i] = P(""), [d, u] = P(""), h = E((M) => M.card), m = E((M) => M.card.customCfg), g = m ? JSON.stringify(m, null, 2) : "", { data: f } = Fe(h), { data: y } = Ns(h), { setCardCustomCfg: p, setCustomVisualCode: b } = se(), v = (M) => {
8424
+ const [t, a] = P(!1), [n, r] = P(""), [l, o] = P(""), [c, i] = P(""), [d, u] = P(""), h = M((E) => E.card), m = M((E) => E.card.customCfg), g = m ? JSON.stringify(m, null, 2) : "", { data: p } = Fe(h), { data: y } = Ns(h), { setCardCustomCfg: f, setCustomVisualCode: b } = se(), v = (E) => {
8425
8425
  var S, C;
8426
8426
  return JSON.stringify(
8427
8427
  {
8428
- ...M,
8428
+ ...E,
8429
8429
  data: {
8430
- ...M.data,
8431
- datasets: (C = (S = M.data) == null ? void 0 : S.datasets) == null ? void 0 : C.map((T) => ({
8430
+ ...E.data,
8431
+ datasets: (C = (S = E.data) == null ? void 0 : S.datasets) == null ? void 0 : C.map((T) => ({
8432
8432
  ...T,
8433
8433
  data: []
8434
8434
  }))
@@ -8439,31 +8439,31 @@ function Uu() {
8439
8439
  );
8440
8440
  }, N = () => {
8441
8441
  var S, C;
8442
- if (!((S = f == null ? void 0 : f.records) != null && S.length)) return;
8443
- const M = rl({
8442
+ if (!((S = p == null ? void 0 : p.records) != null && S.length)) return;
8443
+ const E = rl({
8444
8444
  card: h,
8445
- data: f.records,
8445
+ data: p.records,
8446
8446
  cardType: h.type,
8447
8447
  queryConfig: h.queryConfig,
8448
8448
  //cfg: card.cfg,
8449
8449
  preferences: h.preferences,
8450
8450
  topoJson: y
8451
8451
  });
8452
- if (M) {
8453
- r(v(M)), i(((C = h.preferences) == null ? void 0 : C.customVisualCode) || "");
8454
- const T = xo(M, m);
8452
+ if (E) {
8453
+ r(v(E)), i(((C = h.preferences) == null ? void 0 : C.customVisualCode) || "");
8454
+ const T = xo(E, m);
8455
8455
  o(v(T));
8456
8456
  }
8457
8457
  }, w = () => {
8458
8458
  try {
8459
8459
  if (c && b(c), l) {
8460
- const M = JSON.parse(
8460
+ const E = JSON.parse(
8461
8461
  l
8462
8462
  ), S = bo(
8463
8463
  JSON.parse(n),
8464
- M
8464
+ E
8465
8465
  );
8466
- p(S), u("");
8466
+ f(S), u("");
8467
8467
  }
8468
8468
  } catch {
8469
8469
  u("Invalid JSON configuration");
@@ -8489,8 +8489,8 @@ function Uu() {
8489
8489
  customCode: c,
8490
8490
  cardCustomCfgString: g,
8491
8491
  mergedConfig: l,
8492
- onConfigChange: (M) => o(M ?? ""),
8493
- onCodeChange: (M) => i(M ?? "")
8492
+ onConfigChange: (E) => o(E ?? ""),
8493
+ onCodeChange: (E) => i(E ?? "")
8494
8494
  }
8495
8495
  )
8496
8496
  ] }),
@@ -8500,7 +8500,7 @@ function Uu() {
8500
8500
  error: d,
8501
8501
  hasCardCustomConfig: !!m,
8502
8502
  onReset: () => {
8503
- o(n), p(null);
8503
+ o(n), f(null);
8504
8504
  },
8505
8505
  onApply: w,
8506
8506
  onClose: () => a(!1)
@@ -8544,10 +8544,10 @@ function Bu({
8544
8544
  var h;
8545
8545
  if (i) {
8546
8546
  const g = (await Promise.all(
8547
- (h = i == null ? void 0 : i.plugins) == null ? void 0 : h.map(async (f) => (await dl(f.value)).visuals.map((b) => ({
8547
+ (h = i == null ? void 0 : i.plugins) == null ? void 0 : h.map(async (p) => (await dl(p.value)).visuals.map((b) => ({
8548
8548
  name: b.name,
8549
8549
  icon: b.icon,
8550
- url: f.value
8550
+ url: p.value
8551
8551
  })))
8552
8552
  )).flat();
8553
8553
  n(g);
@@ -8596,7 +8596,7 @@ function ai({
8596
8596
  onChartTypeChange: t,
8597
8597
  iconClassName: a
8598
8598
  }) {
8599
- const { setCardType: n, setCardPreferences: r, setIsDevMode: l } = E(
8599
+ const { setCardType: n, setCardPreferences: r, setIsDevMode: l } = M(
8600
8600
  (h) => h.actions
8601
8601
  ), { setCardCustomCfg: o, setCustomCardPreferences: c, setQueryConfig: i } = se();
8602
8602
  function d(h, m) {
@@ -8841,7 +8841,7 @@ function si({
8841
8841
  variant: t = "ghost"
8842
8842
  }) {
8843
8843
  var o, c;
8844
- const [a, n] = P(!1), r = E((i) => i.card), l = r.type;
8844
+ const [a, n] = P(!1), r = M((i) => i.card), l = r.type;
8845
8845
  return Y((i) => i.isVisualEditing), /* @__PURE__ */ s(at, { open: a, onOpenChange: n, children: [
8846
8846
  /* @__PURE__ */ e(st, { asChild: !0, children: /* @__PURE__ */ e(
8847
8847
  V,
@@ -8885,10 +8885,10 @@ function Cr(t, a) {
8885
8885
  }
8886
8886
  function Hu() {
8887
8887
  var O, _, j, B, U, oe;
8888
- const [t, a] = P(!1), n = E((ae) => {
8888
+ const [t, a] = P(!1), n = M((ae) => {
8889
8889
  var $;
8890
8890
  return ($ = ae.card) == null ? void 0 : $.preferences;
8891
- }), r = E((ae) => {
8891
+ }), r = M((ae) => {
8892
8892
  var $;
8893
8893
  return ($ = ae.card) == null ? void 0 : $.type;
8894
8894
  }), l = ul(n, {}), [o, c] = P(
@@ -8897,9 +8897,9 @@ function Hu() {
8897
8897
  ((j = (_ = (O = n == null ? void 0 : n.chartOptions) == null ? void 0 : O.scales) == null ? void 0 : _[l]) == null ? void 0 : j.min) || ""
8898
8898
  ), [u, h] = P(
8899
8899
  ((oe = (U = (B = n == null ? void 0 : n.chartOptions) == null ? void 0 : B.scales) == null ? void 0 : U[l]) == null ? void 0 : oe.max) || ""
8900
- ), [m, g] = P(i || u ? "custom" : "auto"), [f, y] = P(""), [p, b] = P(0), [v, N] = P(""), [w, z] = P(""), [M, S] = P(""), C = E(
8900
+ ), [m, g] = P(i || u ? "custom" : "auto"), [p, y] = P(""), [f, b] = P(0), [v, N] = P(""), [w, z] = P(""), [E, S] = P(""), C = M(
8901
8901
  (ae) => ae.actions.setCardPreferences
8902
- ), { updateCardInFrame: T } = se(), k = E((ae) => ae.card), R = ["pie", "doughnut", "polarArea", "funnel"].includes(
8902
+ ), { updateCardInFrame: T } = se(), k = M((ae) => ae.card), R = ["pie", "doughnut", "polarArea", "funnel"].includes(
8903
8903
  r
8904
8904
  );
8905
8905
  Te(() => {
@@ -8949,7 +8949,7 @@ function Hu() {
8949
8949
  ]
8950
8950
  }
8951
8951
  ),
8952
- /* @__PURE__ */ s(ge, { value: M, onValueChange: ($) => S($), children: [
8952
+ /* @__PURE__ */ s(ge, { value: E, onValueChange: ($) => S($), children: [
8953
8953
  /* @__PURE__ */ e(
8954
8954
  ye,
8955
8955
  {
@@ -8968,7 +8968,7 @@ function Hu() {
8968
8968
  /* @__PURE__ */ e(
8969
8969
  je,
8970
8970
  {
8971
- value: p,
8971
+ value: f,
8972
8972
  onChange: ($) => b(Number($.target.value)),
8973
8973
  id: "format",
8974
8974
  className: `col-span-6 h-8 w-full tracking-wide ${Xn}`
@@ -9055,7 +9055,7 @@ function Hu() {
9055
9055
  /* @__PURE__ */ e(
9056
9056
  je,
9057
9057
  {
9058
- value: f,
9058
+ value: p,
9059
9059
  onChange: (ae) => y(($) => D($, ae.target.value)),
9060
9060
  id: "step-size",
9061
9061
  className: `col-span-1 h-8 w-full ${Xn}`
@@ -9071,7 +9071,7 @@ function Hu() {
9071
9071
  min: i,
9072
9072
  max: u,
9073
9073
  ticks: {
9074
- stepSize: f
9074
+ stepSize: p
9075
9075
  }
9076
9076
  });
9077
9077
  const $ = {
@@ -9088,10 +9088,10 @@ function Hu() {
9088
9088
  }
9089
9089
  },
9090
9090
  numberAxisFormat: {
9091
- decimalPlaces: p,
9091
+ decimalPlaces: f,
9092
9092
  suffix: v,
9093
9093
  currency: w,
9094
- locale: M
9094
+ locale: E
9095
9095
  }
9096
9096
  };
9097
9097
  console.log($), C($);
@@ -9127,17 +9127,17 @@ function Hu() {
9127
9127
  ] });
9128
9128
  }
9129
9129
  function Ku() {
9130
- const t = E(
9130
+ const t = M(
9131
9131
  (i) => {
9132
9132
  var d, u, h, m;
9133
9133
  return (m = (h = (u = (d = i.card.preferences) == null ? void 0 : d.chartOptions) == null ? void 0 : u.plugins) == null ? void 0 : h.legend) == null ? void 0 : m.position;
9134
9134
  }
9135
- ), a = E(
9135
+ ), a = M(
9136
9136
  (i) => {
9137
9137
  var d, u, h, m;
9138
9138
  return (m = (h = (u = (d = i.card.preferences) == null ? void 0 : d.chartOptions) == null ? void 0 : u.plugins) == null ? void 0 : h.legend) == null ? void 0 : m.align;
9139
9139
  }
9140
- ), n = E(
9140
+ ), n = M(
9141
9141
  (i) => {
9142
9142
  var d, u, h, m;
9143
9143
  return (m = (h = (u = (d = i.card.preferences) == null ? void 0 : d.chartOptions) == null ? void 0 : u.plugins) == null ? void 0 : h.legend) == null ? void 0 : m.display;
@@ -9253,12 +9253,12 @@ function Ku() {
9253
9253
  ] });
9254
9254
  }
9255
9255
  function Ju() {
9256
- const t = E(
9256
+ const t = M(
9257
9257
  (o) => {
9258
9258
  var c, i;
9259
9259
  return (i = (c = o.card.preferences) == null ? void 0 : c.chartOptions) == null ? void 0 : i.indexAxis;
9260
9260
  }
9261
- ), a = E((o) => o.card.type), { setChartOrientation: n } = E((o) => o.actions);
9261
+ ), a = M((o) => o.card.type), { setChartOrientation: n } = M((o) => o.actions);
9262
9262
  function r() {
9263
9263
  return /* @__PURE__ */ e(
9264
9264
  le,
@@ -9286,7 +9286,7 @@ function Ju() {
9286
9286
  return /* @__PURE__ */ e(ne, { children: a === "funnel" ? l() : r() });
9287
9287
  }
9288
9288
  function ri() {
9289
- const t = E((c) => c.card), a = E((c) => c.isShowingVisual), n = E(
9289
+ const t = M((c) => c.card), a = M((c) => c.isShowingVisual), n = M(
9290
9290
  (c) => {
9291
9291
  var i, d;
9292
9292
  return (d = (i = c.card) == null ? void 0 : i.preferences) == null ? void 0 : d.chartOptions;
@@ -9330,32 +9330,32 @@ function ri() {
9330
9330
  ] }) : null;
9331
9331
  }
9332
9332
  function Wu() {
9333
- const t = E((y) => y.frame), a = E((y) => y.card), { setFrame: n, setActiveTabCardId: r, setCard: l, updateCardInFrame: o } = se(), c = (y, p) => {
9334
- y.dataTransfer.setData("tabIndex", p.toString());
9333
+ const t = M((y) => y.frame), a = M((y) => y.card), { setFrame: n, setActiveTabCardId: r, setCard: l, updateCardInFrame: o } = se(), c = (y, f) => {
9334
+ y.dataTransfer.setData("tabIndex", f.toString());
9335
9335
  }, i = (y) => {
9336
9336
  y.preventDefault();
9337
- }, d = (y, p) => {
9337
+ }, d = (y, f) => {
9338
9338
  const b = y.dataTransfer.getData("tabIndex");
9339
- if (b === p.toString()) return;
9339
+ if (b === f.toString()) return;
9340
9340
  const v = Array.from(t.cards), [N] = v.splice(parseInt(b), 1);
9341
- v.splice(p, 0, N), n({ ...t, cards: v });
9341
+ v.splice(f, 0, N), n({ ...t, cards: v });
9342
9342
  };
9343
9343
  function u(y) {
9344
- const p = t.cards.filter((N) => N.id !== y), b = p[0], v = {
9344
+ const f = t.cards.filter((N) => N.id !== y), b = f[0], v = {
9345
9345
  ...t,
9346
- cards: p,
9346
+ cards: f,
9347
9347
  // update the active card to the first card in the frame
9348
9348
  activeCardId: b.id
9349
9349
  };
9350
9350
  n(v), r(b.id), l(b);
9351
9351
  }
9352
- function h(y, p) {
9352
+ function h(y, f) {
9353
9353
  const b = {
9354
9354
  ...t,
9355
- cards: [...t.cards, p],
9355
+ cards: [...t.cards, f],
9356
9356
  activeCardId: y.id
9357
9357
  };
9358
- n(b), r(p.id);
9358
+ n(b), r(f.id);
9359
9359
  }
9360
9360
  function m() {
9361
9361
  const y = {
@@ -9368,7 +9368,7 @@ function Wu() {
9368
9368
  h(a, y);
9369
9369
  }
9370
9370
  function g(y) {
9371
- const p = {
9371
+ const f = {
9372
9372
  dataSource: y.dataSource,
9373
9373
  connectionId: y.connectionId,
9374
9374
  lastSelectedDatabase: y.lastSelectedDatabase,
@@ -9392,35 +9392,35 @@ function Wu() {
9392
9392
  mode: "explorer"
9393
9393
  // Set default mode for new cards
9394
9394
  };
9395
- h(y, p);
9395
+ h(y, f);
9396
9396
  }
9397
- function f(y, p) {
9398
- return y.cards.length === 1 && (p.displayTab === !0 || p.displayTab === void 0) || y.activeCardId !== p.id && (p.displayTab === !0 || p.displayTab === void 0) ? null : /* @__PURE__ */ e(
9397
+ function p(y, f) {
9398
+ return y.cards.length === 1 && (f.displayTab === !0 || f.displayTab === void 0) || y.activeCardId !== f.id && (f.displayTab === !0 || f.displayTab === void 0) ? null : /* @__PURE__ */ e(
9399
9399
  "div",
9400
9400
  {
9401
9401
  onClick: () => {
9402
- const b = p.displayTab === void 0 ? !1 : !p.displayTab;
9403
- l({ ...p, displayTab: b }), o({
9404
- ...p,
9402
+ const b = f.displayTab === void 0 ? !1 : !f.displayTab;
9403
+ l({ ...f, displayTab: b }), o({
9404
+ ...f,
9405
9405
  displayTab: b
9406
9406
  });
9407
9407
  },
9408
- children: p.displayTab === !0 || p.displayTab === void 0 ? /* @__PURE__ */ e(Nn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e(_c, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
9408
+ children: f.displayTab === !0 || f.displayTab === void 0 ? /* @__PURE__ */ e(Nn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e(_c, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
9409
9409
  }
9410
9410
  );
9411
9411
  }
9412
9412
  return /* @__PURE__ */ e(Qt, { className: "group mx-4 justify-between overflow-x-auto", children: /* @__PURE__ */ s("div", { className: "flex items-center", children: [
9413
- t.cards.map((y, p) => /* @__PURE__ */ s(
9413
+ t.cards.map((y, f) => /* @__PURE__ */ s(
9414
9414
  Le,
9415
9415
  {
9416
9416
  draggable: !0,
9417
- onDragStart: (b) => c(b, p),
9417
+ onDragStart: (b) => c(b, f),
9418
9418
  onDragOver: i,
9419
- onDrop: (b) => d(b, p),
9419
+ onDrop: (b) => d(b, f),
9420
9420
  className: "",
9421
9421
  value: y.id,
9422
9422
  children: [
9423
- f(t, y),
9423
+ p(t, y),
9424
9424
  /* @__PURE__ */ e(
9425
9425
  sa,
9426
9426
  {
@@ -9465,27 +9465,27 @@ function Wu() {
9465
9465
  ] }) });
9466
9466
  }
9467
9467
  function li() {
9468
- const t = E((p) => p.frame), a = E((p) => p.card), n = E((p) => p.isSqlRunning), r = E((p) => p.isDevMode), { setFrame: l, setActiveTabCardId: o, setCard: c, setIsDevMode: i, setRunSql: d } = se(), { data: u, isLoading: h, isFetching: m } = Fe(a);
9469
- function g(p) {
9470
- const b = t.cards.find((v) => v.id === p);
9468
+ const t = M((f) => f.frame), a = M((f) => f.card), n = M((f) => f.isSqlRunning), r = M((f) => f.isDevMode), { setFrame: l, setActiveTabCardId: o, setCard: c, setIsDevMode: i, setRunSql: d } = se(), { data: u, isLoading: h, isFetching: m } = Fe(a);
9469
+ function g(f) {
9470
+ const b = t.cards.find((v) => v.id === f);
9471
9471
  if (b != null && b.sql) {
9472
- r || i(!0), o(p);
9472
+ r || i(!0), o(f);
9473
9473
  return;
9474
9474
  }
9475
9475
  if (b != null && b.queryConfig) {
9476
- r && i(!1), f(p), o(p);
9476
+ r && i(!1), p(f), o(f);
9477
9477
  return;
9478
9478
  }
9479
- r || f(p), o(p);
9479
+ r || p(f), o(f);
9480
9480
  }
9481
- function f(p) {
9481
+ function p(f) {
9482
9482
  const b = {
9483
9483
  ...t,
9484
9484
  cards: t.cards.map((N) => N.id === a.id ? a : N),
9485
- activeCardId: p
9485
+ activeCardId: f
9486
9486
  };
9487
9487
  l(b);
9488
- const v = b.cards.find((N) => N.id === p);
9488
+ const v = b.cards.find((N) => N.id === f);
9489
9489
  v.sql && d(!0), c(v);
9490
9490
  }
9491
9491
  function y() {
@@ -9505,7 +9505,7 @@ function li() {
9505
9505
  value: t.activeCardId,
9506
9506
  className: "flex grow flex-col",
9507
9507
  children: [
9508
- t.cards.map((p) => /* @__PURE__ */ e(Et, { className: "mt-0 grow", value: p.id, children: y() }, p.id)),
9508
+ t.cards.map((f) => /* @__PURE__ */ e(Et, { className: "mt-0 grow", value: f.id, children: y() }, f.id)),
9509
9509
  /* @__PURE__ */ e(Wu, {})
9510
9510
  ]
9511
9511
  }
@@ -9514,13 +9514,13 @@ function li() {
9514
9514
  function ea({
9515
9515
  children: t
9516
9516
  }) {
9517
- E((N) => N.frame);
9518
- const a = E((N) => N.card), n = E((N) => N.isDevMode), r = E((N) => N.isShowingVisual), l = Y((N) => N.isVisualEditing), o = E((N) => N.pythonStdOut);
9519
- E((N) => N.actions.setRunSql);
9520
- const { setFrame: c, setCard: i, setActiveTabCardId: d, runAssistant: u, setIsDevMode: h } = se(), { data: m, isLoading: g, isFetching: f, errorMessage: y } = Fe(a);
9521
- function p() {
9522
- const N = JSON.stringify(m == null ? void 0 : m.records, null, 2), w = new Blob([N], { type: "application/json" }), z = URL.createObjectURL(w), M = document.createElement("a");
9523
- M.href = z, M.download = `${a.title}.json`, M.click();
9517
+ M((N) => N.frame);
9518
+ const a = M((N) => N.card), n = M((N) => N.isDevMode), r = M((N) => N.isShowingVisual), l = Y((N) => N.isVisualEditing), o = M((N) => N.pythonStdOut);
9519
+ M((N) => N.actions.setRunSql);
9520
+ const { setFrame: c, setCard: i, setActiveTabCardId: d, runAssistant: u, setIsDevMode: h } = se(), { data: m, isLoading: g, isFetching: p, errorMessage: y } = Fe(a);
9521
+ function f() {
9522
+ const N = JSON.stringify(m == null ? void 0 : m.records, null, 2), w = new Blob([N], { type: "application/json" }), z = URL.createObjectURL(w), E = document.createElement("a");
9523
+ E.href = z, E.download = `${a.title}.json`, E.click();
9524
9524
  }
9525
9525
  function b() {
9526
9526
  const w = [
@@ -9529,8 +9529,8 @@ function ea({
9529
9529
  ).join(","),
9530
9530
  ...((m == null ? void 0 : m.records) || []).map((C) => Object.values(C).join(","))
9531
9531
  ].join(`
9532
- `), z = new Blob([w], { type: "text/csv" }), M = URL.createObjectURL(z), S = document.createElement("a");
9533
- S.href = M, S.download = `${a.title}.csv`, S.click();
9532
+ `), z = new Blob([w], { type: "text/csv" }), E = URL.createObjectURL(z), S = document.createElement("a");
9533
+ S.href = E, S.download = `${a.title}.csv`, S.click();
9534
9534
  }
9535
9535
  function v() {
9536
9536
  const N = `Can you get the documentation for ${a.type} chart?`;
@@ -9541,7 +9541,7 @@ function ea({
9541
9541
  {
9542
9542
  className: "relative isolate flex h-full flex-col py-2 pb-3",
9543
9543
  children: [
9544
- (g || f) && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto flex h-10 w-10 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ e(Me, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }),
9544
+ (g || p) && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto flex h-10 w-10 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ e(Me, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }),
9545
9545
  /* @__PURE__ */ s(
9546
9546
  "div",
9547
9547
  {
@@ -9569,7 +9569,7 @@ function ea({
9569
9569
  className: "h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70",
9570
9570
  variant: "ghost",
9571
9571
  size: "icon",
9572
- onClick: p,
9572
+ onClick: f,
9573
9573
  children: /* @__PURE__ */ e(Vc, { strokeWidth: 1.5, className: "size-4" })
9574
9574
  }
9575
9575
  ),
@@ -9630,7 +9630,7 @@ function ea({
9630
9630
  ) : /* @__PURE__ */ e(ne, { children: "No Active Card" });
9631
9631
  }
9632
9632
  function Yu() {
9633
- const t = E((n) => n.pythonStdOut);
9633
+ const t = M((n) => n.pythonStdOut);
9634
9634
  if (!t) return null;
9635
9635
  const a = t.replace(/\n/g, "<br>");
9636
9636
  return /* @__PURE__ */ s("div", { className: "relative flex w-full flex-col border-r", children: [
@@ -9642,7 +9642,7 @@ function Yu() {
9642
9642
  ] });
9643
9643
  }
9644
9644
  function Qu() {
9645
- const t = E((n) => n.isShowingVisual), a = E(
9645
+ const t = M((n) => n.isShowingVisual), a = M(
9646
9646
  (n) => n.actions.setIsShowingVisual
9647
9647
  );
9648
9648
  return /* @__PURE__ */ s("div", { className: "flex items-center space-x-2", children: [
@@ -9659,12 +9659,12 @@ function Qu() {
9659
9659
  ] });
9660
9660
  }
9661
9661
  function Zu() {
9662
- var p, b;
9663
- const t = E(
9662
+ var f, b;
9663
+ const t = M(
9664
9664
  (v) => v.card.customCardPreferences
9665
- ), { data: a } = Vs(), n = (a == null ? void 0 : a.plugins) || [], r = E((v) => v.card), l = E((v) => v.frame), o = (t == null ? void 0 : t.visualType) || "single", { setCustomCardPreferences: c } = se(), { components: i, manifest: d } = bs(
9665
+ ), { data: a } = Vs(), n = (a == null ? void 0 : a.plugins) || [], r = M((v) => v.card), l = M((v) => v.frame), o = (t == null ? void 0 : t.visualType) || "single", { setCustomCardPreferences: c } = se(), { components: i, manifest: d } = bs(
9666
9666
  (t == null ? void 0 : t.url) || ""
9667
- ), u = (p = d == null ? void 0 : d.visuals) == null ? void 0 : p.find(
9667
+ ), u = (f = d == null ? void 0 : d.visuals) == null ? void 0 : f.find(
9668
9668
  (v) => v.name === (t == null ? void 0 : t.componentName)
9669
9669
  );
9670
9670
  function h(v, N) {
@@ -9683,21 +9683,21 @@ function Zu() {
9683
9683
  }
9684
9684
  function m(v) {
9685
9685
  var w, z;
9686
- const N = (w = l == null ? void 0 : l.cards) == null ? void 0 : w.filter((M) => {
9686
+ const N = (w = l == null ? void 0 : l.cards) == null ? void 0 : w.filter((E) => {
9687
9687
  var S;
9688
- return ((S = M == null ? void 0 : M.customCardPreferences) == null ? void 0 : S.visualType) !== "multiple";
9689
- }).map((M) => ({
9690
- value: M.id,
9691
- label: M.tabTitle || M.title
9688
+ return ((S = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : S.visualType) !== "multiple";
9689
+ }).map((E) => ({
9690
+ value: E.id,
9691
+ label: E.tabTitle || E.title
9692
9692
  }));
9693
- return /* @__PURE__ */ e("div", { className: "space-y-2", children: (z = v == null ? void 0 : v.dataInputs) == null ? void 0 : z.map((M, S) => {
9693
+ return /* @__PURE__ */ e("div", { className: "space-y-2", children: (z = v == null ? void 0 : v.dataInputs) == null ? void 0 : z.map((E, S) => {
9694
9694
  var C, T;
9695
9695
  return /* @__PURE__ */ s(
9696
9696
  "div",
9697
9697
  {
9698
9698
  className: "grid grid-cols-10 gap-2",
9699
9699
  children: [
9700
- /* @__PURE__ */ e("div", { className: "col-span-4 flex items-center", children: M }),
9700
+ /* @__PURE__ */ e("div", { className: "col-span-4 flex items-center", children: E }),
9701
9701
  /* @__PURE__ */ e(
9702
9702
  We,
9703
9703
  {
@@ -9715,12 +9715,12 @@ function Zu() {
9715
9715
  }) });
9716
9716
  }
9717
9717
  function g(v, N, w = [], z = "") {
9718
- var M, S;
9718
+ var E, S;
9719
9719
  return t ? v === "input" ? /* @__PURE__ */ e(
9720
9720
  je,
9721
9721
  {
9722
9722
  className: `h-8 w-full ${St}`,
9723
- value: ((M = t == null ? void 0 : t.settings) == null ? void 0 : M[N]) || z,
9723
+ value: ((E = t == null ? void 0 : t.settings) == null ? void 0 : E[N]) || z,
9724
9724
  onChange: (C) => {
9725
9725
  c({
9726
9726
  ...t,
@@ -9748,7 +9748,7 @@ function Zu() {
9748
9748
  }
9749
9749
  ) : null : null;
9750
9750
  }
9751
- function f(v) {
9751
+ function p(v) {
9752
9752
  const N = Object.entries((v == null ? void 0 : v.settings) || {});
9753
9753
  return /* @__PURE__ */ e("div", { className: "space-y-3", children: N.map(([w, z]) => /* @__PURE__ */ s("div", { className: "space-y-1", children: [
9754
9754
  /* @__PURE__ */ e(Q, { children: z.title }),
@@ -9835,7 +9835,7 @@ function Zu() {
9835
9835
  /* @__PURE__ */ e(Q, { children: "Input Mapping" }),
9836
9836
  /* @__PURE__ */ e("div", { className: "px-2", children: m(u) })
9837
9837
  ] }),
9838
- u && u.settings && /* @__PURE__ */ e("div", { className: "space-y-3", children: /* @__PURE__ */ e("div", { className: "px-2", children: f(u) }) })
9838
+ u && u.settings && /* @__PURE__ */ e("div", { className: "space-y-3", children: /* @__PURE__ */ e("div", { className: "px-2", children: p(u) }) })
9839
9839
  ] })
9840
9840
  ] })
9841
9841
  ]
@@ -9843,12 +9843,12 @@ function Zu() {
9843
9843
  );
9844
9844
  }
9845
9845
  function en() {
9846
- const [t, a] = P([]), n = E((u) => u.card.preferences), { setFilterOnClickColumnIndex: r, setCardPreferences: l } = E(
9846
+ const [t, a] = P([]), n = M((u) => u.card.preferences), { setFilterOnClickColumnIndex: r, setCardPreferences: l } = M(
9847
9847
  (u) => u.actions
9848
- ), o = E(
9848
+ ), o = M(
9849
9849
  (u) => u.queryResultColumns
9850
9850
  );
9851
- E(
9851
+ M(
9852
9852
  (u) => {
9853
9853
  var h;
9854
9854
  return (h = u.card.preferences) == null ? void 0 : h.filterOnClickColumnIndex;
@@ -9878,31 +9878,31 @@ function en() {
9878
9878
  }) : (l({
9879
9879
  ...n,
9880
9880
  onClickFilter: (g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.filter(
9881
- (f) => f.columnIndex !== u
9881
+ (p) => p.columnIndex !== u
9882
9882
  )
9883
- }), a((f) => {
9884
- const y = [...f];
9883
+ }), a((p) => {
9884
+ const y = [...p];
9885
9885
  return y[u] = !1, y;
9886
9886
  }));
9887
9887
  }
9888
9888
  function i(u, h) {
9889
9889
  var g;
9890
- const m = (g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.map((f) => f.columnIndex === u ? {
9891
- ...f,
9890
+ const m = (g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.map((p) => p.columnIndex === u ? {
9891
+ ...p,
9892
9892
  expression: h.target.value
9893
- } : f);
9893
+ } : p);
9894
9894
  l({
9895
9895
  ...n,
9896
9896
  onClickFilter: m
9897
9897
  });
9898
9898
  }
9899
9899
  function d(u) {
9900
- var h, m, g, f;
9900
+ var h, m, g, p;
9901
9901
  if (t != null && t[u] || (m = (h = n == null ? void 0 : n.onClickFilter) == null ? void 0 : h.find((y) => y.columnIndex === u)) != null && m.expression)
9902
9902
  return /* @__PURE__ */ e(
9903
9903
  je,
9904
9904
  {
9905
- value: (f = (g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.find((y) => y.columnIndex === u)) == null ? void 0 : f.expression,
9905
+ value: (p = (g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.find((y) => y.columnIndex === u)) == null ? void 0 : p.expression,
9906
9906
  onChange: (y) => i(u, y),
9907
9907
  type: "text",
9908
9908
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
@@ -9924,9 +9924,9 @@ function en() {
9924
9924
  va,
9925
9925
  {
9926
9926
  checked: !!((m = n == null ? void 0 : n.onClickFilter) != null && m.find(
9927
- (f) => f.columnIndex === h
9927
+ (p) => p.columnIndex === h
9928
9928
  )),
9929
- onCheckedChange: (f) => c(h, f)
9929
+ onCheckedChange: (p) => c(h, p)
9930
9930
  }
9931
9931
  ),
9932
9932
  /* @__PURE__ */ e(
@@ -9937,14 +9937,14 @@ function en() {
9937
9937
  }
9938
9938
  ),
9939
9939
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: ((g = n == null ? void 0 : n.onClickFilter) == null ? void 0 : g.find(
9940
- (f) => f.columnIndex === h
9940
+ (p) => p.columnIndex === h
9941
9941
  )) && /* @__PURE__ */ e(
9942
9942
  Wr,
9943
9943
  {
9944
9944
  onClick: () => {
9945
- a((f) => {
9946
- const y = [...f];
9947
- return y[h] = !f[h], y;
9945
+ a((p) => {
9946
+ const y = [...p];
9947
+ return y[h] = !p[h], y;
9948
9948
  });
9949
9949
  },
9950
9950
  className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
@@ -9961,15 +9961,15 @@ function en() {
9961
9961
  }
9962
9962
  function Xu({ idx: t }) {
9963
9963
  var i;
9964
- const a = E((d) => {
9964
+ const a = M((d) => {
9965
9965
  var u;
9966
9966
  return (u = d.card) == null ? void 0 : u.preferences;
9967
- }), n = E(
9967
+ }), n = M(
9968
9968
  (d) => {
9969
9969
  var u;
9970
9970
  return (u = d.card.preferences) == null ? void 0 : u.datasetOptions;
9971
9971
  }
9972
- ), r = E(
9972
+ ), r = M(
9973
9973
  (d) => d.actions.setCardPreferences
9974
9974
  ), l = (i = a == null ? void 0 : a.chartOptions) == null ? void 0 : i.indexAxis, o = n == null ? void 0 : n.find((d) => d.idx === t);
9975
9975
  function c(d, u) {
@@ -9995,7 +9995,7 @@ function Xu({ idx: t }) {
9995
9995
  const m = { ...o };
9996
9996
  m.datalabels = h;
9997
9997
  const g = n == null ? void 0 : n.map(
9998
- (f) => f.idx === u ? m : f
9998
+ (p) => p.idx === u ? m : p
9999
9999
  );
10000
10000
  r({
10001
10001
  ...a,
@@ -10063,7 +10063,7 @@ function Xu({ idx: t }) {
10063
10063
  ] });
10064
10064
  }
10065
10065
  function em() {
10066
- const t = E((o) => o.card), { data: a } = Fe(t), { keys: n } = Ha((a == null ? void 0 : a.records) || []), r = n.slice(1).filter((o) => !Mo.includes(o));
10066
+ const t = M((o) => o.card), { data: a } = Fe(t), { keys: n } = Ha((a == null ? void 0 : a.records) || []), r = n.slice(1).filter((o) => !Mo.includes(o));
10067
10067
  let l = r;
10068
10068
  if (["stackedBar", "stackedLine"].includes(t.type)) {
10069
10069
  const o = Eo({
@@ -10101,7 +10101,7 @@ function Gs({
10101
10101
  ] }) });
10102
10102
  }
10103
10103
  function ii() {
10104
- const t = E((d) => d.card), a = E(
10104
+ const t = M((d) => d.card), a = M(
10105
10105
  (d) => {
10106
10106
  var u, h, m;
10107
10107
  return (m = (h = (u = d == null ? void 0 : d.card) == null ? void 0 : u.preferences) == null ? void 0 : h.chartOptions) == null ? void 0 : m.indexAxis;
@@ -10145,15 +10145,15 @@ function ci({
10145
10145
  iconClassName: r,
10146
10146
  children: l
10147
10147
  }) {
10148
- const o = E((h) => {
10148
+ const o = M((h) => {
10149
10149
  var m;
10150
10150
  return (m = h.card) == null ? void 0 : m.preferences;
10151
- }), c = E(
10151
+ }), c = M(
10152
10152
  (h) => {
10153
10153
  var m, g;
10154
10154
  return (g = (m = h.card) == null ? void 0 : m.preferences) == null ? void 0 : g.datasetOptions;
10155
10155
  }
10156
- ), i = c == null ? void 0 : c.find((h) => h.idx === a), { setCardPreferences: d } = E((h) => h.actions);
10156
+ ), i = c == null ? void 0 : c.find((h) => h.idx === a), { setCardPreferences: d } = M((h) => h.actions);
10157
10157
  function u(h) {
10158
10158
  if (!i)
10159
10159
  d({
@@ -10171,7 +10171,7 @@ function ci({
10171
10171
  const m = { ...i };
10172
10172
  m.type = h === "area" ? "line" : h, m.fill = h === "area" ? "origin" : "";
10173
10173
  const g = c == null ? void 0 : c.map(
10174
- (f) => f.idx === a ? m : f
10174
+ (p) => p.idx === a ? m : p
10175
10175
  );
10176
10176
  d({
10177
10177
  ...o,
@@ -10226,20 +10226,20 @@ function ci({
10226
10226
  );
10227
10227
  }
10228
10228
  function di() {
10229
- const t = E((f) => f.selectedConnectionId), a = E((f) => f.selectedDatamodelId), n = E((f) => f.selectedDatabaseName), r = E((f) => f.selectedSchemaName), l = E((f) => f.selectedTableName), o = Y((f) => f.dashboard.filters) || [], c = Y((f) => f.actions.addFilter), i = Y((f) => f.actions.removeFilter), { removeFilterValues: d } = yt(), { modelItems: u, tableName: h, connectionType: m } = ot();
10230
- function g(f, y = "dashboard") {
10229
+ const t = M((p) => p.selectedConnectionId), a = M((p) => p.selectedDatamodelId), n = M((p) => p.selectedDatabaseName), r = M((p) => p.selectedSchemaName), l = M((p) => p.selectedTableName), o = Y((p) => p.dashboard.filters) || [], c = Y((p) => p.actions.addFilter), i = Y((p) => p.actions.removeFilter), { removeFilterValues: d } = yt(), { modelItems: u, tableName: h, connectionType: m } = ot();
10230
+ function g(p, y = "dashboard") {
10231
10231
  var C;
10232
- const p = Xe(f.column_name), b = Xe(n || ""), v = Xe(r || ""), N = Xe(h);
10232
+ const f = Xe(p.column_name), b = Xe(n || ""), v = Xe(r || ""), N = Xe(h);
10233
10233
  let w = Oo({
10234
10234
  schemaName: v,
10235
10235
  tableName: N,
10236
10236
  connectionType: m,
10237
10237
  databaseName: b
10238
- }), z = `${w}.${p}`;
10239
- const M = (C = u == null ? void 0 : u.find(
10238
+ }), z = `${w}.${f}`;
10239
+ const E = (C = u == null ? void 0 : u.find(
10240
10240
  (T) => T.id === a
10241
10241
  )) == null ? void 0 : C.name;
10242
- a && a !== "none" && (z = `${lr}.${M}.${p}`, w = `${lr}.${M}`);
10242
+ a && a !== "none" && (z = `${lr}.${E}.${f}`, w = `${lr}.${E}`);
10243
10243
  const S = o == null ? void 0 : o.find(
10244
10244
  (T) => T.column === z && T.table === N && (T.database === b || T.database === n)
10245
10245
  );
@@ -10252,17 +10252,17 @@ function di() {
10252
10252
  id: T,
10253
10253
  //uuidv4(),
10254
10254
  column: z,
10255
- title: f.column_name,
10256
- dataType: f.data_type,
10255
+ title: p.column_name,
10256
+ dataType: p.data_type,
10257
10257
  table: "api",
10258
10258
  database: "",
10259
10259
  // database: 'NA',
10260
10260
  connectionId: t,
10261
10261
  operation: "in",
10262
10262
  sql: Ga(
10263
- f.data_type,
10263
+ p.data_type,
10264
10264
  w,
10265
- p
10265
+ f
10266
10266
  )
10267
10267
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
10268
10268
  }), T) : (c({
@@ -10271,16 +10271,16 @@ function di() {
10271
10271
  location: y,
10272
10272
  column: z,
10273
10273
  //columnName, //`${qualifiedTableName}.${formattedColumnName}`,
10274
- title: f.column_name,
10275
- dataType: f.data_type,
10274
+ title: p.column_name,
10275
+ dataType: p.data_type,
10276
10276
  table: l || "",
10277
10277
  database: n || "",
10278
10278
  connectionId: t || "",
10279
10279
  operation: "in",
10280
10280
  sql: Ga(
10281
- f.data_type,
10281
+ p.data_type,
10282
10282
  w,
10283
- p
10283
+ f
10284
10284
  )
10285
10285
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
10286
10286
  }), T);
@@ -10291,7 +10291,7 @@ function di() {
10291
10291
  function vn() {
10292
10292
  const t = Y(
10293
10293
  (i) => i.dashboard.filters
10294
- ), a = E((i) => i.frame), { setFrame: n } = se(), { columns: r } = ot(), { assignFilter: l } = di();
10294
+ ), a = M((i) => i.frame), { setFrame: n } = se(), { columns: r } = ot(), { assignFilter: l } = di();
10295
10295
  function o(i) {
10296
10296
  const d = l(i, "frame");
10297
10297
  n({ ...a, filterId: d });
@@ -10398,7 +10398,7 @@ function nm({
10398
10398
  ] }) });
10399
10399
  }
10400
10400
  function Ia() {
10401
- const t = E((i) => i.card.type), a = E((i) => i.isDevMode), n = E((i) => i.card.preferences), { setCardPreferences: r } = E((i) => i.actions);
10401
+ const t = M((i) => i.card.type), a = M((i) => i.isDevMode), n = M((i) => i.card.preferences), { setCardPreferences: r } = M((i) => i.actions);
10402
10402
  function l(i) {
10403
10403
  var h;
10404
10404
  const d = {
@@ -10537,7 +10537,7 @@ const sm = {
10537
10537
  ]
10538
10538
  };
10539
10539
  function lm() {
10540
- const t = E((a) => a.card.type);
10540
+ const t = M((a) => a.card.type);
10541
10541
  return /* @__PURE__ */ s("div", { className: "space-y-6 p-6", children: [
10542
10542
  /* @__PURE__ */ e(
10543
10543
  xt,
@@ -10805,8 +10805,8 @@ const cm = [
10805
10805
  value: t
10806
10806
  }));
10807
10807
  function mm() {
10808
- var d, u, h, m, g, f, y, p, b, v, N, w, z, M, S, C, T, k;
10809
- const t = E((R) => R.card), a = (u = (d = t == null ? void 0 : t.preferences) == null ? void 0 : d.mapVisualOptions) == null ? void 0 : u.topoJsonUrl, [n, r] = P(
10808
+ var d, u, h, m, g, p, y, f, b, v, N, w, z, E, S, C, T, k;
10809
+ const t = M((R) => R.card), a = (u = (d = t == null ? void 0 : t.preferences) == null ? void 0 : d.mapVisualOptions) == null ? void 0 : u.topoJsonUrl, [n, r] = P(
10810
10810
  ((m = (h = t == null ? void 0 : t.preferences) == null ? void 0 : h.mapVisualOptions) == null ? void 0 : m.customTopoJsonUrl) || ""
10811
10811
  ), { setCardPreferences: l } = se(), { data: o } = Ns(t), c = Object.keys((o == null ? void 0 : o.objects) || {}).map((R) => ({
10812
10812
  label: R,
@@ -10876,7 +10876,7 @@ function mm() {
10876
10876
  {
10877
10877
  className: "h-9",
10878
10878
  options: c,
10879
- value: ((f = (g = t.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : f.objectKey) || "",
10879
+ value: ((p = (g = t.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : p.objectKey) || "",
10880
10880
  label: "Map Object",
10881
10881
  onValueChange: (R) => {
10882
10882
  var D;
@@ -10898,7 +10898,7 @@ function mm() {
10898
10898
  {
10899
10899
  className: "h-9",
10900
10900
  options: cm,
10901
- value: ((p = (y = t.preferences) == null ? void 0 : y.mapVisualOptions) == null ? void 0 : p.projection) || "",
10901
+ value: ((f = (y = t.preferences) == null ? void 0 : y.mapVisualOptions) == null ? void 0 : f.projection) || "",
10902
10902
  label: "Projection",
10903
10903
  onValueChange: (R) => {
10904
10904
  var D;
@@ -10965,7 +10965,7 @@ function mm() {
10965
10965
  className: `h-9 w-full ${St}`,
10966
10966
  type: "number",
10967
10967
  step: 10,
10968
- value: ((S = (M = (z = t.preferences) == null ? void 0 : z.mapVisualOptions) == null ? void 0 : M.projectionOffset) == null ? void 0 : S[0]) || 0,
10968
+ value: ((S = (E = (z = t.preferences) == null ? void 0 : z.mapVisualOptions) == null ? void 0 : E.projectionOffset) == null ? void 0 : S[0]) || 0,
10969
10969
  onChange: (R) => {
10970
10970
  var D, F, I, A;
10971
10971
  l({
@@ -11011,7 +11011,7 @@ function mm() {
11011
11011
  }
11012
11012
  function hm() {
11013
11013
  var r;
11014
- const t = E((l) => l.card.preferences), { setCardPreferences: a } = E((l) => l.actions);
11014
+ const t = M((l) => l.card.preferences), { setCardPreferences: a } = M((l) => l.actions);
11015
11015
  function n(l) {
11016
11016
  a({
11017
11017
  ...t,
@@ -11089,7 +11089,7 @@ function ta({
11089
11089
  ] }) });
11090
11090
  }
11091
11091
  function pm() {
11092
- const t = E(
11092
+ const t = M(
11093
11093
  (r) => {
11094
11094
  var l, o;
11095
11095
  return (o = (l = r == null ? void 0 : r.card) == null ? void 0 : l.preferences) == null ? void 0 : o.sortChart;
@@ -11171,10 +11171,10 @@ function fm({
11171
11171
  cardType: t = "table"
11172
11172
  }) {
11173
11173
  console.log("cardType", t);
11174
- const a = E((l) => {
11174
+ const a = M((l) => {
11175
11175
  var o;
11176
11176
  return (o = l.card) == null ? void 0 : o.preferences;
11177
- }), n = E(
11177
+ }), n = M(
11178
11178
  (l) => l.actions.setCardPreferences
11179
11179
  );
11180
11180
  return /* @__PURE__ */ s("div", { className: "space-y-6 px-6 py-2", children: [
@@ -11253,7 +11253,7 @@ const gm = /* @__PURE__ */ s("div", { className: "space-y-4 font-mono text-xs",
11253
11253
  ] })
11254
11254
  ] });
11255
11255
  function xm() {
11256
- const t = E((n) => n.card.type);
11256
+ const t = M((n) => n.card.type);
11257
11257
  function a(n) {
11258
11258
  switch (n) {
11259
11259
  case "stackedBar":
@@ -11478,7 +11478,7 @@ function Sm({
11478
11478
  function mi({
11479
11479
  column: t
11480
11480
  }) {
11481
- const a = E((d) => d.card.type), n = E(
11481
+ const a = M((d) => d.card.type), n = M(
11482
11482
  (d) => {
11483
11483
  var u, h;
11484
11484
  return (h = (u = d.card) == null ? void 0 : u.config) == null ? void 0 : h.metricColumns;
@@ -11515,12 +11515,12 @@ function km({
11515
11515
  listeners: h,
11516
11516
  setNodeRef: m,
11517
11517
  transform: g,
11518
- transition: f,
11518
+ transition: p,
11519
11519
  isDragging: y
11520
- } = yn({ id: t.id, data: { type: a } }), p = g ? {
11520
+ } = yn({ id: t.id, data: { type: a } }), f = g ? {
11521
11521
  opacity: y ? 0.5 : void 0,
11522
11522
  transform: At.Translate.toString(g),
11523
- transition: f
11523
+ transition: p
11524
11524
  } : void 0, b = ut(t.type);
11525
11525
  function v(S) {
11526
11526
  const C = Ht(S.data_type), T = ut(S.data_type), k = mt(S.data_type), R = C ? "number" : T ? "string" : k ? "date" : "string";
@@ -11621,7 +11621,7 @@ function km({
11621
11621
  }
11622
11622
  );
11623
11623
  }
11624
- function M() {
11624
+ function E() {
11625
11625
  return /* @__PURE__ */ e("div", { "data-setting-actions": "", className: "flex h-full items-center gap-2", children: /* @__PURE__ */ e(
11626
11626
  "button",
11627
11627
  {
@@ -11645,10 +11645,10 @@ function km({
11645
11645
  }
11646
11646
  ) });
11647
11647
  }
11648
- return /* @__PURE__ */ e("div", { ...h, ...u, ref: m, style: p, children: /* @__PURE__ */ s("div", { className: "group flex items-center justify-between gap-2", children: [
11648
+ return /* @__PURE__ */ e("div", { ...h, ...u, ref: m, style: f, children: /* @__PURE__ */ s("div", { className: "group flex items-center justify-between gap-2", children: [
11649
11649
  /* @__PURE__ */ s("div", { className: "grow", children: [
11650
11650
  /* @__PURE__ */ s("div", { className: "flex h-8 grow items-center justify-between rounded-md bg-muted", children: [
11651
- M(),
11651
+ E(),
11652
11652
  w(),
11653
11653
  z()
11654
11654
  ] }),
@@ -11676,13 +11676,13 @@ function $a({
11676
11676
  sortableType: l,
11677
11677
  onRemoveColumn: o
11678
11678
  }) {
11679
- var p, b;
11679
+ var f, b;
11680
11680
  const { setNodeRef: c, isOver: i, over: d } = Ss({
11681
11681
  id: t
11682
- }), u = Ot((v) => v.activeId), h = E((v) => {
11682
+ }), u = Ot((v) => v.activeId), h = M((v) => {
11683
11683
  var N;
11684
11684
  return (N = v.card) == null ? void 0 : N.type;
11685
- }), m = i || ((b = (p = d == null ? void 0 : d.data) == null ? void 0 : p.current) == null ? void 0 : b.type) === l, g = u ? r : n, f = l === ha ? "Rows" : l === pa ? "Pivot Columns" : "Columns";
11685
+ }), m = i || ((b = (f = d == null ? void 0 : d.data) == null ? void 0 : f.current) == null ? void 0 : b.type) === l, g = u ? r : n, p = l === ha ? "Rows" : l === pa ? "Pivot Columns" : "Columns";
11686
11686
  function y() {
11687
11687
  if (!g || g.length === 0)
11688
11688
  return /* @__PURE__ */ e("div", { className: "mr-5 flex h-8 grow items-center space-x-2 rounded-md border border-dashed border-muted-foreground/80 bg-background px-2 py-1 text-sm text-muted-foreground", children: /* @__PURE__ */ e("span", { className: "invisible text-muted-foreground/70 group-hover:visible", children: "Drag here" }) });
@@ -11699,7 +11699,7 @@ function $a({
11699
11699
  children: [
11700
11700
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between pr-5", children: [
11701
11701
  /* @__PURE__ */ e(Q, { className: "text-sm", children: a }),
11702
- h !== "table" && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground/50", children: f })
11702
+ h !== "table" && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground/50", children: p })
11703
11703
  ] }),
11704
11704
  y(),
11705
11705
  /* @__PURE__ */ e("div", { className: "space-y-2", children: g == null ? void 0 : g.map(
@@ -11737,13 +11737,13 @@ function hi({ children: t, id: a, type: n }) {
11737
11737
  return /* @__PURE__ */ e("div", { ...l, ...r, ref: o, style: u, children: t });
11738
11738
  }
11739
11739
  function Tm() {
11740
- const t = E((v) => {
11740
+ const t = M((v) => {
11741
11741
  var N;
11742
11742
  return (N = v.card.queryConfig) == null ? void 0 : N.orderBy;
11743
- }) || [], a = E((v) => {
11743
+ }) || [], a = M((v) => {
11744
11744
  var N;
11745
11745
  return (N = v.card.queryConfig) == null ? void 0 : N.groupByColumns;
11746
- }) || [], n = E((v) => {
11746
+ }) || [], n = M((v) => {
11747
11747
  var N;
11748
11748
  return (N = v.card.queryConfig) == null ? void 0 : N.metricColumns;
11749
11749
  }) || [], { addOrderByColumn: r, removeOrderByColumn: l, updateOrderByColumn: o } = se(), c = [...a, ...n];
@@ -11754,10 +11754,10 @@ function Tm() {
11754
11754
  value: v.label || v.name
11755
11755
  }));
11756
11756
  function g(v, N) {
11757
- const w = f(v);
11757
+ const w = p(v);
11758
11758
  return w ? w.role === "metric" ? N === "asc" ? u : h : N === "asc" ? i : d : null;
11759
11759
  }
11760
- function f(v) {
11760
+ function p(v) {
11761
11761
  return c.find((N) => N.id === v);
11762
11762
  }
11763
11763
  function y(v) {
@@ -11772,7 +11772,7 @@ function Tm() {
11772
11772
  o(w);
11773
11773
  }
11774
11774
  }
11775
- const p = (v) => {
11775
+ const f = (v) => {
11776
11776
  r({
11777
11777
  columnId: v.id,
11778
11778
  direction: "asc"
@@ -11796,7 +11796,7 @@ function Tm() {
11796
11796
  multiple: !1,
11797
11797
  options: m,
11798
11798
  selectedOptions: [],
11799
- onChange: (v) => p(v[0]),
11799
+ onChange: (v) => f(v[0]),
11800
11800
  selectAllChecked: !1,
11801
11801
  onSelectAllCheckedChange: () => {
11802
11802
  },
@@ -11818,7 +11818,7 @@ function Tm() {
11818
11818
  /* @__PURE__ */ s("div", { className: "flex h-full grow items-center justify-between gap-2 rounded-sm bg-muted px-2", children: [
11819
11819
  /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
11820
11820
  /* @__PURE__ */ e(Sl, { className: "size-3 cursor-move text-muted-foreground hover:text-foreground" }),
11821
- /* @__PURE__ */ e(Gs, { className: "w-[175px] text-sm", children: ((N = f(v.columnId)) == null ? void 0 : N.label) || ((w = f(v.columnId)) == null ? void 0 : w.name) })
11821
+ /* @__PURE__ */ e(Gs, { className: "w-[175px] text-sm", children: ((N = p(v.columnId)) == null ? void 0 : N.label) || ((w = p(v.columnId)) == null ? void 0 : w.name) })
11822
11822
  ] }),
11823
11823
  /* @__PURE__ */ e(
11824
11824
  "button",
@@ -11851,21 +11851,21 @@ function Tm() {
11851
11851
  );
11852
11852
  }
11853
11853
  function Mm() {
11854
- const t = E(
11854
+ const t = M(
11855
11855
  (b) => {
11856
11856
  var v;
11857
11857
  return ((v = b.card.queryConfig) == null ? void 0 : v.groupByColumns) || [];
11858
11858
  }
11859
- ), a = E((b) => b.card.type), n = Ot(
11859
+ ), a = M((b) => b.card.type), n = Ot(
11860
11860
  (b) => b.previewGroupByColumns
11861
- ), r = E(
11861
+ ), r = M(
11862
11862
  (b) => {
11863
11863
  var v;
11864
11864
  return ((v = b.card.queryConfig) == null ? void 0 : v.metricColumns) || [];
11865
11865
  }
11866
11866
  ), l = Ot(
11867
11867
  (b) => b.previewMetricColumns
11868
- ), o = E(
11868
+ ), o = M(
11869
11869
  (b) => {
11870
11870
  var v;
11871
11871
  return ((v = b.card.queryConfig) == null ? void 0 : v.pivotColumns) || [];
@@ -11887,8 +11887,8 @@ function Mm() {
11887
11887
  function g(b) {
11888
11888
  u(b);
11889
11889
  }
11890
- let f = "Group By", y = "Metrics", p = "Stack By";
11891
- return a === "table" && (f = "Rows", y = "Metrics", p = "Columns"), /* @__PURE__ */ s("div", { className: "flex h-full w-full flex-col gap-3 py-4", children: [
11890
+ let p = "Group By", y = "Metrics", f = "Stack By";
11891
+ return a === "table" && (p = "Rows", y = "Metrics", f = "Columns"), /* @__PURE__ */ s("div", { className: "flex h-full w-full flex-col gap-3 py-4", children: [
11892
11892
  /* @__PURE__ */ e(ai, { iconClassName: "size-[19px]" }),
11893
11893
  /* @__PURE__ */ s(Yn, { className: "flex min-h-0 grow basis-0 flex-col gap-4 overflow-y-auto", children: [
11894
11894
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-4 p-4", children: [
@@ -11898,7 +11898,7 @@ function Mm() {
11898
11898
  onRemoveColumn: h,
11899
11899
  sortableType: ha,
11900
11900
  id: Bt,
11901
- label: f,
11901
+ label: p,
11902
11902
  columns: t,
11903
11903
  previewColumns: n
11904
11904
  }
@@ -11909,7 +11909,7 @@ function Mm() {
11909
11909
  onRemoveColumn: g,
11910
11910
  sortableType: pa,
11911
11911
  id: qt,
11912
- label: p,
11912
+ label: f,
11913
11913
  columns: o,
11914
11914
  previewColumns: c
11915
11915
  }
@@ -11938,10 +11938,10 @@ function Hs({
11938
11938
  sortableType: r,
11939
11939
  className: l
11940
11940
  }) {
11941
- const [o, c] = P(!1), { removeEditorFilter: i, clearEditorFilter: d } = se(), u = E(
11941
+ const [o, c] = P(!1), { removeEditorFilter: i, clearEditorFilter: d } = se(), u = M(
11942
11942
  (m) => {
11943
- var g, f;
11944
- return (f = (g = m.card.queryConfig) == null ? void 0 : g.filters) == null ? void 0 : f.some(
11943
+ var g, p;
11944
+ return (p = (g = m.card.queryConfig) == null ? void 0 : g.filters) == null ? void 0 : p.some(
11945
11945
  (y) => y.filterColumnName === a.name
11946
11946
  );
11947
11947
  }
@@ -12004,15 +12004,15 @@ function Em({
12004
12004
  column: t,
12005
12005
  sortableType: a
12006
12006
  }) {
12007
- const n = Y((w) => w.themeStyle), r = E(
12007
+ const n = Y((w) => w.themeStyle), r = M(
12008
12008
  (w) => {
12009
- var z, M;
12010
- return (M = (z = w.card) == null ? void 0 : z.queryConfig) == null ? void 0 : M.filters;
12009
+ var z, E;
12010
+ return (E = (z = w.card) == null ? void 0 : z.queryConfig) == null ? void 0 : E.filters;
12011
12011
  }
12012
- ), l = E(
12012
+ ), l = M(
12013
12013
  (w) => {
12014
- var z, M;
12015
- return (M = (z = w.card.queryConfig) == null ? void 0 : z.filterColumns) == null ? void 0 : M.find(
12014
+ var z, E;
12015
+ return (E = (z = w.card.queryConfig) == null ? void 0 : z.filterColumns) == null ? void 0 : E.find(
12016
12016
  (S) => S.name === t.name
12017
12017
  );
12018
12018
  }
@@ -12035,24 +12035,24 @@ function Em({
12035
12035
  connectionId: o,
12036
12036
  // not needed
12037
12037
  dataType: t.type
12038
- }, { data: g, isLoading: f, isFetching: y, isError: p } = pl(m), b = $e(() => {
12038
+ }, { data: g, isLoading: p, isFetching: y, isError: f } = pl(m), b = $e(() => {
12039
12039
  var z;
12040
- return m.column ? (z = g == null ? void 0 : g.records) == null ? void 0 : z.map((M) => {
12040
+ return m.column ? (z = g == null ? void 0 : g.records) == null ? void 0 : z.map((E) => {
12041
12041
  let S = m.column.split(".").slice(-1)[0].replace(/"/g, "");
12042
- return M[S] === void 0 && (S = S.toLowerCase()), {
12043
- id: M[S],
12042
+ return E[S] === void 0 && (S = S.toLowerCase()), {
12043
+ id: E[S],
12044
12044
  //idx,
12045
- value: M[S]
12045
+ value: E[S]
12046
12046
  // this is needed if
12047
12047
  };
12048
12048
  }) : [];
12049
12049
  }, [g, m.column]);
12050
12050
  function v(w) {
12051
- const z = w.map((M) => M.id);
12051
+ const z = w.map((E) => E.id);
12052
12052
  h(t.name, z);
12053
12053
  }
12054
12054
  function N() {
12055
- return f || y ? /* @__PURE__ */ e(
12055
+ return p || y ? /* @__PURE__ */ e(
12056
12056
  xs,
12057
12057
  {
12058
12058
  style: {
@@ -12060,7 +12060,7 @@ function Em({
12060
12060
  },
12061
12061
  className: "h-8 min-w-60 bg-foreground/10"
12062
12062
  }
12063
- ) : p ? /* @__PURE__ */ e("div", { className: "flex h-8 min-w-60 items-center bg-muted px-2 text-sm", children: "Error" }) : /* @__PURE__ */ e(
12063
+ ) : f ? /* @__PURE__ */ e("div", { className: "flex h-8 min-w-60 items-center bg-muted px-2 text-sm", children: "Error" }) : /* @__PURE__ */ e(
12064
12064
  ws,
12065
12065
  {
12066
12066
  renderFilterModeButton: () => /* @__PURE__ */ e(Om, { columnName: t.name }),
@@ -12086,7 +12086,7 @@ function Em({
12086
12086
  );
12087
12087
  }
12088
12088
  function Om({ columnName: t }) {
12089
- const { setEditorFilterMode: a } = se(), n = E(
12089
+ const { setEditorFilterMode: a } = se(), n = M(
12090
12090
  (l) => {
12091
12091
  var o, c;
12092
12092
  return (c = (o = l.card.queryConfig) == null ? void 0 : o.filterColumns) == null ? void 0 : c.find(
@@ -12125,17 +12125,17 @@ function Am({
12125
12125
  title: "",
12126
12126
  // not needed
12127
12127
  dataType: t.type
12128
- }, { isLoading: d, isFetching: u, isError: h, data: m } = pl(i), g = m == null ? void 0 : m.records, { dateRange: f, setDateRange: y, initialDateRange: p } = Fo(g), { updateEditorFilterValue: b } = se();
12128
+ }, { isLoading: d, isFetching: u, isError: h, data: m } = pl(i), g = m == null ? void 0 : m.records, { dateRange: p, setDateRange: y, initialDateRange: f } = Fo(g), { updateEditorFilterValue: b } = se();
12129
12129
  function v(z) {
12130
12130
  var S, C;
12131
- const M = {
12131
+ const E = {
12132
12132
  gte: (S = z == null ? void 0 : z.from) == null ? void 0 : S.toISOString(),
12133
12133
  lte: (C = z == null ? void 0 : z.to) == null ? void 0 : C.toISOString()
12134
12134
  };
12135
- b(t.name, M);
12135
+ b(t.name, E);
12136
12136
  }
12137
12137
  function N() {
12138
- b(t.name, null, !0), y(p);
12138
+ b(t.name, null, !0), y(f);
12139
12139
  }
12140
12140
  function w() {
12141
12141
  return d || u ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(xs, { className: "h-8 w-72 bg-foreground/10" }) }) : h ? /* @__PURE__ */ e("div", { className: "h-8 w-72 bg-muted px-2", children: "Error" }) : g ? /* @__PURE__ */ e(
@@ -12145,7 +12145,7 @@ function Am({
12145
12145
  open: n,
12146
12146
  inputClassName: "h-8",
12147
12147
  setOpen: r,
12148
- dateRange: f,
12148
+ dateRange: p,
12149
12149
  setDateRange: y,
12150
12150
  onApply: v,
12151
12151
  onClear: N
@@ -12170,14 +12170,14 @@ function Im({
12170
12170
  previewColumns: r,
12171
12171
  sortableType: l
12172
12172
  }) {
12173
- var y, p;
12173
+ var y, f;
12174
12174
  const { setNodeRef: o, isOver: c, over: i } = Ss({
12175
12175
  id: t
12176
12176
  }), d = Ot((b) => b.activeId), u = {
12177
12177
  // borderColor: isOver ? 'green' : undefined,
12178
- }, h = c || ((p = (y = i == null ? void 0 : i.data) == null ? void 0 : y.current) == null ? void 0 : p.type) === l;
12178
+ }, h = c || ((f = (y = i == null ? void 0 : i.data) == null ? void 0 : y.current) == null ? void 0 : f.type) === l;
12179
12179
  function m() {
12180
- if (!f || f.length === 0)
12180
+ if (!p || p.length === 0)
12181
12181
  return /* @__PURE__ */ e("div", { className: "flex h-8 grow items-center space-x-2 rounded-md border border-dashed border-muted-foreground/80 bg-background px-2 py-1 text-sm text-muted-foreground", children: /* @__PURE__ */ e("span", { className: "invisible text-muted-foreground/70 group-hover:visible", children: "Drag here" }) });
12182
12182
  }
12183
12183
  function g(b) {
@@ -12209,7 +12209,7 @@ function Im({
12209
12209
  b.id
12210
12210
  );
12211
12211
  }
12212
- const f = d ? r : n;
12212
+ const p = d ? r : n;
12213
12213
  return /* @__PURE__ */ e(It, { items: n == null ? void 0 : n.map((b) => b.id), children: /* @__PURE__ */ s(
12214
12214
  "div",
12215
12215
  {
@@ -12222,7 +12222,7 @@ function Im({
12222
12222
  children: [
12223
12223
  /* @__PURE__ */ e(Q, { className: "text-sm", children: a }),
12224
12224
  m(),
12225
- /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-4", children: f == null ? void 0 : f.map((b) => g(b)) })
12225
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-4", children: p == null ? void 0 : p.map((b) => g(b)) })
12226
12226
  ]
12227
12227
  }
12228
12228
  ) });
@@ -12231,7 +12231,7 @@ function Rm() {
12231
12231
  return /* @__PURE__ */ e("div", { className: "flex h-8 w-60 items-center space-x-2 rounded-md border border-dashed border-muted-foreground bg-background px-2 py-1 text-sm text-muted-foreground", children: "Drop here" });
12232
12232
  }
12233
12233
  function zm() {
12234
- const t = E(
12234
+ const t = M(
12235
12235
  (l) => {
12236
12236
  var o;
12237
12237
  return ((o = l.card.queryConfig) == null ? void 0 : o.filterColumns) || [];
@@ -12255,7 +12255,7 @@ function zm() {
12255
12255
  ) });
12256
12256
  }
12257
12257
  function Fm() {
12258
- const t = E((o) => o.card), a = E((o) => o.showAIDialog), { setShowAIDialog: n } = se(), { data: r, errorMessage: l } = Fe(t);
12258
+ const t = M((o) => o.card), a = M((o) => o.showAIDialog), { setShowAIDialog: n } = se(), { data: r, errorMessage: l } = Fe(t);
12259
12259
  return /* @__PURE__ */ s("section", { className: "flex justify-between gap-2 p-4", children: [
12260
12260
  /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
12261
12261
  /* @__PURE__ */ e(Oa, {}),
@@ -12281,7 +12281,7 @@ function Fm() {
12281
12281
  ] });
12282
12282
  }
12283
12283
  function Lm() {
12284
- const t = nt(null), a = nt(null), n = E((i) => i.isShowingVisual), r = E((i) => i.showAIDialog), l = E((i) => i.isDevMode);
12284
+ const t = nt(null), a = nt(null), n = M((i) => i.isShowingVisual), r = M((i) => i.showAIDialog), l = M((i) => i.isDevMode);
12285
12285
  Te(() => {
12286
12286
  var i, d, u, h;
12287
12287
  r ? ((i = t.current) == null || i.resize(0), (d = a.current) == null || d.resize(0)) : ((u = t.current) == null || u.resize(25), (h = a.current) == null || h.resize(25));
@@ -12373,23 +12373,23 @@ function Lm() {
12373
12373
  function _m(t) {
12374
12374
  const a = _o(
12375
12375
  (L) => L.currentAIContext
12376
- ), [n, r] = P(""), [l, o] = P(null), { authToken: c } = Ee(), i = E((L) => {
12376
+ ), [n, r] = P(""), [l, o] = P(null), { authToken: c } = Ee(), i = M((L) => {
12377
12377
  var re;
12378
12378
  return (re = L == null ? void 0 : L.card) == null ? void 0 : re.sql;
12379
- }), d = E((L) => L.isDevMode), u = E((L) => {
12379
+ }), d = M((L) => L.isDevMode), u = M((L) => {
12380
12380
  var re;
12381
12381
  return (re = L == null ? void 0 : L.card) == null ? void 0 : re.python;
12382
12382
  }), {
12383
12383
  setCardPython: h,
12384
12384
  setCardSql: m,
12385
12385
  setRunSql: g,
12386
- switchCardType: f,
12386
+ switchCardType: p,
12387
12387
  setQueryConfig: y
12388
- } = se(), p = E((L) => L.currentAssitantScope) || [], b = E((L) => L.userInputForAI), v = E((L) => L.triggerAIRun), N = E((L) => L.card), w = E(
12388
+ } = se(), f = M((L) => L.currentAssitantScope) || [], b = M((L) => L.userInputForAI), v = M((L) => L.triggerAIRun), N = M((L) => L.card), w = M(
12389
12389
  (L) => L.selectedDatabaseName
12390
- ), z = E((L) => L.selectedTableName), M = E(
12390
+ ), z = M((L) => L.selectedTableName), E = M(
12391
12391
  (L) => L.selectedConnectionId
12392
- ), S = E(
12392
+ ), S = M(
12393
12393
  (L) => L.selectedSchemaName
12394
12394
  ), C = Y(
12395
12395
  (L) => L.dashboard.aiScopeTables
@@ -12442,7 +12442,7 @@ function _m(t) {
12442
12442
  var re, Ie, bt, _t;
12443
12443
  if (["createChartFromSql", "createForecast"].includes(L.toolName)) {
12444
12444
  const fe = L.args.sql, _e = L.args.python, Pe = L.args.chartType;
12445
- return f(Pe), m(fe), h(_e), g(!0), {
12445
+ return p(Pe), m(fe), h(_e), g(!0), {
12446
12446
  status: "success",
12447
12447
  message: "Let the user know that chart is created"
12448
12448
  // query: sql,
@@ -12462,12 +12462,12 @@ function _m(t) {
12462
12462
  if (L.toolName === "getCurrentTableScope")
12463
12463
  return r("Getting table scope..."), he(), {
12464
12464
  status: "success",
12465
- tables: p
12465
+ tables: f
12466
12466
  };
12467
12467
  if (L.toolName === "generateQueryConfig") {
12468
12468
  r("Generating query config...");
12469
12469
  const fe = L.args.chartType, _e = L.args.queryConfig;
12470
- L.args.cardConfig, f(fe), I(_e), m(void 0), h(void 0);
12470
+ L.args.cardConfig, p(fe), I(_e), m(void 0), h(void 0);
12471
12471
  const Pe = await k();
12472
12472
  return (re = Pe == null ? void 0 : Pe.data) != null && re.error ? {
12473
12473
  status: "error",
@@ -12495,7 +12495,7 @@ function _m(t) {
12495
12495
  } : L);
12496
12496
  }
12497
12497
  function de(L) {
12498
- const re = Bo(p, L);
12498
+ const re = Bo(f, L);
12499
12499
  pe(re);
12500
12500
  }
12501
12501
  function pe(L) {
@@ -12516,9 +12516,9 @@ function _m(t) {
12516
12516
  tableName: z || "",
12517
12517
  datamodelId: O || "",
12518
12518
  datamodelName: oa(A),
12519
- connectionId: M || "",
12519
+ connectionId: E || "",
12520
12520
  connectionType: x || ""
12521
- }, re = ir([...p, L]);
12521
+ }, re = ir([...f, L]);
12522
12522
  pe(re);
12523
12523
  }
12524
12524
  function he() {
@@ -12527,17 +12527,17 @@ function _m(t) {
12527
12527
  schemaName: S || "",
12528
12528
  tableName: z || "",
12529
12529
  datamodelName: oa(A),
12530
- connectionId: M || "",
12530
+ connectionId: E || "",
12531
12531
  connectionType: x || "",
12532
12532
  datamodelId: O || ""
12533
12533
  };
12534
12534
  if (!Vo(
12535
- [...C || [], ...p],
12535
+ [...C || [], ...f],
12536
12536
  L
12537
- ) || p.length === 0) {
12537
+ ) || f.length === 0) {
12538
12538
  const Ie = ir([
12539
12539
  ...C || [],
12540
- ...p,
12540
+ ...f,
12541
12541
  L
12542
12542
  ]).filter(
12543
12543
  (bt) => bt.connectionId === L.connectionId
@@ -12557,7 +12557,7 @@ function _m(t) {
12557
12557
  handleSetAIScope: he,
12558
12558
  handleAddCurrentTableToScope: be,
12559
12559
  removeFromCurrentSelections: de,
12560
- currentAssitantScope: p,
12560
+ currentAssitantScope: f,
12561
12561
  setCurrentAssitantScope: F,
12562
12562
  handleInputChange: J,
12563
12563
  handleSubmit: q,
@@ -12580,9 +12580,9 @@ const Pm = [
12580
12580
  }
12581
12581
  ];
12582
12582
  function wr() {
12583
- const t = nt(null), a = nt(null), [n, r] = P(!1), [l, o] = P(ls), [c, i] = P(!1), [d, u] = P(!1), h = $o(), { setCurrentAIContext: m } = qo(), g = Y((Z) => Z.dashboard.aiContext), f = E((Z) => Z.card.dataSource), y = E((Z) => Z.actions.setCardSql), p = E((Z) => Z.actions.setRunSql), b = E((Z) => Z.showAIDialog), v = Y(
12583
+ const t = nt(null), a = nt(null), [n, r] = P(!1), [l, o] = P(ls), [c, i] = P(!1), [d, u] = P(!1), h = $o(), { setCurrentAIContext: m } = qo(), g = Y((Z) => Z.dashboard.aiContext), p = M((Z) => Z.card.dataSource), y = M((Z) => Z.actions.setCardSql), f = M((Z) => Z.actions.setRunSql), b = M((Z) => Z.showAIDialog), v = Y(
12584
12584
  (Z) => Z.handleOpenAssistantProfile
12585
- ), { setShowAIDialog: N, setCardPython: w } = se(), { setDataSource: z } = se(), { assistantProfile: M } = Go(), {
12585
+ ), { setShowAIDialog: N, setCardPython: w } = se(), { setDataSource: z } = se(), { assistantProfile: E } = Go(), {
12586
12586
  messages: S,
12587
12587
  setMessages: C,
12588
12588
  reload: T,
@@ -12604,11 +12604,11 @@ function wr() {
12604
12604
  }), Te(() => {
12605
12605
  var Z;
12606
12606
  b && ((Z = a.current) == null || Z.focus(), m({
12607
- selectedEntities: (f == null ? void 0 : f.selectedEntities) || []
12607
+ selectedEntities: (p == null ? void 0 : p.selectedEntities) || []
12608
12608
  }));
12609
- }, [b, f, m]);
12609
+ }, [b, p, m]);
12610
12610
  function B(Z, ee) {
12611
- ee === "sql" ? (y(Z), p(!0)) : ee === "python" && (w(Z), p(!0));
12611
+ ee === "sql" ? (y(Z), f(!0)) : ee === "python" && (w(Z), f(!0));
12612
12612
  }
12613
12613
  function U() {
12614
12614
  var Z;
@@ -12698,7 +12698,7 @@ function wr() {
12698
12698
  size: "sm",
12699
12699
  className: "h-7 p-2",
12700
12700
  onClick: v,
12701
- children: (M == null ? void 0 : M.name) || "Default Profile"
12701
+ children: (E == null ? void 0 : E.name) || "Default Profile"
12702
12702
  }
12703
12703
  ),
12704
12704
  /* @__PURE__ */ s("div", { "data-role": "header-actions", className: "flex items-center gap-2", children: [
@@ -12766,17 +12766,17 @@ function wr() {
12766
12766
  }
12767
12767
  ),
12768
12768
  /* @__PURE__ */ s("div", { className: "mb-3", children: [
12769
- q && !M && /* @__PURE__ */ e(
12769
+ q && !E && /* @__PURE__ */ e(
12770
12770
  Wo,
12771
12771
  {
12772
12772
  onClick: ae,
12773
12773
  placeholders: Pm
12774
12774
  }
12775
12775
  ),
12776
- /* @__PURE__ */ e("div", { children: q && M && /* @__PURE__ */ e(
12776
+ /* @__PURE__ */ e("div", { children: q && E && /* @__PURE__ */ e(
12777
12777
  Yo,
12778
12778
  {
12779
- seedQuestions: M.seedQuestions || [],
12779
+ seedQuestions: E.seedQuestions || [],
12780
12780
  handleSeedQuestionClick: $
12781
12781
  }
12782
12782
  ) })
@@ -12811,10 +12811,10 @@ function wr() {
12811
12811
  /* @__PURE__ */ e(
12812
12812
  gl,
12813
12813
  {
12814
- incomingSelectedEntities: (f == null ? void 0 : f.selectedEntities) || [],
12814
+ incomingSelectedEntities: (p == null ? void 0 : p.selectedEntities) || [],
12815
12815
  open: d,
12816
12816
  onOpenChange: u,
12817
- dataSource: f || ca,
12817
+ dataSource: p || ca,
12818
12818
  fallbackDataSource: ca,
12819
12819
  dialogMode: "aiContext"
12820
12820
  }
@@ -12873,7 +12873,7 @@ const Ks = (t) => {
12873
12873
  removeMetricColumn: i,
12874
12874
  removePivotByColumn: d,
12875
12875
  removeSortByColumn: u
12876
- } = se(), h = E((F) => F.card.type), m = t == null ? void 0 : t.id, g = me(
12876
+ } = se(), h = M((F) => F.card.type), m = t == null ? void 0 : t.id, g = me(
12877
12877
  (F) => {
12878
12878
  if (!(t != null && t.config)) return [];
12879
12879
  switch (F) {
@@ -12929,7 +12929,7 @@ const Ks = (t) => {
12929
12929
  }
12930
12930
  },
12931
12931
  [t]
12932
- ), f = me(
12932
+ ), p = me(
12933
12933
  (F, I) => {
12934
12934
  if (m)
12935
12935
  switch (F) {
@@ -12994,7 +12994,7 @@ const Ks = (t) => {
12994
12994
  l,
12995
12995
  o
12996
12996
  ]
12997
- ), p = me(
12997
+ ), f = me(
12998
12998
  (F, I) => {
12999
12999
  if (!m) return;
13000
13000
  const x = g("metrics")[F];
@@ -13051,7 +13051,7 @@ const Ks = (t) => {
13051
13051
  m && a(m, { comparisonType: F });
13052
13052
  },
13053
13053
  [m, a]
13054
- ), M = me(
13054
+ ), E = me(
13055
13055
  (F) => {
13056
13056
  m && a(m, { showTrendline: F });
13057
13057
  },
@@ -13094,13 +13094,13 @@ const Ks = (t) => {
13094
13094
  ), _ = g(O);
13095
13095
  if (as(F, _)) return;
13096
13096
  const j = Ka(F, O);
13097
- j && f(O, [..._, j]);
13097
+ j && p(O, [..._, j]);
13098
13098
  },
13099
13099
  [
13100
13100
  m,
13101
13101
  (D = t == null ? void 0 : t.config) == null ? void 0 : D.joinPlan,
13102
13102
  g,
13103
- f
13103
+ p
13104
13104
  ]
13105
13105
  ), R = me(
13106
13106
  (F, I) => {
@@ -13143,9 +13143,9 @@ const Ks = (t) => {
13143
13143
  );
13144
13144
  return {
13145
13145
  getFieldsForContainer: g,
13146
- setFieldsForContainer: f,
13146
+ setFieldsForContainer: p,
13147
13147
  updateLabel: y,
13148
- handleAggregationChange: p,
13148
+ handleAggregationChange: f,
13149
13149
  handleDateFormatChange: b,
13150
13150
  handleGranularityChange: v,
13151
13151
  handleAliasTemplateChange: N,
@@ -13154,7 +13154,7 @@ const Ks = (t) => {
13154
13154
  handleFieldClick: k,
13155
13155
  // KPI-specific handlers
13156
13156
  handleKpiComparisonTypeChange: z,
13157
- handleKpiShowTrendlineChange: M,
13157
+ handleKpiShowTrendlineChange: E,
13158
13158
  handleKpiTrendlineWindowChange: S,
13159
13159
  handleKpiTrendlineGranularityChange: C,
13160
13160
  handleKpiTargetValueChange: T,
@@ -13180,14 +13180,14 @@ function Um({ field: t }) {
13180
13180
  transform: l,
13181
13181
  transition: o,
13182
13182
  isDragging: c
13183
- } = yn({ id: t.id }), [i, d] = P(!1), u = E((y) => y.card), { handleFieldClick: h } = Ks(u), m = {
13183
+ } = yn({ id: t.id }), [i, d] = P(!1), u = M((y) => y.card), { handleFieldClick: h } = Ks(u), m = {
13184
13184
  transform: At.Transform.toString(l),
13185
13185
  transition: o
13186
13186
  };
13187
13187
  et(t.dataType);
13188
13188
  const g = (y) => {
13189
- const p = (y || "").toLowerCase();
13190
- switch (et(p)) {
13189
+ const f = (y || "").toLowerCase();
13190
+ switch (et(f)) {
13191
13191
  case "number":
13192
13192
  return Tn;
13193
13193
  case "date":
@@ -13201,8 +13201,8 @@ function Um({ field: t }) {
13201
13201
  default:
13202
13202
  return On;
13203
13203
  }
13204
- }, f = (y) => {
13205
- const p = (y || "").toLowerCase(), b = et(p);
13204
+ }, p = (y) => {
13205
+ const f = (y || "").toLowerCase(), b = et(f);
13206
13206
  return b === "string" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-blue-100 text-xs text-blue-700 dark:bg-blue-950 dark:text-blue-300", children: /* @__PURE__ */ e(On, { className: "h-3 w-3" }) }) : b === "number" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-green-100 text-xs text-green-700 dark:bg-green-950 dark:text-green-300", children: /* @__PURE__ */ e(Tn, { className: "h-3 w-3" }) }) : b === "date" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-purple-100 text-xs text-purple-700 dark:bg-purple-950 dark:text-purple-300", children: /* @__PURE__ */ e(on, { className: "h-3 w-3" }) }) : b === "boolean" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-orange-100 text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300", children: /* @__PURE__ */ e(ua, { className: "h-3 w-3" }) }) : b === "json" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300", children: /* @__PURE__ */ e(ur, { className: "h-3 w-3" }) }) : b === "geo" ? /* @__PURE__ */ e("div", { className: "bg-orange -100 flex size-6 shrink-0 items-center justify-center rounded-sm text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300", children: /* @__PURE__ */ e(mr, { className: "h-3 w-3" }) }) : b === "calculated" ? /* @__PURE__ */ e("div", { className: "flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300", children: /* @__PURE__ */ e(Nl, { className: "h-3 w-3" }) }) : null;
13207
13207
  };
13208
13208
  return g(t.dataType), /* @__PURE__ */ s(
@@ -13220,7 +13220,7 @@ function Um({ field: t }) {
13220
13220
  className: "flex min-w-0 items-center gap-3 p-2",
13221
13221
  onClick: () => h(t),
13222
13222
  children: [
13223
- f(t.dataType),
13223
+ p(t.dataType),
13224
13224
  /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ s(Ue, { children: [
13225
13225
  /* @__PURE__ */ e(qe, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 overflow-hidden", children: /* @__PURE__ */ e(
13226
13226
  "span",
@@ -13278,7 +13278,7 @@ function Um({ field: t }) {
13278
13278
  );
13279
13279
  }
13280
13280
  function Bm() {
13281
- const [t, a] = P(""), [n, r] = P("all"), l = E((w) => w.card.dataSource), {
13281
+ const [t, a] = P(""), [n, r] = P("all"), l = M((w) => w.card.dataSource), {
13282
13282
  columns: o = [],
13283
13283
  columnGroups: c = [],
13284
13284
  isLoading: i,
@@ -13293,12 +13293,12 @@ function Bm() {
13293
13293
  }, g = (n === "all" ? u : u.filter(
13294
13294
  (w) => h(w) === n
13295
13295
  )).reduce((w, z) => {
13296
- const M = z.qualifiedEntityName || "Other Fields";
13297
- return w[M] || (w[M] = {
13296
+ const E = z.qualifiedEntityName || "Other Fields";
13297
+ return w[E] || (w[E] = {
13298
13298
  label: ec(z.entityName),
13299
13299
  fields: []
13300
- }), w[M].fields.push(z), w;
13301
- }, {}), y = Object.keys(g), p = u.filter(
13300
+ }), w[E].fields.push(z), w;
13301
+ }, {}), y = Object.keys(g), f = u.filter(
13302
13302
  (w) => h(w) === "dimensions"
13303
13303
  ).length, b = u.filter(
13304
13304
  (w) => h(w) === "metrics"
@@ -13345,7 +13345,7 @@ function Bm() {
13345
13345
  ] }),
13346
13346
  /* @__PURE__ */ s(Le, { value: "dimensions", className: "text-xs", children: [
13347
13347
  /* @__PURE__ */ e(tc, { className: "size-4 shrink-0" }),
13348
- /* @__PURE__ */ e("span", { className: "ml-2 text-xs font-semibold", children: p })
13348
+ /* @__PURE__ */ e("span", { className: "ml-2 text-xs font-semibold", children: f })
13349
13349
  ] }),
13350
13350
  /* @__PURE__ */ s(Le, { value: "metrics", className: "text-xs", children: [
13351
13351
  /* @__PURE__ */ e(os, { className: "size-4 shrink-0" }),
@@ -13367,7 +13367,7 @@ function Bm() {
13367
13367
  defaultValue: y,
13368
13368
  className: "space-y-2",
13369
13369
  children: Object.entries(g).map(([w, z]) => {
13370
- const M = c.find((S) => S.entityName === w) || {
13370
+ const E = c.find((S) => S.entityName === w) || {
13371
13371
  entityName: w,
13372
13372
  label: z.label
13373
13373
  };
@@ -13378,7 +13378,7 @@ function Bm() {
13378
13378
  className: "border-none",
13379
13379
  children: [
13380
13380
  /* @__PURE__ */ e(Se, { className: "group rounded-md px-2.5 py-2 text-muted-foreground hover:bg-muted hover:no-underline", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
13381
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-primary", children: M.label || M.entityName }),
13381
+ /* @__PURE__ */ e("span", { className: "text-sm font-medium text-primary", children: E.label || E.entityName }),
13382
13382
  /* @__PURE__ */ e(
13383
13383
  ie,
13384
13384
  {
@@ -13692,7 +13692,7 @@ function Gm({
13692
13692
  onCancel: l
13693
13693
  }) {
13694
13694
  const { setCardConfig: o } = se();
13695
- E((D) => D.card.config);
13695
+ M((D) => D.card.config);
13696
13696
  const { columnGroups: c } = Sa(), {
13697
13697
  joinPlan: i,
13698
13698
  expandedJoins: d,
@@ -13700,15 +13700,15 @@ function Gm({
13700
13700
  addJoin: h,
13701
13701
  removeJoin: m,
13702
13702
  updateJoin: g,
13703
- moveJoinUp: f,
13703
+ moveJoinUp: p,
13704
13704
  moveJoinDown: y,
13705
- toggleJoinExpansion: p,
13705
+ toggleJoinExpansion: f,
13706
13706
  getAvailableSourceEntities: b,
13707
13707
  getAvailableTargetEntities: v,
13708
13708
  addJoinKeyGroup: N,
13709
13709
  updateGroupOperator: w,
13710
13710
  removeJoinKeyGroup: z,
13711
- addJoinKey: M,
13711
+ addJoinKey: E,
13712
13712
  updateJoinKey: S,
13713
13713
  removeJoinKey: C,
13714
13714
  generateSQLPreview: T,
@@ -13807,7 +13807,7 @@ function Gm({
13807
13807
  {
13808
13808
  variant: "ghost",
13809
13809
  size: "sm",
13810
- onClick: () => f(D.id),
13810
+ onClick: () => p(D.id),
13811
13811
  disabled: D.sequence === 1,
13812
13812
  children: /* @__PURE__ */ e(Ca, { className: "h-4 w-4" })
13813
13813
  }
@@ -13827,7 +13827,7 @@ function Gm({
13827
13827
  {
13828
13828
  variant: "ghost",
13829
13829
  size: "sm",
13830
- onClick: () => p(D.id),
13830
+ onClick: () => f(D.id),
13831
13831
  children: A ? /* @__PURE__ */ e(hl, { className: "h-4 w-4" }) : /* @__PURE__ */ e(fn, { className: "h-4 w-4" })
13832
13832
  }
13833
13833
  ),
@@ -14238,7 +14238,7 @@ function Gm({
14238
14238
  variant: "outline",
14239
14239
  size: "sm",
14240
14240
  className: "mt-2",
14241
- onClick: () => M(D.id, O),
14241
+ onClick: () => E(D.id, O),
14242
14242
  children: [
14243
14243
  /* @__PURE__ */ e(ze, { className: "mr-1 h-3 w-3" }),
14244
14244
  " Add Condition"
@@ -14397,7 +14397,7 @@ function Hm({
14397
14397
  }
14398
14398
  function Km() {
14399
14399
  var h, m;
14400
- const t = E((g) => g.card), a = E(
14400
+ const t = M((g) => g.card), a = M(
14401
14401
  (g) => g.actions.updateCardConfig
14402
14402
  ), n = ((h = t == null ? void 0 : t.config) == null ? void 0 : h.joinPlan) || {
14403
14403
  baseEntity: {
@@ -14424,30 +14424,30 @@ function Km() {
14424
14424
  l(!1);
14425
14425
  }, u = () => {
14426
14426
  const g = [...n.joins].sort(
14427
- (p, b) => p.sequence - b.sequence
14428
- ), f = n.baseEntity;
14429
- if (!f.name)
14427
+ (f, b) => f.sequence - b.sequence
14428
+ ), p = n.baseEntity;
14429
+ if (!p.name)
14430
14430
  return "SELECT * FROM table -- Please select a base entity";
14431
14431
  let y = `SELECT *
14432
- FROM ${f.name}`;
14433
- return g.forEach((p) => {
14432
+ FROM ${p.name}`;
14433
+ return g.forEach((f) => {
14434
14434
  const b = o.find(
14435
- (w) => w.name === p.target.name
14435
+ (w) => w.name === f.target.name
14436
14436
  );
14437
14437
  if (!b) return;
14438
- const v = p.joinKeyGroups.filter((w) => w.keys && w.keys.length > 0).map((w) => {
14438
+ const v = f.joinKeyGroups.filter((w) => w.keys && w.keys.length > 0).map((w) => {
14439
14439
  const z = w.keys.filter(
14440
- (M) => {
14440
+ (E) => {
14441
14441
  var S, C, T, k;
14442
- return ((S = M.source) == null ? void 0 : S.name) && ((C = M.target) == null ? void 0 : C.name) && ((T = M.source) == null ? void 0 : T.entityName) && ((k = M.target) == null ? void 0 : k.entityName);
14442
+ return ((S = E.source) == null ? void 0 : S.name) && ((C = E.target) == null ? void 0 : C.name) && ((T = E.source) == null ? void 0 : T.entityName) && ((k = E.target) == null ? void 0 : k.entityName);
14443
14443
  }
14444
14444
  ).map(
14445
- (M) => `${M.source.entityName}.${M.source.name} ${M.operator} ${M.target.entityName}.${M.target.name}`
14445
+ (E) => `${E.source.entityName}.${E.source.name} ${E.operator} ${E.target.entityName}.${E.target.name}`
14446
14446
  );
14447
14447
  return z.length > 1 ? `(${z.join(` ${w.operator} `)})` : z[0];
14448
14448
  }).filter(Boolean), N = v.length > 1 ? v.join(" OR ") : v[0] || "condition_here";
14449
14449
  y += `
14450
- ${p.joinType} JOIN ${b.name}
14450
+ ${f.joinType} JOIN ${b.name}
14451
14451
  ON ${N}`;
14452
14452
  }), y;
14453
14453
  };
@@ -14606,17 +14606,19 @@ function Ym({
14606
14606
  isVisible: t,
14607
14607
  onToggleVisibility: a
14608
14608
  }) {
14609
- const [n, r] = P(!1), [l, o] = P(!0), c = E((h) => h.card.dataSource), { updateDataSource: i } = se(), d = {
14609
+ const n = M((p) => p.isDevMode), r = M((p) => p.card.connectionId), l = Y((p) => p.isVisualEditing), [o, c] = P(!1), [i, d] = P(!0), u = M((p) => p.card.dataSource), { updateDataSource: h } = se(), m = {
14610
14610
  connectionId: "",
14611
14611
  connectionType: "",
14612
14612
  mode: "database",
14613
14613
  selectedEntities: []
14614
- }, u = {
14615
- ...d,
14616
- ...c,
14617
- selectedEntities: (c == null ? void 0 : c.selectedEntities) || []
14614
+ }, g = {
14615
+ ...m,
14616
+ ...u,
14617
+ selectedEntities: (u == null ? void 0 : u.selectedEntities) || []
14618
14618
  };
14619
- return /* @__PURE__ */ s(
14619
+ return Te(() => {
14620
+ l && (n || (!r || !u) && c(!0));
14621
+ }, [u, r, n, l]), /* @__PURE__ */ s(
14620
14622
  "div",
14621
14623
  {
14622
14624
  className: G(
@@ -14635,17 +14637,25 @@ function Ym({
14635
14637
  "div",
14636
14638
  {
14637
14639
  className: G("p-4 px-6", {
14638
- "pb-0": !l
14640
+ "pb-0": !i
14639
14641
  }),
14640
14642
  children: /* @__PURE__ */ s("div", { className: "flex w-full items-center justify-between", children: [
14641
14643
  /* @__PURE__ */ s(
14642
14644
  "div",
14643
14645
  {
14644
14646
  className: "flex cursor-pointer items-center gap-2",
14645
- onClick: () => o(!l),
14646
14647
  children: [
14647
- l ? /* @__PURE__ */ e(fn, { className: "h-4 w-4" }) : /* @__PURE__ */ e(ac, { className: "h-4 w-4" }),
14648
- /* @__PURE__ */ e("h2", { className: "text-brand-100 font-semibold", children: "Data Source" })
14648
+ /* @__PURE__ */ e("h2", { className: "text-brand-100 font-semibold", children: "Data Source" }),
14649
+ /* @__PURE__ */ e(
14650
+ V,
14651
+ {
14652
+ variant: "ghost",
14653
+ size: "sm",
14654
+ onClick: () => d(!i),
14655
+ className: "h-6 w-6 p-0",
14656
+ children: i ? /* @__PURE__ */ e(fn, { className: "h-4 w-4" }) : /* @__PURE__ */ e(ac, { className: "h-4 w-4" })
14657
+ }
14658
+ )
14649
14659
  ]
14650
14660
  }
14651
14661
  ),
@@ -14667,7 +14677,7 @@ function Ym({
14667
14677
  size: "sm",
14668
14678
  variant: "outline",
14669
14679
  className: "h-7",
14670
- onClick: () => r(!0),
14680
+ onClick: () => c(!0),
14671
14681
  children: [
14672
14682
  /* @__PURE__ */ e(ze, { className: "mr-1 h-3.5 w-3.5" }),
14673
14683
  "Add"
@@ -14681,29 +14691,29 @@ function Ym({
14681
14691
  /* @__PURE__ */ s(
14682
14692
  "div",
14683
14693
  {
14684
- className: `overflow-hidden px-6 ${l ? "max-h-96 space-y-4" : "max-h-0 py-0 opacity-0"}`,
14694
+ className: `overflow-hidden px-6 ${i ? "max-h-96 space-y-4" : "max-h-0 py-0 opacity-0"}`,
14685
14695
  children: [
14686
- u.selectedEntities.length > 0 && /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1", children: [
14687
- u.selectedEntities.slice(0, 3).map((h, m) => /* @__PURE__ */ s(Ue, { children: [
14696
+ g.selectedEntities.length > 0 && /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1", children: [
14697
+ g.selectedEntities.slice(0, 3).map((p, y) => /* @__PURE__ */ s(Ue, { children: [
14688
14698
  /* @__PURE__ */ e(qe, { asChild: !0, children: /* @__PURE__ */ s(
14689
14699
  ie,
14690
14700
  {
14691
14701
  variant: "secondary",
14692
14702
  className: "group relative cursor-pointer pr-6 text-xs transition-colors hover:border-red-200 hover:bg-red-50 dark:hover:border-red-800 dark:hover:bg-red-950",
14693
14703
  children: [
14694
- ks(h),
14704
+ ks(p),
14695
14705
  /* @__PURE__ */ e(
14696
14706
  "button",
14697
14707
  {
14698
- onClick: (g) => {
14699
- g.stopPropagation();
14700
- const f = u.selectedEntities.filter(
14701
- (y) => !(y.name === h.name && y.type === h.type)
14708
+ onClick: (f) => {
14709
+ f.stopPropagation();
14710
+ const b = g.selectedEntities.filter(
14711
+ (v) => !(v.name === p.name && v.type === p.type)
14702
14712
  );
14703
- i({
14704
- ...d,
14705
- ...c,
14706
- selectedEntities: f
14713
+ h({
14714
+ ...m,
14715
+ ...u,
14716
+ selectedEntities: b
14707
14717
  });
14708
14718
  },
14709
14719
  className: "absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-0.5 hover:bg-red-100",
@@ -14713,18 +14723,18 @@ function Ym({
14713
14723
  ]
14714
14724
  }
14715
14725
  ) }),
14716
- /* @__PURE__ */ e(Jm, { entity: h })
14717
- ] }, `${h.type}-${h.name}-${m}`)),
14718
- u.selectedEntities.length > 3 && /* @__PURE__ */ s(Ue, { children: [
14726
+ /* @__PURE__ */ e(Jm, { entity: p })
14727
+ ] }, `${p.type}-${p.name}-${y}`)),
14728
+ g.selectedEntities.length > 3 && /* @__PURE__ */ s(Ue, { children: [
14719
14729
  /* @__PURE__ */ e(qe, { asChild: !0, children: /* @__PURE__ */ s(ie, { variant: "outline", className: "text-xs", children: [
14720
14730
  "+",
14721
- u.selectedEntities.length - 3,
14731
+ g.selectedEntities.length - 3,
14722
14732
  " more"
14723
14733
  ] }) }),
14724
14734
  /* @__PURE__ */ e(
14725
14735
  Wm,
14726
14736
  {
14727
- entities: u.selectedEntities.slice(3)
14737
+ entities: g.selectedEntities.slice(3)
14728
14738
  }
14729
14739
  )
14730
14740
  ] })
@@ -14740,12 +14750,12 @@ function Ym({
14740
14750
  /* @__PURE__ */ e(
14741
14751
  gl,
14742
14752
  {
14743
- incomingSelectedEntities: (c == null ? void 0 : c.selectedEntities) || [],
14753
+ incomingSelectedEntities: (u == null ? void 0 : u.selectedEntities) || [],
14744
14754
  dialogMode: "dataSource",
14745
- open: n,
14746
- onOpenChange: r,
14747
- dataSource: u,
14748
- fallbackDataSource: d
14755
+ open: o,
14756
+ onOpenChange: c,
14757
+ dataSource: g,
14758
+ fallbackDataSource: m
14749
14759
  }
14750
14760
  )
14751
14761
  ]
@@ -14841,14 +14851,14 @@ function Xm({
14841
14851
  var S;
14842
14852
  const [n, r] = P([]), [l, o] = P(!1), { data: c } = Vs();
14843
14853
  Zm();
14844
- const d = ((S = E((C) => C.card).customCardPreferences) == null ? void 0 : S.url) || "";
14854
+ const d = ((S = M((C) => C.card).customCardPreferences) == null ? void 0 : S.url) || "";
14845
14855
  Rs(d);
14846
- const { setCardType: u, setCardPreferences: h, setIsDevMode: m } = E(
14856
+ const { setCardType: u, setCardPreferences: h, setIsDevMode: m } = M(
14847
14857
  (C) => C.actions
14848
- ), { setCardCustomCfg: g, setCustomCardPreferences: f, setQueryConfig: y } = se(), [p, b] = ys("chart-section-active", null), v = $e(() => p ? [
14849
- p,
14850
- ...Dr.filter((C) => C !== p)
14851
- ] : Dr, [p]);
14858
+ ), { setCardCustomCfg: g, setCustomCardPreferences: p, setQueryConfig: y } = se(), [f, b] = ys("chart-section-active", null), v = $e(() => f ? [
14859
+ f,
14860
+ ...Dr.filter((C) => C !== f)
14861
+ ] : Dr, [f]);
14852
14862
  Te(() => {
14853
14863
  (async () => {
14854
14864
  if (c) {
@@ -14882,7 +14892,7 @@ function Xm({
14882
14892
  g(null), h({}), u(C), ["custom", "text", "map"].includes(C) && (m(!0), y(void 0)), a(C), o(!1);
14883
14893
  }
14884
14894
  function w(C) {
14885
- g(null), h({}), u("custom"), f({
14895
+ g(null), h({}), u("custom"), p({
14886
14896
  type: "component",
14887
14897
  visualType: "single",
14888
14898
  url: C.url,
@@ -14894,7 +14904,7 @@ function Xm({
14894
14904
  const z = () => {
14895
14905
  var T;
14896
14906
  if (t === "custom") {
14897
- const k = E.getState().card;
14907
+ const k = M.getState().card;
14898
14908
  return ((T = k == null ? void 0 : k.customCardPreferences) == null ? void 0 : T.componentName) || "Custom Visual";
14899
14909
  }
14900
14910
  const C = la.find((k) => k.id === t);
@@ -14913,7 +14923,7 @@ function Xm({
14913
14923
  (() => {
14914
14924
  var T, k;
14915
14925
  if (t === "custom") {
14916
- const R = E.getState().card, D = (T = R == null ? void 0 : R.customCardPreferences) == null ? void 0 : T.icon, F = (k = R == null ? void 0 : R.customCardPreferences) == null ? void 0 : k.componentName;
14926
+ const R = M.getState().card, D = (T = R == null ? void 0 : R.customCardPreferences) == null ? void 0 : T.icon, F = (k = R == null ? void 0 : R.customCardPreferences) == null ? void 0 : k.componentName;
14917
14927
  if (D && F)
14918
14928
  return /* @__PURE__ */ e(eh, { icon: D, componentName: F });
14919
14929
  if (F) {
@@ -14955,7 +14965,7 @@ function Xm({
14955
14965
  /* @__PURE__ */ e(
14956
14966
  aa,
14957
14967
  {
14958
- checked: p === "default",
14968
+ checked: f === "default",
14959
14969
  onCheckedChange: (T) => b(T ? "default" : null),
14960
14970
  className: "scale-75"
14961
14971
  }
@@ -14996,7 +15006,7 @@ function Xm({
14996
15006
  /* @__PURE__ */ e(
14997
15007
  aa,
14998
15008
  {
14999
- checked: p === "standardPlugin",
15009
+ checked: f === "standardPlugin",
15000
15010
  onCheckedChange: (k) => b(
15001
15011
  k ? "standardPlugin" : null
15002
15012
  ),
@@ -15039,7 +15049,7 @@ function Xm({
15039
15049
  /* @__PURE__ */ e(
15040
15050
  aa,
15041
15051
  {
15042
- checked: p === "customPlugin",
15052
+ checked: f === "customPlugin",
15043
15053
  onCheckedChange: (k) => b(k ? "customPlugin" : null),
15044
15054
  className: "scale-75"
15045
15055
  }
@@ -15081,7 +15091,7 @@ function th({
15081
15091
  onAliasTemplateChange: a
15082
15092
  }) {
15083
15093
  var d;
15084
- const [n, r] = P(t), [l, o] = P(!1), c = (d = E((u) => {
15094
+ const [n, r] = P(t), [l, o] = P(!1), c = (d = M((u) => {
15085
15095
  var h;
15086
15096
  return (h = u.card.config) == null ? void 0 : h.pivotByColumns;
15087
15097
  })) == null ? void 0 : d[0], i = c ? `e.g. Min Sales in {{${c.name}}}` : "e.g. Min Sales in {{region}}";
@@ -15152,7 +15162,7 @@ function nh({
15152
15162
  return /* @__PURE__ */ s("div", { className: "space-y-1", children: [
15153
15163
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-muted-foreground", children: "Pivot Value Aliases" }),
15154
15164
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
15155
- Object.entries(t).map(([m, g], f) => /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n === m ? /* @__PURE__ */ s(ne, { children: [
15165
+ Object.entries(t).map(([m, g], p) => /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n === m ? /* @__PURE__ */ s(ne, { children: [
15156
15166
  /* @__PURE__ */ e(
15157
15167
  Re,
15158
15168
  {
@@ -15241,7 +15251,7 @@ function nh({
15241
15251
  children: /* @__PURE__ */ e(Ne, { className: "h-3 w-3" })
15242
15252
  }
15243
15253
  )
15244
- ] }) }, m + f)),
15254
+ ] }) }, m + p)),
15245
15255
  /* @__PURE__ */ s(
15246
15256
  V,
15247
15257
  {
@@ -15337,20 +15347,20 @@ function ah({
15337
15347
  transform: h,
15338
15348
  transition: m,
15339
15349
  isDragging: g
15340
- } = yn({ id: t.id }), f = E((ce) => ce.card), {
15350
+ } = yn({ id: t.id }), p = M((ce) => ce.card), {
15341
15351
  updateLabel: y,
15342
- handleAggregationChange: p,
15352
+ handleAggregationChange: f,
15343
15353
  handleDateFormatChange: b,
15344
15354
  handleGranularityChange: v,
15345
15355
  handleAliasTemplateChange: N,
15346
15356
  handleValueAliasesChange: w,
15347
15357
  removeField: z,
15348
- handleKpiComparisonTypeChange: M,
15358
+ handleKpiComparisonTypeChange: E,
15349
15359
  handleKpiShowTrendlineChange: S,
15350
15360
  handleKpiTrendlineWindowChange: C,
15351
15361
  handleKpiTrendlineGranularityChange: T,
15352
15362
  handleKpiTargetValueChange: k
15353
- } = Ks(f), [R, D] = P(!1), [F, I] = P(
15363
+ } = Ks(p), [R, D] = P(!1), [F, I] = P(
15354
15364
  t.dateFormat || "YYYY-MM-DD"
15355
15365
  ), [A, x] = P(t.customFormat || ""), [O, _] = P(!!t.customFormat), [j, B] = P(
15356
15366
  t.granularity || "day"
@@ -15386,7 +15396,7 @@ function ah({
15386
15396
  { value: "YYYY-MM", label: "2024-01 (YYYY-MM)" },
15387
15397
  { value: "MMMM YYYY", label: "January 2024 (MMMM YYYY)" },
15388
15398
  { value: "custom", label: "Custom Format..." }
15389
- ], L = !Oe && a !== "pivotBy", re = he && a === "groupBy", Ie = !Oe && he && a === "groupBy", bt = Oe && he && a === "groupBy", _t = Oe && a === "metrics" && ((Ys = f.config) == null ? void 0 : Ys.comparisonType) === "target", fe = a === "metrics", _e = () => /* @__PURE__ */ e(
15399
+ ], L = !Oe && a !== "pivotBy", re = he && a === "groupBy", Ie = !Oe && he && a === "groupBy", bt = Oe && he && a === "groupBy", _t = Oe && a === "metrics" && ((Ys = p.config) == null ? void 0 : Ys.comparisonType) === "target", fe = a === "metrics", _e = () => /* @__PURE__ */ e(
15390
15400
  "div",
15391
15401
  {
15392
15402
  onPointerDown: (ce) => {
@@ -15458,8 +15468,8 @@ function ah({
15458
15468
  /* @__PURE__ */ s(
15459
15469
  ge,
15460
15470
  {
15461
- value: ((ce = f.config) == null ? void 0 : ce.comparisonType) || "none",
15462
- onValueChange: M,
15471
+ value: ((ce = p.config) == null ? void 0 : ce.comparisonType) || "none",
15472
+ onValueChange: E,
15463
15473
  children: [
15464
15474
  /* @__PURE__ */ e(ye, { className: "h-8 w-full text-xs", children: /* @__PURE__ */ e(ve, { placeholder: "Select comparison type..." }) }),
15465
15475
  /* @__PURE__ */ s(xe, { children: [
@@ -15477,12 +15487,12 @@ function ah({
15477
15487
  /* @__PURE__ */ e(
15478
15488
  Na,
15479
15489
  {
15480
- checked: ((Nt = f.config) == null ? void 0 : Nt.showTrendline) || !1,
15490
+ checked: ((Nt = p.config) == null ? void 0 : Nt.showTrendline) || !1,
15481
15491
  onCheckedChange: S
15482
15492
  }
15483
15493
  )
15484
15494
  ] }) }),
15485
- ((tn = f.config) == null ? void 0 : tn.showTrendline) && /* @__PURE__ */ s(ne, { children: [
15495
+ ((tn = p.config) == null ? void 0 : tn.showTrendline) && /* @__PURE__ */ s(ne, { children: [
15486
15496
  /* @__PURE__ */ s("div", { className: "space-y-1", children: [
15487
15497
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-muted-foreground", children: "Trendline Window" }),
15488
15498
  /* @__PURE__ */ e(
@@ -15491,7 +15501,7 @@ function ah({
15491
15501
  type: "number",
15492
15502
  min: "1",
15493
15503
  max: "365",
15494
- value: ((Qs = f.config) == null ? void 0 : Qs.trendlineWindow) || 30,
15504
+ value: ((Qs = p.config) == null ? void 0 : Qs.trendlineWindow) || 30,
15495
15505
  onChange: (wi) => {
15496
15506
  const Si = parseInt(wi.target.value) || 30;
15497
15507
  C(Si);
@@ -15506,7 +15516,7 @@ function ah({
15506
15516
  /* @__PURE__ */ s(
15507
15517
  ge,
15508
15518
  {
15509
- value: ((Zs = f.config) == null ? void 0 : Zs.trendlineGranularity) || "day",
15519
+ value: ((Zs = p.config) == null ? void 0 : Zs.trendlineGranularity) || "day",
15510
15520
  onValueChange: T,
15511
15521
  children: [
15512
15522
  /* @__PURE__ */ e(ye, { className: "h-8 w-full text-xs", children: /* @__PURE__ */ e(ve, { placeholder: "Select granularity..." }) }),
@@ -15528,7 +15538,7 @@ function ah({
15528
15538
  /* @__PURE__ */ e(
15529
15539
  Tr,
15530
15540
  {
15531
- value: ((ce = f.config) == null ? void 0 : ce.targetValue) !== void 0 && ((Nt = f.config) == null ? void 0 : Nt.targetValue) !== null ? String(f.config.targetValue) : "",
15541
+ value: ((ce = p.config) == null ? void 0 : ce.targetValue) !== void 0 && ((Nt = p.config) == null ? void 0 : Nt.targetValue) !== null ? String(p.config.targetValue) : "",
15532
15542
  onSave: (tn) => {
15533
15543
  !isNaN(Number(tn)) && tn !== null ? k(Number(tn)) : k(0);
15534
15544
  },
@@ -15545,7 +15555,7 @@ function ah({
15545
15555
  {
15546
15556
  value: t.aggregate,
15547
15557
  onValueChange: (ce) => {
15548
- p(n, ce);
15558
+ f(n, ce);
15549
15559
  },
15550
15560
  children: [
15551
15561
  /* @__PURE__ */ e(ye, { className: "h-8 w-full text-xs", children: /* @__PURE__ */ e(ve, { placeholder: "Select function..." }) }),
@@ -15756,15 +15766,15 @@ function na({
15756
15766
  }) {
15757
15767
  const { isOver: c, setNodeRef: i } = Ss({
15758
15768
  id: t
15759
- }), { updateSortByColumn: d } = se(), u = E((y) => y.card), h = E((y) => y.card.type), m = a.length > 0, g = (y, p) => {
15769
+ }), { updateSortByColumn: d } = se(), u = M((y) => y.card), h = M((y) => y.card.type), m = a.length > 0, g = (y, f) => {
15760
15770
  var v;
15761
15771
  !((v = u.config) != null && v.sortByColumns) || u.config.sortByColumns.findIndex(
15762
15772
  (N) => N.id === y
15763
- ) === -1 || d(u.id, y, { direction: p });
15773
+ ) === -1 || d(u.id, y, { direction: f });
15764
15774
  };
15765
15775
  if (t === "sortBy" && l === !1)
15766
15776
  return null;
15767
- const f = t !== "sortBy" && h !== "kpi";
15777
+ const p = t !== "sortBy" && h !== "kpi";
15768
15778
  return /* @__PURE__ */ s("div", { className: "mb-4", children: [
15769
15779
  /* @__PURE__ */ s("div", { className: "mb-2 flex items-center gap-2", children: [
15770
15780
  /* @__PURE__ */ e(
@@ -15778,7 +15788,7 @@ function na({
15778
15788
  children: n
15779
15789
  }
15780
15790
  ),
15781
- f && /* @__PURE__ */ e(sh, { concept: t })
15791
+ p && /* @__PURE__ */ e(sh, { concept: t })
15782
15792
  ] }),
15783
15793
  /* @__PURE__ */ e(
15784
15794
  "div",
@@ -15790,7 +15800,7 @@ function na({
15790
15800
  {
15791
15801
  items: a.map((y) => y.id),
15792
15802
  strategy: kn,
15793
- children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2", children: a.map((y, p) => {
15803
+ children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2", children: a.map((y, f) => {
15794
15804
  const v = y.direction;
15795
15805
  return /* @__PURE__ */ e(
15796
15806
  "div",
@@ -15801,7 +15811,7 @@ function na({
15801
15811
  {
15802
15812
  field: y,
15803
15813
  zone: t,
15804
- index: p,
15814
+ index: f,
15805
15815
  sortDirection: v,
15806
15816
  onSortDirectionChange: (N) => g(y.id, N),
15807
15817
  hasPivotColumns: o,
@@ -15824,7 +15834,7 @@ function rh({
15824
15834
  metricsFields: n,
15825
15835
  sortByFields: r
15826
15836
  }) {
15827
- const l = E((m) => m.card), o = l == null ? void 0 : l.type, c = t.length > 0 || n.length > 0, i = o !== "kpi", d = o !== "kpi" && c, u = () => o === "kpi" ? {
15837
+ const l = M((m) => m.card), o = l == null ? void 0 : l.type, c = t.length > 0 || n.length > 0, i = o !== "kpi", d = o !== "kpi" && c, u = () => o === "kpi" ? {
15828
15838
  label: "Trend By",
15829
15839
  placeholder: "Drop fields to trend data"
15830
15840
  } : {
@@ -15885,14 +15895,14 @@ function lh({
15885
15895
  metricsFields: l,
15886
15896
  sortByFields: o
15887
15897
  }) {
15888
- const c = E((m) => m.showAIDialog), i = n.length > 0 || r.length > 0 || l.length > 0, { setShowAIDialog: d } = se(), u = E((m) => m.card), { data: h } = Fe(u);
15898
+ const c = M((m) => m.showAIDialog), i = n.length > 0 || r.length > 0 || l.length > 0, { setShowAIDialog: d } = se(), u = M((m) => m.card), { data: h } = Fe(u);
15889
15899
  return /* @__PURE__ */ s(
15890
15900
  "div",
15891
15901
  {
15892
15902
  "data-content": "Chart Configuration Panel",
15893
15903
  className: "flex w-96 flex-col",
15894
15904
  children: [
15895
- /* @__PURE__ */ s("div", { className: "space-y-4 px-6 py-4", children: [
15905
+ /* @__PURE__ */ s("div", { className: "space-y-4 px-6 pt-4", children: [
15896
15906
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e("h2", { className: "font-semibold", children: "Chart Configuration" }) }),
15897
15907
  /* @__PURE__ */ e(
15898
15908
  Xm,
@@ -15947,7 +15957,7 @@ function ih({
15947
15957
  groups: []
15948
15958
  }
15949
15959
  );
15950
- E((M) => M.card.dataSource);
15960
+ M((E) => E.card.dataSource);
15951
15961
  const { columns: l, isLoading: o } = Sa(), i = a || l || [], d = {
15952
15962
  id: "default",
15953
15963
  name: "default",
@@ -15956,9 +15966,9 @@ function ih({
15956
15966
  entityId: "default",
15957
15967
  entityName: "Default",
15958
15968
  entityType: "table"
15959
- }, u = (M) => {
15969
+ }, u = (E) => {
15960
15970
  const S = (C) => {
15961
- if (C.id === M) {
15971
+ if (C.id === E) {
15962
15972
  const T = i[0] || d;
15963
15973
  return {
15964
15974
  ...C,
@@ -15979,9 +15989,9 @@ function ih({
15979
15989
  };
15980
15990
  };
15981
15991
  r(S(n));
15982
- }, h = (M) => {
15992
+ }, h = (E) => {
15983
15993
  const S = (C) => {
15984
- if (C.id === M) {
15994
+ if (C.id === E) {
15985
15995
  const T = i[0] || d;
15986
15996
  return {
15987
15997
  ...C,
@@ -16010,8 +16020,8 @@ function ih({
16010
16020
  };
16011
16021
  };
16012
16022
  r(S(n));
16013
- }, m = (M, S) => {
16014
- const C = (T) => T.id === M ? {
16023
+ }, m = (E, S) => {
16024
+ const C = (T) => T.id === E ? {
16015
16025
  ...T,
16016
16026
  conditions: T.conditions.filter((k) => k.id !== S)
16017
16027
  } : {
@@ -16019,8 +16029,8 @@ function ih({
16019
16029
  groups: T.groups.map(C)
16020
16030
  };
16021
16031
  r(C(n));
16022
- }, g = (M, S) => {
16023
- const C = (T) => T.id === M ? {
16032
+ }, g = (E, S) => {
16033
+ const C = (T) => T.id === E ? {
16024
16034
  ...T,
16025
16035
  groups: T.groups.filter((k) => k.id !== S)
16026
16036
  } : {
@@ -16028,12 +16038,12 @@ function ih({
16028
16038
  groups: T.groups.map(C)
16029
16039
  };
16030
16040
  r(C(n));
16031
- }, f = (M, S, C, T) => {
16041
+ }, p = (E, S, C, T) => {
16032
16042
  if (C === "field")
16033
16043
  throw new Error(
16034
16044
  "Use a dedicated method to update the field property with a Field object"
16035
16045
  );
16036
- const k = (R) => R.id === M ? {
16046
+ const k = (R) => R.id === E ? {
16037
16047
  ...R,
16038
16048
  conditions: R.conditions.map((D) => D.id === S ? {
16039
16049
  ...D,
@@ -16044,8 +16054,8 @@ function ih({
16044
16054
  groups: R.groups.map(k)
16045
16055
  };
16046
16056
  r(k(n));
16047
- }, y = (M, S, C) => {
16048
- const T = (k) => k.id === M ? {
16057
+ }, y = (E, S, C) => {
16058
+ const T = (k) => k.id === E ? {
16049
16059
  ...k,
16050
16060
  conditions: k.conditions.map((R) => R.id === S ? { ...R, ...C } : R)
16051
16061
  } : {
@@ -16053,8 +16063,8 @@ function ih({
16053
16063
  groups: k.groups.map(T)
16054
16064
  };
16055
16065
  r(T(n));
16056
- }, p = (M, S) => {
16057
- const C = (T) => T.id === M ? {
16066
+ }, f = (E, S) => {
16067
+ const C = (T) => T.id === E ? {
16058
16068
  ...T,
16059
16069
  logicalOperator: S
16060
16070
  } : {
@@ -16062,8 +16072,8 @@ function ih({
16062
16072
  groups: T.groups.map(C)
16063
16073
  };
16064
16074
  r(C(n));
16065
- }, b = (M, S) => {
16066
- const C = (T) => T.id === M ? {
16075
+ }, b = (E, S) => {
16076
+ const C = (T) => T.id === E ? {
16067
16077
  ...T,
16068
16078
  negate: S
16069
16079
  } : {
@@ -16071,8 +16081,8 @@ function ih({
16071
16081
  groups: T.groups.map(C)
16072
16082
  };
16073
16083
  r(C(n));
16074
- }, v = (M, S, C) => {
16075
- const T = (k) => k.id === M ? {
16084
+ }, v = (E, S, C) => {
16085
+ const T = (k) => k.id === E ? {
16076
16086
  ...k,
16077
16087
  conditions: Ja(k.conditions, S, C)
16078
16088
  } : {
@@ -16080,8 +16090,8 @@ function ih({
16080
16090
  groups: k.groups.map(T)
16081
16091
  };
16082
16092
  r(T(n));
16083
- }, N = (M, S, C) => {
16084
- const T = (k) => k.id === M ? {
16093
+ }, N = (E, S, C) => {
16094
+ const T = (k) => k.id === E ? {
16085
16095
  ...k,
16086
16096
  groups: Ja(k.groups, S, C)
16087
16097
  } : {
@@ -16089,8 +16099,8 @@ function ih({
16089
16099
  groups: k.groups.map(T)
16090
16100
  };
16091
16101
  r(T(n));
16092
- }, w = (M) => {
16093
- if (!M || M.conditions.length === 0 && M.groups.length === 0)
16102
+ }, w = (E) => {
16103
+ if (!E || E.conditions.length === 0 && E.groups.length === 0)
16094
16104
  return "-- No filters defined";
16095
16105
  const S = (T) => {
16096
16106
  let k = "";
@@ -16128,7 +16138,7 @@ function ih({
16128
16138
  const F = D.join(` ${T.logicalOperator} `), I = D.length > 1 ? `(${F})` : F;
16129
16139
  return T.negate ? `NOT ${I}` : I;
16130
16140
  };
16131
- return C(M);
16141
+ return C(E);
16132
16142
  }, z = n.conditions.length > 0 || n.groups.length > 0;
16133
16143
  return {
16134
16144
  currentFilters: n,
@@ -16139,9 +16149,9 @@ function ih({
16139
16149
  addGroup: h,
16140
16150
  removeCondition: m,
16141
16151
  removeGroup: g,
16142
- updateCondition: f,
16152
+ updateCondition: p,
16143
16153
  updateConditionFields: y,
16144
- updateGroupOperator: p,
16154
+ updateGroupOperator: f,
16145
16155
  updateGroupNegate: b,
16146
16156
  reorderConditions: v,
16147
16157
  reorderGroups: N,
@@ -16239,7 +16249,7 @@ function uh({
16239
16249
  ch(m[0].entityType),
16240
16250
  /* @__PURE__ */ e("span", { children: m[0].entityName })
16241
16251
  ] }),
16242
- m.map((g, f) => /* @__PURE__ */ s(
16252
+ m.map((g, p) => /* @__PURE__ */ s(
16243
16253
  gn,
16244
16254
  {
16245
16255
  value: g.id,
@@ -16263,7 +16273,7 @@ function uh({
16263
16273
  ] })
16264
16274
  ]
16265
16275
  },
16266
- g.id + f
16276
+ g.id + p
16267
16277
  ))
16268
16278
  ] }, `${d}-${h}`))
16269
16279
  },
@@ -16274,7 +16284,7 @@ function uh({
16274
16284
  }
16275
16285
  function Ws(t) {
16276
16286
  var y;
16277
- const a = E((p) => p.card), { authToken: n } = Ee(), r = E((p) => p.card.config), l = r == null ? void 0 : r.joinPlan, o = {
16287
+ const a = M((f) => f.card), { authToken: n } = Ee(), r = M((f) => f.card.config), l = r == null ? void 0 : r.joinPlan, o = {
16278
16288
  ...t,
16279
16289
  alias: t.name,
16280
16290
  // we need exact field name in the output for the filters to work.
@@ -16313,8 +16323,8 @@ function Ws(t) {
16313
16323
  cardDataSource: a.dataSource
16314
16324
  }
16315
16325
  );
16316
- } catch (p) {
16317
- console.log(t), console.error("error", p);
16326
+ } catch (f) {
16327
+ console.log(t), console.error("error", f);
16318
16328
  }
16319
16329
  },
16320
16330
  enabled: !!u,
@@ -16322,10 +16332,10 @@ function Ws(t) {
16322
16332
  refetchOnWindowFocus: !1
16323
16333
  });
16324
16334
  return { filterValues: ((h == null ? void 0 : h.records) || []).map(
16325
- (p) => ({
16326
- label: p[t.name] || "BLANK",
16327
- value: p[t.name] || "BLANK",
16328
- count: (p == null ? void 0 : p.count) || 0
16335
+ (f) => ({
16336
+ label: f[t.name] || "BLANK",
16337
+ value: f[t.name] || "BLANK",
16338
+ count: (f == null ? void 0 : f.count) || 0
16329
16339
  })
16330
16340
  ), isPending: m, error: g };
16331
16341
  }
@@ -16508,13 +16518,13 @@ function yi({
16508
16518
  listeners: h,
16509
16519
  setNodeRef: m,
16510
16520
  transform: g,
16511
- transition: f,
16521
+ transition: p,
16512
16522
  isDragging: y
16513
- } = yn({ id: t.id }), { isPending: p, error: b } = Ws(
16523
+ } = yn({ id: t.id }), { isPending: f, error: b } = Ws(
16514
16524
  t.field
16515
16525
  ), v = {
16516
16526
  transform: At.Transform.toString(g),
16517
- transition: f
16527
+ transition: p
16518
16528
  };
16519
16529
  return /* @__PURE__ */ s(
16520
16530
  "div",
@@ -16583,7 +16593,7 @@ function yi({
16583
16593
  ]
16584
16594
  }
16585
16595
  ),
16586
- et(t.field.dataType) === "string" ? t.operator === "in" || t.operator === "not in" ? p ? /* @__PURE__ */ s("div", { className: "flex flex-1 items-center justify-center p-2 text-xs text-gray-500", children: [
16596
+ et(t.field.dataType) === "string" ? t.operator === "in" || t.operator === "not in" ? f ? /* @__PURE__ */ s("div", { className: "flex flex-1 items-center justify-center p-2 text-xs text-gray-500", children: [
16587
16597
  /* @__PURE__ */ e(Me, { className: "mr-2 size-3.5 animate-spin" }),
16588
16598
  " Loading values..."
16589
16599
  ] }) : b ? /* @__PURE__ */ e("div", { className: "flex-1 p-2 text-xs text-red-500", children: "Error loading values" }) : /* @__PURE__ */ e(
@@ -16670,9 +16680,9 @@ function bh({
16670
16680
  onReorderGroups: h,
16671
16681
  onAddCondition: m,
16672
16682
  onAddGroup: g,
16673
- availableFields: f,
16683
+ availableFields: p,
16674
16684
  renderFilterGroup: y,
16675
- updateConditionFields: p
16685
+ updateConditionFields: f
16676
16686
  }) {
16677
16687
  const {
16678
16688
  attributes: b,
@@ -16680,7 +16690,7 @@ function bh({
16680
16690
  setNodeRef: N,
16681
16691
  transform: w,
16682
16692
  transition: z,
16683
- isDragging: M
16693
+ isDragging: E
16684
16694
  } = yn({ id: t.id }), S = {
16685
16695
  transform: At.Transform.toString(w),
16686
16696
  transition: z
@@ -16706,7 +16716,7 @@ function bh({
16706
16716
  {
16707
16717
  ref: N,
16708
16718
  style: S,
16709
- className: `rounded-lg ${a > 0 ? "mt-2 border border-border" : ""} ${M ? "z-50 opacity-50" : ""}`,
16719
+ className: `rounded-lg ${a > 0 ? "mt-2 border border-border" : ""} ${E ? "z-50 opacity-50" : ""}`,
16710
16720
  children: [
16711
16721
  a > 0 && /* @__PURE__ */ s("div", { className: "flex items-center justify-between rounded-t-lg bg-muted p-2", children: [
16712
16722
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
@@ -16784,8 +16794,8 @@ function bh({
16784
16794
  onUpdateField: i,
16785
16795
  onRemoveCondition: d,
16786
16796
  onUpdateGroupOperator: r,
16787
- availableFields: f,
16788
- updateConditionFields: p
16797
+ availableFields: p,
16798
+ updateConditionFields: f
16789
16799
  },
16790
16800
  k.id
16791
16801
  ))
@@ -16865,9 +16875,9 @@ function Nh({
16865
16875
  removeCondition: h,
16866
16876
  removeGroup: m,
16867
16877
  updateCondition: g,
16868
- updateConditionFields: f,
16878
+ updateConditionFields: p,
16869
16879
  updateGroupOperator: y,
16870
- updateGroupNegate: p,
16880
+ updateGroupNegate: f,
16871
16881
  reorderConditions: b,
16872
16882
  reorderGroups: v,
16873
16883
  generateSQLPreview: N,
@@ -16876,7 +16886,7 @@ function Nh({
16876
16886
  } = ih({
16877
16887
  initialFilters: t,
16878
16888
  availableFields: a
16879
- }), M = Sn(
16889
+ }), E = Sn(
16880
16890
  kt(da),
16881
16891
  kt(Ya, {
16882
16892
  coordinateGetter: Wa
@@ -16898,7 +16908,7 @@ function Nh({
16898
16908
  /* @__PURE__ */ e(
16899
16909
  cn,
16900
16910
  {
16901
- sensors: M,
16911
+ sensors: E,
16902
16912
  collisionDetection: Dn,
16903
16913
  onDragEnd: (A) => {
16904
16914
  const { active: x, over: O } = A;
@@ -16928,7 +16938,7 @@ function Nh({
16928
16938
  onRemoveCondition: h,
16929
16939
  onUpdateGroupOperator: y,
16930
16940
  availableFields: c,
16931
- updateConditionFields: f
16941
+ updateConditionFields: p
16932
16942
  },
16933
16943
  A.id
16934
16944
  ))
@@ -16939,7 +16949,7 @@ function Nh({
16939
16949
  /* @__PURE__ */ e(
16940
16950
  cn,
16941
16951
  {
16942
- sensors: M,
16952
+ sensors: E,
16943
16953
  collisionDetection: Dn,
16944
16954
  onDragEnd: (A) => {
16945
16955
  const { active: x, over: O } = A;
@@ -16999,7 +17009,7 @@ function Nh({
16999
17009
  depth: F,
17000
17010
  parentGroupId: I,
17001
17011
  onUpdateGroupOperator: y,
17002
- onUpdateGroupNegate: p,
17012
+ onUpdateGroupNegate: f,
17003
17013
  onRemoveGroup: m,
17004
17014
  onUpdateCondition: g,
17005
17015
  onUpdateField: T,
@@ -17010,7 +17020,7 @@ function Nh({
17010
17020
  onAddGroup: u,
17011
17021
  availableFields: c,
17012
17022
  renderFilterGroup: k,
17013
- updateConditionFields: f
17023
+ updateConditionFields: p
17014
17024
  },
17015
17025
  D.id
17016
17026
  ), R = gi(t);
@@ -17105,33 +17115,33 @@ function wh({
17105
17115
  getFieldsForContainer: n,
17106
17116
  setFieldsForContainer: r
17107
17117
  }) {
17108
- var f;
17109
- const [l, o] = P(null), c = E((y) => y.card), i = (f = c == null ? void 0 : c.config) == null ? void 0 : f.joinPlan, d = [
17118
+ var p;
17119
+ const [l, o] = P(null), c = M((y) => y.card), i = (p = c == null ? void 0 : c.config) == null ? void 0 : p.joinPlan, d = [
17110
17120
  ...a,
17111
17121
  ...n("groupBy"),
17112
17122
  ...n("pivotBy"),
17113
17123
  ...n("metrics"),
17114
17124
  ...n("sortBy")
17115
17125
  ], u = me(
17116
- (y) => y.startsWith("card-") ? null : y.startsWith("source-") || a.find((p) => p.id === y) ? "source" : n("groupBy").find((p) => p.id === y) ? "groupBy" : n("metrics").find((p) => p.id === y) ? "metrics" : n("pivotBy").find((p) => p.id === y) ? "pivotBy" : n("sortBy").find((p) => p.id === y) ? "sortBy" : null,
17126
+ (y) => y.startsWith("card-") ? null : y.startsWith("source-") || a.find((f) => f.id === y) ? "source" : n("groupBy").find((f) => f.id === y) ? "groupBy" : n("metrics").find((f) => f.id === y) ? "metrics" : n("pivotBy").find((f) => f.id === y) ? "pivotBy" : n("sortBy").find((f) => f.id === y) ? "sortBy" : null,
17117
17127
  [a, n]
17118
17128
  ), h = me((y) => {
17119
17129
  o(y.active.id);
17120
17130
  }, []), m = me(
17121
17131
  (y) => {
17122
- const { active: p, over: b } = y;
17132
+ const { active: f, over: b } = y;
17123
17133
  if (!b || !t) {
17124
17134
  o(null);
17125
17135
  return;
17126
17136
  }
17127
- const v = p.id, N = b.id, w = u(v), z = u(N) || N;
17137
+ const v = f.id, N = b.id, w = u(v), z = u(N) || N;
17128
17138
  if (w === "source" && z === "sortBy") {
17129
17139
  o(null);
17130
17140
  return;
17131
17141
  }
17132
17142
  if (w === "source" && z !== "source" && z !== "sortBy") {
17133
- const M = [...a].find((k) => k.id === v);
17134
- if (!M) {
17143
+ const E = [...a].find((k) => k.id === v);
17144
+ if (!E) {
17135
17145
  o(null);
17136
17146
  return;
17137
17147
  }
@@ -17147,11 +17157,11 @@ function wh({
17147
17157
  o(null);
17148
17158
  return;
17149
17159
  }
17150
- if (k !== M.qualifiedEntityName && M.qualifiedEntityName)
17160
+ if (k !== E.qualifiedEntityName && E.qualifiedEntityName)
17151
17161
  if (i) {
17152
17162
  if (!pi(
17153
17163
  k,
17154
- M.qualifiedEntityName,
17164
+ E.qualifiedEntityName,
17155
17165
  i
17156
17166
  )) {
17157
17167
  ns(), o(null);
@@ -17163,16 +17173,16 @@ function wh({
17163
17173
  }
17164
17174
  }
17165
17175
  const C = n(z);
17166
- if (as(M, C)) {
17176
+ if (as(E, C)) {
17167
17177
  o(null);
17168
17178
  return;
17169
17179
  }
17170
- const T = Ka(M, z);
17180
+ const T = Ka(E, z);
17171
17181
  o(null), r(z, [...C, T]);
17172
17182
  return;
17173
17183
  }
17174
17184
  if (w && z && w !== "source" && z !== "source" && w !== z) {
17175
- const M = n(w), S = n(z), C = M.find((R) => R.id === v);
17185
+ const E = n(w), S = n(z), C = E.find((R) => R.id === v);
17176
17186
  if (!C) {
17177
17187
  o(null);
17178
17188
  return;
@@ -17186,16 +17196,16 @@ function wh({
17186
17196
  as(C, S) || r(z, [...S, T]);
17187
17197
  return;
17188
17198
  }
17189
- const k = M.filter(
17199
+ const k = E.filter(
17190
17200
  (R) => R.id !== v
17191
17201
  );
17192
17202
  r(w, k), r(z, [...S, T]);
17193
17203
  return;
17194
17204
  }
17195
17205
  if (w && z && w === z && w !== "source") {
17196
- const M = n(w), S = M.findIndex((T) => T.id === v), C = M.findIndex((T) => T.id === N);
17206
+ const E = n(w), S = E.findIndex((T) => T.id === v), C = E.findIndex((T) => T.id === N);
17197
17207
  if (S !== C) {
17198
- const T = Ja(M, S, C);
17208
+ const T = Ja(E, S, C);
17199
17209
  r(w, T);
17200
17210
  }
17201
17211
  }
@@ -17222,9 +17232,9 @@ function Sh({
17222
17232
  onDebugToggle: a,
17223
17233
  onAccept: n
17224
17234
  }) {
17225
- const r = E((f) => f.isDevMode), l = E((f) => f.card);
17235
+ const r = M((p) => p.isDevMode), l = M((p) => p.card);
17226
17236
  sl(l);
17227
- const { config: o } = fc(ic).tokenProps, c = (o == null ? void 0 : o.showAdvancedMode) !== !1, { setIsDevMode: i } = se(), d = E((f) => f.showAIDialog), u = E((f) => f.frame), h = qa((f) => f.selectedVisual), m = (h == null ? void 0 : h.id) === (u == null ? void 0 : u.id), { setShowAIDialog: g } = se();
17237
+ const { config: o } = fc(ic).tokenProps, c = (o == null ? void 0 : o.showAdvancedMode) !== !1, { setIsDevMode: i } = se(), d = M((p) => p.showAIDialog), u = M((p) => p.frame), h = qa((p) => p.selectedVisual), m = (h == null ? void 0 : h.id) === (u == null ? void 0 : u.id), { setShowAIDialog: g } = se();
17228
17238
  return /* @__PURE__ */ s(
17229
17239
  "div",
17230
17240
  {
@@ -17259,7 +17269,7 @@ function Sh({
17259
17269
  );
17260
17270
  }
17261
17271
  function kh({ activeView: t, onViewChange: a }) {
17262
- const n = E((l) => l.card), { errorMessage: r } = Fe(n);
17272
+ const n = M((l) => l.card), { errorMessage: r } = Fe(n);
17263
17273
  return /* @__PURE__ */ e(
17264
17274
  Yt,
17265
17275
  {
@@ -17309,7 +17319,7 @@ const Dh = [
17309
17319
  ];
17310
17320
  function Th() {
17311
17321
  var d, u;
17312
- const t = E((h) => h.card), { updateRowLimit: a } = se(), [n, r] = P(!1), [l, o] = P(""), c = (h) => {
17322
+ const t = M((h) => h.card), { updateRowLimit: a } = se(), [n, r] = P(!1), [l, o] = P(""), c = (h) => {
17313
17323
  if (h === "custom") {
17314
17324
  r(!0);
17315
17325
  return;
@@ -17347,17 +17357,17 @@ function Mh({
17347
17357
  }) {
17348
17358
  const n = Vl(a, {
17349
17359
  enabled: t
17350
- }), r = E(
17360
+ }), r = M(
17351
17361
  (h) => {
17352
17362
  var m;
17353
17363
  return ((m = h.card.customCardPreferences) == null ? void 0 : m.url) || "";
17354
17364
  }
17355
- ), l = E((h) => h.card), o = E(
17365
+ ), l = M((h) => h.card), o = M(
17356
17366
  (h) => {
17357
17367
  var m;
17358
17368
  return ((m = h.card.customCardPreferences) == null ? void 0 : m.pluginChartType) || "";
17359
17369
  }
17360
- ), c = E(
17370
+ ), c = M(
17361
17371
  (h) => {
17362
17372
  var m;
17363
17373
  return ((m = h.card.customCardPreferences) == null ? void 0 : m.settings) || {};
@@ -17421,14 +17431,14 @@ function Eh({
17421
17431
  // setActiveCard,
17422
17432
  }) {
17423
17433
  var F;
17424
- const f = E((I) => I.card), y = Y((I) => I.filterValues), { updateCardConfig: p } = se(), b = E((I) => I.showAIDialog), [v, N] = P(!1), w = E(
17434
+ const p = M((I) => I.card), y = Y((I) => I.filterValues), { updateCardConfig: f } = se(), b = M((I) => I.showAIDialog), [v, N] = P(!1), w = M(
17425
17435
  (I) => {
17426
17436
  var A;
17427
17437
  return ((A = I.card.customCardPreferences) == null ? void 0 : A.url) && I.card.type === "custom";
17428
17438
  }
17429
17439
  ), {
17430
17440
  data: z,
17431
- errorMessage: M,
17441
+ errorMessage: E,
17432
17442
  isPending: S,
17433
17443
  isLoading: C,
17434
17444
  isFetching: T
@@ -17437,7 +17447,7 @@ function Eh({
17437
17447
  return /* @__PURE__ */ e("div", { className: "border-b border-border bg-background p-4", children: /* @__PURE__ */ s("div", { className: "space-y-4", children: [
17438
17448
  /* @__PURE__ */ s("div", { children: [
17439
17449
  /* @__PURE__ */ e("h3", { className: "mb-2 text-sm font-medium", children: "Active Card Config" }),
17440
- /* @__PURE__ */ e("pre", { className: "max-h-40 overflow-auto rounded border bg-background p-3 text-xs", children: JSON.stringify(f.config || {}, null, 2) })
17450
+ /* @__PURE__ */ e("pre", { className: "max-h-40 overflow-auto rounded border bg-background p-3 text-xs", children: JSON.stringify(p.config || {}, null, 2) })
17441
17451
  ] }),
17442
17452
  /* @__PURE__ */ s("div", { children: [
17443
17453
  /* @__PURE__ */ e("h3", { className: "mb-2 text-sm font-medium", children: "Dashboard Filters" }),
@@ -17458,15 +17468,15 @@ function Eh({
17458
17468
  ] }) });
17459
17469
  }
17460
17470
  const R = (I) => {
17461
- if (!f.config) return;
17471
+ if (!p.config) return;
17462
17472
  if (!I.length) {
17463
- p(f.id, {
17464
- ...f.config,
17473
+ f(p.id, {
17474
+ ...p.config,
17465
17475
  sortByColumns: []
17466
17476
  });
17467
17477
  return;
17468
17478
  }
17469
- const A = f.config, x = I.map(({ id: O, desc: _ }) => {
17479
+ const A = p.config, x = I.map(({ id: O, desc: _ }) => {
17470
17480
  var oe, ae;
17471
17481
  const j = (oe = A.metricColumns) == null ? void 0 : oe.find(
17472
17482
  ($) => $.label === O
@@ -17486,17 +17496,17 @@ function Eh({
17486
17496
  direction: _ ? "desc" : "asc"
17487
17497
  } : null;
17488
17498
  }).filter((O) => O !== null);
17489
- p(f.id, {
17499
+ f(p.id, {
17490
17500
  ...A,
17491
17501
  sortByColumns: x
17492
17502
  });
17493
17503
  }, D = $e(() => {
17494
17504
  var I, A;
17495
- return (A = (I = f.config) == null ? void 0 : I.sortByColumns) == null ? void 0 : A.map((x) => ({
17505
+ return (A = (I = p.config) == null ? void 0 : I.sortByColumns) == null ? void 0 : A.map((x) => ({
17496
17506
  id: x.label,
17497
17507
  desc: x.direction === "desc"
17498
17508
  }));
17499
- }, [(F = f.config) == null ? void 0 : F.sortByColumns]);
17509
+ }, [(F = p.config) == null ? void 0 : F.sortByColumns]);
17500
17510
  return /* @__PURE__ */ s("div", { className: "relative flex w-0 grow flex-col", children: [
17501
17511
  /* @__PURE__ */ e(
17502
17512
  Sh,
@@ -17557,9 +17567,9 @@ function Eh({
17557
17567
  }
17558
17568
  )
17559
17569
  ] }),
17560
- t === "sql" && /* @__PURE__ */ e("div", { className: "p-6", children: /* @__PURE__ */ s("div", { className: "rounded-md border bg-background p-4", children: [
17570
+ t === "sql" && /* @__PURE__ */ e("div", { className: "p-6", children: /* @__PURE__ */ s("div", { className: "rounded-md bg-background", children: [
17561
17571
  (z == null ? void 0 : z.sql) && /* @__PURE__ */ e("h3", { className: "mb-3 text-sm font-medium", children: "Generated SQL Query" }),
17562
- /* @__PURE__ */ e(Ql, { sql: z == null ? void 0 : z.sql, error: M })
17572
+ /* @__PURE__ */ e(Ql, { sql: z == null ? void 0 : z.sql, error: E })
17563
17573
  ] }) })
17564
17574
  ] }),
17565
17575
  /* @__PURE__ */ e(
@@ -17619,23 +17629,23 @@ function Ih() {
17619
17629
  var $, K;
17620
17630
  const [t, a] = P(
17621
17631
  "chart"
17622
- ), [n, r] = P(!1), [l, o] = P(!1), [c, i] = P(!0), d = E((J) => J.showAIDialog), u = Y((J) => J.isVisualEditing), { setCardType: h } = se(), m = E((J) => J.card.type);
17632
+ ), [n, r] = P(!1), [l, o] = P(!1), [c, i] = P(!0), d = M((J) => J.showAIDialog), u = Y((J) => J.isVisualEditing), { setCardType: h } = se(), m = M((J) => J.card.type);
17623
17633
  Te(() => Ah(), []);
17624
17634
  const g = () => {
17625
17635
  console.log("Accept clicked - would save/apply current configuration");
17626
- }, f = () => {
17636
+ }, p = () => {
17627
17637
  console.log("Clear clicked - would reset all configurations");
17628
17638
  }, y = () => {
17629
17639
  console.log("Advanced mode toggled");
17630
- }, p = () => {
17640
+ }, f = () => {
17631
17641
  o(!0);
17632
17642
  }, b = (J) => {
17633
17643
  h(J);
17634
- }, v = E((J) => J.frame), N = E((J) => J.card);
17635
- E((J) => J.activeTabCardId), E(
17644
+ }, v = M((J) => J.frame), N = M((J) => J.card);
17645
+ M((J) => J.activeTabCardId), M(
17636
17646
  (J) => J.actions.getAvailableFields
17637
17647
  );
17638
- const { addCard: w, removeCard: z, updateCard: M, setActiveCard: S, updateFilters: C } = se(), {
17648
+ const { addCard: w, removeCard: z, updateCard: E, setActiveCard: S, updateFilters: C } = se(), {
17639
17649
  columns: T = [],
17640
17650
  isLoading: k,
17641
17651
  error: R
@@ -17657,7 +17667,7 @@ function Ih() {
17657
17667
  q && C(J, q);
17658
17668
  }, B = (J) => {
17659
17669
  var q;
17660
- M(J, {
17670
+ E(J, {
17661
17671
  config: {
17662
17672
  ...(q = v.cards.find((Z) => Z.id === J)) == null ? void 0 : q.config,
17663
17673
  filters: void 0
@@ -17707,9 +17717,9 @@ function Ih() {
17707
17717
  showDebug: n,
17708
17718
  onDebugToggle: () => r(!n),
17709
17719
  onAccept: g,
17710
- onClear: f,
17720
+ onClear: p,
17711
17721
  onAdvancedToggle: y,
17712
- onFiltersClick: p,
17722
+ onFiltersClick: f,
17713
17723
  filterCount: ae,
17714
17724
  activeCard: F,
17715
17725
  dataSourceState: N.dataSource || ca,
@@ -17724,7 +17734,7 @@ function Ih() {
17724
17734
  }
17725
17735
  )
17726
17736
  ] }),
17727
- !c && u && /* @__PURE__ */ e("div", { className: "fixed bottom-4 left-4 z-50", children: /* @__PURE__ */ e(
17737
+ !c && u && /* @__PURE__ */ e("div", { className: "fixed left-6 top-[105px] z-50", children: /* @__PURE__ */ e(
17728
17738
  V,
17729
17739
  {
17730
17740
  size: "sm",
@@ -17754,11 +17764,11 @@ function Ih() {
17754
17764
  );
17755
17765
  }
17756
17766
  function Rh({ authToken: t, onSave: a, onClose: n }) {
17757
- const r = nt(null), l = E((N) => N.showAIDialog), o = E((N) => N.isDevMode), { setAuthToken: c } = yt(), { setShowAIDialog: i, setOnSave: d, setOnClose: u } = se(), {
17767
+ const r = nt(null), l = M((N) => N.showAIDialog), o = M((N) => N.isDevMode), { setAuthToken: c } = yt(), { setShowAIDialog: i, setOnSave: d, setOnClose: u } = se(), {
17758
17768
  handleDragOver: h,
17759
17769
  handleDragEnd: m,
17760
17770
  handleDragStart: g,
17761
- handleDragCancel: f,
17771
+ handleDragCancel: p,
17762
17772
  sensors: y
17763
17773
  } = Nu();
17764
17774
  Te(() => {
@@ -17769,7 +17779,7 @@ function Rh({ authToken: t, onSave: a, onClose: n }) {
17769
17779
  var N, w;
17770
17780
  l ? ((N = r.current) == null || N.resize(40), i(!0)) : (i(!1), (w = r.current) == null || w.resize(0));
17771
17781
  }, [l, i]);
17772
- function p(N) {
17782
+ function f(N) {
17773
17783
  N < 1 ? i(!1) : l || i(!0);
17774
17784
  }
17775
17785
  function b() {
@@ -17789,7 +17799,7 @@ function Rh({ authToken: t, onSave: a, onClose: n }) {
17789
17799
  {
17790
17800
  "data-role": "editor-assistant-panel",
17791
17801
  ref: r,
17792
- onResize: p,
17802
+ onResize: f,
17793
17803
  defaultSize: 0,
17794
17804
  children: /* @__PURE__ */ e(wr, {})
17795
17805
  }
@@ -17814,7 +17824,7 @@ function Rh({ authToken: t, onSave: a, onClose: n }) {
17814
17824
  {
17815
17825
  "data-role": "editor-assistant-panel",
17816
17826
  ref: r,
17817
- onResize: p,
17827
+ onResize: f,
17818
17828
  defaultSize: 0,
17819
17829
  children: /* @__PURE__ */ e(wr, {})
17820
17830
  }
@@ -17830,7 +17840,7 @@ function Rh({ authToken: t, onSave: a, onClose: n }) {
17830
17840
  onDragStart: g,
17831
17841
  onDragEnd: m,
17832
17842
  onDragOver: h,
17833
- onDragCancel: f,
17843
+ onDragCancel: p,
17834
17844
  children: /* @__PURE__ */ e(
17835
17845
  "section",
17836
17846
  {
@@ -17863,7 +17873,7 @@ function zh() {
17863
17873
  );
17864
17874
  }
17865
17875
  function Fh() {
17866
- const t = E((o) => o.selectedDatabaseName), a = E((o) => o.selectedTableName), n = Y((o) => o.dashboard.filters) || [], { columns: r } = ot(), { assignFilter: l } = di();
17876
+ const t = M((o) => o.selectedDatabaseName), a = M((o) => o.selectedTableName), n = Y((o) => o.dashboard.filters) || [], { columns: r } = ot(), { assignFilter: l } = di();
17867
17877
  return /* @__PURE__ */ e(rt, { className: "flex-1 basis-0 flex-col px-3", children: r == null ? void 0 : r.map((o) => {
17868
17878
  const c = n == null ? void 0 : n.find(
17869
17879
  (i) => i.column === Xe(o.column_name) && i.table === a && i.database === t