react-semaphor 0.1.267 → 0.1.268

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.
Files changed (35) hide show
  1. package/dist/chunks/{dashboard-controls-d8j31cnQ.js → dashboard-controls-D9FGH-ux.js} +108 -108
  2. package/dist/chunks/{dashboard-controls-BRv37g5w.js → dashboard-controls-DVZnpRK5.js} +1 -1
  3. package/dist/chunks/dashboard-filter-controls-button-CcrX4Kjv.js +11 -0
  4. package/dist/chunks/{dashboard-filter-controls-button-BOs9T2hG.js → dashboard-filter-controls-button-DdI-qlYl.js} +209 -199
  5. package/dist/chunks/{dashboard-json-DjNS3G-C.js → dashboard-json-1s8UpQRT.js} +1 -1
  6. package/dist/chunks/{dashboard-json-CnEYIbNI.js → dashboard-json-B9t11hsc.js} +1 -1
  7. package/dist/chunks/{dashboard-summary-settings-dialog-DOVwh8Cc.js → dashboard-summary-settings-dialog-BXJnm_OC.js} +1 -1
  8. package/dist/chunks/{dashboard-summary-settings-dialog-CrBOuggE.js → dashboard-summary-settings-dialog-BruCXCaN.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-D4UMcS6R.js → edit-dashboard-visual-C4HfjuuW.js} +7447 -6972
  10. package/dist/chunks/edit-dashboard-visual-DrdskRgR.js +193 -0
  11. package/dist/chunks/{index-D5jdzvu3.js → index-BrLm4rYX.js} +35935 -34785
  12. package/dist/chunks/{index-C2i6CRUk.js → index-DTw8TJ-8.js} +523 -326
  13. package/dist/chunks/{resource-management-panel-3XD0FrTD.js → resource-management-panel-C7hHyHwo.js} +16 -16
  14. package/dist/chunks/{resource-management-panel-ZK4SWoad.js → resource-management-panel-CLZBF-Dw.js} +1 -1
  15. package/dist/chunks/{use-create-flow-overlay-state-Bb83NOgW.js → use-create-flow-overlay-state-BrRL7vBF.js} +589 -591
  16. package/dist/chunks/use-create-flow-overlay-state-C6B_dReH.js +21 -0
  17. package/dist/chunks/{use-visual-utils-Bj7eAUMG.js → use-visual-utils-1cXtOxvS.js} +111 -123
  18. package/dist/chunks/use-visual-utils-CLCzIgCj.js +1 -0
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +5 -5
  23. package/dist/style.css +1 -1
  24. package/dist/surfboard/index.cjs +1 -1
  25. package/dist/surfboard/index.js +2 -2
  26. package/dist/types/dashboard.d.ts +38 -0
  27. package/dist/types/main.d.ts +40 -0
  28. package/dist/types/shared.d.ts +38 -0
  29. package/dist/types/surfboard.d.ts +38 -0
  30. package/dist/types/types.d.ts +38 -0
  31. package/package.json +1 -1
  32. package/dist/chunks/dashboard-filter-controls-button-DKRyKRsP.js +0 -11
  33. package/dist/chunks/edit-dashboard-visual-D6RokBEF.js +0 -188
  34. package/dist/chunks/use-create-flow-overlay-state-Cmt64wFE.js +0 -21
  35. package/dist/chunks/use-visual-utils-Bdwejpa1.js +0 -1
@@ -1,14 +1,14 @@
1
- import { bL as ae, U as S, bM as qe, bN as et, bO as tt, bP as at, bQ as st, bR as lt, u as ve, ae as rt, bS as nt, bT as dt, bU as it, ab as Z, c as q, bV as ot, bW as ct, M as ee, B as w, s as ut, H as se, N as Oe, J as _e, bX as Me, w as ze, bY as Be, X as Qe, x as Q, bZ as mt, b_ as J, b$ as Ie, c0 as we, c1 as oe, c2 as Te, c3 as pt, c4 as ht, c5 as P, c6 as ft, c7 as bt, a5 as Ve, c8 as Fe, c9 as ge, ca as je, cb as Ue, cc as yt, L as R, I as Re, y as ce, z as ue, A as me, E as pe, F as he, cd as $e, ce as vt, cf as gt, cg as Ke, ch as He, ci as xt, cj as Ct, ck as Nt, cl as kt, cm as St, cn as Dt, co as It, cp as wt, cq as fe, cr as Tt, cs as Le, ct as Vt, cu as Ft, cv as Lt } from "./index-D5jdzvu3.js";
2
- import { jsx as t, jsxs as i, Fragment as X } from "react/jsx-runtime";
3
- import { u as Et, a as xe } from "./use-visual-utils-Bj7eAUMG.js";
4
- import { useMemo as E, useState as j, useRef as At, useCallback as _, useEffect as be, Fragment as qt } from "react";
1
+ import { bM as te, U as E, bN as Oe, bO as tt, bP as at, bQ as st, bR as lt, bS as rt, u as ve, af as nt, bT as dt, bU as it, bV as ot, ac as Z, c as q, bW as ct, bX as ut, B as I, s as mt, H as ae, N as Me, J as _e, bY as ze, w as Be, M as fe, bZ as Qe, X as je, x as _, b_ as pt, b$ as ht, c0 as J, c1 as we, c2 as Te, c3 as ie, c4 as Fe, c5 as ft, c6 as bt, c7 as P, c8 as yt, c9 as vt, a6 as Ve, ca as Ee, cb as ge, cc as Ue, cd as Re, ce as gt, L as R, I as $e, y as oe, z as ce, A as ue, E as me, F as pe, cf as Ke, cg as xt, ch as Ct, ci as He, cj as Ye, ck as Nt, cl as kt, cm as St, cn as Dt, co as It, cp as wt, cq as Tt, cr as Ft, cs as he, ct as Vt, cu as Le, cv as Et, cw as Lt, cx as At } from "./index-BrLm4rYX.js";
2
+ import { jsx as t, jsxs as d, Fragment as X } from "react/jsx-runtime";
3
+ import { useMemo as L, useState as j, useRef as qt, useCallback as M, useEffect as be, Fragment as Ot } from "react";
4
+ import { u as xe } from "./use-visual-utils-1cXtOxvS.js";
5
5
  /**
6
6
  * @license lucide-react v0.453.0 - ISC
7
7
  *
8
8
  * This source code is licensed under the ISC license.
9
9
  * See the LICENSE file in the root directory of this source tree.
10
10
  */
