react-semaphor 0.1.259 → 0.1.261

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 (46) hide show
  1. package/dist/chunks/dashboard-controls-0hbftZxY.js +42 -0
  2. package/dist/chunks/dashboard-controls-BYi_r2lH.js +1971 -0
  3. package/dist/chunks/dashboard-filter-controls-button-BPCw1GMh.js +1066 -0
  4. package/dist/chunks/dashboard-filter-controls-button-f4pDkDUL.js +11 -0
  5. package/dist/chunks/{dashboard-json-B43n1l6C.js → dashboard-json-2NJCXsDD.js} +1 -1
  6. package/dist/chunks/{dashboard-json-D0oSxmLa.js → dashboard-json-Dpy-zKf2.js} +1 -1
  7. package/dist/chunks/{dashboard-summary-settings-dialog-CxZAMb8B.js → dashboard-summary-settings-dialog-B9zRCvc-.js} +1 -1
  8. package/dist/chunks/{dashboard-summary-settings-dialog-DMWYgbwB.js → dashboard-summary-settings-dialog-Be3JilRI.js} +1 -1
  9. package/dist/chunks/edit-dashboard-visual-Bon08erH.js +188 -0
  10. package/dist/chunks/{edit-dashboard-visual-CCoz1oGX.js → edit-dashboard-visual-CqTlmuYL.js} +5970 -5492
  11. package/dist/chunks/index-BoJEr_9F.js +1114 -0
  12. package/dist/chunks/{index-DpSxZvI0.js → index-C2c-_lPE.js} +48682 -45193
  13. package/dist/chunks/{normalize-dashboard-for-dirty-check-Bn27S0PN.js → normalize-dashboard-for-dirty-check-5KpZN8xr.js} +20 -19
  14. package/dist/chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js +1 -0
  15. package/dist/chunks/{resource-management-panel-L51m1i4h.js → resource-management-panel-BtLPW2b4.js} +1 -1
  16. package/dist/chunks/{resource-management-panel-B_bDGuq_.js → resource-management-panel-Bva2_0OU.js} +70 -70
  17. package/dist/chunks/use-create-flow-overlay-state-9X7GyUzl.js +21 -0
  18. package/dist/chunks/use-create-flow-overlay-state-Vyd5mSnf.js +1445 -0
  19. package/dist/chunks/{use-visual-utils-V6paZich.js → use-visual-utils-Jv4hWSLm.js} +1 -1
  20. package/dist/chunks/{use-visual-utils-Cp5KVbr6.js → use-visual-utils-OPk_1t4I.js} +1 -1
  21. package/dist/dashboard/index.cjs +1 -1
  22. package/dist/dashboard/index.js +5 -4
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +102 -99
  25. package/dist/shared/index.cjs +1 -1
  26. package/dist/shared/index.js +1 -1
  27. package/dist/style.css +1 -1
  28. package/dist/surfboard/index.cjs +1 -1
  29. package/dist/surfboard/index.js +5 -4
  30. package/dist/types/dashboard.d.ts +105 -0
  31. package/dist/types/index.cjs +1 -1
  32. package/dist/types/index.js +4 -3
  33. package/dist/types/main.d.ts +175 -1
  34. package/dist/types/shared.d.ts +89 -0
  35. package/dist/types/surfboard.d.ts +105 -0
  36. package/dist/types/types.d.ts +113 -0
  37. package/package.json +1 -1
  38. package/dist/chunks/dashboard-controls-51P6aUVB.js +0 -1847
  39. package/dist/chunks/dashboard-controls-BC3hDGwD.js +0 -47
  40. package/dist/chunks/edit-dashboard-visual-D1mwhPGF.js +0 -193
  41. package/dist/chunks/editor-action-buttons-B6ElCCo2.js +0 -412
  42. package/dist/chunks/editor-action-buttons-Dbs6eczj.js +0 -21
  43. package/dist/chunks/index-DAhkssOV.js +0 -1109
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +0 -1
  45. package/dist/chunks/notification-bell-DoIAAZqX.js +0 -6
  46. package/dist/chunks/notification-bell-cYCkxEbp.js +0 -839
