react-semaphor 0.1.57 → 0.1.58
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.
- package/dist/chunks/{dashboard-plus-FOEBfkTw.js → dashboard-plus-DttJ7tRM.js} +45 -42
- package/dist/chunks/{dashboard-plus-BbcM_f3e.js → dashboard-plus-zWWZ2ch-.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as X } from "react/jsx-runtime";
|
|
2
|
-
import { c as ue, a3 as Es, u as _, a4 as It, a5 as Et, B as R, a6 as At, a7 as Ye, a8 as As, $ as at, a9 as qe, aa as rt, ab as Kn, ac as ze, ad as lt, ae as it, af as ot, ag as bt, ah as B, ai as Ce, aj as qt, I as me, ak as Fs, al as da, am as Tl, an as hn, ao as _n, f as K, ap as Ms, aq as Il, ar as Jn, as as El, at as Al, au as Os, av as te, x as pn, aw as Fl, ax as Ml, ay as pt, a1 as T, az as vt, aA as za, aB as Ra, aC as Hn, aD as Qn, aE as Fe, aF as ft, aG as Ol, aH as Pl, aI as Mt, aJ as Ot, aK as Ve, aL as gt, aM as ea, aN as ct, aO as fs, aP as Kt, aQ as gs, aR as We, aS as Wn, aT as Yn, aU as _t, aV as Ll, aW as ja, aX as Ba, aY as $a, aZ as qa, a_ as Ga, a$ as Ua, b0 as Ka, b1 as _a, b2 as Vl, b3 as Ja, b4 as fa, a2 as se, b5 as zl, b6 as xt, b7 as Rl, b8 as je, o as Jt, b9 as Xn, ba as Me, bb as Ie, bc as jl, bd as Ha, be as Fa, bf as Ps, bg as Da, bh as Ls, bi as Vs, bj as Bl, bk as Zn, bl as $l, R as oa, bm as ql, bn as Gl, bo as Ul, bp as Ta, w as Kl, bq as _l, br as Ma, bs as er, bt as Jl, s as zs, bu as Qa, bv as Hl, bw as Xe, bx as Ql, by as Wl, bz as Ia, bA as Yl, bB as Ea, bC as Aa, bD as Wa, X as ga, G as fn, T as gn, L as tr, K as ar, z as
|
|
2
|
+
import { c as ue, a3 as Es, u as _, a4 as It, a5 as Et, B as R, a6 as At, a7 as Ye, a8 as As, $ as at, a9 as qe, aa as rt, ab as Kn, ac as ze, ad as lt, ae as it, af as ot, ag as bt, ah as B, ai as Ce, aj as qt, I as me, ak as Fs, al as da, am as Tl, an as hn, ao as _n, f as K, ap as Ms, aq as Il, ar as Jn, as as El, at as Al, au as Os, av as te, x as pn, aw as Fl, ax as Ml, ay as pt, a1 as T, az as vt, aA as za, aB as Ra, aC as Hn, aD as Qn, aE as Fe, aF as ft, aG as Ol, aH as Pl, aI as Mt, aJ as Ot, aK as Ve, aL as gt, aM as ea, aN as ct, aO as fs, aP as Kt, aQ as gs, aR as We, aS as Wn, aT as Yn, aU as _t, aV as Ll, aW as ja, aX as Ba, aY as $a, aZ as qa, a_ as Ga, a$ as Ua, b0 as Ka, b1 as _a, b2 as Vl, b3 as Ja, b4 as fa, a2 as se, b5 as zl, b6 as xt, b7 as Rl, b8 as je, o as Jt, b9 as Xn, ba as Me, bb as Ie, bc as jl, bd as Ha, be as Fa, bf as Ps, bg as Da, bh as Ls, bi as Vs, bj as Bl, bk as Zn, bl as $l, R as oa, bm as ql, bn as Gl, bo as Ul, bp as Ta, w as Kl, bq as _l, br as Ma, bs as er, bt as Jl, s as zs, bu as Qa, bv as Hl, bw as Xe, bx as Ql, by as Wl, bz as Ia, bA as Yl, bB as Ea, bC as Aa, bD as Wa, X as ga, G as fn, T as gn, L as tr, K as ar, z as kt, A as Xl, H as Zl, V as ei, bE as ti, bF as xn, bG as bn, bH as sr, bI as nr, bJ as rr, bK as ai, bL as Ya, bM as Xa, bN as si, bO as ut, bP as Be, bQ as $e, bR as Ue, bS as Ht, bT as Za, bU as Ne, bV as xa, bW as ni, bX as Oa, bY as Ft, bZ as lr, b_ as Rs, b$ as ri, c0 as ir, c1 as tt, c2 as ge, c3 as xe, c4 as be, c5 as or, c6 as ua, c7 as ie, c8 as oe, c9 as ce, ca as de, cb as W, cc as cr, cd as dr, ce as ur, cf as mr, cg as ba, g as Pt, ch as vn, ci as hr, cj as Tt, ck as li, cl as xs, cm as pr, cn as js, co as fr, cp as Nt, cq as yn, cr as ii, cs as oi, ct as ci, cu as gr, cv as va, cw as di, cx as ui, cy as xr, cz as mi, cA as es, cB as hi, cC as pi, cD as bs, cE as Gt, cF as Qe, cG as Ut, cH as fi, cI as gi, cJ as br, cK as ts, cL as vs, cM as xi, cN as Bs, cO as bi, cP as $s, cQ as vi, cR as vr, cS as yr, cT as yi, cU as Ni, cV as Ci, cW as qs, cX as wi, cY as Si, cZ as Nn, c_ as ki, E as ya, b as Gs, c$ as Di, d0 as Ti, d1 as Ii, d2 as Ei, d3 as Ai, d4 as Fi, d5 as Nr, d6 as ys, d7 as Us, d8 as Cr, d9 as wr, da as Sr, db as kr, dc as Dr, dd as Ks, de as _s, df as Tr, dg as Ir, dh as Er, di as Js, dj as as, dk as ss, dl as Mi, P as Lt, e as Vt, dm as Oi, dn as Bt, dp as Pi, dq as Li, dr as Vi, ds as zi, dt as Ri, du as ji, dv as Ar, dw as et, dx as ma, dy as Pa, dz as Dt, h as Qt, dA as Bi, dB as $i, dC as qi, dD as Gi, dE as Ui, dF as Fr, dG as Ki, i as ns, j as rs, k as ls, l as is, m as Zt, n as Na, dH as _i, dI as nt, dJ as Ca, dK as Cn, dL as Ji, dM as wn, dN as Hi, dO as Qi, dP as Wi, dQ as Yi, dR as Sn, dS as Xi, dT as Zi, dU as eo, dV as to, dW as ao, Q as kn, dX as Dn, dY as so, dZ as no, d_ as Mr, d$ as ro, e0 as Or, e1 as lo, e2 as io, e3 as oo, e4 as co, e5 as uo, e6 as mo, e7 as ho, e8 as po, e9 as fo, ea as go, eb as Pr, ec as xo, ed as bo, ee as vo, ef as yo, eg as No, eh as Co, ei as Lr, ej as ds, ek as Hs, el as Vr, em as zr, en as wo, eo as So, ep as ko, eq as Tn, er as Do, es as To, et as Io, eu as ta, ev as aa, ew as Eo, ex as Rr, ey as Ao, ez as Ns, eA as Fo, eB as Mo, eC as La, eD as $t, eE as Cs, eF as ws, eG as Va, eH as jr, eI as sa, eJ as na, eK as Qs, eL as Oo, eM as Po, eN as Lo, eO as Vo, eP as zo, eQ as Ro, eR as jo, eS as Bo, eT as us, eU as $o, eV as qo, eW as Go, F as Br, eX as Uo, eY as Ko, eZ as _o, e_ as In, e$ as Jo, f0 as Ho, f1 as Qo, f2 as Wo, f3 as $r, f4 as qr, f5 as Yo, f6 as Xo, f7 as Zo, f8 as ec, f9 as tc, fa as ac, fb as sc, S as nc, fc as rc, U as lc, fd as ic, C as oc } from "./index-DbMJ2vk9.js";
|
|
3
3
|
import * as Ss from "react";
|
|
4
4
|
import ha, { useRef as mt, useEffect as fe, useState as z, useMemo as Ze, useCallback as ye, useContext as Ws, Suspense as Gr } from "react";
|
|
5
5
|
import { createPortal as cc } from "react-dom";
|
|
@@ -3393,8 +3393,8 @@ function Yr() {
|
|
|
3393
3393
|
(V) => V.id === d
|
|
3394
3394
|
)) == null ? void 0 : x.name, w = ar(
|
|
3395
3395
|
N,
|
|
3396
|
-
|
|
3397
|
-
|
|
3396
|
+
kt(c || ""),
|
|
3397
|
+
kt(l),
|
|
3398
3398
|
A || "",
|
|
3399
3399
|
g,
|
|
3400
3400
|
o || ""
|
|
@@ -3486,7 +3486,7 @@ function Xr() {
|
|
|
3486
3486
|
const t = T((v) => v.selectedConnectionId), s = T((v) => v.selectedDatamodelId), n = T((v) => v.selectedDatabaseName), r = T((v) => v.selectedSchemaName), l = T((v) => v.selectedTableName), c = _((v) => v.dashboard.filters) || [], o = _((v) => v.selectedSheetId), i = _((v) => v.actions.addFilter), d = _((v) => v.actions.removeFilter), { removeFilterValues: u } = at(), { modelItems: m, tableName: h, connectionType: p } = ga();
|
|
3487
3487
|
function b(v, g = "sheet", y) {
|
|
3488
3488
|
var N;
|
|
3489
|
-
const k =
|
|
3489
|
+
const k = kt(v.column_name), D = kt(n || ""), L = kt(r || ""), O = kt(h);
|
|
3490
3490
|
let I = ei({
|
|
3491
3491
|
schemaName: L,
|
|
3492
3492
|
tableName: O,
|
|
@@ -3574,8 +3574,8 @@ function Td({ column: t }) {
|
|
|
3574
3574
|
h(L);
|
|
3575
3575
|
const I = ar(
|
|
3576
3576
|
L,
|
|
3577
|
-
|
|
3578
|
-
|
|
3577
|
+
kt(c || ""),
|
|
3578
|
+
kt(l),
|
|
3579
3579
|
O || "",
|
|
3580
3580
|
m,
|
|
3581
3581
|
o || ""
|
|
@@ -5640,7 +5640,7 @@ function al({
|
|
|
5640
5640
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-destructive", children: "Query Error" }),
|
|
5641
5641
|
/* @__PURE__ */ a("div", { className: "relative rounded-md bg-background/60 p-3", children: [
|
|
5642
5642
|
/* @__PURE__ */ e(
|
|
5643
|
-
|
|
5643
|
+
Nt,
|
|
5644
5644
|
{
|
|
5645
5645
|
text: t,
|
|
5646
5646
|
className: "absolute right-2 top-2 h-6 w-6 z-10"
|
|
@@ -5702,7 +5702,7 @@ function al({
|
|
|
5702
5702
|
/* @__PURE__ */ e(yn, { open: o, onOpenChange: i, children: /* @__PURE__ */ e(ci, { className: "space-y-2", children: /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: [
|
|
5703
5703
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
5704
5704
|
/* @__PURE__ */ e("p", { className: "text-xs font-medium text-muted-foreground", children: s ? "Error SQL Query" : "SQL Query" }),
|
|
5705
|
-
s && /* @__PURE__ */ e(
|
|
5705
|
+
s && /* @__PURE__ */ e(Nt, { text: s, className: "h-6 w-6" })
|
|
5706
5706
|
] }),
|
|
5707
5707
|
s ? /* @__PURE__ */ e("div", { className: "rounded-md bg-background/60 p-2 max-h-80 overflow-auto", children: /* @__PURE__ */ e(gr, { code: s, language: "sql" }) }) : /* @__PURE__ */ e("div", { className: "rounded-md bg-background/60 p-3", children: /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground italic", children: "SQL query not available for this error" }) })
|
|
5708
5708
|
] }) }) })
|
|
@@ -5773,28 +5773,28 @@ function sl({
|
|
|
5773
5773
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Card ID" }),
|
|
5774
5774
|
/* @__PURE__ */ e("code", { className: "text-xs font-mono", children: m.id || "N/A" })
|
|
5775
5775
|
] }),
|
|
5776
|
-
/* @__PURE__ */ e(
|
|
5776
|
+
/* @__PURE__ */ e(Nt, { text: m.id || "", className: "h-6 w-6" })
|
|
5777
5777
|
] }),
|
|
5778
5778
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between rounded-md bg-background/60 px-3 py-2", children: [
|
|
5779
5779
|
/* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
|
|
5780
5780
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Frame ID" }),
|
|
5781
5781
|
/* @__PURE__ */ e("code", { className: "text-xs font-mono", children: h.id || "N/A" })
|
|
5782
5782
|
] }),
|
|
5783
|
-
/* @__PURE__ */ e(
|
|
5783
|
+
/* @__PURE__ */ e(Nt, { text: h.id || "", className: "h-6 w-6" })
|
|
5784
5784
|
] }),
|
|
5785
5785
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between rounded-md bg-background/60 px-3 py-2", children: [
|
|
5786
5786
|
/* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
|
|
5787
5787
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Sheet ID" }),
|
|
5788
5788
|
/* @__PURE__ */ e("code", { className: "text-xs font-mono", children: p || "N/A" })
|
|
5789
5789
|
] }),
|
|
5790
|
-
/* @__PURE__ */ e(
|
|
5790
|
+
/* @__PURE__ */ e(Nt, { text: p || "", className: "h-6 w-6" })
|
|
5791
5791
|
] }),
|
|
5792
5792
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between rounded-md bg-background/60 px-3 py-2", children: [
|
|
5793
5793
|
/* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
|
|
5794
5794
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Dashboard ID" }),
|
|
5795
5795
|
/* @__PURE__ */ e("code", { className: "text-xs font-mono", children: b || "N/A" })
|
|
5796
5796
|
] }),
|
|
5797
|
-
/* @__PURE__ */ e(
|
|
5797
|
+
/* @__PURE__ */ e(Nt, { text: b || "", className: "h-6 w-6" })
|
|
5798
5798
|
] })
|
|
5799
5799
|
] })
|
|
5800
5800
|
] }) }),
|
|
@@ -5808,7 +5808,10 @@ function sl({
|
|
|
5808
5808
|
onOpenInEditor: () => v(n)
|
|
5809
5809
|
}
|
|
5810
5810
|
),
|
|
5811
|
-
!s && t && /* @__PURE__ */ e("div", { className: "flex flex-col space-y-1.5", children: /* @__PURE__ */
|
|
5811
|
+
!s && t && /* @__PURE__ */ e("div", { className: "flex flex-col space-y-1.5", children: /* @__PURE__ */ a("div", { className: "relative", children: [
|
|
5812
|
+
/* @__PURE__ */ e("div", { className: "absolute right-2 top-2 z-10", children: /* @__PURE__ */ e(Nt, { text: t, className: "h-6 w-6" }) }),
|
|
5813
|
+
/* @__PURE__ */ e(gr, { code: t, language: "sql" })
|
|
5814
|
+
] }) })
|
|
5812
5815
|
] }),
|
|
5813
5816
|
s && r && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ a(
|
|
5814
5817
|
R,
|
|
@@ -7207,7 +7210,7 @@ function tu({
|
|
|
7207
7210
|
className: `relative rounded-md border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-950/20 ${s}`,
|
|
7208
7211
|
children: [
|
|
7209
7212
|
/* @__PURE__ */ e("div", { className: "float-right mb-2 ml-2", children: /* @__PURE__ */ e(
|
|
7210
|
-
|
|
7213
|
+
Nt,
|
|
7211
7214
|
{
|
|
7212
7215
|
text: t,
|
|
7213
7216
|
className: `h-6 w-6 p-0 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 ${r}`
|
|
@@ -7665,7 +7668,7 @@ function Pn({
|
|
|
7665
7668
|
}
|
|
7666
7669
|
),
|
|
7667
7670
|
/* @__PURE__ */ e(
|
|
7668
|
-
|
|
7671
|
+
Nt,
|
|
7669
7672
|
{
|
|
7670
7673
|
text: JSON.stringify(p == null ? void 0 : p.records, null, 2),
|
|
7671
7674
|
className: "h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70"
|
|
@@ -7793,7 +7796,7 @@ function lu() {
|
|
|
7793
7796
|
)
|
|
7794
7797
|
] });
|
|
7795
7798
|
}
|
|
7796
|
-
function
|
|
7799
|
+
function Ct({
|
|
7797
7800
|
defaultValue: t,
|
|
7798
7801
|
label: s,
|
|
7799
7802
|
options: n,
|
|
@@ -7869,7 +7872,7 @@ function iu() {
|
|
|
7869
7872
|
children: [
|
|
7870
7873
|
/* @__PURE__ */ e("div", { className: "col-span-4 flex items-center", children: I }),
|
|
7871
7874
|
/* @__PURE__ */ e(
|
|
7872
|
-
|
|
7875
|
+
Ct,
|
|
7873
7876
|
{
|
|
7874
7877
|
className: "col-span-6 h-8 w-full justify-between",
|
|
7875
7878
|
label: "",
|
|
@@ -7903,7 +7906,7 @@ function iu() {
|
|
|
7903
7906
|
},
|
|
7904
7907
|
D
|
|
7905
7908
|
) : k === "select" ? /* @__PURE__ */ e(
|
|
7906
|
-
|
|
7909
|
+
Ct,
|
|
7907
7910
|
{
|
|
7908
7911
|
className: "h-8 w-full",
|
|
7909
7912
|
label: "",
|
|
@@ -7949,7 +7952,7 @@ function iu() {
|
|
|
7949
7952
|
/* @__PURE__ */ e(be, { children: /* @__PURE__ */ a("div", { className: "space-y-4 text-sm", children: [
|
|
7950
7953
|
/* @__PURE__ */ e("div", { className: "space-y-2", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
7951
7954
|
/* @__PURE__ */ e(
|
|
7952
|
-
|
|
7955
|
+
Ct,
|
|
7953
7956
|
{
|
|
7954
7957
|
icon: /* @__PURE__ */ e(dc, { className: "h-3.5 w-3.5" }),
|
|
7955
7958
|
className: "h-9 w-full",
|
|
@@ -7978,7 +7981,7 @@ function iu() {
|
|
|
7978
7981
|
)
|
|
7979
7982
|
] }) }),
|
|
7980
7983
|
((t == null ? void 0 : t.type) === "component" || (t == null ? void 0 : t.type) === void 0) && t && /* @__PURE__ */ e(X, { children: i && /* @__PURE__ */ e(
|
|
7981
|
-
|
|
7984
|
+
Ct,
|
|
7982
7985
|
{
|
|
7983
7986
|
icon: /* @__PURE__ */ e(fc, { className: "h-3.5 w-3.5" }),
|
|
7984
7987
|
className: "h-9 w-full",
|
|
@@ -9165,7 +9168,7 @@ function wu() {
|
|
|
9165
9168
|
/* @__PURE__ */ e(Tt, { className: "my-4" }),
|
|
9166
9169
|
/* @__PURE__ */ e(hs, { open: !0, summary: "Settings", children: /* @__PURE__ */ a("div", { className: "space-y-3 px-2", children: [
|
|
9167
9170
|
/* @__PURE__ */ e(
|
|
9168
|
-
|
|
9171
|
+
Ct,
|
|
9169
9172
|
{
|
|
9170
9173
|
className: "h-9",
|
|
9171
9174
|
options: [
|
|
@@ -9220,7 +9223,7 @@ function wu() {
|
|
|
9220
9223
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
9221
9224
|
/* @__PURE__ */ e(B, { children: "Map Object" }),
|
|
9222
9225
|
/* @__PURE__ */ e(
|
|
9223
|
-
|
|
9226
|
+
Ct,
|
|
9224
9227
|
{
|
|
9225
9228
|
className: "h-9",
|
|
9226
9229
|
options: o,
|
|
@@ -9242,7 +9245,7 @@ function wu() {
|
|
|
9242
9245
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
9243
9246
|
/* @__PURE__ */ e(B, { children: "Projection" }),
|
|
9244
9247
|
/* @__PURE__ */ e(
|
|
9245
|
-
|
|
9248
|
+
Ct,
|
|
9246
9249
|
{
|
|
9247
9250
|
className: "h-9",
|
|
9248
9251
|
options: yu,
|
|
@@ -9264,7 +9267,7 @@ function wu() {
|
|
|
9264
9267
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
9265
9268
|
/* @__PURE__ */ e(B, { children: "Colors" }),
|
|
9266
9269
|
/* @__PURE__ */ e(
|
|
9267
|
-
|
|
9270
|
+
Ct,
|
|
9268
9271
|
{
|
|
9269
9272
|
className: "h-9",
|
|
9270
9273
|
options: Cu,
|
|
@@ -9444,7 +9447,7 @@ function ku() {
|
|
|
9444
9447
|
return /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
9445
9448
|
/* @__PURE__ */ e(B, { children: "Sort" }),
|
|
9446
9449
|
/* @__PURE__ */ e(
|
|
9447
|
-
|
|
9450
|
+
Ct,
|
|
9448
9451
|
{
|
|
9449
9452
|
className: "h-8",
|
|
9450
9453
|
label: "Sort Chart",
|
|
@@ -10008,7 +10011,7 @@ function gl() {
|
|
|
10008
10011
|
] }) })
|
|
10009
10012
|
] });
|
|
10010
10013
|
}
|
|
10011
|
-
function
|
|
10014
|
+
function wt({
|
|
10012
10015
|
value: t,
|
|
10013
10016
|
onSave: s,
|
|
10014
10017
|
placeholder: n = "",
|
|
@@ -10373,7 +10376,7 @@ function zn({ axis: t, label: s, type: n, config: r, onChange: l }) {
|
|
|
10373
10376
|
)
|
|
10374
10377
|
] }),
|
|
10375
10378
|
((p = r == null ? void 0 : r.name) == null ? void 0 : p.enabled) && /* @__PURE__ */ e(
|
|
10376
|
-
|
|
10379
|
+
wt,
|
|
10377
10380
|
{
|
|
10378
10381
|
placeholder: `${s} title`,
|
|
10379
10382
|
value: ((b = r == null ? void 0 : r.name) == null ? void 0 : b.text) || "",
|
|
@@ -10443,7 +10446,7 @@ function zn({ axis: t, label: s, type: n, config: r, onChange: l }) {
|
|
|
10443
10446
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10444
10447
|
/* @__PURE__ */ e(B, { className: "w-8 text-xs text-muted-foreground", children: "Min" }),
|
|
10445
10448
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10446
|
-
|
|
10449
|
+
wt,
|
|
10447
10450
|
{
|
|
10448
10451
|
type: "number",
|
|
10449
10452
|
placeholder: "auto",
|
|
@@ -10456,7 +10459,7 @@ function zn({ axis: t, label: s, type: n, config: r, onChange: l }) {
|
|
|
10456
10459
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10457
10460
|
/* @__PURE__ */ e(B, { className: "w-8 text-xs text-muted-foreground", children: "Max" }),
|
|
10458
10461
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10459
|
-
|
|
10462
|
+
wt,
|
|
10460
10463
|
{
|
|
10461
10464
|
type: "number",
|
|
10462
10465
|
placeholder: "auto",
|
|
@@ -10469,7 +10472,7 @@ function zn({ axis: t, label: s, type: n, config: r, onChange: l }) {
|
|
|
10469
10472
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10470
10473
|
/* @__PURE__ */ e(B, { className: "w-8 text-xs text-muted-foreground", children: "Step" }),
|
|
10471
10474
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10472
|
-
|
|
10475
|
+
wt,
|
|
10473
10476
|
{
|
|
10474
10477
|
type: "number",
|
|
10475
10478
|
placeholder: "auto",
|
|
@@ -10779,7 +10782,7 @@ function vl() {
|
|
|
10779
10782
|
["number", "currency", "percent"].includes(s.format) && /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10780
10783
|
/* @__PURE__ */ e(B, { className: "text-xs text-muted-foreground w-20", children: "Decimals" }),
|
|
10781
10784
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10782
|
-
|
|
10785
|
+
wt,
|
|
10783
10786
|
{
|
|
10784
10787
|
type: "number",
|
|
10785
10788
|
placeholder: "0",
|
|
@@ -10833,7 +10836,7 @@ function vl() {
|
|
|
10833
10836
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10834
10837
|
/* @__PURE__ */ e(B, { className: "text-xs text-muted-foreground w-20", children: "Size" }),
|
|
10835
10838
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10836
|
-
|
|
10839
|
+
wt,
|
|
10837
10840
|
{
|
|
10838
10841
|
type: "number",
|
|
10839
10842
|
placeholder: "12",
|
|
@@ -10882,7 +10885,7 @@ function vl() {
|
|
|
10882
10885
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
10883
10886
|
/* @__PURE__ */ e(B, { className: "text-xs text-muted-foreground w-20", children: "Rotation" }),
|
|
10884
10887
|
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
10885
|
-
|
|
10888
|
+
wt,
|
|
10886
10889
|
{
|
|
10887
10890
|
type: "number",
|
|
10888
10891
|
placeholder: "0",
|
|
@@ -12636,7 +12639,7 @@ function em({
|
|
|
12636
12639
|
), Rt = () => U ? /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
12637
12640
|
/* @__PURE__ */ e(B, { className: "text-xs font-medium text-muted-foreground", children: "Label" }),
|
|
12638
12641
|
/* @__PURE__ */ e(
|
|
12639
|
-
|
|
12642
|
+
wt,
|
|
12640
12643
|
{
|
|
12641
12644
|
value: t.label ?? "",
|
|
12642
12645
|
onSave: G,
|
|
@@ -12697,7 +12700,7 @@ function em({
|
|
|
12697
12700
|
] })
|
|
12698
12701
|
] })
|
|
12699
12702
|
] }) : null, Ae = () => {
|
|
12700
|
-
var Le, He,
|
|
12703
|
+
var Le, He, St, ia, mn;
|
|
12701
12704
|
const Q = ht, Pe = yt;
|
|
12702
12705
|
return !Q && !Pe ? null : /* @__PURE__ */ a(X, { children: [
|
|
12703
12706
|
Q && /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
@@ -12730,7 +12733,7 @@ function em({
|
|
|
12730
12733
|
}
|
|
12731
12734
|
)
|
|
12732
12735
|
] }) }),
|
|
12733
|
-
((
|
|
12736
|
+
((St = b.config) == null ? void 0 : St.showTrendline) && /* @__PURE__ */ a(X, { children: [
|
|
12734
12737
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
12735
12738
|
/* @__PURE__ */ e(B, { className: "text-xs font-medium text-muted-foreground", children: "Trendline Window" }),
|
|
12736
12739
|
/* @__PURE__ */ e(
|
|
@@ -12775,7 +12778,7 @@ function em({
|
|
|
12775
12778
|
return Je ? /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
12776
12779
|
/* @__PURE__ */ e(B, { className: "text-xs font-medium text-muted-foreground", children: "Target Value" }),
|
|
12777
12780
|
/* @__PURE__ */ e(
|
|
12778
|
-
|
|
12781
|
+
wt,
|
|
12779
12782
|
{
|
|
12780
12783
|
value: ((Q = b.config) == null ? void 0 : Q.targetValue) !== void 0 && ((Pe = b.config) == null ? void 0 : Pe.targetValue) !== null ? String(b.config.targetValue) : "",
|
|
12781
12784
|
onSave: (Le) => {
|
|
@@ -12855,16 +12858,16 @@ function em({
|
|
|
12855
12858
|
var He;
|
|
12856
12859
|
Pe.stopPropagation();
|
|
12857
12860
|
const Le = ee.conditions.filter(
|
|
12858
|
-
(
|
|
12861
|
+
(St) => St.id !== Q.id
|
|
12859
12862
|
);
|
|
12860
12863
|
if (Le.length > 0) {
|
|
12861
|
-
const
|
|
12864
|
+
const St = {
|
|
12862
12865
|
...ee,
|
|
12863
12866
|
conditions: Le
|
|
12864
12867
|
};
|
|
12865
|
-
ne(
|
|
12868
|
+
ne(St);
|
|
12866
12869
|
} else if (J(void 0), s === "metrics") {
|
|
12867
|
-
const
|
|
12870
|
+
const St = {
|
|
12868
12871
|
...t,
|
|
12869
12872
|
parameters: {
|
|
12870
12873
|
...t.parameters,
|
|
@@ -12873,7 +12876,7 @@ function em({
|
|
|
12873
12876
|
}, ia = [
|
|
12874
12877
|
...((He = b.config) == null ? void 0 : He.metricColumns) || []
|
|
12875
12878
|
];
|
|
12876
|
-
ia[n] =
|
|
12879
|
+
ia[n] = St, T.getState().actions.updateCardConfig(b.id, {
|
|
12877
12880
|
metricColumns: ia
|
|
12878
12881
|
});
|
|
12879
12882
|
}
|
|
@@ -214,7 +214,7 @@ ${y.joinType} JOIN ${I.name}
|
|
|
214
214
|
ON ${B}`}),g},isValidConfiguration:()=>!(!n.baseEntity.name||n.joins.some(y=>!y.source.name||!y.target.name)||n.joins.some(y=>y.joinKeyGroups.some(I=>I.keys.length===0))||n.joins.some(y=>y.joinKeyGroups.some(I=>I.keys.some(C=>!C.source.name||!C.target.name||!C.operator))))}}function La({joinPlan:t,availableDataSources:a,onSave:n,onRemove:r,onCancel:l}){const{setCardConfig:c}=s.useEditorActions();s.useEditorStore(C=>C.card.config);const{columnGroups:i}=s.useColumns(),{joinPlan:o,expandedJoins:d,setJoinPlan:u,addJoin:m,removeJoin:h,updateJoin:x,moveJoinUp:j,moveJoinDown:b,toggleJoinExpansion:f,getAvailableSourceEntities:v,getAvailableTargetEntities:D,addJoinKeyGroup:k,updateGroupOperator:P,removeJoinKeyGroup:L,addJoinKey:T,updateJoinKey:N,removeJoinKey:p,generateSQLPreview:g,isValidConfiguration:y}=Fa({initialJoinPlan:t,availableDataSources:a}),I=C=>{const B=i.find(A=>A.entityName===C);return(B==null?void 0:B.columns)||[]};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Base Entity (FROM clause)"}),e.jsxs(s.Select,{value:o.baseEntity.name,onValueChange:C=>{const B=a.find(A=>A.name===C);u({...o,baseEntity:{connectionId:(B==null?void 0:B.connectionId)||"",connectionType:(B==null?void 0:B.connectionType)||"none",type:(B==null?void 0:B.type)||"table",name:C,database:B==null?void 0:B.database,schema:B==null?void 0:B.schema}})},children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select base entity..."})}),e.jsx(s.SelectContent,{children:a.map(C=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:C.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:C.type}),C.name,e.jsx(s.Badge,{variant:"outline",className:"text-xs text-green-600",children:"BASE"})]})},C.name))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This entity will be used as the base table in the FROM clause of the SQL query."})]}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Join SQL Preview"}),e.jsx("code",{className:"block whitespace-pre-wrap break-all text-xs",children:g()})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(s.Label,{children:["Joins Configuration (",o.joins.length,")"]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(s.Button,{variant:"outline",size:"sm",onClick:m,children:[e.jsx(s.Plus,{className:"mr-1 h-4 w-4"}),"Add Join"]})})]}),o.joins.length===0?e.jsx("div",{className:"rounded-lg border border-dashed py-8 text-center text-muted-foreground",children:e.jsx("p",{children:"No joins configured. Add a join to connect multiple data sources."})}):e.jsx("div",{className:"max-h-[300px] space-y-4 overflow-y-auto",children:o.joins.map(C=>{const B=a.find(E=>E.name===C.source.name),A=a.find(E=>E.name===C.target.name),F=d.has(C.id);return e.jsxs(s.Card,{className:"border",children:[e.jsx(s.CardHeader,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{children:C.sequence}),e.jsxs(s.CardTitle,{className:"text-sm",children:["Join ",C.sequence,B&&A&&e.jsxs("span",{className:"ml-2 font-normal text-gray-600",children:["(",B.name," → ",A.name,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>j(C.id),disabled:C.sequence===1,children:e.jsx(s.ArrowUp,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>b(C.id),disabled:C.sequence===o.joins.length,children:e.jsx(s.ArrowDown,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>f(C.id),children:F?e.jsx(s.ChevronUp,{className:"h-4 w-4"}):e.jsx(s.ChevronDown,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>h(C.id),children:e.jsx(s.X,{className:"h-4 w-4"})})]})]})}),F&&e.jsxs(s.CardContent,{className:"space-y-4 pb-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Source"}),e.jsxs(s.Select,{value:C.source.name,onValueChange:E=>{const M=a.find(S=>S.name===E);x(C.id,{source:{connectionId:(M==null?void 0:M.connectionId)||"",connectionType:(M==null?void 0:M.connectionType)||"none",type:(M==null?void 0:M.type)||"table",name:E,database:M==null?void 0:M.database,schema:M==null?void 0:M.schema}})},children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select source..."})}),e.jsx(s.SelectContent,{children:v(C.id).map(E=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:E.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:E.type}),E.name]})},E.name))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Join Type"}),e.jsxs(s.Select,{value:C.joinType,onValueChange:E=>x(C.id,{joinType:E}),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"INNER",children:"INNER JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"LEFT",children:"LEFT JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"RIGHT",children:"RIGHT JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"FULL",children:"FULL JOIN"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Target"}),e.jsxs(s.Select,{value:C.target.name,onValueChange:E=>{const M=a.find(S=>S.name===E);x(C.id,{target:{connectionId:(M==null?void 0:M.connectionId)||"",connectionType:(M==null?void 0:M.connectionType)||"none",type:(M==null?void 0:M.type)||"table",name:E,database:M==null?void 0:M.database,schema:M==null?void 0:M.schema}})},disabled:!C.source.name,children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select target..."})}),e.jsx(s.SelectContent,{children:C.source.name?D(C.source.name).map(E=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:E.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:E.type}),E.name,E.name===C.source.name&&e.jsx(s.Badge,{variant:"outline",className:"text-xs text-yellow-600",children:"(Self-join)"})]})},E.name)):[]})]})]})]}),C.source.name&&C.target.name&&B&&A&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(s.Label,{children:"Join Conditions"}),e.jsxs(s.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>k(C.id),children:[e.jsx(s.Plus,{className:"mr-1 h-3 w-3"})," Add Condition Group"]})]}),C.joinKeyGroups.length===0?e.jsx("div",{className:"rounded-md border p-3 text-center text-sm text-gray-500",children:"No join conditions defined. Add condition groups to specify how data sources should be joined."}):e.jsx("div",{className:"space-y-4",children:C.joinKeyGroups.map((E,M)=>e.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(s.Label,{children:["Group ",M+1]}),M>0&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-gray-100 px-2 py-1",children:[e.jsx(s.Label,{className:"text-xs font-normal",children:"Join with:"}),e.jsx("span",{className:"text-sm font-medium",children:"OR"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(s.Select,{value:E.operator,onValueChange:S=>P(C.id,M,S),children:[e.jsx(s.SelectTrigger,{className:"w-[100px]",children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"AND",children:"AND"}),e.jsx(s.SelectItem,{value:"OR",children:"OR"})]})]}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>L(C.id,M),children:e.jsx(s.Trash2,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[E.keys.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-center text-sm text-gray-500",children:"No conditions in this group. Add conditions to specify join criteria."}):e.jsx("div",{className:"space-y-2",children:E.keys.map((S,O)=>e.jsxs("div",{className:"flex flex-col items-start gap-2 rounded-md border p-2 sm:flex-row sm:items-center",children:[O>0&&e.jsx("div",{className:"self-center rounded-md bg-gray-100 px-2 py-1 text-xs font-medium",children:E.operator}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:flex-1",children:e.jsxs(s.Select,{value:S.source.name,onValueChange:R=>N(C.id,M,O,"sourceColumnName",R),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Source column"})}),e.jsx(s.SelectContent,{children:I(C.source.name).map(R=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:R.name,children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("span",{children:R.name}),e.jsx(s.Badge,{variant:"outline",className:"ml-2 text-xs",children:R.dataType})]})},R.name))})]})}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:w-20",children:e.jsxs(s.Select,{value:S.operator,onValueChange:R=>N(C.id,M,O,"operator",R),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"=",children:"="}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"<",children:"<"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:">",children:">"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"<=",children:"<="}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:">=",children:">="})]})]})}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:flex-1",children:e.jsxs(s.Select,{value:S.target.name,onValueChange:R=>N(C.id,M,O,"targetColumnName",R),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Target column"})}),e.jsx(s.SelectContent,{children:I(C.target.name).map(R=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:R.name,children:e.jsxs("div",{className:"flex w-full items-center justify-between hover:bg-muted",children:[e.jsx("span",{children:R.name}),e.jsx(s.Badge,{variant:"outline",className:"ml-2 text-xs",children:R.dataType})]})},R.name))})]})}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",className:"self-center",onClick:()=>p(C.id,M,O),children:e.jsx(s.X,{className:"size-3.5"})})]},S.id||O))}),e.jsxs(s.Button,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>T(C.id,M),children:[e.jsx(s.Plus,{className:"mr-1 h-3 w-3"})," Add Condition"]})]})]},E.id))})]})]})]},C.id)})})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>{r(),l()},children:"Remove All"}),e.jsx(s.Button,{variant:"outline",onClick:l,children:"Cancel"}),e.jsx(s.Button,{onClick:()=>n(o),disabled:!y(),children:"Save"})]})]})}function He({children:t,open:a,onOpenChange:n,joinPlan:r,availableDataSources:l,onRemove:c,onSave:i,onCancel:o}){return e.jsxs(s.Dialog,{open:a,onOpenChange:n,children:[e.jsxs(s.DialogContent,{className:"max-w-4xl",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Join Configuration"}),e.jsx(s.DialogDescription,{children:"Configure the join between the two entities to combine the fields."})]}),e.jsx(La,{joinPlan:r,availableDataSources:l,onSave:i,onCancel:o,onRemove:c})]}),t]})}function Ma({joins:t,baseEntityId:a,availableDataSources:n,generateSQLPreview:r}){return e.jsxs("div",{className:"divide-y divide-border",children:[t.length>0&&e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"mb-3 text-left font-semibold",children:"Join Chain"}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:(()=>{const l=[...t].sort((i,o)=>i.sequence-o.sequence),c=n.find(i=>i.name===a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1 rounded-md border bg-muted px-2 py-1",children:[e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:c==null?void 0:c.type}),e.jsx("span",{className:"text-xs font-medium",children:c==null?void 0:c.name}),e.jsx(s.Badge,{variant:"outline",className:"text-xs text-green-600",children:"BASE"})]}),l.map(i=>{const o=n.find(d=>d.name===i.target.name);return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"mx-1 flex items-center gap-1",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:i.joinType}),e.jsx("span",{className:"text-muted-foreground",children:"→"})]}),e.jsxs("div",{className:"flex items-center gap-1 rounded-md border bg-muted px-2 py-1",children:[e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:o==null?void 0:o.type}),e.jsx("span",{className:"text-xs font-medium",children:o==null?void 0:o.name})]})]},i.id)})]})})()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"mb-3 text-left text-sm font-medium",children:["Configured Joins (",t.length,")"]}),e.jsx("div",{className:"space-y-2",children:[...t].sort((l,c)=>l.sequence-c.sequence).map((l,c)=>{const i=n.find(d=>d.name===l.source.name),o=n.find(d=>d.name===l.target.name);return e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted p-2 text-left",children:[e.jsx(s.Badge,{variant:"secondary",className:"shrink-0 text-xs",children:c+1}),e.jsx(s.Badge,{variant:"outline",className:"shrink-0 text-xs",children:l.joinType}),e.jsxs("span",{className:"text-xs font-medium",children:[i==null?void 0:i.name," → ",o==null?void 0:o.name]}),e.jsxs(s.Badge,{variant:"outline",className:"ml-auto text-xs",children:[l.joinKeyGroups.reduce((d,u)=>d+u.keys.length,0)," ","condition",l.joinKeyGroups.reduce((d,u)=>d+u.keys.length,0)>1?"s":""]})]},l.id)})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"mb-3 text-left text-sm font-medium",children:"SQL Query"}),e.jsx("div",{className:"overflow-x-auto rounded-md border bg-muted p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-left font-mono text-xs text-muted-foreground",children:r()})})]})]})}function Pa(){var h,x;const t=s.useEditorStore(j=>j.card),{autoJoinMetadata:a}=s.useDashboardCardQuery(t),n=s.useEditorStore(j=>j.actions.updateCardConfig),r=((h=t==null?void 0:t.config)==null?void 0:h.joinPlan)||{baseEntity:{type:"table",name:"",database:"",schema:"",connectionId:"",connectionType:"none",dialect:"none"},joins:[]},[l,c]=w.useState(!1),i=((x=t==null?void 0:t.dataSource)==null?void 0:x.selectedEntities)||[],o=j=>{n(t.id,{...t==null?void 0:t.config,joinPlan:j}),c(!1)},d=()=>{n(t.id,{...t==null?void 0:t.config,joinPlan:void 0})},u=()=>{c(!1)},m=()=>{const j=[...r.joins].sort((v,D)=>v.sequence-D.sequence),b=r.baseEntity;if(!b.name)return"SELECT * FROM table -- Please select a base entity";let f=`SELECT *
|
|
215
215
|
FROM ${b.name}`;return j.forEach(v=>{const D=i.find(L=>L.name===v.target.name);if(!D)return;const k=v.joinKeyGroups.filter(L=>L.keys&&L.keys.length>0).map(L=>{const T=L.keys.filter(N=>{var p,g,y,I;return((p=N.source)==null?void 0:p.name)&&((g=N.target)==null?void 0:g.name)&&((y=N.source)==null?void 0:y.entityName)&&((I=N.target)==null?void 0:I.entityName)}).map(N=>`${N.source.entityName}.${N.source.name} ${N.operator} ${N.target.entityName}.${N.target.name}`);return T.length>1?`(${T.join(` ${L.operator} `)})`:T[0]}).filter(Boolean),P=k.length>1?k.join(" OR "):k[0]||"condition_here";f+=`
|
|
216
216
|
${v.joinType} JOIN ${D.name}
|
|
217
|
-
ON ${P}`}),f};return i.length<2?null:e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[r.joins.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-6 text-xs font-semibold",onClick:()=>c(!0),children:[e.jsx(s.Link,{className:s.cn("mr-1 h-3 w-3",{"text-blue-500":r.joins.length>0,"text-gray-500":r.joins.length===0})}),"Join",r.joins.length>1?"s":""," (",r.joins.length,")"]})}),e.jsx(s.TooltipContent,{side:"right",className:"max-w-md overflow-hidden p-0",children:e.jsx(Ma,{joins:r.joins,baseEntityId:r.baseEntity.name,availableDataSources:i,generateSQLPreview:m})})]})}),(a==null?void 0:a.autoResolved)&&e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",className:"h-6 gap-1 bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-300",children:[e.jsx(s.Sparkles,{className:"h-3 w-3"}),"Auto"]})}),e.jsx(s.TooltipContent,{side:"right",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Auto-resolved using relationships:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:a.relationshipsUsed.map((j,b)=>e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:j},b))})]})})]})}),e.jsx(He,{open:l,onOpenChange:c,joinPlan:r,availableDataSources:i,onSave:o,onCancel:u,onRemove:d,children:e.jsx("div",{})})]}),r.joins.length===0&&e.jsx(He,{open:l,onOpenChange:c,joinPlan:r,availableDataSources:i,onSave:o,onCancel:u,onRemove:d,children:e.jsxs(s.Button,{onClick:()=>c(!0),variant:"outline",size:"sm",className:"w-full",children:[e.jsx(s.Link,{className:"mr-3 size-4"}),"Configure Joins"]})})]})})})}function Ba({open:t,onOpenChange:a}){const[n,r]=w.useState([]),{updateDataSource:l}=s.useEditorActions(),c=s.useDashboardStore(f=>f.dashboard.aiContext),i=(c==null?void 0:c.selectedEntities)||[];w.useEffect(()=>{t&&r([])},[t]);const o=f=>{r(v=>v.some(k=>k.name===f.name&&k.type===f.type)?v.filter(k=>!(k.name===f.name&&k.type===f.type)):[...v,f])},d=()=>{r([...i])},u=()=>{r([])},m=()=>{if(n.length===0)return;const f=n[0],v=f.connectionId||"",D=f.connectionType||"",P=n.some(T=>T.type==="dataset")?"semanticDomain":"database";l({connectionId:v,connectionType:D,mode:P,selectedEntities:n}),a(!1)},h=f=>{switch(f.type){case"table":return e.jsx(s.Table,{className:"h-4 w-4"});case"view":return e.jsx(_t,{className:"h-4 w-4"});case"model":return e.jsx(Nt,{className:"h-4 w-4"});case"dataset":return e.jsx(s.Database,{className:"h-4 w-4"});case"file":case"url":case"upload":return e.jsx(s.FileText,{className:"h-4 w-4"});default:return e.jsx(s.Database,{className:"h-4 w-4"})}},x=f=>"label"in f&&f.label?f.label:f.name,j=f=>{if("description"in f&&f.description)return f.description;const v=[];return f.database&&v.push(f.database),f.schema&&v.push(f.schema),f.name&&v.push(f.name),v.join(".")},b=f=>n.some(v=>v.name===f.name&&v.type===f.type);return i.length===0?e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"max-w-md",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"No Data Available"}),e.jsx(s.DialogDescription,{children:"No entities are currently available in the AI context. Please add some data sources to the dashboard first."})]}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{onClick:()=>a(!1),children:"Close"})})]})}):e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"flex max-w-2xl flex-col",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Select Data to Analyze"}),e.jsx(s.DialogDescription,{children:"Choose entities from the dashboard's context"})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:d,disabled:n.length===i.length,children:"Select All"}),e.jsx(s.Button,{variant:"outline",size:"sm",onClick:u,disabled:n.length===0,children:"Clear All"})]}),e.jsxs(s.Badge,{variant:"secondary",children:[n.length," of ",i.length," selected"]})]}),e.jsx(s.Separator,{}),e.jsx(s.ScrollArea,{className:"h-64",children:e.jsx("div",{className:"space-y-2",children:i.map((f,v)=>e.jsxs("div",{className:s.cn("flex items-center gap-3 rounded-lg border p-3 transition-colors hover:bg-muted/50",b(f)&&"border-primary bg-primary/5"),children:[e.jsx(s.Checkbox,{checked:b(f),onCheckedChange:()=>o(f)}),e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:h(f)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:x(f)}),e.jsx("div",{className:"truncate text-sm text-muted-foreground",children:j(f)})]}),e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:f.type})]},`${f.type}-${f.name}-${v}`))})})]}),e.jsx(s.DialogFooter,{children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex grow justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsxs(s.Button,{onClick:m,disabled:n.length===0,children:["Select"," ",n.length>0?`(${n.length})`:""]})]})})})]})})}function Oa({entity:t,title:a,maxDetails:n=10}){const l=s.getEntityDetails(t).slice(0,n),c=l.find(o=>o.label==="Description"),i=l.filter(o=>o.label==="Description"?!1:!["Connection","Database","Schema"].includes(o.label));return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:a||s.getDisplayName(t)}),c&&e.jsxs("div",{className:"border-t border-border pt-2",children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:c.value})]}),i.length>0&&e.jsx("div",{className:"space-y-0.5",children:i.map((o,d)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[o.label,":"]}),e.jsx("span",{className:"font-mono",children:o.value})]},d))})]})})}function Va({entities:t}){return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[t.length," more entities"]}),e.jsx("div",{className:"space-y-1",children:t.map((a,n)=>{const r=s.getEntityDetails(a),l=r.find(i=>i.label==="Description"),c=r.filter(i=>i.label==="Description"?!1:!["Connection","Database","Schema"].includes(i.label)).slice(0,3);return e.jsxs("div",{className:"border-b border-border pb-1 last:border-b-0",children:[e.jsx("div",{className:"text-xs font-medium",children:s.getDisplayName(a)}),l&&e.jsxs("div",{className:"mb-1 mt-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:l.value})]}),c.length>0&&e.jsx("div",{className:"mt-1 space-y-0.5",children:c.map((i,o)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[i.label,":"]}),e.jsx("span",{className:"font-mono",children:i.value})]},o))})]},`remaining-${a.type}-${a.name}-${n}`)})})]})})}function zs(){const t=s.useEditorStore(i=>i.card.dataSource),{setSelectedConnectionId:a,setSelectedDatabaseName:n,setSelectedSchemaName:r,setSelectedTableName:l,setSelectedDatamodelId:c}=s.useEditorActions();w.useEffect(()=>{var j;if(!t)return;const{tableName:i,schemaName:o,databaseName:d,connectionId:u}=Xe(t),m=(j=t.selectedEntities)==null?void 0:j[0],x=(m==null?void 0:m.type)==="model"&&"id"in m?m.id:"";a(u||""),n(d||""),r(o||""),l(i||""),c(x)},[t,a,n,r,l,c])}function qs({isVisible:t}){const a=s.useEditorStore(x=>x.isDevMode);zs();const[n,r]=w.useState(!1),[l,c]=w.useState(!1),[i,o]=w.useState(!0),d=s.useEditorStore(x=>x.card.dataSource);s.useCurrentUserInfo();const{updateDataSource:u}=s.useEditorActions(),m={connectionId:"",connectionType:"",mode:"database",selectedEntities:[]},h={...m,...d,selectedEntities:(d==null?void 0:d.selectedEntities)||[]};return e.jsxs("div",{className:s.cn("flex flex-col overflow-hidden bg-background transition-all duration-300 ease-in-out",{"w-[325px]":t,"w-0":!t}),children:[e.jsxs("div",{children:[e.jsx("div",{className:"p-4 px-6 pb-2",children:e.jsxs(s.Button,{className:"w-full bg-muted/50",variant:"outline",onClick:()=>r(!0),children:[e.jsx(s.Database,{className:"mr-2 h-3.5 w-3.5"}),"Choose Dataset"]})}),e.jsxs("div",{className:"relative px-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center px-6",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center",children:e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>o(!i),className:"size-6 bg-background p-1 py-1 hover:bg-accent",children:i?e.jsx(s.ChevronUp,{className:"h-3.5 w-3.5"}):e.jsx(s.ChevronDown,{className:"h-3.5 w-3.5"})})})]}),e.jsxs("div",{className:`overflow-hidden px-6 ${i?"max-h-96 space-y-4":"max-h-0 py-0 opacity-0"}`,children:[h.selectedEntities.length>0&&e.jsx(s.TooltipProvider,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.selectedEntities.slice(0,3).map((x,j)=>e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",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",children:[s.getDisplayName(x),e.jsx("button",{onClick:b=>{b.stopPropagation();const f=h.selectedEntities.filter(v=>!(v.name===x.name&&v.type===x.type));u({...m,...d,selectedEntities:f})},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-0.5 hover:bg-red-100",children:e.jsx(s.X,{className:"h-2.5 w-2.5 group-hover:text-red-500"})})]})}),e.jsx(Oa,{entity:x})]},`${x.type}-${x.name}-${j}`)),h.selectedEntities.length>3&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"outline",className:"text-xs",children:["+",h.selectedEntities.length-3," more"]})}),e.jsx(Va,{entities:h.selectedEntities.slice(3)})]})]})}),!a&&e.jsx(Pa,{})]})]}),e.jsx(Rs,{}),e.jsx(s.DataSourceDialog,{incomingSelectedEntities:(d==null?void 0:d.selectedEntities)||[],dialogMode:"dataSource",open:n,onOpenChange:r,dataSource:h}),e.jsx(Ba,{open:l,onOpenChange:c})]})}function $s({error:t,errorSql:a,onSendFeedback:n,onOpenInEditor:r,className:l,showFeedbackButton:c=!0}){const[i,o]=w.useState(!1);return e.jsx("div",{className:s.cn("rounded-lg border border-destructive/30 bg-destructive/5 p-4",l),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.CircleAlert,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-destructive"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Query Error"}),e.jsxs("div",{className:"relative rounded-md bg-background/60 p-3",children:[e.jsx(s.CopyButton,{text:t,className:"absolute right-2 top-2 h-6 w-6 z-10"}),e.jsx("div",{className:"max-h-40 overflow-auto pr-10",children:e.jsx("p",{className:"font-mono text-xs text-foreground/80 break-all",children:t})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(s.Collapsible,{open:i,onOpenChange:o,children:e.jsx(s.CollapsibleTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"sm",className:"h-8",children:i?e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronUp,{className:"mr-1.5 h-3.5 w-3.5"}),"Hide Details"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronDown,{className:"mr-1.5 h-3.5 w-3.5"}),"Show Details"]})})})}),r&&a&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:r,children:[e.jsx(Ds,{className:"mr-1.5 h-3.5 w-3.5"}),"Open in Editor"]}),c&&n&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:n,children:[e.jsx(s.MessageSquareWarning,{className:"mr-1.5 h-3.5 w-3.5"}),"Send Feedback"]})]}),e.jsx(s.Collapsible,{open:i,onOpenChange:o,children:e.jsx(s.CollapsibleContent,{className:"space-y-2",children:e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:a?"Error SQL Query":"SQL Query"}),a&&e.jsx(s.CopyButton,{text:a,className:"h-6 w-6"})]}),a?e.jsx("div",{className:"rounded-md bg-background/60 p-2 max-h-80 overflow-auto",children:e.jsx(s.CodeHighlighter,{code:a,language:"sql"})}):e.jsx("div",{className:"rounded-md bg-background/60 p-3",children:e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"SQL query not available for this error"})})]})})})]})]})})}function Gs({sql:t,error:a,errorSql:n,onDebugWithAssistant:r}){const l=s.useEditorStore(f=>f.isDevMode),{setIsDevMode:c,setCardSql:i,setRunSql:o}=s.useEditorActions(),[d,u]=w.useState(!1),m=s.useEditorStore(f=>f.card),h=s.useEditorStore(f=>f.frame),x=s.useDashboardStore(f=>f.selectedSheetId),j=s.useDashboardStore(f=>{var v;return(v=f.dashboard)==null?void 0:v.id});function b(f){c(!0),i(f||t),setTimeout(()=>{o(!0)},100)}return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col pt-4",children:[!l&&t&&!a&&e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs(s.Button,{onClick:()=>b(),variant:"secondary",size:"sm",children:[e.jsx(Ds,{className:"mr-2 h-4 w-4"}),"View in SQL Editor"]}),e.jsxs(s.Button,{onClick:()=>u(!d),variant:"outline",size:"sm",children:[e.jsx(s.Info,{className:"mr-2 h-4 w-4"}),"Card Details"]})]}),d&&e.jsx("div",{className:"mb-3 rounded-lg border border-border bg-muted/30 p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Card Information"}),e.jsx(s.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>u(!1),children:e.jsx(ws,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Card ID"}),e.jsx("code",{className:"text-xs font-mono",children:m.id||"N/A"})]}),e.jsx(s.CopyButton,{text:m.id||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Frame ID"}),e.jsx("code",{className:"text-xs font-mono",children:h.id||"N/A"})]}),e.jsx(s.CopyButton,{text:h.id||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Sheet ID"}),e.jsx("code",{className:"text-xs font-mono",children:x||"N/A"})]}),e.jsx(s.CopyButton,{text:x||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Dashboard ID"}),e.jsx("code",{className:"text-xs font-mono",children:j||"N/A"})]}),e.jsx(s.CopyButton,{text:j||"",className:"h-6 w-6"})]})]})]})}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto text-xs leading-relaxed text-foreground/80",children:[a&&e.jsx($s,{error:a,errorSql:n,showFeedbackButton:!1,onOpenInEditor:()=>b(n)}),!a&&t&&e.jsx("div",{className:"flex flex-col space-y-1.5",children:e.jsx("div",{className:"",children:e.jsx(s.CodeHighlighter,{code:t,language:"sql"})})})]}),a&&r&&e.jsx("div",{className:"mt-3",children:e.jsxs(s.Button,{onClick:r,size:"sm",variant:"outline",children:[e.jsx(Et,{className:"mr-2 h-4 w-4"}),"Debug with Assistant"]})})]})}function Ra({sql:t,error:a,errorSql:n,onDebugWithAssistant:r}){return e.jsxs(s.HoverCard,{openDelay:a?0:500,children:[e.jsx(s.HoverCardTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"link",className:"h-5 p-0",children:a?e.jsx(ws,{className:"h-4 w-4 text-red-500"}):e.jsx(s.Info,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(s.HoverCardContent,{align:"start",className:"flex w-[700px]",children:e.jsx(Gs,{errorSql:n,sql:t,error:a,onDebugWithAssistant:r})})]})}function za(t){return s.GenIcon({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)}function Us(t){const{theme:a}=s.useTheme(),n=s.useDashboardStore(f=>f.theme),r=s.useEditorStore(f=>f.frame),l=s.useEditorStore(f=>f.card),c=s.useEditorStore(f=>f.activeTabCardId),i=s.Le(),{refetch:o}=s.useDashboardCardQuery(l),{updateCardTab:d,setRunSql:u}=s.useEditorActions(),m=w.useRef(),h=w.useRef({}),x=r.cards.find(f=>f.id===c),j=w.useCallback(()=>{let f="";return t==="python"&&(f=(x==null?void 0:x.python)||s.PYTHON_DEFAULT_CODE),t==="sql"&&(f=(x==null?void 0:x.sql)||""),f},[t,x]);w.useEffect(()=>{if(c&&l.id&&l.id!==c){if(m.current&&i){const f=m.current.getModel();f&&(h.current[l.id]=f);let v=h.current[c];if(!v){const D=j();v=i.editor.createModel(D,t),h.current[c]=v}m.current.setModel(v)}d(c,l),u(!0)}},[c,l,d,i,u,t,j]),w.useEffect(()=>{if(!i)return;const f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",v=n==="system"?f:n;i.editor.defineTheme("default",{base:v==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":v==="light"?"#ffffff":s.hslStringToHex("240 10% 10%")}}),i.editor.setTheme("default")},[a,n,i]),w.useEffect(()=>{const f=m.current;f&&i&&l&&f.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,function(){return o(),!1})},[i,o,l]);function b(f,v){if(m.current=f,!h.current[l.id]){const D=f.getModel(),k=j();h.current[l.id]=D||(v==null?void 0:v.editor.createModel(k,t))||f.getModel()}f.setModel(h.current[l.id])}return{handleEditorDidMount:b}}function qa(){const t=s.useEditorStore(i=>i.card.sql),a=s.useEditorStore(i=>i.sqlGen),{setCardSql:n,setSqlGen:r}=s.useEditorActions(),{handleEditorDidMount:l}=Us("sql");function c(i){n(i),s.isObjectEmpty(a)||r({})}return e.jsxs("div",{className:"relative h-full w-full",children:[!t&&e.jsx("div",{className:"pointer-events-none absolute left-[65px] top-3 z-10 font-mono text-sm text-muted-foreground",children:"Write your SQL here"}),e.jsx(s.Ft,{theme:"default",className:"pt-3",onChange:c,value:t||"",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"sql",onMount:l})]})}function $a(){const t=s.useEditorStore(l=>l.card.python),{setCardPython:a}=s.useEditorActions(),{handleEditorDidMount:n}=Us("python");function r(l){a(l)}return e.jsx(s.Ft,{className:"pt-3",theme:"default",onChange:r,value:t||s.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"python",onMount:n})}function Ga({jsonString:t}){return e.jsx(s.Ft,{theme:"default",defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:t,options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})}function Ua(){const t=s.useQueryClient(),{isConsoleMode:a}=s.useDashboardPreferences(),[n,r]=w.useState(!1),[l,c]=w.useState(!1);s.useEditorStore(V=>V.frame);const i=s.useEditorStore(V=>V.card);s.useEditorStore(V=>V.isShowingVisual),s.useEditorStore(V=>V.selectedConnectionId),s.useEditorStore(V=>V.tempQueryData),s.useEditorStore(V=>V.selectedDatabaseName),s.useEditorStore(V=>V.selectedDatamodelId),s.useEditorStore(V=>V.selectedSchemaName);const o=s.useEditorStore(V=>V.showAIDialog);s.useEditorStore(V=>V.selectedTableName);const d=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.sql}),u=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.python}),{cardFilterValues:m}=s.useCardFilterValues((i==null?void 0:i.id)??""),{setCardCustomCfg:h,setQueryResultColumns:x,setCardSql:j,setTempQueryData:b,setPythonStdOut:f,setCardPreferences:v,setCardType:D,setCardPython:k,runAssistant:P,setShowAIDialog:L}=s.useEditorActions();s.useEditorStore(V=>V.onSave),s.useEditorStore(V=>V.onClose),s.useEditorStore(V=>V.actions.setSqlGen);const T=s.useEditorStore(V=>V.runSql),N=s.useEditorStore(V=>V.actions.setRunSql),p=s.useEditorStore(V=>V.actions.setIsSqlRunning),{data:g,isLoading:y,isFetching:I,isSuccess:C,isError:B,error:A,errorSql:F,queryKey:E,refetch:M,errorMessage:S}=s.useDashboardCardQuery(i);w.useEffect(()=>{if(g&&(g.rowLimitExceeded&&s.ue.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),f((g==null?void 0:g.output)||""),g.records.length>0)){const{dimensionKeys:V}=s.getKeys(g.records);x(V)}},[g,x,f]),w.useEffect(()=>{(y||I)&&p(!0),(B||C)&&p(!1),B&&(x([]),f(""))},[y,I,g,f,B,C,p,x,A]),w.useEffect(()=>{T&&(t.getQueryData(E)||M(),N(!1))},[T,M,N,E,t]);async function O(){const V=`Can you help me debug this query?
|
|
217
|
+
ON ${P}`}),f};return i.length<2?null:e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[r.joins.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-6 text-xs font-semibold",onClick:()=>c(!0),children:[e.jsx(s.Link,{className:s.cn("mr-1 h-3 w-3",{"text-blue-500":r.joins.length>0,"text-gray-500":r.joins.length===0})}),"Join",r.joins.length>1?"s":""," (",r.joins.length,")"]})}),e.jsx(s.TooltipContent,{side:"right",className:"max-w-md overflow-hidden p-0",children:e.jsx(Ma,{joins:r.joins,baseEntityId:r.baseEntity.name,availableDataSources:i,generateSQLPreview:m})})]})}),(a==null?void 0:a.autoResolved)&&e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",className:"h-6 gap-1 bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-300",children:[e.jsx(s.Sparkles,{className:"h-3 w-3"}),"Auto"]})}),e.jsx(s.TooltipContent,{side:"right",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Auto-resolved using relationships:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:a.relationshipsUsed.map((j,b)=>e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:j},b))})]})})]})}),e.jsx(He,{open:l,onOpenChange:c,joinPlan:r,availableDataSources:i,onSave:o,onCancel:u,onRemove:d,children:e.jsx("div",{})})]}),r.joins.length===0&&e.jsx(He,{open:l,onOpenChange:c,joinPlan:r,availableDataSources:i,onSave:o,onCancel:u,onRemove:d,children:e.jsxs(s.Button,{onClick:()=>c(!0),variant:"outline",size:"sm",className:"w-full",children:[e.jsx(s.Link,{className:"mr-3 size-4"}),"Configure Joins"]})})]})})})}function Ba({open:t,onOpenChange:a}){const[n,r]=w.useState([]),{updateDataSource:l}=s.useEditorActions(),c=s.useDashboardStore(f=>f.dashboard.aiContext),i=(c==null?void 0:c.selectedEntities)||[];w.useEffect(()=>{t&&r([])},[t]);const o=f=>{r(v=>v.some(k=>k.name===f.name&&k.type===f.type)?v.filter(k=>!(k.name===f.name&&k.type===f.type)):[...v,f])},d=()=>{r([...i])},u=()=>{r([])},m=()=>{if(n.length===0)return;const f=n[0],v=f.connectionId||"",D=f.connectionType||"",P=n.some(T=>T.type==="dataset")?"semanticDomain":"database";l({connectionId:v,connectionType:D,mode:P,selectedEntities:n}),a(!1)},h=f=>{switch(f.type){case"table":return e.jsx(s.Table,{className:"h-4 w-4"});case"view":return e.jsx(_t,{className:"h-4 w-4"});case"model":return e.jsx(Nt,{className:"h-4 w-4"});case"dataset":return e.jsx(s.Database,{className:"h-4 w-4"});case"file":case"url":case"upload":return e.jsx(s.FileText,{className:"h-4 w-4"});default:return e.jsx(s.Database,{className:"h-4 w-4"})}},x=f=>"label"in f&&f.label?f.label:f.name,j=f=>{if("description"in f&&f.description)return f.description;const v=[];return f.database&&v.push(f.database),f.schema&&v.push(f.schema),f.name&&v.push(f.name),v.join(".")},b=f=>n.some(v=>v.name===f.name&&v.type===f.type);return i.length===0?e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"max-w-md",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"No Data Available"}),e.jsx(s.DialogDescription,{children:"No entities are currently available in the AI context. Please add some data sources to the dashboard first."})]}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{onClick:()=>a(!1),children:"Close"})})]})}):e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"flex max-w-2xl flex-col",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Select Data to Analyze"}),e.jsx(s.DialogDescription,{children:"Choose entities from the dashboard's context"})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:d,disabled:n.length===i.length,children:"Select All"}),e.jsx(s.Button,{variant:"outline",size:"sm",onClick:u,disabled:n.length===0,children:"Clear All"})]}),e.jsxs(s.Badge,{variant:"secondary",children:[n.length," of ",i.length," selected"]})]}),e.jsx(s.Separator,{}),e.jsx(s.ScrollArea,{className:"h-64",children:e.jsx("div",{className:"space-y-2",children:i.map((f,v)=>e.jsxs("div",{className:s.cn("flex items-center gap-3 rounded-lg border p-3 transition-colors hover:bg-muted/50",b(f)&&"border-primary bg-primary/5"),children:[e.jsx(s.Checkbox,{checked:b(f),onCheckedChange:()=>o(f)}),e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:h(f)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:x(f)}),e.jsx("div",{className:"truncate text-sm text-muted-foreground",children:j(f)})]}),e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:f.type})]},`${f.type}-${f.name}-${v}`))})})]}),e.jsx(s.DialogFooter,{children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex grow justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsxs(s.Button,{onClick:m,disabled:n.length===0,children:["Select"," ",n.length>0?`(${n.length})`:""]})]})})})]})})}function Oa({entity:t,title:a,maxDetails:n=10}){const l=s.getEntityDetails(t).slice(0,n),c=l.find(o=>o.label==="Description"),i=l.filter(o=>o.label==="Description"?!1:!["Connection","Database","Schema"].includes(o.label));return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:a||s.getDisplayName(t)}),c&&e.jsxs("div",{className:"border-t border-border pt-2",children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:c.value})]}),i.length>0&&e.jsx("div",{className:"space-y-0.5",children:i.map((o,d)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[o.label,":"]}),e.jsx("span",{className:"font-mono",children:o.value})]},d))})]})})}function Va({entities:t}){return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[t.length," more entities"]}),e.jsx("div",{className:"space-y-1",children:t.map((a,n)=>{const r=s.getEntityDetails(a),l=r.find(i=>i.label==="Description"),c=r.filter(i=>i.label==="Description"?!1:!["Connection","Database","Schema"].includes(i.label)).slice(0,3);return e.jsxs("div",{className:"border-b border-border pb-1 last:border-b-0",children:[e.jsx("div",{className:"text-xs font-medium",children:s.getDisplayName(a)}),l&&e.jsxs("div",{className:"mb-1 mt-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:l.value})]}),c.length>0&&e.jsx("div",{className:"mt-1 space-y-0.5",children:c.map((i,o)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[i.label,":"]}),e.jsx("span",{className:"font-mono",children:i.value})]},o))})]},`remaining-${a.type}-${a.name}-${n}`)})})]})})}function zs(){const t=s.useEditorStore(i=>i.card.dataSource),{setSelectedConnectionId:a,setSelectedDatabaseName:n,setSelectedSchemaName:r,setSelectedTableName:l,setSelectedDatamodelId:c}=s.useEditorActions();w.useEffect(()=>{var j;if(!t)return;const{tableName:i,schemaName:o,databaseName:d,connectionId:u}=Xe(t),m=(j=t.selectedEntities)==null?void 0:j[0],x=(m==null?void 0:m.type)==="model"&&"id"in m?m.id:"";a(u||""),n(d||""),r(o||""),l(i||""),c(x)},[t,a,n,r,l,c])}function qs({isVisible:t}){const a=s.useEditorStore(x=>x.isDevMode);zs();const[n,r]=w.useState(!1),[l,c]=w.useState(!1),[i,o]=w.useState(!0),d=s.useEditorStore(x=>x.card.dataSource);s.useCurrentUserInfo();const{updateDataSource:u}=s.useEditorActions(),m={connectionId:"",connectionType:"",mode:"database",selectedEntities:[]},h={...m,...d,selectedEntities:(d==null?void 0:d.selectedEntities)||[]};return e.jsxs("div",{className:s.cn("flex flex-col overflow-hidden bg-background transition-all duration-300 ease-in-out",{"w-[325px]":t,"w-0":!t}),children:[e.jsxs("div",{children:[e.jsx("div",{className:"p-4 px-6 pb-2",children:e.jsxs(s.Button,{className:"w-full bg-muted/50",variant:"outline",onClick:()=>r(!0),children:[e.jsx(s.Database,{className:"mr-2 h-3.5 w-3.5"}),"Choose Dataset"]})}),e.jsxs("div",{className:"relative px-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center px-6",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center",children:e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>o(!i),className:"size-6 bg-background p-1 py-1 hover:bg-accent",children:i?e.jsx(s.ChevronUp,{className:"h-3.5 w-3.5"}):e.jsx(s.ChevronDown,{className:"h-3.5 w-3.5"})})})]}),e.jsxs("div",{className:`overflow-hidden px-6 ${i?"max-h-96 space-y-4":"max-h-0 py-0 opacity-0"}`,children:[h.selectedEntities.length>0&&e.jsx(s.TooltipProvider,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.selectedEntities.slice(0,3).map((x,j)=>e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",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",children:[s.getDisplayName(x),e.jsx("button",{onClick:b=>{b.stopPropagation();const f=h.selectedEntities.filter(v=>!(v.name===x.name&&v.type===x.type));u({...m,...d,selectedEntities:f})},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-0.5 hover:bg-red-100",children:e.jsx(s.X,{className:"h-2.5 w-2.5 group-hover:text-red-500"})})]})}),e.jsx(Oa,{entity:x})]},`${x.type}-${x.name}-${j}`)),h.selectedEntities.length>3&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"outline",className:"text-xs",children:["+",h.selectedEntities.length-3," more"]})}),e.jsx(Va,{entities:h.selectedEntities.slice(3)})]})]})}),!a&&e.jsx(Pa,{})]})]}),e.jsx(Rs,{}),e.jsx(s.DataSourceDialog,{incomingSelectedEntities:(d==null?void 0:d.selectedEntities)||[],dialogMode:"dataSource",open:n,onOpenChange:r,dataSource:h}),e.jsx(Ba,{open:l,onOpenChange:c})]})}function $s({error:t,errorSql:a,onSendFeedback:n,onOpenInEditor:r,className:l,showFeedbackButton:c=!0}){const[i,o]=w.useState(!1);return e.jsx("div",{className:s.cn("rounded-lg border border-destructive/30 bg-destructive/5 p-4",l),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.CircleAlert,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-destructive"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Query Error"}),e.jsxs("div",{className:"relative rounded-md bg-background/60 p-3",children:[e.jsx(s.CopyButton,{text:t,className:"absolute right-2 top-2 h-6 w-6 z-10"}),e.jsx("div",{className:"max-h-40 overflow-auto pr-10",children:e.jsx("p",{className:"font-mono text-xs text-foreground/80 break-all",children:t})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(s.Collapsible,{open:i,onOpenChange:o,children:e.jsx(s.CollapsibleTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"sm",className:"h-8",children:i?e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronUp,{className:"mr-1.5 h-3.5 w-3.5"}),"Hide Details"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronDown,{className:"mr-1.5 h-3.5 w-3.5"}),"Show Details"]})})})}),r&&a&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:r,children:[e.jsx(Ds,{className:"mr-1.5 h-3.5 w-3.5"}),"Open in Editor"]}),c&&n&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:n,children:[e.jsx(s.MessageSquareWarning,{className:"mr-1.5 h-3.5 w-3.5"}),"Send Feedback"]})]}),e.jsx(s.Collapsible,{open:i,onOpenChange:o,children:e.jsx(s.CollapsibleContent,{className:"space-y-2",children:e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:a?"Error SQL Query":"SQL Query"}),a&&e.jsx(s.CopyButton,{text:a,className:"h-6 w-6"})]}),a?e.jsx("div",{className:"rounded-md bg-background/60 p-2 max-h-80 overflow-auto",children:e.jsx(s.CodeHighlighter,{code:a,language:"sql"})}):e.jsx("div",{className:"rounded-md bg-background/60 p-3",children:e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"SQL query not available for this error"})})]})})})]})]})})}function Gs({sql:t,error:a,errorSql:n,onDebugWithAssistant:r}){const l=s.useEditorStore(f=>f.isDevMode),{setIsDevMode:c,setCardSql:i,setRunSql:o}=s.useEditorActions(),[d,u]=w.useState(!1),m=s.useEditorStore(f=>f.card),h=s.useEditorStore(f=>f.frame),x=s.useDashboardStore(f=>f.selectedSheetId),j=s.useDashboardStore(f=>{var v;return(v=f.dashboard)==null?void 0:v.id});function b(f){c(!0),i(f||t),setTimeout(()=>{o(!0)},100)}return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col pt-4",children:[!l&&t&&!a&&e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs(s.Button,{onClick:()=>b(),variant:"secondary",size:"sm",children:[e.jsx(Ds,{className:"mr-2 h-4 w-4"}),"View in SQL Editor"]}),e.jsxs(s.Button,{onClick:()=>u(!d),variant:"outline",size:"sm",children:[e.jsx(s.Info,{className:"mr-2 h-4 w-4"}),"Card Details"]})]}),d&&e.jsx("div",{className:"mb-3 rounded-lg border border-border bg-muted/30 p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Card Information"}),e.jsx(s.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>u(!1),children:e.jsx(ws,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Card ID"}),e.jsx("code",{className:"text-xs font-mono",children:m.id||"N/A"})]}),e.jsx(s.CopyButton,{text:m.id||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Frame ID"}),e.jsx("code",{className:"text-xs font-mono",children:h.id||"N/A"})]}),e.jsx(s.CopyButton,{text:h.id||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Sheet ID"}),e.jsx("code",{className:"text-xs font-mono",children:x||"N/A"})]}),e.jsx(s.CopyButton,{text:x||"",className:"h-6 w-6"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/60 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Dashboard ID"}),e.jsx("code",{className:"text-xs font-mono",children:j||"N/A"})]}),e.jsx(s.CopyButton,{text:j||"",className:"h-6 w-6"})]})]})]})}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto text-xs leading-relaxed text-foreground/80",children:[a&&e.jsx($s,{error:a,errorSql:n,showFeedbackButton:!1,onOpenInEditor:()=>b(n)}),!a&&t&&e.jsx("div",{className:"flex flex-col space-y-1.5",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute right-2 top-2 z-10",children:e.jsx(s.CopyButton,{text:t,className:"h-6 w-6"})}),e.jsx(s.CodeHighlighter,{code:t,language:"sql"})]})})]}),a&&r&&e.jsx("div",{className:"mt-3",children:e.jsxs(s.Button,{onClick:r,size:"sm",variant:"outline",children:[e.jsx(Et,{className:"mr-2 h-4 w-4"}),"Debug with Assistant"]})})]})}function Ra({sql:t,error:a,errorSql:n,onDebugWithAssistant:r}){return e.jsxs(s.HoverCard,{openDelay:a?0:500,children:[e.jsx(s.HoverCardTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"link",className:"h-5 p-0",children:a?e.jsx(ws,{className:"h-4 w-4 text-red-500"}):e.jsx(s.Info,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(s.HoverCardContent,{align:"start",className:"flex w-[700px]",children:e.jsx(Gs,{errorSql:n,sql:t,error:a,onDebugWithAssistant:r})})]})}function za(t){return s.GenIcon({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)}function Us(t){const{theme:a}=s.useTheme(),n=s.useDashboardStore(f=>f.theme),r=s.useEditorStore(f=>f.frame),l=s.useEditorStore(f=>f.card),c=s.useEditorStore(f=>f.activeTabCardId),i=s.Le(),{refetch:o}=s.useDashboardCardQuery(l),{updateCardTab:d,setRunSql:u}=s.useEditorActions(),m=w.useRef(),h=w.useRef({}),x=r.cards.find(f=>f.id===c),j=w.useCallback(()=>{let f="";return t==="python"&&(f=(x==null?void 0:x.python)||s.PYTHON_DEFAULT_CODE),t==="sql"&&(f=(x==null?void 0:x.sql)||""),f},[t,x]);w.useEffect(()=>{if(c&&l.id&&l.id!==c){if(m.current&&i){const f=m.current.getModel();f&&(h.current[l.id]=f);let v=h.current[c];if(!v){const D=j();v=i.editor.createModel(D,t),h.current[c]=v}m.current.setModel(v)}d(c,l),u(!0)}},[c,l,d,i,u,t,j]),w.useEffect(()=>{if(!i)return;const f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",v=n==="system"?f:n;i.editor.defineTheme("default",{base:v==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":v==="light"?"#ffffff":s.hslStringToHex("240 10% 10%")}}),i.editor.setTheme("default")},[a,n,i]),w.useEffect(()=>{const f=m.current;f&&i&&l&&f.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,function(){return o(),!1})},[i,o,l]);function b(f,v){if(m.current=f,!h.current[l.id]){const D=f.getModel(),k=j();h.current[l.id]=D||(v==null?void 0:v.editor.createModel(k,t))||f.getModel()}f.setModel(h.current[l.id])}return{handleEditorDidMount:b}}function qa(){const t=s.useEditorStore(i=>i.card.sql),a=s.useEditorStore(i=>i.sqlGen),{setCardSql:n,setSqlGen:r}=s.useEditorActions(),{handleEditorDidMount:l}=Us("sql");function c(i){n(i),s.isObjectEmpty(a)||r({})}return e.jsxs("div",{className:"relative h-full w-full",children:[!t&&e.jsx("div",{className:"pointer-events-none absolute left-[65px] top-3 z-10 font-mono text-sm text-muted-foreground",children:"Write your SQL here"}),e.jsx(s.Ft,{theme:"default",className:"pt-3",onChange:c,value:t||"",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"sql",onMount:l})]})}function $a(){const t=s.useEditorStore(l=>l.card.python),{setCardPython:a}=s.useEditorActions(),{handleEditorDidMount:n}=Us("python");function r(l){a(l)}return e.jsx(s.Ft,{className:"pt-3",theme:"default",onChange:r,value:t||s.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"python",onMount:n})}function Ga({jsonString:t}){return e.jsx(s.Ft,{theme:"default",defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:t,options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})}function Ua(){const t=s.useQueryClient(),{isConsoleMode:a}=s.useDashboardPreferences(),[n,r]=w.useState(!1),[l,c]=w.useState(!1);s.useEditorStore(V=>V.frame);const i=s.useEditorStore(V=>V.card);s.useEditorStore(V=>V.isShowingVisual),s.useEditorStore(V=>V.selectedConnectionId),s.useEditorStore(V=>V.tempQueryData),s.useEditorStore(V=>V.selectedDatabaseName),s.useEditorStore(V=>V.selectedDatamodelId),s.useEditorStore(V=>V.selectedSchemaName);const o=s.useEditorStore(V=>V.showAIDialog);s.useEditorStore(V=>V.selectedTableName);const d=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.sql}),u=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.python}),{cardFilterValues:m}=s.useCardFilterValues((i==null?void 0:i.id)??""),{setCardCustomCfg:h,setQueryResultColumns:x,setCardSql:j,setTempQueryData:b,setPythonStdOut:f,setCardPreferences:v,setCardType:D,setCardPython:k,runAssistant:P,setShowAIDialog:L}=s.useEditorActions();s.useEditorStore(V=>V.onSave),s.useEditorStore(V=>V.onClose),s.useEditorStore(V=>V.actions.setSqlGen);const T=s.useEditorStore(V=>V.runSql),N=s.useEditorStore(V=>V.actions.setRunSql),p=s.useEditorStore(V=>V.actions.setIsSqlRunning),{data:g,isLoading:y,isFetching:I,isSuccess:C,isError:B,error:A,errorSql:F,queryKey:E,refetch:M,errorMessage:S}=s.useDashboardCardQuery(i);w.useEffect(()=>{if(g&&(g.rowLimitExceeded&&s.ue.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),f((g==null?void 0:g.output)||""),g.records.length>0)){const{dimensionKeys:V}=s.getKeys(g.records);x(V)}},[g,x,f]),w.useEffect(()=>{(y||I)&&p(!0),(B||C)&&p(!1),B&&(x([]),f(""))},[y,I,g,f,B,C,p,x,A]),w.useEffect(()=>{T&&(t.getQueryData(E)||M(),N(!1))},[T,M,N,E,t]);async function O(){const V=`Can you help me debug this query?
|
|
218
218
|
|
|
219
219
|
Error:
|
|
220
220
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-B3HYK-tY.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-B3HYK-tY.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-zWWZ2ch-.js"),a=require("react/jsx-runtime"),x=require("react");require("react-dom");function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const p=j(x);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as x, E as v, F as N, S as w, U as A, a as L, C as _, u as E, b as g, d as P, P as k, e as W, B as F, f as M, g as R, h as V, i as B, j as O, I as Q, k as I, l as j, m as q, n as U, o as z } from "./chunks/index-DbMJ2vk9.js";
|
|
2
2
|
import { D as ne, v as ie, R as de, r as le, r as ce, s as Ye, a0 as ue, L as he, x as pe, z as fe, N as me, M as Me, T as Ce, V as De, K as ge, w as ve, J as ye, O as be, H as Te, G as Se, A as xe, W as Ne, Q as we, t as Ae, Y as Le, _ as _e, Z as Ee, $ as Pe, y as ke, p as We, a2 as Fe, X as Re, a1 as Ve, q as Be } from "./chunks/index-DbMJ2vk9.js";
|
|
3
3
|
import { EMPTY_SELECTION as Qe } from "./types/index.js";
|
|
4
|
-
import { A as je, R as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-
|
|
4
|
+
import { A as je, R as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-DttJ7tRM.js";
|
|
5
5
|
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
import * as h from "react";
|
|
7
7
|
import { useMemo as G } from "react";
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-zWWZ2ch-.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/surfboard/index.js
CHANGED