11
- const Ht = ae("CircleX", [
11
+ const Yt = te("CircleX", [
12
12
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
13
13
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
14
14
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
@@ -19,7 +19,7 @@ const Ht = ae("CircleX", [
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
21
  */
22
- const Ot = ae("Library", [
22
+ const Mt = te("Library", [
23
23
  ["path", { d: "m16 6 4 14", key: "ji33uf" }],
24
24
  ["path", { d: "M12 6v14", key: "1n7gus" }],
25
25
  ["path", { d: "M8 8v12", key: "1gg7y9" }],
@@ -31,7 +31,7 @@ const Ot = ae("Library", [
31
31
  * This source code is licensed under the ISC license.
32
32
  * See the LICENSE file in the root directory of this source tree.
33
33
  */
34
- const _t = ae("Link2", [
34
+ const _t = te("Link2", [
35
35
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
36
36
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
37
37
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
@@ -42,7 +42,7 @@ const _t = ae("Link2", [
42
42
  * This source code is licensed under the ISC license.
43
43
  * See the LICENSE file in the root directory of this source tree.
44
44
  */
45
- const Ye = ae("Save", [
45
+ const Xe = te("Save", [
46
46
  [
47
47
  "path",
48
48
  {
@@ -53,123 +53,123 @@ const Ye = ae("Save", [
53
53
  ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
54
54
  ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
55
55
  ]);
56
- function Xe() {
57
- var r, x;
58
- const s = S((y) => y.card), l = S((y) => y.frame), n = E(
59
- () => qe(l, s),
56
+ function Ge() {
57
+ var m, x;
58
+ const s = E((v) => v.card), l = E((v) => v.frame), r = L(
59
+ () => Oe(l, s),
60
60
  [l, s]
61
- ), { manifest: o } = et(
62
- ((r = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : r.url) || ""
63
- ), m = E(
61
+ ), { manifest: i } = tt(
62
+ ((m = r == null ? void 0 : r.customCardPreferences) == null ? void 0 : m.url) || ""
63
+ ), u = L(
64
64
  () => {
65
- var y;
66
- return (y = o == null ? void 0 : o.visuals) == null ? void 0 : y.find(
67
- (f) => {
68
- var v;
69
- return f.name === ((v = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : v.componentName);
65
+ var v;
66
+ return (v = i == null ? void 0 : i.visuals) == null ? void 0 : v.find(
67
+ (b) => {
68
+ var y;
69
+ return b.name === ((y = r == null ? void 0 : r.customCardPreferences) == null ? void 0 : y.componentName);
70
70
  }
71
71
  );
72
72
  },
73
- [o, (x = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : x.componentName]
74
- ), b = tt(n, m), p = E(
75
- () => at({
73
+ [i, (x = r == null ? void 0 : r.customCardPreferences) == null ? void 0 : x.componentName]
74
+ ), p = at(r, u), h = L(
75
+ () => st({
76
76
  frame: l,
77
- configCard: n,
78
- isMultiInputVisual: b === "multiple"
77
+ configCard: r,
78
+ isMultiInputVisual: p === "multiple"
79
79
  }),
80
- [l, n, b]
81
- ), h = E(() => {
82
- const y = p.findIndex(
83
- (f) => (f == null ? void 0 : f.id) === s.id
80
+ [l, r, p]
81
+ ), f = L(() => {
82
+ const v = h.findIndex(
83
+ (b) => (b == null ? void 0 : b.id) === s.id
84
84
  );
85
- return y < 0 ? -1 : st(s, y);
86
- }, [p, s]);
87
- return E(() => !n || b !== "multiple" || h < 0 ? s.type : lt(
85
+ return v < 0 ? -1 : lt(s, v);
86
+ }, [h, s]);
87
+ return L(() => !r || p !== "multiple" || f < 0 ? s.type : rt(
88
88
  s,
89
- h,
90
- m == null ? void 0 : m.slots
91
- ) ?? s.type, [n, b, h, s, m == null ? void 0 : m.slots]);
89
+ f,
90
+ u == null ? void 0 : u.slots
91
+ ) ?? s.type, [r, p, f, s, u == null ? void 0 : u.slots]);
92
92
  }
93
- function Yt({
93
+ function Xt({
94
94
  type: s,
95
95
  isLinked: l,
96
- className: n,
97
- showLabel: o = !1,
98
- showLocal: m = !1
96
+ className: r,
97
+ showLabel: i = !1,
98
+ showLocal: u = !1
99
99
  }) {
100
- const b = ve((I) => I.selectedFrameId), p = rt((I) => I.selectedVisual), h = S((I) => I.frame);
101
- let r;
100
+ const p = ve((D) => D.selectedFrameId), h = nt((D) => D.selectedVisual), f = E((D) => D.frame);
101
+ let m;
102
102
  if (s)
103
- r = s;
103
+ m = s;
104
104
  else if (l !== void 0)
105
- r = l ? "linked" : "library";
106
- else if (!!!(h != null && h.visualId || p != null && p.id) && b)
107
- r = "local";
108
- else if (p && !b)
109
- r = "library";
110
- else if (h != null && h.visualId && b)
111
- r = "linked";
112
- else if (p != null && p.id && b)
113
- r = "library";
105
+ m = l ? "linked" : "library";
106
+ else if (!!!(f != null && f.visualId || h != null && h.id) && p)
107
+ m = "local";
108
+ else if (h && !p)
109
+ m = "library";
110
+ else if (f != null && f.visualId && p)
111
+ m = "linked";
112
+ else if (h != null && h.id && p)
113
+ m = "library";
114
114
  else
115
115
  return null;
116
- if (r === "local" && !m)
116
+ if (m === "local" && !u)
117
117
  return null;
118
118
  const x = {
119
119
  local: "border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",
120
120
  linked: "border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",
121
121
  library: "border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"
122
- }, y = {
122
+ }, v = {
123
123
  local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
124
124
  linked: "Linked to library: Changes made here update the library visual and all linked instances.",
125
125
  library: "Library visual: Share and reuse this visual across multiple dashboards."
126
- }, f = {
126
+ }, b = {
127
127
  local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
128
128
  linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
129
129
  library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
130
- }, v = {
130
+ }, y = {
131
131
  local: "fill-slate-50 dark:fill-slate-900",
132
132
  linked: "fill-purple-50 dark:fill-purple-950",
133
133
  library: "fill-blue-50 dark:fill-blue-950"
134
134
  }, C = {
135
135
  local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
136
136
  linked: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
137
- library: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
137
+ library: /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" })
138
138
  }, A = {
139
139
  local: "Local",
140
140
  linked: "Linked",
141
141
  library: "Library"
142
142
  };
143
- return /* @__PURE__ */ t(nt, { children: /* @__PURE__ */ i(dt, { delayDuration: 300, children: [
144
- /* @__PURE__ */ t(it, { asChild: !0, children: /* @__PURE__ */ i(
143
+ return /* @__PURE__ */ t(dt, { children: /* @__PURE__ */ d(it, { delayDuration: 300, children: [
144
+ /* @__PURE__ */ t(ot, { asChild: !0, children: /* @__PURE__ */ d(
145
145
  Z,
146
146
  {
147
147
  variant: "outline",
148
148
  className: q(
149
149
  "cursor-help select-none transition-all",
150
- x[r],
151
- n
150
+ x[m],
151
+ r
152
152
  ),
153
153
  children: [
154
- C[r],
155
- o && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: A[r] })
154
+ C[m],
155
+ i && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: A[m] })
156
156
  ]
157
157
  }
158
158
  ) }),
159
- /* @__PURE__ */ i(
160
- ot,
159
+ /* @__PURE__ */ d(
160
+ ct,
161
161
  {
162
162
  side: "bottom",
163
- className: q("max-w-xs", f[r]),
163
+ className: q("max-w-xs", b[m]),
164
164
  children: [
165
- /* @__PURE__ */ t(ct, { className: v[r] }),
166
- /* @__PURE__ */ t("p", { children: y[r] })
165
+ /* @__PURE__ */ t(ut, { className: y[m] }),
166
+ /* @__PURE__ */ t("p", { children: v[m] })
167
167
  ]
168
168
  }
169
169
  )
170
170
  ] }) });
171
171
  }
172
- function Mt(s, l) {
172
+ function zt(s, l) {
173
173
  return {
174
174
  ...s,
175
175
  sql: "",
@@ -179,80 +179,74 @@ function Mt(s, l) {
179
179
  preferences: {},
180
180
  interactionConfig: void 0,
181
181
  linkedInteractionTargetOverrides: void 0,
182
+ dynamicCardPreferences: void 0,
182
183
  customCardPreferences: l ? s.customCardPreferences : void 0,
184
+ visualizationMode: "builtin",
183
185
  type: l ? s.type : "bar"
184
186
  };
185
187
  }
186
- function Xt({
188
+ function Ce(s) {
189
+ const l = pt(s);
190
+ return l ? (_.error(l), !1) : !0;
191
+ }
192
+ function Gt({
187
193
  className: s,
188
194
  variant: l = "outline"
189
195
  }) {
190
- var h;
191
- const { setCardSql: n } = ee();
192
- S((r) => r.frame);
193
- const o = S((r) => r.card);
194
- Et(
195
- ((h = o.customCardPreferences) == null ? void 0 : h.url) || ""
196
- ), S(
197
- (r) => r.selectedSchemaName
198
- ), S(
199
- (r) => r.selectedDatamodelId
200
- ), S(
201
- (r) => r.selectedDatabaseName
202
- ), S((r) => r.selectedTableName), S(
203
- (r) => r.selectedConnectionId
204
- ), S((r) => r.isShowingVisual), o.sql;
205
- const m = S((r) => r.onSave), { getUpdatedFrame: b } = xe();
206
- function p() {
207
- const r = b();
208
- m == null || m(r);
196
+ const r = E((p) => p.onSave), { getUpdatedFrame: i } = xe();
197
+ function u() {
198
+ const p = i();
199
+ Ce(p) && (r == null || r(p));
209
200
  }
210
- return /* @__PURE__ */ i(
211
- w,
201
+ return /* @__PURE__ */ d(
202
+ I,
212
203
  {
213
- onClick: p,
204
+ onClick: u,
214
205
  className: q("h-8", s),
215
206
  size: "sm",
216
207
  variant: l,
217
208
  children: [
218
- /* @__PURE__ */ t(ut, { className: "mr-2 size-4 font-bold" }),
209
+ /* @__PURE__ */ t(mt, { className: "mr-2 size-4 font-bold" }),
219
210
  "Accept"
220
211
  ]
221
212
  }
222
213
  );
223
214
  }
224
- function Gt({
215
+ function Wt({
225
216
  className: s,
226
217
  variant: l = "default"
227
218
  }) {
228
- const n = se(), [o, m] = j(!1), b = ve(
229
- (v) => v.actions.setIsDashboardPanelOpen
230
- ), { setIsVisualEditing: p } = Oe(), { getUpdatedFrame: h } = xe(), r = _e(), x = S((v) => v.frame), y = Me();
231
- return /* @__PURE__ */ i(
232
- w,
219
+ const r = ae(), [i, u] = j(!1), p = ve(
220
+ (y) => y.actions.setIsDashboardPanelOpen
221
+ ), { setIsVisualEditing: h } = Me(), { getUpdatedFrame: f } = xe(), m = _e(), x = E((y) => y.frame), v = ze();
222
+ return /* @__PURE__ */ d(
223
+ I,
233
224
  {
234
225
  onClick: () => {
235
- const v = h(), C = (x == null ? void 0 : x.visualId) || (r == null ? void 0 : r.id);
226
+ const y = f();
227
+ if (!Ce(y))
228
+ return;
229
+ const C = (x == null ? void 0 : x.visualId) || (m == null ? void 0 : m.id);
236
230
  if (!C) {
237
- Q.error("No visual to save");
231
+ _.error("No visual to save");
238
232
  return;
239
233
  }
240
- m(!0), y.mutate(
234
+ u(!0), v.mutate(
241
235
  {
242
236
  visualId: C,
243
237
  data: {
244
- frameObject: v
238
+ frameObject: y
245
239
  }
246
240
  },
247
241
  {
248
242
  onSuccess: () => {
249
- m(!1), b(!0), Q.success("Visual updated successfully"), n.invalidateQueries({
243
+ u(!1), p(!0), _.success("Visual updated successfully"), r.invalidateQueries({
250
244
  queryKey: ["resource-by-id", "visual", C],
251
245
  exact: !0
252
246
  });
253
247
  },
254
248
  onError: () => {
255
- m(!1), Q.error("Failed to update visual");
249
+ u(!1), _.error("Failed to update visual");
256
250
  }
257
251
  }
258
252
  );
@@ -261,154 +255,158 @@ function Gt({
261
255
  size: "sm",
262
256
  variant: l,
263
257
  children: [
264
- o && /* @__PURE__ */ i(X, { children: [
265
- /* @__PURE__ */ t(ze, { className: "mr-2 size-4 animate-spin font-bold" }),
258
+ i && /* @__PURE__ */ d(X, { children: [
259
+ /* @__PURE__ */ t(Be, { className: "mr-2 size-4 animate-spin font-bold" }),
266
260
  " Saving"
267
261
  ] }),
268
- !o && /* @__PURE__ */ i(X, { children: [
269
- /* @__PURE__ */ t(Ye, { className: "mr-2 size-4 font-bold" }),
262
+ !i && /* @__PURE__ */ d(X, { children: [
263
+ /* @__PURE__ */ t(Xe, { className: "mr-2 size-4 font-bold" }),
270
264
  "Save to Library"
271
265
  ] })
272
266
  ]
273
267
  }
274
268
  );
275
269
  }
276
- function Wt({
270
+ function Jt({
277
271
  className: s
278
272
  }) {
279
- const l = se(), [n, o] = j(!1), m = _e(), b = S((v) => v.frame), p = ve((v) => v.selectedSheetId), { updateFrame: h, setIsVisualEditing: r } = Oe(), { getUpdatedFrame: x } = xe(), y = Me();
273
+ const l = ae(), [r, i] = j(!1), u = _e(), p = E((y) => y.frame), h = ve((y) => y.selectedSheetId), { updateFrame: f, setIsVisualEditing: m } = Me(), { getUpdatedFrame: x } = xe(), v = ze();
280
274
  return /* @__PURE__ */ t(
281
- w,
275
+ I,
282
276
  {
283
277
  onClick: async () => {
284
- if (!p) {
285
- Q.error("No sheet selected");
278
+ if (!h) {
279
+ _.error("No sheet selected");
286
280
  return;
287
281
  }
288
- const v = (b == null ? void 0 : b.visualId) || (m == null ? void 0 : m.id);
289
- if (!v) {
290
- Q.error("No visual to update");
282
+ const y = (p == null ? void 0 : p.visualId) || (u == null ? void 0 : u.id);
283
+ if (!y) {
284
+ _.error("No visual to update");
291
285
  return;
292
286
  }
293
- o(!0);
287
+ i(!0);
294
288
  try {
295
289
  const C = x();
296
- await y.mutateAsync({
297
- visualId: v,
290
+ if (!Ce(C)) {
291
+ i(!1);
292
+ return;
293
+ }
294
+ await v.mutateAsync({
295
+ visualId: y,
298
296
  data: {
299
297
  frameObject: C
300
298
  }
301
299
  });
302
300
  const A = {
303
301
  ...C,
304
- visualId: v
302
+ visualId: y
305
303
  // Keep the link to library visual
306
304
  };
307
- h(p, A), l.invalidateQueries({ queryKey: ["visuals"] }), l.invalidateQueries({ queryKey: ["visual", v] }), Q.success("Saved to library and applied locally"), setTimeout(() => {
308
- r(!1);
305
+ f(h, A), l.invalidateQueries({ queryKey: ["visuals"] }), l.invalidateQueries({ queryKey: ["visual", y] }), _.success("Saved to library and applied locally"), setTimeout(() => {
306
+ m(!1);
309
307
  }, 300);
310
308
  } catch (C) {
311
- console.error("Failed to save and apply:", C), Q.error("Failed to save and apply changes");
309
+ console.error("Failed to save and apply:", C), _.error("Failed to save and apply changes");
312
310
  } finally {
313
- o(!1);
311
+ i(!1);
314
312
  }
315
313
  },
316
314
  className: q("h-8", s),
317
315
  size: "sm",
318
316
  variant: "default",
319
- disabled: n,
320
- children: n ? /* @__PURE__ */ i(X, { children: [
321
- /* @__PURE__ */ t(ze, { className: "mr-2 size-4 animate-spin font-bold" }),
317
+ disabled: r,
318
+ children: r ? /* @__PURE__ */ d(X, { children: [
319
+ /* @__PURE__ */ t(Be, { className: "mr-2 size-4 animate-spin font-bold" }),
322
320
  " Saving..."
323
- ] }) : /* @__PURE__ */ i(X, { children: [
324
- /* @__PURE__ */ t(Ye, { className: "mr-2 size-4 font-bold" }),
321
+ ] }) : /* @__PURE__ */ d(X, { children: [
322
+ /* @__PURE__ */ t(Xe, { className: "mr-2 size-4 font-bold" }),
325
323
  "Save & Apply"
326
324
  ] })
327
325
  }
328
326
  );
329
327
  }
330
- function Jt({ className: s }) {
331
- const { setTempQueryData: l, setSqlGen: n } = ee(), o = se(), m = S((f) => f.tempQueryData), b = S((f) => f.onClose), p = S((f) => f.card), h = Xe(), r = E(() => h !== p.type ? { ...p, type: h } : p, [p, h]), { queryKey: x } = Be(r);
332
- function y() {
333
- if (m) {
334
- const { queryKey: f, queryData: v } = m;
335
- f && v && o.setQueryData(f, v);
328
+ function Pt({ className: s }) {
329
+ const { setTempQueryData: l, setSqlGen: r } = fe(), i = ae(), u = E((b) => b.tempQueryData), p = E((b) => b.onClose), h = E((b) => b.card), f = Ge(), m = L(() => f !== h.type ? { ...h, type: f } : h, [h, f]), { queryKey: x } = Qe(m);
330
+ function v() {
331
+ if (u) {
332
+ const { queryKey: b, queryData: y } = u;
333
+ b && y && i.setQueryData(b, y);
336
334
  }
337
- n({}), b == null || b();
335
+ r({}), p == null || p();
338
336
  }
339
- return /* @__PURE__ */ i(
340
- w,
337
+ return /* @__PURE__ */ d(
338
+ I,
341
339
  {
342
- onClick: y,
340
+ onClick: v,
343
341
  className: q("h-8", s),
344
342
  size: "sm",
345
343
  variant: "outline",
346
344
  children: [
347
- /* @__PURE__ */ t(Qe, { className: "mr-2 size-4" }),
345
+ /* @__PURE__ */ t(je, { className: "mr-2 size-4" }),
348
346
  "Close"
349
347
  ]
350
348
  }
351
349
  );
352
350
  }
353
- function Pt({
351
+ function Zt({
354
352
  label: s = "Clear",
355
353
  variant: l = "secondary",
356
- className: n
354
+ className: r
357
355
  } = {}) {
358
- const { setTempQueryData: o } = ee(), m = se(), b = S((a) => a.tempQueryData), p = S((a) => a.card), h = Xe(), r = E(() => h !== p.type ? { ...p, type: h } : p, [p, h]), { queryKey: x } = Be(r), {
359
- setCardSql: y,
360
- setSqlGen: f,
361
- setCardPython: v,
356
+ const { setTempQueryData: i } = fe(), u = ae(), p = E((a) => a.tempQueryData), h = E((a) => a.card), f = Ge(), m = L(() => f !== h.type ? { ...h, type: f } : h, [h, f]), { queryKey: x } = Qe(m), {
357
+ setCardSql: v,
358
+ setSqlGen: b,
359
+ setCardPython: y,
362
360
  setCardCustomCfg: C,
363
361
  setCardPreferences: A,
364
- clearQueryConfig: I,
365
- setCardConfig: le,
366
- setCardType: re,
362
+ clearQueryConfig: D,
363
+ setCardConfig: se,
364
+ setCardType: le,
367
365
  setFrame: G,
368
366
  setCard: $,
369
- setActiveTabCardId: ne
370
- } = ee();
367
+ setActiveTabCardId: re
368
+ } = fe();
371
369
  function U() {
372
- var z, W, H, F;
373
- const a = m.getQueryData(x);
374
- b != null && b.queryData || o({
370
+ var B, W, H, F;
371
+ const a = u.getQueryData(x);
372
+ p != null && p.queryData || i({
375
373
  queryKey: x,
376
374
  queryData: a
377
- }), m.setQueryData(x, null), m.removeQueries({ queryKey: x, exact: !0 }), y(""), f({}), I(), le(void 0), v(""), C(""), A({});
378
- const D = S.getState().frame, K = S.getState().card, V = qe(D, K), T = ((z = V == null ? void 0 : V.customCardPreferences) == null ? void 0 : z.visualType) === "multiple" || !!((W = V == null ? void 0 : V.customCardPreferences) != null && W.dataInputCardIds) || (((H = V == null ? void 0 : V.customCardPreferences) == null ? void 0 : H.minInputs) || 0) > 1 || (((F = V == null ? void 0 : V.customCardPreferences) == null ? void 0 : F.maxInputs) || 0) > 1, M = Mt(K, T);
375
+ }), u.setQueryData(x, null), u.removeQueries({ queryKey: x, exact: !0 }), v(""), b({}), D(), se(void 0), y(""), C(""), A({});
376
+ const S = E.getState().frame, K = E.getState().card, T = Oe(S, K), w = ((B = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : B.visualType) === "multiple" || !!((W = T == null ? void 0 : T.customCardPreferences) != null && W.dataInputCardIds) || (((H = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : H.minInputs) || 0) > 1 || (((F = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : F.maxInputs) || 0) > 1, z = zt(K, w);
379
377
  G({
380
- ...D,
381
- cards: D.cards.map(
382
- (O) => O.id === M.id ? M : O
378
+ ...S,
379
+ cards: S.cards.map(
380
+ (O) => O.id === z.id ? z : O
383
381
  )
384
- }), ne(M.id), $(M), T || re("bar");
382
+ }), re(z.id), $(z), w || le("bar");
385
383
  }
386
- return /* @__PURE__ */ i(
387
- w,
384
+ return /* @__PURE__ */ d(
385
+ I,
388
386
  {
389
387
  onClick: U,
390
- className: q("h-8", n),
388
+ className: q("h-8", r),
391
389
  size: "sm",
392
390
  variant: l,
393
391
  children: [
394
- /* @__PURE__ */ t(Qe, { className: "mr-2 size-3.5" }),
392
+ /* @__PURE__ */ t(je, { className: "mr-2 size-3.5" }),
395
393
  s
396
394
  ]
397
395
  }
398
396
  );
399
397
  }
400
- function Ge(s) {
401
- const { control: l, onChange: n } = s;
402
- return /* @__PURE__ */ i("div", { className: "space-y-1", children: [
398
+ function We(s) {
399
+ const { control: l, onChange: r } = s;
400
+ return /* @__PURE__ */ d("div", { className: "space-y-1", children: [
403
401
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Label" }),
404
- /* @__PURE__ */ i("div", { className: "relative", children: [
402
+ /* @__PURE__ */ d("div", { className: "relative", children: [
405
403
  /* @__PURE__ */ t(
406
- Re,
404
+ $e,
407
405
  {
408
406
  className: "pr-40",
409
407
  value: l.label,
410
408
  placeholder: "Control label",
411
- onChange: (o) => n(o.target.value)
409
+ onChange: (i) => r(i.target.value)
412
410
  }
413
411
  ),
414
412
  /* @__PURE__ */ t(
@@ -422,20 +420,20 @@ function Ge(s) {
422
420
  ] })
423
421
  ] });
424
422
  }
425
- function zt(s) {
426
- const { currentStep: l, labels: n } = s;
427
- return /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-1 border-b bg-background/95 px-1 pb-2 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: n.map((o, m) => {
428
- const b = m + 1, p = b === l, h = b < l;
429
- return /* @__PURE__ */ i(qt, { children: [
430
- /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
423
+ function Bt(s) {
424
+ const { currentStep: l, labels: r } = s;
425
+ return /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-1 border-b bg-background/95 px-1 pb-2 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: r.map((i, u) => {
426
+ const p = u + 1, h = p === l, f = p < l;
427
+ return /* @__PURE__ */ d(Ot, { children: [
428
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
431
429
  /* @__PURE__ */ t(
432
430
  "span",
433
431
  {
434
432
  className: q(
435
433
  "flex h-7 w-7 items-center justify-center rounded-full border text-[11px] font-semibold",
436
- p ? "border-primary bg-primary text-primary-foreground" : h ? "border-primary/25 bg-primary/10 text-primary" : "border-border bg-muted/30 text-muted-foreground"
434
+ h ? "border-primary bg-primary text-primary-foreground" : f ? "border-primary/25 bg-primary/10 text-primary" : "border-border bg-muted/30 text-muted-foreground"
437
435
  ),
438
- children: b
436
+ children: p
439
437
  }
440
438
  ),
441
439
  /* @__PURE__ */ t(
@@ -443,467 +441,467 @@ function zt(s) {
443
441
  {
444
442
  className: q(
445
443
  "text-xs font-medium",
446
- p ? "text-foreground" : "text-muted-foreground"
444
+ h ? "text-foreground" : "text-muted-foreground"
447
445
  ),
448
- children: o
446
+ children: i
449
447
  }
450
448
  )
451
449
  ] }),
452
- m < n.length - 1 ? /* @__PURE__ */ t(
450
+ u < r.length - 1 ? /* @__PURE__ */ t(
453
451
  "span",
454
452
  {
455
453
  className: "h-px w-5 bg-border/80 sm:w-8",
456
454
  "aria-hidden": "true"
457
455
  }
458
456
  ) : null
459
- ] }, o);
457
+ ] }, i);
460
458
  }) }) });
461
459
  }
462
- function te(s) {
463
- const { secondary: l, tertiary: n, primary: o } = s;
464
- return /* @__PURE__ */ i("div", { className: "sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: [
460
+ function ee(s) {
461
+ const { secondary: l, tertiary: r, primary: i } = s;
462
+ return /* @__PURE__ */ d("div", { className: "sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: [
465
463
  l,
466
- n,
467
- o
464
+ r,
465
+ i
468
466
  ] });
469
467
  }
470
- function Bt(s) {
471
- const { control: l, scope: n, detail: o } = s;
472
- return /* @__PURE__ */ i("div", { className: "flex items-start gap-3 rounded-xl border border-border/40 bg-muted/20 p-3", children: [
473
- /* @__PURE__ */ t(Ft, { className: "mt-0.5 h-4 w-4 text-emerald-600" }),
474
- /* @__PURE__ */ i("div", { className: "space-y-1", children: [
468
+ function Qt(s) {
469
+ const { control: l, scope: r, detail: i } = s;
470
+ return /* @__PURE__ */ d("div", { className: "flex items-start gap-3 rounded-xl border border-border/40 bg-muted/20 p-3", children: [
471
+ /* @__PURE__ */ t(Lt, { className: "mt-0.5 h-4 w-4 text-emerald-600" }),
472
+ /* @__PURE__ */ d("div", { className: "space-y-1", children: [
475
473
  /* @__PURE__ */ t("div", { className: "text-sm font-medium", children: l.label }),
476
- /* @__PURE__ */ i("div", { className: "text-xs text-muted-foreground", children: [
474
+ /* @__PURE__ */ d("div", { className: "text-xs text-muted-foreground", children: [
477
475
  ge(l.type).label,
478
476
  " ·",
479
477
  " ",
480
- Ue(l),
478
+ Re(l),
481
479
  " ·",
482
480
  " ",
483
- je(n, l.placement)
481
+ Ue(r, l.placement)
484
482
  ] }),
485
- o ? /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: o }) : null
483
+ i ? /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: i }) : null
486
484
  ] })
487
485
  ] });
488
486
  }
489
487
  function ye(s) {
490
- const { title: l, children: n, className: o } = s;
491
- return /* @__PURE__ */ i(
488
+ const { title: l, children: r, className: i } = s;
489
+ return /* @__PURE__ */ d(
492
490
  "div",
493
491
  {
494
492
  className: q(
495
493
  "space-y-1 rounded-xl border border-border/40 bg-muted/20 p-3",
496
- o
494
+ i
497
495
  ),
498
496
  children: [
499
497
  /* @__PURE__ */ t("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: l }),
500
- n
498
+ r
501
499
  ]
502
500
  }
503
501
  );
504
502
  }
505
- function Qt(s) {
506
- const { createdReference: l, description: n } = s;
507
- return /* @__PURE__ */ i(ye, { title: "SQL cards", className: "space-y-2", children: [
508
- /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 rounded-md border border-border/30 bg-muted/40 px-3 py-2", children: [
503
+ function jt(s) {
504
+ const { createdReference: l, description: r } = s;
505
+ return /* @__PURE__ */ d(ye, { title: "SQL cards", className: "space-y-2", children: [
506
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 rounded-md border border-border/30 bg-muted/40 px-3 py-2", children: [
509
507
  /* @__PURE__ */ t("code", { className: "min-w-0 truncate text-xs", children: l }),
510
508
  /* @__PURE__ */ t(
511
- Lt,
509
+ At,
512
510
  {
513
511
  text: l,
514
512
  ariaLabel: "Copy SQL control reference"
515
513
  }
516
514
  )
517
515
  ] }),
518
- /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: n })
516
+ /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: r })
519
517
  ] });
520
518
  }
521
- function Ee(s) {
519
+ function Ae(s) {
522
520
  const {
523
521
  control: l,
524
- defaultValue: n,
525
- availableFieldChoices: o,
526
- availableMetricChoices: m,
527
- onControlChange: b,
528
- onLabelChange: p,
529
- onDefaultValueChange: h,
530
- onBack: r,
522
+ defaultValue: r,
523
+ availableFieldChoices: i,
524
+ availableMetricChoices: u,
525
+ onControlChange: p,
526
+ onLabelChange: h,
527
+ onDefaultValueChange: f,
528
+ onBack: m,
531
529
  onNext: x,
532
- nextDisabled: y
530
+ nextDisabled: v
533
531
  } = s;
534
- return /* @__PURE__ */ i("div", { className: "space-y-3", children: [
535
- /* @__PURE__ */ t(Ge, { control: l, onChange: p }),
532
+ return /* @__PURE__ */ d("div", { className: "space-y-3", children: [
533
+ /* @__PURE__ */ t(We, { control: l, onChange: h }),
536
534
  /* @__PURE__ */ t(
537
- Ke,
535
+ He,
538
536
  {
539
537
  control: l,
540
- availableFieldChoices: o,
541
- availableMetricChoices: m,
542
- onChange: b
538
+ availableFieldChoices: i,
539
+ availableMetricChoices: u,
540
+ onChange: p
543
541
  }
544
542
  ),
545
543
  /* @__PURE__ */ t(
546
- He,
544
+ Ye,
547
545
  {
548
546
  control: l,
549
- value: n,
550
- onChange: h,
547
+ value: r,
548
+ onChange: f,
551
549
  allowCardDefault: !0,
552
550
  hint: "This is the value viewers will see first."
553
551
  }
554
552
  ),
555
553
  /* @__PURE__ */ t(
556
- te,
554
+ ee,
557
555
  {
558
- secondary: /* @__PURE__ */ t(w, { type: "button", variant: "outline", onClick: r, children: "Back" }),
559
- primary: /* @__PURE__ */ t(w, { type: "button", onClick: x, disabled: y, children: "Next" })
556
+ secondary: /* @__PURE__ */ t(I, { type: "button", variant: "outline", onClick: m, children: "Back" }),
557
+ primary: /* @__PURE__ */ t(I, { type: "button", onClick: x, disabled: v, children: "Next" })
560
558
  }
561
559
  )
562
560
  ] });
563
561
  }
564
- function Ae(s) {
562
+ function qe(s) {
565
563
  const {
566
564
  control: l,
567
- scope: n,
568
- createdReference: o,
569
- explorerContent: m,
570
- sqlDescription: b,
571
- summaryDetail: p,
572
- onBack: h,
573
- onCancel: r,
565
+ scope: r,
566
+ createdReference: i,
567
+ explorerContent: u,
568
+ sqlDescription: p,
569
+ summaryDetail: h,
570
+ onBack: f,
571
+ onCancel: m,
574
572
  onDone: x
575
573
  } = s;
576
- return /* @__PURE__ */ i("div", { className: "space-y-4", children: [
574
+ return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
577
575
  /* @__PURE__ */ t(
578
- Bt,
576
+ Qt,
579
577
  {
580
578
  control: l,
581
- scope: n,
582
- detail: p
579
+ scope: r,
580
+ detail: h
583
581
  }
584
582
  ),
585
- /* @__PURE__ */ i("div", { className: "space-y-2", children: [
583
+ /* @__PURE__ */ d("div", { className: "space-y-2", children: [
586
584
  /* @__PURE__ */ t("p", { className: "text-sm font-medium", children: "How cards use this control" }),
587
- m,
585
+ u,
588
586
  /* @__PURE__ */ t(
589
- Qt,
587
+ jt,
590
588
  {
591
- createdReference: o,
592
- description: b
589
+ createdReference: i,
590
+ description: p
593
591
  }
594
592
  )
595
593
  ] }),
596
594
  /* @__PURE__ */ t(
597
- te,
595
+ ee,
598
596
  {
599
- secondary: /* @__PURE__ */ t(w, { type: "button", variant: "outline", onClick: h, children: "Back" }),
600
- tertiary: /* @__PURE__ */ t(w, { type: "button", variant: "outline", onClick: r, children: "Cancel" }),
601
- primary: /* @__PURE__ */ t(w, { type: "button", onClick: x, children: "Done" })
597
+ secondary: /* @__PURE__ */ t(I, { type: "button", variant: "outline", onClick: f, children: "Back" }),
598
+ tertiary: /* @__PURE__ */ t(I, { type: "button", variant: "outline", onClick: m, children: "Cancel" }),
599
+ primary: /* @__PURE__ */ t(I, { type: "button", onClick: x, children: "Done" })
602
600
  }
603
601
  )
604
602
  ] });
605
603
  }
606
- function jt(s) {
604
+ function Ut(s) {
607
605
  const l = J(
608
606
  s.scope,
609
607
  s.existingControls,
610
608
  s.reservedIds
611
- ), n = s.type === l.type ? {
609
+ ), r = s.type === l.type ? {
612
610
  ...l,
613
- label: fe[s.type]
611
+ label: he[s.type]
614
612
  } : {
615
- ...$e({
613
+ ...Ke({
616
614
  controls: [
617
615
  {
618
616
  ...l,
619
- label: fe[s.type]
617
+ label: he[s.type]
620
618
  }
621
619
  ],
622
620
  controlId: l.id,
623
621
  nextType: s.type
624
622
  }).controls[0],
625
- label: fe[s.type]
623
+ label: he[s.type]
626
624
  };
627
625
  return {
628
626
  step: 2,
629
- control: n,
630
- defaultValue: P(n, void 0)
627
+ control: r,
628
+ defaultValue: P(r, void 0)
631
629
  };
632
630
  }
633
- function Zt({
631
+ function ea({
634
632
  scope: s,
635
633
  controls: l,
636
- reservedControlIds: n,
637
- defaultValues: o,
638
- onChange: m,
639
- emptyMessage: b,
640
- initialCreateFlow: p = !1,
641
- usageByControlId: h,
642
- availableFieldChoices: r,
634
+ reservedControlIds: r,
635
+ defaultValues: i,
636
+ onChange: u,
637
+ emptyMessage: p,
638
+ initialCreateFlow: h = !1,
639
+ usageByControlId: f,
640
+ availableFieldChoices: m,
643
641
  availableMetricChoices: x,
644
- structuralParticipants: y,
645
- structuralParticipantIdsByControlId: f,
646
- card: v,
642
+ structuralParticipants: v,
643
+ structuralParticipantIdsByControlId: b,
644
+ card: y,
647
645
  onCreateFlowActiveChange: C,
648
646
  onCreateFlowComplete: A
649
647
  }) {
650
- const I = E(
651
- () => new Set(n || []),
652
- [n]
653
- ), le = vt(s), re = mt(s), [G, $] = j(
648
+ const D = L(
649
+ () => new Set(r || []),
650
+ [r]
651
+ ), se = xt(s), le = ht(s), [G, $] = j(
654
652
  null
655
- ), [ne, U] = j(
653
+ ), [re, U] = j(
656
654
  null
657
- ), [a, D] = j(
658
- () => p ? {
655
+ ), [a, S] = j(
656
+ () => h ? {
659
657
  step: 1,
660
- control: J(s, l, Array.from(I))
658
+ control: J(s, l, Array.from(D))
661
659
  } : null
662
- ), K = At(p), V = E(
663
- () => Ie({ scope: s, card: v }),
664
- [v, s]
665
- ), T = _(
660
+ ), K = qt(h), T = L(
661
+ () => we({ scope: s, card: y }),
662
+ [y, s]
663
+ ), w = M(
666
664
  (e) => s === "dashboard" && (e === "field_selector" || e === "metric_selector"),
667
665
  [s]
668
- ), M = E(
669
- () => a ? we(
670
- y || [],
666
+ ), z = L(
667
+ () => a ? Te(
668
+ v || [],
671
669
  a.control.type
672
670
  ) : [],
673
- [a, y]
674
- ), z = E(() => {
671
+ [a, v]
672
+ ), B = L(() => {
675
673
  if (!a)
676
674
  return {
677
- fields: r || [],
675
+ fields: m || [],
678
676
  metrics: x || []
679
677
  };
680
- if (!T(a.control.type))
678
+ if (!w(a.control.type))
681
679
  return {
682
- fields: r || [],
680
+ fields: m || [],
683
681
  metrics: x || []
684
682
  };
685
- const e = a.selectedCardIds || [], u = oe({
683
+ const e = a.selectedCardIds || [], c = ie({
686
684
  controlType: a.control.type,
687
- participants: y || [],
685
+ participants: v || [],
688
686
  selectedCardIds: e
689
687
  });
690
688
  return {
691
- fields: a.control.type === "field_selector" ? u.choices.map((c) => ({
692
- option: c,
693
- target: u.fieldTargetMap[c.value]
689
+ fields: a.control.type === "field_selector" ? c.choices.map((o) => ({
690
+ option: o,
691
+ target: c.fieldTargetMap[o.value]
694
692
  })) : [],
695
- metrics: a.control.type === "metric_selector" ? u.choices.map((c) => ({
696
- option: c,
697
- target: u.metricTargetMap[c.value]
693
+ metrics: a.control.type === "metric_selector" ? c.choices.map((o) => ({
694
+ option: o,
695
+ target: c.metricTargetMap[o.value]
698
696
  })) : []
699
697
  };
700
698
  }, [
701
- r,
699
+ m,
702
700
  x,
703
701
  a,
704
- T,
705
- y
702
+ w,
703
+ v
706
704
  ]);
707
705
  be(() => {
708
706
  C == null || C(!!a);
709
707
  }, [a, C]), be(() => {
710
- const e = p && !K.current;
711
- K.current = p, e && (D({
708
+ const e = h && !K.current;
709
+ K.current = h, e && (S({
712
710
  step: 1,
713
- control: J(s, l, Array.from(I))
711
+ control: J(s, l, Array.from(D))
714
712
  }), U(null), $(null));
715
- }, [l, p, I, s]);
713
+ }, [l, h, D, s]);
716
714
  const W = (e) => {
717
- if (!T(e.type))
715
+ if (!w(e.type))
718
716
  return {
719
- fields: r || [],
717
+ fields: m || [],
720
718
  metrics: x || []
721
719
  };
722
- const u = (f == null ? void 0 : f[e.id]) || [];
723
- if (u.length === 0)
720
+ const c = (b == null ? void 0 : b[e.id]) || [];
721
+ if (c.length === 0)
724
722
  return {
725
- fields: r || [],
723
+ fields: m || [],
726
724
  metrics: x || []
727
725
  };
728
- const c = oe({
726
+ const o = ie({
729
727
  controlType: e.type,
730
- participants: y || [],
731
- selectedCardIds: u
728
+ participants: v || [],
729
+ selectedCardIds: c
732
730
  });
733
731
  return {
734
- fields: e.type === "field_selector" ? c.choices.map((g) => ({
732
+ fields: e.type === "field_selector" ? o.choices.map((g) => ({
735
733
  option: g,
736
- target: c.fieldTargetMap[g.value]
734
+ target: o.fieldTargetMap[g.value]
737
735
  })) : [],
738
- metrics: e.type === "metric_selector" ? c.choices.map((g) => ({
736
+ metrics: e.type === "metric_selector" ? o.choices.map((g) => ({
739
737
  option: g,
740
- target: c.metricTargetMap[g.value]
738
+ target: o.metricTargetMap[g.value]
741
739
  })) : []
742
740
  };
743
741
  }, H = (e) => {
744
- if (!T(e.control.type))
742
+ if (!w(e.control.type))
745
743
  return {
746
744
  nextControl: e.control,
747
745
  cardBindingsById: void 0
748
746
  };
749
- const u = (f == null ? void 0 : f[e.control.id]) || [], c = oe({
747
+ const c = (b == null ? void 0 : b[e.control.id]) || [], o = ie({
750
748
  controlType: e.control.type,
751
- participants: y || [],
749
+ participants: v || [],
752
750
  selectedCardIds: e.nextSelectedCardIds
753
- }), g = Vt({
751
+ }), g = Et({
754
752
  control: e.control,
755
- choices: c.choices
753
+ choices: o.choices
756
754
  }), N = Object.fromEntries(
757
- u.filter((d) => !e.nextSelectedCardIds.includes(d)).map((d) => [d, void 0])
755
+ c.filter((n) => !e.nextSelectedCardIds.includes(n)).map((n) => [n, void 0])
758
756
  );
759
757
  return e.nextSelectedCardIds.length > 0 && g.source.kind === "manual" && g.source.options.length > 0 && Object.assign(
760
758
  N,
761
759
  Le({
762
760
  control: g,
763
- participants: y || [],
761
+ participants: v || [],
764
762
  selectedCardIds: e.nextSelectedCardIds
765
763
  })
766
764
  ), {
767
765
  nextControl: g,
768
766
  cardBindingsById: N
769
767
  };
770
- }, F = _((e, u = o, c = { type: "update" }) => {
771
- m(e, u, c);
772
- }, [o, m]), O = (e, u) => {
773
- const c = l.find(
774
- (L) => L.id === e
768
+ }, F = M((e, c = i, o = { type: "update" }) => {
769
+ u(e, c, o);
770
+ }, [i, u]), O = (e, c) => {
771
+ const o = l.find(
772
+ (V) => V.id === e
775
773
  );
776
- let g = l.map((L) => L.id !== e ? L : u(L));
774
+ let g = l.map((V) => V.id !== e ? V : c(V));
777
775
  const N = g.find(
778
- (L) => L.id === e
776
+ (V) => V.id === e
779
777
  );
780
- let d, k;
778
+ let n, k;
781
779
  if (N && s === "dashboard" && (N.type === "field_selector" || N.type === "metric_selector")) {
782
- const L = (f == null ? void 0 : f[N.id]) || [], B = H({
780
+ const V = (b == null ? void 0 : b[N.id]) || [], Q = H({
783
781
  control: N,
784
- nextSelectedCardIds: L
782
+ nextSelectedCardIds: V
785
783
  });
786
784
  g = g.map(
787
- (De) => De.id === e ? B.nextControl : De
788
- ), d = B.cardBindingsById, k = [N.id];
789
- } else if (c && s === "dashboard" && (c.type === "field_selector" || c.type === "metric_selector")) {
790
- const L = (f == null ? void 0 : f[c.id]) || [];
791
- d = Object.fromEntries(
792
- L.map((B) => [B, void 0])
793
- ), k = [c.id];
785
+ (Ie) => Ie.id === e ? Q.nextControl : Ie
786
+ ), n = Q.cardBindingsById, k = [N.id];
787
+ } else if (o && s === "dashboard" && (o.type === "field_selector" || o.type === "metric_selector")) {
788
+ const V = (b == null ? void 0 : b[o.id]) || [];
789
+ n = Object.fromEntries(
790
+ V.map((Q) => [Q, void 0])
791
+ ), k = [o.id];
794
792
  }
795
- F(g, o, {
793
+ F(g, i, {
796
794
  type: "update",
797
- cardBindingsById: d,
795
+ cardBindingsById: n,
798
796
  affectedBindingControlIds: k
799
797
  });
800
- }, We = (e, u) => {
801
- const c = u.trim();
802
- if (c.length === 0 || c === e || I.has(c) || l.some(
803
- (d) => d.id === c && d.id !== e
798
+ }, Je = (e, c) => {
799
+ const o = c.trim();
800
+ if (o.length === 0 || o === e || D.has(o) || l.some(
801
+ (n) => n.id === o && n.id !== e
804
802
  ))
805
803
  return;
806
804
  const g = l.map(
807
- (d) => d.id === e ? { ...d, id: c } : d
805
+ (n) => n.id === e ? { ...n, id: o } : n
808
806
  );
809
- if (!o) {
807
+ if (!i) {
810
808
  F(g, void 0, {
811
809
  type: "rename",
812
810
  oldId: e,
813
- newId: c
811
+ newId: o
814
812
  });
815
813
  return;
816
814
  }
817
- const N = { ...o };
818
- Object.prototype.hasOwnProperty.call(N, e) && (N[c] = N[e], delete N[e]), F(g, N, {
815
+ const N = { ...i };
816
+ Object.prototype.hasOwnProperty.call(N, e) && (N[o] = N[e], delete N[e]), F(g, N, {
819
817
  type: "rename",
820
818
  oldId: e,
821
- newId: c
819
+ newId: o
822
820
  });
823
- }, Je = (e) => {
824
- const u = l.filter((g) => g.id !== e);
825
- if (!o) {
826
- F(u, void 0, { type: "remove", controlId: e });
821
+ }, Pe = (e) => {
822
+ const c = l.filter((g) => g.id !== e);
823
+ if (!i) {
824
+ F(c, void 0, { type: "remove", controlId: e });
827
825
  return;
828
826
  }
829
- const c = { ...o };
830
- delete c[e], F(u, c, { type: "remove", controlId: e });
831
- }, Pe = _(() => {
832
- D({
827
+ const o = { ...i };
828
+ delete o[e], F(c, o, { type: "remove", controlId: e });
829
+ }, Ze = M(() => {
830
+ S({
833
831
  step: 1,
834
- control: J(s, l, Array.from(I))
832
+ control: J(s, l, Array.from(D))
835
833
  }), U(null), $(null);
836
- }, [l, I, s]), Y = (e) => {
837
- D(
838
- (u) => u && {
839
- ...u,
840
- control: e(u.control)
834
+ }, [l, D, s]), Y = (e) => {
835
+ S(
836
+ (c) => c && {
837
+ ...c,
838
+ control: e(c.control)
841
839
  }
842
840
  );
843
- }, Ce = (e) => {
844
- D(
845
- (u) => u && {
846
- ...u,
841
+ }, Ne = (e) => {
842
+ S(
843
+ (c) => c && {
844
+ ...c,
847
845
  defaultValue: e
848
846
  }
849
847
  );
850
- }, de = (() => {
848
+ }, ne = (() => {
851
849
  if (!a)
852
850
  return !1;
853
- if (a.step === 2 && T(a.control.type))
851
+ if (a.step === 2 && w(a.control.type))
854
852
  return (a.selectedCardIds || []).length > 0;
855
853
  if (a.step !== 2 && a.step !== 3 || !a.control.label.trim())
856
854
  return !1;
857
- const u = Te(a.control);
858
- return u.source.kind === "manual" && (pt(u) && u.source.options.length === 0 || u.source.options.some(
855
+ const c = Fe(a.control);
856
+ return c.source.kind === "manual" && (ft(c) && c.source.options.length === 0 || c.source.options.some(
859
857
  (g) => g.label.trim().length === 0 || g.value.trim().length === 0
860
- )) ? !1 : ht(
861
- P(u, a.defaultValue)
858
+ )) ? !1 : bt(
859
+ P(c, a.defaultValue)
862
860
  );
863
- })(), Ne = () => {
864
- var d;
861
+ })(), ke = () => {
862
+ var n;
865
863
  if (!a)
866
864
  return;
867
- const e = Te(a.control), u = Tt({
865
+ const e = Fe(a.control), c = Vt({
868
866
  label: e.label,
869
867
  fallbackId: e.id,
870
868
  existingControls: l,
871
- reservedIds: Array.from(I)
872
- }), c = {
869
+ reservedIds: Array.from(D)
870
+ }), o = {
873
871
  ...e,
874
- id: u
875
- }, g = s === "dashboard" && (c.type === "field_selector" || c.type === "metric_selector") && ((d = a.selectedCardIds) != null && d.length) ? Le({
876
- control: c,
877
- participants: y || [],
872
+ id: c
873
+ }, g = s === "dashboard" && (o.type === "field_selector" || o.type === "metric_selector") && ((n = a.selectedCardIds) != null && n.length) ? Le({
874
+ control: o,
875
+ participants: v || [],
878
876
  selectedCardIds: a.selectedCardIds
879
877
  }) : void 0, N = P(
880
- c,
878
+ o,
881
879
  a.defaultValue
882
880
  );
883
- D({
884
- step: s === "dashboard" && (c.type === "field_selector" || c.type === "metric_selector") ? 4 : 3,
885
- control: c,
881
+ S({
882
+ step: s === "dashboard" && (o.type === "field_selector" || o.type === "metric_selector") ? 4 : 3,
883
+ control: o,
886
884
  defaultValue: N,
887
- createdControlId: u,
885
+ createdControlId: c,
888
886
  selectedCardIds: a.selectedCardIds,
889
887
  cardBindingsById: g
890
888
  });
891
- }, ie = _(() => {
892
- D(null);
893
- }, []), ke = _(() => {
889
+ }, de = M(() => {
890
+ S(null);
891
+ }, []), Se = M(() => {
894
892
  if (!(a != null && a.createdControlId)) {
895
- D(null);
893
+ S(null);
896
894
  return;
897
895
  }
898
- const e = a.control, u = a.createdControlId, c = P(
896
+ const e = a.control, c = a.createdControlId, o = P(
899
897
  e,
900
898
  a.defaultValue
901
899
  );
902
- o ? F(
900
+ i ? F(
903
901
  [...l, e],
904
902
  {
905
- ...o,
906
- [u]: c
903
+ ...i,
904
+ [c]: o
907
905
  },
908
906
  {
909
907
  type: "add",
@@ -914,7 +912,7 @@ function Zt({
914
912
  ...l,
915
913
  {
916
914
  ...e,
917
- defaultValue: c
915
+ defaultValue: o
918
916
  }
919
917
  ],
920
918
  void 0,
@@ -922,33 +920,33 @@ function Zt({
922
920
  type: "add",
923
921
  cardBindingsById: a.cardBindingsById
924
922
  }
925
- ), U(u), D(null), A == null || A();
926
- }, [l, a, o, F, A]), Ze = a ? T(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Se = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${ft(a.control.label) || a.control.id}]]` : "";
927
- return /* @__PURE__ */ i("div", { className: "space-y-4", children: [
928
- a ? /* @__PURE__ */ i("div", { className: "space-y-4 pb-1", children: [
923
+ ), U(c), S(null), A == null || A();
924
+ }, [l, a, i, F, A]), et = a ? w(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], De = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${yt(a.control.label) || a.control.id}]]` : "";
925
+ return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
926
+ a ? /* @__PURE__ */ d("div", { className: "space-y-4 pb-1", children: [
929
927
  /* @__PURE__ */ t(
930
- zt,
928
+ Bt,
931
929
  {
932
930
  currentStep: a.step,
933
- labels: Ze
931
+ labels: et
934
932
  }
935
933
  ),
936
- a.step === 1 && /* @__PURE__ */ i("div", { className: "space-y-4", children: [
937
- /* @__PURE__ */ i("div", { children: [
934
+ a.step === 1 && /* @__PURE__ */ d("div", { className: "space-y-4", children: [
935
+ /* @__PURE__ */ d("div", { children: [
938
936
  /* @__PURE__ */ t("p", { className: "text-sm font-medium", children: "What kind of input should viewers see?" }),
939
937
  /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Choose the viewer experience first. You can fine-tune the details next." }),
940
- s === "card" && (v == null ? void 0 : v.sql) == null ? /* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Explorer cards support displayed metric, group by field, aggregation, and time grain controls here." }) : null
938
+ s === "card" && (y == null ? void 0 : y.sql) == null ? /* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Explorer cards support displayed metric, group by field, aggregation, and time grain controls here." }) : null
941
939
  ] }),
942
- /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2", children: V.map((e) => /* @__PURE__ */ i(
940
+ /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2", children: T.map((e) => /* @__PURE__ */ d(
943
941
  "button",
944
942
  {
945
943
  type: "button",
946
944
  className: "rounded-xl border border-border/50 bg-muted/20 p-3 text-left transition-colors hover:border-border/70 hover:bg-muted/35",
947
- onClick: () => D(
948
- jt({
945
+ onClick: () => S(
946
+ Ut({
949
947
  scope: s,
950
948
  existingControls: l,
951
- reservedIds: Array.from(I),
949
+ reservedIds: Array.from(D),
952
950
  type: e.value
953
951
  })
954
952
  ),
@@ -960,49 +958,49 @@ function Zt({
960
958
  e.value
961
959
  )) }),
962
960
  /* @__PURE__ */ t(
963
- te,
961
+ ee,
964
962
  {
965
963
  secondary: /* @__PURE__ */ t(
966
- w,
964
+ I,
967
965
  {
968
966
  type: "button",
969
967
  variant: "outline",
970
- onClick: ie,
968
+ onClick: de,
971
969
  children: "Back to controls"
972
970
  }
973
971
  )
974
972
  }
975
973
  )
976
974
  ] }),
977
- a.step === 2 && T(a.control.type) && /* @__PURE__ */ i("div", { className: "space-y-3", children: [
978
- /* @__PURE__ */ i("div", { className: "space-y-3", children: [
975
+ a.step === 2 && w(a.control.type) && /* @__PURE__ */ d("div", { className: "space-y-3", children: [
976
+ /* @__PURE__ */ d("div", { className: "space-y-3", children: [
979
977
  /* @__PURE__ */ t(
980
- Ge,
978
+ We,
981
979
  {
982
980
  control: a.control,
983
- onChange: (e) => Y((u) => ({
984
- ...u,
981
+ onChange: (e) => Y((c) => ({
982
+ ...c,
985
983
  label: e
986
984
  }))
987
985
  }
988
986
  ),
989
987
  /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Choose which cards should respond to this shared control." })
990
988
  ] }),
991
- M.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-xl bg-muted/20 p-3 text-xs text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-2 rounded-xl bg-muted/20 p-3", children: M.map((e) => {
992
- const u = (a.selectedCardIds || []).includes(e.cardId);
993
- return /* @__PURE__ */ i(
989
+ z.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-xl bg-muted/20 p-3 text-xs text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-2 rounded-xl bg-muted/20 p-3", children: z.map((e) => {
990
+ const c = (a.selectedCardIds || []).includes(e.cardId);
991
+ return /* @__PURE__ */ d(
994
992
  "label",
995
993
  {
996
994
  className: "flex items-start gap-2 text-sm",
997
995
  children: [
998
996
  /* @__PURE__ */ t(
999
- bt,
997
+ vt,
1000
998
  {
1001
- checked: u,
1002
- onCheckedChange: (c) => D(
999
+ checked: c,
1000
+ onCheckedChange: (o) => S(
1003
1001
  (g) => g && {
1004
1002
  ...g,
1005
- selectedCardIds: c === !0 ? [
1003
+ selectedCardIds: o === !0 ? [
1006
1004
  ...g.selectedCardIds || [],
1007
1005
  e.cardId
1008
1006
  ] : (g.selectedCardIds || []).filter(
@@ -1012,7 +1010,7 @@ function Zt({
1012
1010
  )
1013
1011
  }
1014
1012
  ),
1015
- /* @__PURE__ */ i("div", { className: "min-w-0", children: [
1013
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1016
1014
  /* @__PURE__ */ t("div", { className: "font-medium", children: e.title }),
1017
1015
  /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: a.control.type === "field_selector" ? `${e.fieldChoices.length} compatible group-by fields` : `${e.metricChoices.length} compatible metrics` })
1018
1016
  ] })
@@ -1022,14 +1020,14 @@ function Zt({
1022
1020
  );
1023
1021
  }) }),
1024
1022
  /* @__PURE__ */ t(
1025
- te,
1023
+ ee,
1026
1024
  {
1027
1025
  secondary: /* @__PURE__ */ t(
1028
- w,
1026
+ I,
1029
1027
  {
1030
1028
  type: "button",
1031
1029
  variant: "outline",
1032
- onClick: () => D(
1030
+ onClick: () => S(
1033
1031
  (e) => e && {
1034
1032
  ...e,
1035
1033
  step: 1,
@@ -1040,75 +1038,75 @@ function Zt({
1040
1038
  }
1041
1039
  ),
1042
1040
  primary: /* @__PURE__ */ t(
1043
- w,
1041
+ I,
1044
1042
  {
1045
1043
  type: "button",
1046
- onClick: () => D(
1044
+ onClick: () => S(
1047
1045
  (e) => e && {
1048
1046
  ...e,
1049
1047
  step: 3
1050
1048
  }
1051
1049
  ),
1052
- disabled: !de,
1050
+ disabled: !ne,
1053
1051
  children: "Next"
1054
1052
  }
1055
1053
  )
1056
1054
  }
1057
1055
  )
1058
1056
  ] }),
1059
- a.step === 2 && !T(a.control.type) && /* @__PURE__ */ t(
1060
- Ee,
1057
+ a.step === 2 && !w(a.control.type) && /* @__PURE__ */ t(
1058
+ Ae,
1061
1059
  {
1062
1060
  control: a.control,
1063
1061
  defaultValue: a.defaultValue,
1064
- availableFieldChoices: z.fields,
1065
- availableMetricChoices: z.metrics,
1062
+ availableFieldChoices: B.fields,
1063
+ availableMetricChoices: B.metrics,
1066
1064
  onControlChange: (e) => Y(() => e),
1067
- onLabelChange: (e) => Y((u) => ({
1068
- ...u,
1065
+ onLabelChange: (e) => Y((c) => ({
1066
+ ...c,
1069
1067
  label: e
1070
1068
  })),
1071
- onDefaultValueChange: Ce,
1072
- onBack: () => D(
1069
+ onDefaultValueChange: Ne,
1070
+ onBack: () => S(
1073
1071
  (e) => e && {
1074
1072
  ...e,
1075
1073
  step: 1
1076
1074
  }
1077
1075
  ),
1078
- onNext: Ne,
1079
- nextDisabled: !de
1076
+ onNext: ke,
1077
+ nextDisabled: !ne
1080
1078
  }
1081
1079
  ),
1082
- a.step === 3 && T(a.control.type) && /* @__PURE__ */ t(
1083
- Ee,
1080
+ a.step === 3 && w(a.control.type) && /* @__PURE__ */ t(
1081
+ Ae,
1084
1082
  {
1085
1083
  control: a.control,
1086
1084
  defaultValue: a.defaultValue,
1087
- availableFieldChoices: z.fields,
1088
- availableMetricChoices: z.metrics,
1085
+ availableFieldChoices: B.fields,
1086
+ availableMetricChoices: B.metrics,
1089
1087
  onControlChange: (e) => Y(() => e),
1090
- onLabelChange: (e) => Y((u) => ({
1091
- ...u,
1088
+ onLabelChange: (e) => Y((c) => ({
1089
+ ...c,
1092
1090
  label: e
1093
1091
  })),
1094
- onDefaultValueChange: Ce,
1095
- onBack: () => D(
1092
+ onDefaultValueChange: Ne,
1093
+ onBack: () => S(
1096
1094
  (e) => e && {
1097
1095
  ...e,
1098
1096
  step: 2
1099
1097
  }
1100
1098
  ),
1101
- onNext: Ne,
1102
- nextDisabled: !de
1099
+ onNext: ke,
1100
+ nextDisabled: !ne
1103
1101
  }
1104
1102
  ),
1105
- a.step === 3 && !T(a.control.type) && /* @__PURE__ */ t(
1106
- Ae,
1103
+ a.step === 3 && !w(a.control.type) && /* @__PURE__ */ t(
1104
+ qe,
1107
1105
  {
1108
1106
  control: a.control,
1109
1107
  scope: s,
1110
- createdReference: Se,
1111
- explorerContent: /* @__PURE__ */ t(ye, { title: "Explorer cards", children: /* @__PURE__ */ i("p", { className: "text-sm", children: [
1108
+ createdReference: De,
1109
+ explorerContent: /* @__PURE__ */ t(ye, { title: "Explorer cards", children: /* @__PURE__ */ d("p", { className: "text-sm", children: [
1112
1110
  "Open the card and use",
1113
1111
  " ",
1114
1112
  /* @__PURE__ */ t("span", { className: "font-medium", children: "Settings → Controls" }),
@@ -1116,23 +1114,23 @@ function Zt({
1116
1114
  "to choose what this control changes."
1117
1115
  ] }) }),
1118
1116
  sqlDescription: "Reference this control directly in the SQL editor.",
1119
- onBack: () => D(
1117
+ onBack: () => S(
1120
1118
  (e) => e && {
1121
1119
  ...e,
1122
1120
  step: 2
1123
1121
  }
1124
1122
  ),
1125
- onCancel: ie,
1126
- onDone: ke
1123
+ onCancel: de,
1124
+ onDone: Se
1127
1125
  }
1128
1126
  ),
1129
- a.step === 4 && T(a.control.type) && /* @__PURE__ */ t(
1130
- Ae,
1127
+ a.step === 4 && w(a.control.type) && /* @__PURE__ */ t(
1128
+ qe,
1131
1129
  {
1132
1130
  control: a.control,
1133
1131
  scope: s,
1134
- createdReference: Se,
1135
- summaryDetail: /* @__PURE__ */ i(X, { children: [
1132
+ createdReference: De,
1133
+ summaryDetail: /* @__PURE__ */ d(X, { children: [
1136
1134
  "Used by ",
1137
1135
  (a.selectedCardIds || []).length,
1138
1136
  " ",
@@ -1141,141 +1139,141 @@ function Zt({
1141
1139
  ] }),
1142
1140
  explorerContent: /* @__PURE__ */ t(ye, { title: "Explorer cards", children: /* @__PURE__ */ t("p", { className: "text-sm", children: "Selected cards have been set up to respond to this control automatically." }) }),
1143
1141
  sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
1144
- onBack: () => D(
1142
+ onBack: () => S(
1145
1143
  (e) => e && {
1146
1144
  ...e,
1147
1145
  step: 3
1148
1146
  }
1149
1147
  ),
1150
- onCancel: ie,
1151
- onDone: ke
1148
+ onCancel: de,
1149
+ onDone: Se
1152
1150
  }
1153
1151
  )
1154
1152
  ] }) : null,
1155
- !a && l.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: b }) : null,
1153
+ !a && l.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: p }) : null,
1156
1154
  !a && l.map((e) => {
1157
- const u = W(e), c = h == null ? void 0 : h[e.id], g = o && Object.prototype.hasOwnProperty.call(o, e.id) ? o[e.id] : e.defaultValue, N = ne === e.id;
1158
- return /* @__PURE__ */ i("div", { className: "rounded-md border", children: [
1159
- /* @__PURE__ */ i("div", { className: "flex items-center gap-2 px-3 py-3", children: [
1160
- /* @__PURE__ */ i(
1155
+ const c = W(e), o = f == null ? void 0 : f[e.id], g = i && Object.prototype.hasOwnProperty.call(i, e.id) ? i[e.id] : e.defaultValue, N = re === e.id;
1156
+ return /* @__PURE__ */ d("div", { className: "rounded-md border", children: [
1157
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2 px-3 py-3", children: [
1158
+ /* @__PURE__ */ d(
1161
1159
  "button",
1162
1160
  {
1163
1161
  type: "button",
1164
1162
  className: "flex min-w-0 flex-1 items-start gap-2 text-left",
1165
1163
  onClick: () => U(
1166
- (d) => d === e.id ? null : e.id
1164
+ (n) => n === e.id ? null : e.id
1167
1165
  ),
1168
1166
  children: [
1169
- N ? /* @__PURE__ */ t(Ve, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Fe, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }),
1170
- /* @__PURE__ */ i("div", { className: "min-w-0", children: [
1171
- /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
1167
+ N ? /* @__PURE__ */ t(Ve, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Ee, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }),
1168
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1169
+ /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
1172
1170
  /* @__PURE__ */ t("span", { className: "truncate text-sm font-medium", children: e.label || "Untitled control" }),
1173
1171
  /* @__PURE__ */ t(Z, { variant: "outline", className: "text-[11px]", children: ge(e.type).label }),
1174
- /* @__PURE__ */ t(Z, { variant: "secondary", className: "text-[11px]", children: je(s, e.placement) })
1172
+ /* @__PURE__ */ t(Z, { variant: "secondary", className: "text-[11px]", children: Ue(s, e.placement) })
1175
1173
  ] }),
1176
- /* @__PURE__ */ i("div", { className: "mt-1 text-xs text-muted-foreground", children: [
1177
- Ue(e),
1178
- c != null && c.status ? ` · ${c.status}` : ""
1174
+ /* @__PURE__ */ d("div", { className: "mt-1 text-xs text-muted-foreground", children: [
1175
+ Re(e),
1176
+ o != null && o.status ? ` · ${o.status}` : ""
1179
1177
  ] })
1180
1178
  ] })
1181
1179
  ]
1182
1180
  }
1183
1181
  ),
1184
1182
  /* @__PURE__ */ t(
1185
- w,
1183
+ I,
1186
1184
  {
1187
1185
  type: "button",
1188
1186
  size: "icon",
1189
1187
  variant: "ghost",
1190
1188
  className: "h-8 w-8 shrink-0",
1191
- onClick: () => Je(e.id),
1189
+ onClick: () => Pe(e.id),
1192
1190
  "aria-label": `Remove ${e.label}`,
1193
- children: /* @__PURE__ */ t(yt, { className: "h-4 w-4" })
1191
+ children: /* @__PURE__ */ t(gt, { className: "h-4 w-4" })
1194
1192
  }
1195
1193
  )
1196
1194
  ] }),
1197
- N && /* @__PURE__ */ i("div", { className: "space-y-4 border-t px-3 py-4", children: [
1198
- c != null && c.helper ? /* @__PURE__ */ t("div", { className: "rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: c.helper }) : null,
1199
- /* @__PURE__ */ i("div", { className: "grid gap-3 md:grid-cols-3", children: [
1200
- /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
1195
+ N && /* @__PURE__ */ d("div", { className: "space-y-4 border-t px-3 py-4", children: [
1196
+ o != null && o.helper ? /* @__PURE__ */ t("div", { className: "rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: o.helper }) : null,
1197
+ /* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-3", children: [
1198
+ /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1201
1199
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Label" }),
1202
1200
  /* @__PURE__ */ t(
1203
- Re,
1201
+ $e,
1204
1202
  {
1205
1203
  value: e.label,
1206
1204
  placeholder: "Control label",
1207
- onChange: (d) => O(e.id, (k) => ({
1205
+ onChange: (n) => O(e.id, (k) => ({
1208
1206
  ...k,
1209
- label: d.target.value
1207
+ label: n.target.value
1210
1208
  }))
1211
1209
  }
1212
1210
  )
1213
1211
  ] }),
1214
- /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
1212
+ /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1215
1213
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Type" }),
1216
- /* @__PURE__ */ i(
1217
- ce,
1214
+ /* @__PURE__ */ d(
1215
+ oe,
1218
1216
  {
1219
1217
  value: e.type,
1220
- onValueChange: (d) => {
1221
- const k = $e({
1218
+ onValueChange: (n) => {
1219
+ const k = Ke({
1222
1220
  controls: l,
1223
1221
  controlId: e.id,
1224
- nextType: d,
1225
- defaultValues: o
1222
+ nextType: n,
1223
+ defaultValues: i
1226
1224
  });
1227
1225
  F(k.controls, k.defaultValues);
1228
1226
  },
1229
1227
  children: [
1230
- /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ t(me, {}) }),
1231
- /* @__PURE__ */ t(pe, { children: Ie({
1228
+ /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(ue, {}) }),
1229
+ /* @__PURE__ */ t(me, { children: we({
1232
1230
  scope: s,
1233
- card: v,
1231
+ card: y,
1234
1232
  includeType: e.type
1235
- }).map((d) => /* @__PURE__ */ t(he, { value: d.value, children: d.label }, d.value)) })
1233
+ }).map((n) => /* @__PURE__ */ t(pe, { value: n.value, children: n.label }, n.value)) })
1236
1234
  ]
1237
1235
  }
1238
1236
  )
1239
1237
  ] }),
1240
- /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
1238
+ /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1241
1239
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Show in" }),
1242
- /* @__PURE__ */ i(
1243
- ce,
1240
+ /* @__PURE__ */ d(
1241
+ oe,
1244
1242
  {
1245
- value: e.placement || re,
1246
- onValueChange: (d) => O(e.id, (k) => ({
1243
+ value: e.placement || le,
1244
+ onValueChange: (n) => O(e.id, (k) => ({
1247
1245
  ...k,
1248
- placement: d
1246
+ placement: n
1249
1247
  })),
1250
1248
  children: [
1251
- /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ t(me, {}) }),
1252
- /* @__PURE__ */ t(pe, { children: le.map((d) => /* @__PURE__ */ t(he, { value: d.value, children: d.label }, d.value)) })
1249
+ /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(ue, {}) }),
1250
+ /* @__PURE__ */ t(me, { children: se.map((n) => /* @__PURE__ */ t(pe, { value: n.value, children: n.label }, n.value)) })
1253
1251
  ]
1254
1252
  }
1255
1253
  )
1256
1254
  ] })
1257
1255
  ] }),
1258
- T(e.type) ? /* @__PURE__ */ t(
1259
- gt,
1256
+ w(e.type) ? /* @__PURE__ */ t(
1257
+ Ct,
1260
1258
  {
1261
1259
  type: e.type,
1262
- participants: we(
1263
- y || [],
1260
+ participants: Te(
1261
+ v || [],
1264
1262
  e.type
1265
- ).map((d) => ({
1266
- cardId: d.cardId,
1267
- title: d.title,
1268
- choiceCount: e.type === "field_selector" ? d.fieldChoices.length : d.metricChoices.length
1263
+ ).map((n) => ({
1264
+ cardId: n.cardId,
1265
+ title: n.title,
1266
+ choiceCount: e.type === "field_selector" ? n.fieldChoices.length : n.metricChoices.length
1269
1267
  })),
1270
- selectedCardIds: (f == null ? void 0 : f[e.id]) || [],
1271
- onChange: (d) => {
1268
+ selectedCardIds: (b == null ? void 0 : b[e.id]) || [],
1269
+ onChange: (n) => {
1272
1270
  const k = H({
1273
1271
  control: e,
1274
- nextSelectedCardIds: d
1275
- }), L = l.map(
1276
- (B) => B.id === e.id ? k.nextControl : B
1272
+ nextSelectedCardIds: n
1273
+ }), V = l.map(
1274
+ (Q) => Q.id === e.id ? k.nextControl : Q
1277
1275
  );
1278
- F(L, o, {
1276
+ F(V, i, {
1279
1277
  type: "update",
1280
1278
  cardBindingsById: k.cardBindingsById
1281
1279
  });
@@ -1283,98 +1281,98 @@ function Zt({
1283
1281
  }
1284
1282
  ) : null,
1285
1283
  /* @__PURE__ */ t(
1286
- Ke,
1284
+ He,
1287
1285
  {
1288
1286
  control: e,
1289
- availableFieldChoices: u.fields,
1290
- availableMetricChoices: u.metrics,
1291
- onChange: (d) => O(e.id, () => d)
1287
+ availableFieldChoices: c.fields,
1288
+ availableMetricChoices: c.metrics,
1289
+ onChange: (n) => O(e.id, () => n)
1292
1290
  }
1293
1291
  ),
1294
1292
  e.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
1295
- He,
1293
+ Ye,
1296
1294
  {
1297
1295
  control: e,
1298
1296
  value: g,
1299
1297
  allowNoDefault: !0,
1300
1298
  allowCardDefault: !0,
1301
- onChange: (d) => {
1302
- if (o) {
1303
- const k = { ...o };
1304
- d === void 0 ? delete k[e.id] : k[e.id] = d, F(l, k);
1299
+ onChange: (n) => {
1300
+ if (i) {
1301
+ const k = { ...i };
1302
+ n === void 0 ? delete k[e.id] : k[e.id] = n, F(l, k);
1305
1303
  return;
1306
1304
  }
1307
1305
  O(e.id, (k) => ({
1308
1306
  ...k,
1309
- defaultValue: d
1307
+ defaultValue: n
1310
1308
  }));
1311
1309
  }
1312
1310
  }
1313
1311
  ),
1314
- /* @__PURE__ */ i(
1315
- xt,
1312
+ /* @__PURE__ */ d(
1313
+ Nt,
1316
1314
  {
1317
1315
  open: G === e.id,
1318
- onOpenChange: (d) => $(d ? e.id : null),
1316
+ onOpenChange: (n) => $(n ? e.id : null),
1319
1317
  children: [
1320
- /* @__PURE__ */ t(Ct, { asChild: !0, children: /* @__PURE__ */ i(
1321
- w,
1318
+ /* @__PURE__ */ t(kt, { asChild: !0, children: /* @__PURE__ */ d(
1319
+ I,
1322
1320
  {
1323
1321
  type: "button",
1324
1322
  variant: "ghost",
1325
1323
  className: "h-auto px-0 text-xs text-muted-foreground hover:bg-transparent",
1326
1324
  children: [
1327
- G === e.id ? /* @__PURE__ */ t(Ve, { className: "mr-1 h-4 w-4" }) : /* @__PURE__ */ t(Fe, { className: "mr-1 h-4 w-4" }),
1325
+ G === e.id ? /* @__PURE__ */ t(Ve, { className: "mr-1 h-4 w-4" }) : /* @__PURE__ */ t(Ee, { className: "mr-1 h-4 w-4" }),
1328
1326
  "Advanced"
1329
1327
  ]
1330
1328
  }
1331
1329
  ) }),
1332
- /* @__PURE__ */ i(Nt, { className: "space-y-3 pt-2", children: [
1333
- /* @__PURE__ */ i("div", { className: "grid gap-3 md:grid-cols-2", children: [
1334
- /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
1330
+ /* @__PURE__ */ d(St, { className: "space-y-3 pt-2", children: [
1331
+ /* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-2", children: [
1332
+ /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1335
1333
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Control ID" }),
1336
1334
  /* @__PURE__ */ t(
1337
- kt,
1335
+ Dt,
1338
1336
  {
1339
1337
  controlId: e.id,
1340
- onCommit: (d) => We(e.id, d)
1338
+ onCommit: (n) => Je(e.id, n)
1341
1339
  },
1342
1340
  e.id
1343
1341
  )
1344
1342
  ] }),
1345
- /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
1343
+ /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1346
1344
  /* @__PURE__ */ t(R, { className: "text-xs", children: "Initial value" }),
1347
- /* @__PURE__ */ i(
1348
- ce,
1345
+ /* @__PURE__ */ d(
1346
+ oe,
1349
1347
  {
1350
1348
  value: e.initialValueStrategy,
1351
- onValueChange: (d) => O(e.id, (k) => ({
1349
+ onValueChange: (n) => O(e.id, (k) => ({
1352
1350
  ...k,
1353
- initialValueStrategy: d
1351
+ initialValueStrategy: n
1354
1352
  })),
1355
1353
  children: [
1356
- /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ t(me, {}) }),
1357
- /* @__PURE__ */ t(pe, { children: St.map((d) => /* @__PURE__ */ t(
1358
- he,
1354
+ /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(ue, {}) }),
1355
+ /* @__PURE__ */ t(me, { children: It.map((n) => /* @__PURE__ */ t(
1356
+ pe,
1359
1357
  {
1360
- value: d.value,
1361
- children: d.label
1358
+ value: n.value,
1359
+ children: n.label
1362
1360
  },
1363
- d.value
1361
+ n.value
1364
1362
  )) })
1365
1363
  ]
1366
1364
  }
1367
1365
  ),
1368
- /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: Dt(
1366
+ /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: wt(
1369
1367
  e.initialValueStrategy
1370
1368
  ) })
1371
1369
  ] })
1372
1370
  ] }),
1373
1371
  /* @__PURE__ */ t(
1374
- It,
1372
+ Tt,
1375
1373
  {
1376
1374
  control: e,
1377
- onChange: (d) => O(e.id, () => d)
1375
+ onChange: (n) => O(e.id, () => n)
1378
1376
  }
1379
1377
  )
1380
1378
  ] })
@@ -1384,62 +1382,62 @@ function Zt({
1384
1382
  ] })
1385
1383
  ] }, e.id);
1386
1384
  }),
1387
- !a && /* @__PURE__ */ i(
1388
- w,
1385
+ !a && /* @__PURE__ */ d(
1386
+ I,
1389
1387
  {
1390
1388
  type: "button",
1391
1389
  variant: "outline",
1392
1390
  size: "sm",
1393
- onClick: Pe,
1391
+ onClick: Ze,
1394
1392
  children: [
1395
- /* @__PURE__ */ t(wt, { className: "mr-2 h-4 w-4" }),
1393
+ /* @__PURE__ */ t(Ft, { className: "mr-2 h-4 w-4" }),
1396
1394
  "Add control"
1397
1395
  ]
1398
1396
  }
1399
1397
  )
1400
1398
  ] });
1401
1399
  }
1402
- function ea(s) {
1403
- const { open: l, onOpenChange: n, initialCreateFlowActive: o = !1 } = s, m = l !== void 0, [b, p] = j(!1), [h, r] = j(
1404
- o
1405
- ), x = m ? l : b, y = _(
1400
+ function ta(s) {
1401
+ const { open: l, onOpenChange: r, initialCreateFlowActive: i = !1 } = s, u = l !== void 0, [p, h] = j(!1), [f, m] = j(
1402
+ i
1403
+ ), x = u ? l : p, v = M(
1406
1404
  (C) => {
1407
- !C && h || (m || p(C), C || r(!1), n == null || n(C));
1405
+ !C && f || (u || h(C), C || m(!1), r == null || r(C));
1408
1406
  },
1409
- [m, h, n]
1410
- ), f = _(() => {
1411
- m || p(!1), r(!1), n == null || n(!1);
1412
- }, [m, n]);
1407
+ [u, f, r]
1408
+ ), b = M(() => {
1409
+ u || h(!1), m(!1), r == null || r(!1);
1410
+ }, [u, r]);
1413
1411
  be(() => {
1414
- x || r(!1);
1412
+ x || m(!1);
1415
1413
  }, [x]);
1416
- const v = _(
1414
+ const y = M(
1417
1415
  (C) => {
1418
- h && C.preventDefault();
1416
+ f && C.preventDefault();
1419
1417
  },
1420
- [h]
1418
+ [f]
1421
1419
  );
1422
1420
  return {
1423
- forceClose: f,
1424
- handleOpenChange: y,
1425
- isCreateFlowActive: h,
1426
- preventPassiveDismissDuringCreate: v,
1421
+ forceClose: b,
1422
+ handleOpenChange: v,
1423
+ isCreateFlowActive: f,
1424
+ preventPassiveDismissDuringCreate: y,
1427
1425
  resolvedOpen: x,
1428
- setIsCreateFlowActive: r
1426
+ setIsCreateFlowActive: m
1429
1427
  };
1430
1428
  }
1431
1429
  export {
1432
- Ht as C,
1433
- Xt as E,
1434
- Ot as L,
1435
- Ye as S,
1436
- Yt as V,
1437
- Gt as a,
1438
- Wt as b,
1430
+ Yt as C,
1431
+ Gt as E,
1432
+ Mt as L,
1433
+ Xe as S,
1434
+ Xt as V,
1435
+ Wt as a,
1436
+ Jt as b,
1439
1437
  _t as c,
1440
- Jt as d,
1441
- Zt as e,
1442
- Pt as f,
1443
- Xe as g,
1444
- ea as u
1438
+ Pt as d,
1439
+ ea as e,
1440
+ Zt as f,
1441
+ Ge as g,
1442
+ ta as u
1445
1443
  };