@@ -1,412 +0,0 @@
1
- import { bL as D, U as d, bM as U, bN as te, bO as se, bP as re, bQ as le, bR as oe, u as M, ae as ne, bS as de, bT as ie, bU as ue, ab as ce, c as g, bV as pe, bW as me, M as q, B as x, s as be, H as F, N as K, J as j, bX as O, w as H, bY as X, X as G, x as C } from "./index-DpSxZvI0.js";
2
- import { jsx as b, jsxs as f, Fragment as T } from "react/jsx-runtime";
3
- import { u as ye, a as P } from "./use-visual-utils-Cp5KVbr6.js";
4
- import { useMemo as k, useState as R } from "react";
5
- /**
6
- * @license lucide-react v0.453.0 - ISC
7
- *
8
- * This source code is licensed under the ISC license.
9
- * See the LICENSE file in the root directory of this source tree.
10
- */
11
- const Ie = D("CircleX", [
12
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
13
- ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
14
- ["path", { d: "m9 9 6 6", key: "z0biqf" }]
15
- ]);
16
- /**
17
- * @license lucide-react v0.453.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */
22
- const he = D("Library", [
23
- ["path", { d: "m16 6 4 14", key: "ji33uf" }],
24
- ["path", { d: "M12 6v14", key: "1n7gus" }],
25
- ["path", { d: "M8 8v12", key: "1gg7y9" }],
26
- ["path", { d: "M4 4v16", key: "6qkkli" }]
27
- ]);
28
- /**
29
- * @license lucide-react v0.453.0 - ISC
30
- *
31
- * This source code is licensed under the ISC license.
32
- * See the LICENSE file in the root directory of this source tree.
33
- */
34
- const fe = D("Link2", [
35
- ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
36
- ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
37
- ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
38
- ]);
39
- /**
40
- * @license lucide-react v0.453.0 - ISC
41
- *
42
- * This source code is licensed under the ISC license.
43
- * See the LICENSE file in the root directory of this source tree.
44
- */
45
- const J = D("Save", [
46
- [
47
- "path",
48
- {
49
- d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
50
- key: "1c8476"
51
- }
52
- ],
53
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
54
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
55
- ]);
56
- function W() {
57
- var e, m;
58
- const t = d((p) => p.card), i = d((p) => p.frame), s = k(
59
- () => U(i, t),
60
- [i, t]
61
- ), { manifest: c } = te(
62
- ((e = s == null ? void 0 : s.customCardPreferences) == null ? void 0 : e.url) || ""
63
- ), a = k(
64
- () => {
65
- var p;
66
- return (p = c == null ? void 0 : c.visuals) == null ? void 0 : p.find(
67
- (u) => {
68
- var n;
69
- return u.name === ((n = s == null ? void 0 : s.customCardPreferences) == null ? void 0 : n.componentName);
70
- }
71
- );
72
- },
73
- [c, (m = s == null ? void 0 : s.customCardPreferences) == null ? void 0 : m.componentName]
74
- ), l = se(s, a), r = k(
75
- () => re({
76
- frame: i,
77
- configCard: s,
78
- isMultiInputVisual: l === "multiple"
79
- }),
80
- [i, s, l]
81
- ), o = k(() => {
82
- const p = r.findIndex(
83
- (u) => (u == null ? void 0 : u.id) === t.id
84
- );
85
- return p < 0 ? -1 : le(t, p);
86
- }, [r, t]);
87
- return k(() => !s || l !== "multiple" || o < 0 ? t.type : oe(
88
- t,
89
- o,
90
- a == null ? void 0 : a.slots
91
- ) ?? t.type, [s, l, o, t, a == null ? void 0 : a.slots]);
92
- }
93
- function xe({
94
- type: t,
95
- isLinked: i,
96
- className: s,
97
- showLabel: c = !1,
98
- showLocal: a = !1
99
- }) {
100
- const l = M((v) => v.selectedFrameId), r = ne((v) => v.selectedVisual), o = d((v) => v.frame);
101
- let e;
102
- if (t)
103
- e = t;
104
- else if (i !== void 0)
105
- e = i ? "linked" : "library";
106
- else if (!!!(o != null && o.visualId || r != null && r.id) && l)
107
- e = "local";
108
- else if (r && !l)
109
- e = "library";
110
- else if (o != null && o.visualId && l)
111
- e = "linked";
112
- else if (r != null && r.id && l)
113
- e = "library";
114
- else
115
- return null;
116
- if (e === "local" && !a)
117
- return null;
118
- const m = {
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
- 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
- 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
- }, p = {
123
- local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
124
- linked: "Linked to library: Changes made here update the library visual and all linked instances.",
125
- library: "Library visual: Share and reuse this visual across multiple dashboards."
126
- }, u = {
127
- local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
128
- linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
129
- library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
130
- }, n = {
131
- local: "fill-slate-50 dark:fill-slate-900",
132
- linked: "fill-purple-50 dark:fill-purple-950",
133
- library: "fill-blue-50 dark:fill-blue-950"
134
- }, y = {
135
- local: /* @__PURE__ */ b("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
136
- linked: /* @__PURE__ */ b(fe, { className: "h-3.5 w-3.5" }),
137
- library: /* @__PURE__ */ b(he, { className: "h-3.5 w-3.5" })
138
- }, S = {
139
- local: "Local",
140
- linked: "Linked",
141
- library: "Library"
142
- };
143
- return /* @__PURE__ */ b(de, { children: /* @__PURE__ */ f(ie, { delayDuration: 300, children: [
144
- /* @__PURE__ */ b(ue, { asChild: !0, children: /* @__PURE__ */ f(
145
- ce,
146
- {
147
- variant: "outline",
148
- className: g(
149
- "cursor-help select-none transition-all",
150
- m[e],
151
- s
152
- ),
153
- children: [
154
- y[e],
155
- c && /* @__PURE__ */ b("span", { className: "ml-1 text-xs font-medium leading-none", children: S[e] })
156
- ]
157
- }
158
- ) }),
159
- /* @__PURE__ */ f(
160
- pe,
161
- {
162
- side: "bottom",
163
- className: g("max-w-xs", u[e]),
164
- children: [
165
- /* @__PURE__ */ b(me, { className: n[e] }),
166
- /* @__PURE__ */ b("p", { children: p[e] })
167
- ]
168
- }
169
- )
170
- ] }) });
171
- }
172
- function ve(t, i) {
173
- return {
174
- ...t,
175
- sql: "",
176
- python: "",
177
- config: void 0,
178
- customCfg: "",
179
- preferences: {},
180
- interactionConfig: void 0,
181
- linkedInteractionTargetOverrides: void 0,
182
- customCardPreferences: i ? t.customCardPreferences : void 0,
183
- type: i ? t.type : "bar"
184
- };
185
- }
186
- function Ne({
187
- className: t,
188
- variant: i = "outline"
189
- }) {
190
- var o;
191
- const { setCardSql: s } = q();
192
- d((e) => e.frame);
193
- const c = d((e) => e.card);
194
- ye(
195
- ((o = c.customCardPreferences) == null ? void 0 : o.url) || ""
196
- ), d(
197
- (e) => e.selectedSchemaName
198
- ), d(
199
- (e) => e.selectedDatamodelId
200
- ), d(
201
- (e) => e.selectedDatabaseName
202
- ), d((e) => e.selectedTableName), d(
203
- (e) => e.selectedConnectionId
204
- ), d((e) => e.isShowingVisual), c.sql;
205
- const a = d((e) => e.onSave), { getUpdatedFrame: l } = P();
206
- function r() {
207
- const e = l();
208
- a == null || a(e);
209
- }
210
- return /* @__PURE__ */ f(
211
- x,
212
- {
213
- onClick: r,
214
- className: g("h-8", t),
215
- size: "sm",
216
- variant: i,
217
- children: [
218
- /* @__PURE__ */ b(be, { className: "mr-2 size-4 font-bold" }),
219
- "Accept"
220
- ]
221
- }
222
- );
223
- }
224
- function qe({
225
- className: t,
226
- variant: i = "default"
227
- }) {
228
- const s = F(), [c, a] = R(!1), l = M(
229
- (n) => n.actions.setIsDashboardPanelOpen
230
- ), { setIsVisualEditing: r } = K(), { getUpdatedFrame: o } = P(), e = j(), m = d((n) => n.frame), p = O();
231
- return /* @__PURE__ */ f(
232
- x,
233
- {
234
- onClick: () => {
235
- const n = o(), y = (m == null ? void 0 : m.visualId) || (e == null ? void 0 : e.id);
236
- if (!y) {
237
- C.error("No visual to save");
238
- return;
239
- }
240
- a(!0), p.mutate(
241
- {
242
- visualId: y,
243
- data: {
244
- frameObject: n
245
- }
246
- },
247
- {
248
- onSuccess: () => {
249
- a(!1), l(!0), C.success("Visual updated successfully"), s.invalidateQueries({
250
- queryKey: ["resource-by-id", "visual", y],
251
- exact: !0
252
- });
253
- },
254
- onError: () => {
255
- a(!1), C.error("Failed to update visual");
256
- }
257
- }
258
- );
259
- },
260
- className: g("h-8", t),
261
- size: "sm",
262
- variant: i,
263
- children: [
264
- c && /* @__PURE__ */ f(T, { children: [
265
- /* @__PURE__ */ b(H, { className: "mr-2 size-4 animate-spin font-bold" }),
266
- " Saving"
267
- ] }),
268
- !c && /* @__PURE__ */ f(T, { children: [
269
- /* @__PURE__ */ b(J, { className: "mr-2 size-4 font-bold" }),
270
- "Save to Library"
271
- ] })
272
- ]
273
- }
274
- );
275
- }
276
- function Te({
277
- className: t
278
- }) {
279
- const i = F(), [s, c] = R(!1), a = j(), l = d((n) => n.frame), r = M((n) => n.selectedSheetId), { updateFrame: o, setIsVisualEditing: e } = K(), { getUpdatedFrame: m } = P(), p = O();
280
- return /* @__PURE__ */ b(
281
- x,
282
- {
283
- onClick: async () => {
284
- if (!r) {
285
- C.error("No sheet selected");
286
- return;
287
- }
288
- const n = (l == null ? void 0 : l.visualId) || (a == null ? void 0 : a.id);
289
- if (!n) {
290
- C.error("No visual to update");
291
- return;
292
- }
293
- c(!0);
294
- try {
295
- const y = m();
296
- await p.mutateAsync({
297
- visualId: n,
298
- data: {
299
- frameObject: y
300
- }
301
- });
302
- const S = {
303
- ...y,
304
- visualId: n
305
- // Keep the link to library visual
306
- };
307
- o(r, S), i.invalidateQueries({ queryKey: ["visuals"] }), i.invalidateQueries({ queryKey: ["visual", n] }), C.success("Saved to library and applied locally"), setTimeout(() => {
308
- e(!1);
309
- }, 300);
310
- } catch (y) {
311
- console.error("Failed to save and apply:", y), C.error("Failed to save and apply changes");
312
- } finally {
313
- c(!1);
314
- }
315
- },
316
- className: g("h-8", t),
317
- size: "sm",
318
- variant: "default",
319
- disabled: s,
320
- children: s ? /* @__PURE__ */ f(T, { children: [
321
- /* @__PURE__ */ b(H, { className: "mr-2 size-4 animate-spin font-bold" }),
322
- " Saving..."
323
- ] }) : /* @__PURE__ */ f(T, { children: [
324
- /* @__PURE__ */ b(J, { className: "mr-2 size-4 font-bold" }),
325
- "Save & Apply"
326
- ] })
327
- }
328
- );
329
- }
330
- function De({ className: t }) {
331
- const { setTempQueryData: i, setSqlGen: s } = q(), c = F(), a = d((u) => u.tempQueryData), l = d((u) => u.onClose), r = d((u) => u.card), o = W(), e = k(() => o !== r.type ? { ...r, type: o } : r, [r, o]), { queryKey: m } = X(e);
332
- function p() {
333
- if (a) {
334
- const { queryKey: u, queryData: n } = a;
335
- u && n && c.setQueryData(u, n);
336
- }
337
- s({}), l == null || l();
338
- }
339
- return /* @__PURE__ */ f(
340
- x,
341
- {
342
- onClick: p,
343
- className: g("h-8", t),
344
- size: "sm",
345
- variant: "outline",
346
- children: [
347
- /* @__PURE__ */ b(G, { className: "mr-2 size-4" }),
348
- "Close"
349
- ]
350
- }
351
- );
352
- }
353
- function Fe({
354
- label: t = "Clear",
355
- variant: i = "secondary",
356
- className: s
357
- } = {}) {
358
- const { setTempQueryData: c } = q(), a = F(), l = d((I) => I.tempQueryData), r = d((I) => I.card), o = W(), e = k(() => o !== r.type ? { ...r, type: o } : r, [r, o]), { queryKey: m } = X(e), {
359
- setCardSql: p,
360
- setSqlGen: u,
361
- setCardPython: n,
362
- setCardCustomCfg: y,
363
- setCardPreferences: S,
364
- clearQueryConfig: v,
365
- setCardConfig: Y,
366
- setCardType: Z,
367
- setFrame: _,
368
- setCard: $,
369
- setActiveTabCardId: ee
370
- } = q();
371
- function ae() {
372
- var Q, w, L, E;
373
- const I = a.getQueryData(m);
374
- l != null && l.queryData || c({
375
- queryKey: m,
376
- queryData: I
377
- }), a.setQueryData(m, null), a.removeQueries({ queryKey: m, exact: !0 }), p(""), u({}), v(), Y(void 0), n(""), y(""), S({});
378
- const V = d.getState().frame, z = d.getState().card, h = U(V, z), A = ((Q = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : Q.visualType) === "multiple" || !!((w = h == null ? void 0 : h.customCardPreferences) != null && w.dataInputCardIds) || (((L = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : L.minInputs) || 0) > 1 || (((E = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : E.maxInputs) || 0) > 1, N = ve(z, A);
379
- _({
380
- ...V,
381
- cards: V.cards.map(
382
- (B) => B.id === N.id ? N : B
383
- )
384
- }), ee(N.id), $(N), A || Z("bar");
385
- }
386
- return /* @__PURE__ */ f(
387
- x,
388
- {
389
- onClick: ae,
390
- className: g("h-8", s),
391
- size: "sm",
392
- variant: i,
393
- children: [
394
- /* @__PURE__ */ b(G, { className: "mr-2 size-3.5" }),
395
- t
396
- ]
397
- }
398
- );
399
- }
400
- export {
401
- Ie as C,
402
- Ne as E,
403
- he as L,
404
- J as S,
405
- xe as V,
406
- qe as a,
407
- Te as b,
408
- fe as c,
409
- De as d,
410
- Fe as e,
411
- W as u
412
- };
@@ -1,21 +0,0 @@
1
- "use strict";const e=require("./index-DAhkssOV.js"),r=require("react/jsx-runtime"),x=require("./use-visual-utils-V6paZich.js"),f=require("react");/**
2
- * @license lucide-react v0.453.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const U=e.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
7
- * @license lucide-react v0.453.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const F=e.createLucideIcon("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
12
- * @license lucide-react v0.453.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const A=e.createLucideIcon("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
17
- * @license lucide-react v0.453.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const E=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function I(){var t,y;const a=e.useEditorStore(m=>m.card),c=e.useEditorStore(m=>m.frame),o=f.useMemo(()=>e.findCustomVisualConfigCard(c,a),[c,a]),{manifest:p}=e.useCustomVisual(((t=o==null?void 0:o.customCardPreferences)==null?void 0:t.url)||""),s=f.useMemo(()=>{var m;return(m=p==null?void 0:p.visuals)==null?void 0:m.find(d=>{var u;return d.name===((u=o==null?void 0:o.customCardPreferences)==null?void 0:u.componentName)})},[p,(y=o==null?void 0:o.customCardPreferences)==null?void 0:y.componentName]),n=e.resolveMultiInputType(o,s),l=f.useMemo(()=>e.getCustomVisualInputCards({frame:c,configCard:o,isMultiInputVisual:n==="multiple"}),[c,o,n]),i=f.useMemo(()=>{const m=l.findIndex(d=>(d==null?void 0:d.id)===a.id);return m<0?-1:e.getSlotIndexForCard(a,m)},[l,a]);return f.useMemo(()=>!o||n!=="multiple"||i<0?a.type:e.getEffectiveCardTypeForSlot(a,i,s==null?void 0:s.slots)??a.type,[o,n,i,a,s==null?void 0:s.slots])}function K({type:a,isLinked:c,className:o,showLabel:p=!1,showLocal:s=!1}){const n=e.useDashboardStore(v=>v.selectedFrameId),l=e.useManagementStore(v=>v.selectedVisual),i=e.useEditorStore(v=>v.frame);let t;if(a)t=a;else if(c!==void 0)t=c?"linked":"library";else if(!!!(i!=null&&i.visualId||l!=null&&l.id)&&n)t="local";else if(l&&!n)t="library";else if(i!=null&&i.visualId&&n)t="linked";else if(l!=null&&l.id&&n)t="library";else return null;if(t==="local"&&!s)return null;const y={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",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",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"},m={local:"Local to this dashboard: Changes made here only affect this dashboard copy.",linked:"Linked to library: Changes made here update the library visual and all linked instances.",library:"Library visual: Share and reuse this visual across multiple dashboards."},d={local:"border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",linked:"border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",library:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"},u={local:"fill-slate-50 dark:fill-slate-900",linked:"fill-purple-50 dark:fill-purple-950",library:"fill-blue-50 dark:fill-blue-950"},b={local:r.jsx("span",{className:"h-2 w-2 rounded-full bg-current/70"}),linked:r.jsx(A,{className:"h-3.5 w-3.5"}),library:r.jsx(F,{className:"h-3.5 w-3.5"})},S={local:"Local",linked:"Linked",library:"Library"};return r.jsx(e.TooltipProvider,{children:r.jsxs(e.Tooltip,{delayDuration:300,children:[r.jsx(e.TooltipTrigger,{asChild:!0,children:r.jsxs(e.Badge,{variant:"outline",className:e.cn("cursor-help select-none transition-all",y[t],o),children:[b[t],p&&r.jsx("span",{className:"ml-1 text-xs font-medium leading-none",children:S[t]})]})}),r.jsxs(e.TooltipContent,{side:"bottom",className:e.cn("max-w-xs",d[t]),children:[r.jsx(e.TooltipArrow,{className:u[t]}),r.jsx("p",{children:m[t]})]})]})})}function O(a,c){return{...a,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,customCardPreferences:c?a.customCardPreferences:void 0,type:c?a.type:"bar"}}function X({className:a,variant:c="outline"}){var i;const{setCardSql:o}=e.useEditorActions();e.useEditorStore(t=>t.frame);const p=e.useEditorStore(t=>t.card);x.useRemoteChartStore(((i=p.customCardPreferences)==null?void 0:i.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),p.sql;const s=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:n}=x.useVisualUtils();function l(){const t=n();s==null||s(t)}return r.jsxs(e.Button,{onClick:l,className:e.cn("h-8",a),size:"sm",variant:c,children:[r.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function H({className:a,variant:c="default"}){const o=e.useQueryClient(),[p,s]=f.useState(!1),n=e.useDashboardStore(u=>u.actions.setIsDashboardPanelOpen),{setIsVisualEditing:l}=e.useDashboardActions(),{getUpdatedFrame:i}=x.useVisualUtils(),t=e.useSelectedVisual(),y=e.useEditorStore(u=>u.frame),m=e.useUpdateVisualMutation(),d=()=>{const u=i(),b=(y==null?void 0:y.visualId)||(t==null?void 0:t.id);if(!b){e.ue.error("No visual to save");return}s(!0),m.mutate({visualId:b,data:{frameObject:u}},{onSuccess:()=>{s(!1),n(!0),e.ue.success("Visual updated successfully"),o.invalidateQueries({queryKey:["resource-by-id","visual",b],exact:!0})},onError:()=>{s(!1),e.ue.error("Failed to update visual")}})};return r.jsxs(e.Button,{onClick:d,className:e.cn("h-8",a),size:"sm",variant:c,children:[p&&r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!p&&r.jsxs(r.Fragment,{children:[r.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function R({className:a}){const c=e.useQueryClient(),[o,p]=f.useState(!1),s=e.useSelectedVisual(),n=e.useEditorStore(u=>u.frame),l=e.useDashboardStore(u=>u.selectedSheetId),{updateFrame:i,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:y}=x.useVisualUtils(),m=e.useUpdateVisualMutation(),d=async()=>{if(!l){e.ue.error("No sheet selected");return}const u=(n==null?void 0:n.visualId)||(s==null?void 0:s.id);if(!u){e.ue.error("No visual to update");return}p(!0);try{const b=y();await m.mutateAsync({visualId:u,data:{frameObject:b}});const S={...b,visualId:u};i(l,S),c.invalidateQueries({queryKey:["visuals"]}),c.invalidateQueries({queryKey:["visual",u]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(b){console.error("Failed to save and apply:",b),e.ue.error("Failed to save and apply changes")}finally{p(!1)}};return r.jsx(e.Button,{onClick:d,className:e.cn("h-8",a),size:"sm",variant:"default",disabled:o,children:o?r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function G({className:a}){const{setTempQueryData:c,setSqlGen:o}=e.useEditorActions(),p=e.useQueryClient(),s=e.useEditorStore(d=>d.tempQueryData),n=e.useEditorStore(d=>d.onClose),l=e.useEditorStore(d=>d.card),i=I(),t=f.useMemo(()=>i!==l.type?{...l,type:i}:l,[l,i]),{queryKey:y}=e.useDashboardCardQuery(t);function m(){if(s){const{queryKey:d,queryData:u}=s;d&&u&&p.setQueryData(d,u)}o({}),n==null||n()}return r.jsxs(e.Button,{onClick:m,className:e.cn("h-8",a),size:"sm",variant:"outline",children:[r.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function J({label:a="Clear",variant:c="secondary",className:o}={}){const{setTempQueryData:p}=e.useEditorActions(),s=e.useQueryClient(),n=e.useEditorStore(k=>k.tempQueryData),l=e.useEditorStore(k=>k.card),i=I(),t=f.useMemo(()=>i!==l.type?{...l,type:i}:l,[l,i]),{queryKey:y}=e.useDashboardCardQuery(t),{setCardSql:m,setSqlGen:d,setCardPython:u,setCardCustomCfg:b,setCardPreferences:S,clearQueryConfig:v,setCardConfig:B,setCardType:L,setFrame:Q,setCard:z,setActiveTabCardId:P}=e.useEditorActions();function w(){var N,V,T,D;const k=s.getQueryData(y);n!=null&&n.queryData||p({queryKey:y,queryData:k}),s.setQueryData(y,null),s.removeQueries({queryKey:y,exact:!0}),m(""),d({}),v(),B(void 0),u(""),b(""),S({});const g=e.useEditorStore.getState().frame,j=e.useEditorStore.getState().card,h=e.findCustomVisualConfigCard(g,j),q=((N=h==null?void 0:h.customCardPreferences)==null?void 0:N.visualType)==="multiple"||!!((V=h==null?void 0:h.customCardPreferences)!=null&&V.dataInputCardIds)||(((T=h==null?void 0:h.customCardPreferences)==null?void 0:T.minInputs)||0)>1||(((D=h==null?void 0:h.customCardPreferences)==null?void 0:D.maxInputs)||0)>1,C=O(j,q);Q({...g,cards:g.cards.map(M=>M.id===C.id?C:M)}),P(C.id),z(C),q||L("bar")}return r.jsxs(e.Button,{onClick:w,className:e.cn("h-8",o),size:"sm",variant:c,children:[r.jsx(e.X,{className:"mr-2 size-3.5"}),a]})}exports.CircleX=U;exports.EditorAcceptButton=X;exports.EditorCancelButton=G;exports.EditorClearButton=J;exports.Library=F;exports.Link2=A;exports.Save=E;exports.VisualBadge=K;exports.VisualSaveAndApplyButton=R;exports.VisualSaveButton=H;exports.useEffectiveEditorCardType=I;