react-semaphor 0.1.207 → 0.1.209

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 (37) hide show
  1. package/dist/chunks/{dashboard-controls-HlEsqiRq.js → dashboard-controls-BNTI4r0_.js} +581 -553
  2. package/dist/chunks/{dashboard-controls-CwMm9_ki.js → dashboard-controls-Dcpx9_an.js} +8 -8
  3. package/dist/chunks/{dashboard-json-DoYcT7tI.js → dashboard-json-BjOqpGbW.js} +1 -1
  4. package/dist/chunks/{dashboard-json-CI8wIOzY.js → dashboard-json-kIoBtmBF.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-ioe7ZyFE.js → dashboard-summary-settings-dialog-BoX18wiA.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-eQcHYcAI.js → dashboard-summary-settings-dialog-CO1SwHHD.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-Cl_qfIV_.js → edit-dashboard-visual-B9HuGExj.js} +2 -2
  8. package/dist/chunks/{edit-dashboard-visual-BotbTTiL.js → edit-dashboard-visual-DG4VLoJF.js} +1108 -1122
  9. package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +11 -0
  10. package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +345 -0
  11. package/dist/chunks/{index-CqOQuBxB.js → index-D0TdW88i.js} +24716 -24254
  12. package/dist/chunks/index-DSA80lEg.js +1104 -0
  13. package/dist/chunks/{notification-bell-BSBRPw38.js → notification-bell-D2V1-ARa.js} +1 -1
  14. package/dist/chunks/{notification-bell-BI-XywDI.js → notification-bell-DFiRaeJQ.js} +52 -52
  15. package/dist/chunks/resource-management-panel-BhiWNPcw.js +6 -0
  16. package/dist/chunks/resource-management-panel-DS_WEv1x.js +902 -0
  17. package/dist/chunks/{use-role-aware-display-preferences-BWghO18e.js → use-role-aware-display-preferences-D8j5_cnK.js} +1 -1
  18. package/dist/chunks/{use-role-aware-display-preferences-C-m9KEuJ.js → use-role-aware-display-preferences-DfihB5pN.js} +1 -1
  19. package/dist/chunks/{use-visual-utils-BbVM0bck.js → use-visual-utils-BfLXO_vi.js} +34 -34
  20. package/dist/chunks/{use-visual-utils-DHmGIepC.js → use-visual-utils-CzcVz3zB.js} +1 -1
  21. package/dist/dashboard/index.cjs +1 -1
  22. package/dist/dashboard/index.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +5 -5
  25. package/dist/style.css +1 -1
  26. package/dist/surfboard/index.cjs +1 -1
  27. package/dist/surfboard/index.js +2 -2
  28. package/dist/types/dashboard.d.ts +12 -1
  29. package/dist/types/main.d.ts +13 -1
  30. package/dist/types/surfboard.d.ts +12 -1
  31. package/dist/types/types.d.ts +12 -1
  32. package/package.json +1 -1
  33. package/dist/chunks/editor-action-buttons-B0-mScSZ.js +0 -340
  34. package/dist/chunks/editor-action-buttons-CcXUQDy4.js +0 -11
  35. package/dist/chunks/index-plgMsXq1.js +0 -1104
  36. package/dist/chunks/resource-management-panel-D0q51oXw.js +0 -6
  37. package/dist/chunks/resource-management-panel-Z8x52dx2.js +0 -914
@@ -0,0 +1,11 @@
1
+ "use strict";const e=require("./index-DSA80lEg.js"),r=require("react/jsx-runtime"),h=require("./use-visual-utils-CzcVz3zB.js"),v=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 k=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 x=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 g(){var t,y;const o=e.useEditorStore(p=>p.card),u=e.useEditorStore(p=>p.frame),s=v.useMemo(()=>e.findCustomVisualConfigCard(u,o),[u,o]),{manifest:n}=e.useCustomVisual(((t=s==null?void 0:s.customCardPreferences)==null?void 0:t.url)||""),a=v.useMemo(()=>{var p;return(p=n==null?void 0:n.visuals)==null?void 0:p.find(l=>{var d;return l.name===((d=s==null?void 0:s.customCardPreferences)==null?void 0:d.componentName)})},[n,(y=s==null?void 0:s.customCardPreferences)==null?void 0:y.componentName]),i=e.resolveMultiInputType(s,a),c=v.useMemo(()=>e.getCustomVisualInputCards({frame:u,configCard:s,isMultiInputVisual:i==="multiple"}),[u,s,i]),m=v.useMemo(()=>{const p=c.findIndex(l=>(l==null?void 0:l.id)===o.id);return p<0?-1:e.getSlotIndexForCard(o,p)},[c,o]);return v.useMemo(()=>!s||i!=="multiple"||m<0?o.type:e.getEffectiveCardTypeForSlot(o,m,a==null?void 0:a.slots)??o.type,[s,i,m,o,a==null?void 0:a.slots])}function P(o,u){return{...o,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,customCardPreferences:u?o.customCardPreferences:void 0,type:u?o.type:"bar"}}function U({className:o,variant:u="outline"}){var m;const{setCardSql:s}=e.useEditorActions();e.useEditorStore(t=>t.frame);const n=e.useEditorStore(t=>t.card);h.useRemoteChartStore(((m=n.customCardPreferences)==null?void 0:m.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),n.sql;const a=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:i}=h.useVisualUtils();function c(){const t=i();a==null||a(t)}return r.jsxs(e.Button,{onClick:c,className:e.cn("h-8",o),size:"sm",variant:u,children:[r.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function L({className:o,variant:u="default"}){const s=e.useQueryClient(),[n,a]=v.useState(!1),i=e.useDashboardStore(d=>d.actions.setIsDashboardPanelOpen),{setIsVisualEditing:c}=e.useDashboardActions(),{getUpdatedFrame:m}=h.useVisualUtils(),t=e.useSelectedVisual(),y=e.useEditorStore(d=>d.frame),p=e.useUpdateVisualMutation(),l=()=>{const d=m(),S=(y==null?void 0:y.visualId)||(t==null?void 0:t.id);if(!S){e.ue.error("No visual to save");return}a(!0),p.mutate({visualId:S,data:{frameObject:d}},{onSuccess:()=>{a(!1),i(!0),e.ue.success("Visual updated successfully"),s.invalidateQueries({queryKey:["resource-by-id","visual",S],exact:!0})},onError:()=>{a(!1),e.ue.error("Failed to update visual")}})};return r.jsxs(e.Button,{onClick:l,className:e.cn("h-8",o),size:"sm",variant:u,children:[n&&r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!n&&r.jsxs(r.Fragment,{children:[r.jsx(x,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function K({className:o}){const u=e.useQueryClient(),[s,n]=v.useState(!1),a=e.useSelectedVisual(),i=e.useEditorStore(d=>d.frame),c=e.useDashboardStore(d=>d.selectedSheetId),{updateFrame:m,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:y}=h.useVisualUtils(),p=e.useUpdateVisualMutation(),l=async()=>{if(!c){e.ue.error("No sheet selected");return}const d=(i==null?void 0:i.visualId)||(a==null?void 0:a.id);if(!d){e.ue.error("No visual to update");return}n(!0);try{const S=y();await p.mutateAsync({visualId:d,data:{frameObject:S}});const I={...S,visualId:d};m(c,I),u.invalidateQueries({queryKey:["visuals"]}),u.invalidateQueries({queryKey:["visual",d]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(S){console.error("Failed to save and apply:",S),e.ue.error("Failed to save and apply changes")}finally{n(!1)}};return r.jsx(e.Button,{onClick:l,className:e.cn("h-8",o),size:"sm",variant:"default",disabled:s,children:s?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(x,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function O({className:o}){const{getUpdatedFrame:u}=h.useVisualUtils();e.useEditorStore(t=>t.frame);const s=e.useDashboardStore(t=>t.selectedSheetId),{updateFrame:n,setIsVisualEditing:a}=e.useDashboardActions(),[i,c]=v.useState(!1),m=()=>{if(!s){e.ue.error("No sheet selected");return}c(!0);const y={...u(),visualId:void 0};n(s,y),setTimeout(()=>{c(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),a(!1)},300)};return r.jsxs(e.Button,{onClick:m,className:e.cn("h-8",o),size:"sm",variant:"outline",children:[i&&r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!i&&r.jsxs(r.Fragment,{children:[r.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function X({className:o}){const{setTempQueryData:u,setSqlGen:s}=e.useEditorActions(),n=e.useQueryClient(),a=e.useEditorStore(l=>l.tempQueryData),i=e.useEditorStore(l=>l.onClose),c=e.useEditorStore(l=>l.card),m=g(),t=v.useMemo(()=>m!==c.type?{...c,type:m}:c,[c,m]),{queryKey:y}=e.useDashboardCardQuery(t);function p(){if(a){const{queryKey:l,queryData:d}=a;l&&d&&n.setQueryData(l,d)}s({}),i==null||i()}return r.jsxs(e.Button,{onClick:p,className:e.cn("h-8",o),size:"sm",variant:"outline",children:[r.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function w(){const{setTempQueryData:o}=e.useEditorActions(),u=e.useQueryClient();e.useEditorStore(C=>C.isDevMode);const s=e.useEditorStore(C=>C.tempQueryData),n=e.useEditorStore(C=>C.card),a=g(),i=v.useMemo(()=>a!==n.type?{...n,type:a}:n,[n,a]),{queryKey:c}=e.useDashboardCardQuery(i),{setCardSql:m,setSqlGen:t,setCardPython:y,setCardCustomCfg:p,setCardPreferences:l,updateDataSource:d,clearQueryConfig:S,setCardConfig:I,setCardType:z,setFrame:B,setCard:Q,setActiveTabCardId:M}=e.useEditorActions();function T(){var A,F,j,D;const C=u.getQueryData(c);s!=null&&s.queryData||o({queryKey:c,queryData:C}),u.setQueryData(c,null),u.removeQueries({queryKey:c,exact:!0}),m(""),t({}),S(),I(void 0),y(""),p(""),l({});const b=e.useEditorStore.getState().frame,V=e.useEditorStore.getState().card,f=e.findCustomVisualConfigCard(b,V),q=((A=f==null?void 0:f.customCardPreferences)==null?void 0:A.visualType)==="multiple"||!!((F=f==null?void 0:f.customCardPreferences)!=null&&F.dataInputCardIds)||(((j=f==null?void 0:f.customCardPreferences)==null?void 0:j.minInputs)||0)>1||(((D=f==null?void 0:f.customCardPreferences)==null?void 0:D.maxInputs)||0)>1,E=P(V,q);B({...b,cards:b.cards.map(N=>N.id===E.id?E:N)}),M(E.id),Q(E),q||z("bar")}return r.jsxs(e.Button,{onClick:T,className:"h-8",size:"sm",variant:"secondary",children:[r.jsx(e.X,{className:"mr-2 size-3.5"}),"Clear"]})}exports.CircleX=k;exports.EditorAcceptButton=U;exports.EditorCancelButton=X;exports.EditorClearButton=w;exports.Save=x;exports.VisualApplyLocalButton=O;exports.VisualSaveAndApplyButton=K;exports.VisualSaveButton=L;exports.useEffectiveEditorCardType=g;
@@ -0,0 +1,345 @@
1
+ import { bP as O, bA as n, bQ as j, bR as ae, bS as te, bT as se, bU as re, bV as ne, by as A, B as N, E as X, c as g, u as T, bs as k, H as E, bJ as F, bK as w, bW as H, bX as G, X as R, I as C } from "./index-D0TdW88i.js";
2
+ import { jsxs as f, jsx as h, Fragment as I } from "react/jsx-runtime";
3
+ import { u as oe, a as V } from "./use-visual-utils-BfLXO_vi.js";
4
+ import { useMemo as S, useState as P } 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 me = O("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 J = O("Save", [
23
+ [
24
+ "path",
25
+ {
26
+ 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",
27
+ key: "1c8476"
28
+ }
29
+ ],
30
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
31
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
32
+ ]);
33
+ function W() {
34
+ var e, p;
35
+ const s = n((m) => m.card), o = n((m) => m.frame), a = S(
36
+ () => j(o, s),
37
+ [o, s]
38
+ ), { manifest: r } = ae(
39
+ ((e = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : e.url) || ""
40
+ ), t = S(
41
+ () => {
42
+ var m;
43
+ return (m = r == null ? void 0 : r.visuals) == null ? void 0 : m.find(
44
+ (d) => {
45
+ var i;
46
+ return d.name === ((i = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : i.componentName);
47
+ }
48
+ );
49
+ },
50
+ [r, (p = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : p.componentName]
51
+ ), c = te(a, t), l = S(
52
+ () => se({
53
+ frame: o,
54
+ configCard: a,
55
+ isMultiInputVisual: c === "multiple"
56
+ }),
57
+ [o, a, c]
58
+ ), u = S(() => {
59
+ const m = l.findIndex(
60
+ (d) => (d == null ? void 0 : d.id) === s.id
61
+ );
62
+ return m < 0 ? -1 : re(s, m);
63
+ }, [l, s]);
64
+ return S(() => !a || c !== "multiple" || u < 0 ? s.type : ne(
65
+ s,
66
+ u,
67
+ t == null ? void 0 : t.slots
68
+ ) ?? s.type, [a, c, u, s, t == null ? void 0 : t.slots]);
69
+ }
70
+ function ce(s, o) {
71
+ return {
72
+ ...s,
73
+ sql: "",
74
+ python: "",
75
+ config: void 0,
76
+ customCfg: "",
77
+ preferences: {},
78
+ interactionConfig: void 0,
79
+ linkedInteractionTargetOverrides: void 0,
80
+ customCardPreferences: o ? s.customCardPreferences : void 0,
81
+ type: o ? s.type : "bar"
82
+ };
83
+ }
84
+ function pe({
85
+ className: s,
86
+ variant: o = "outline"
87
+ }) {
88
+ var u;
89
+ const { setCardSql: a } = A();
90
+ n((e) => e.frame);
91
+ const r = n((e) => e.card);
92
+ oe(
93
+ ((u = r.customCardPreferences) == null ? void 0 : u.url) || ""
94
+ ), n(
95
+ (e) => e.selectedSchemaName
96
+ ), n(
97
+ (e) => e.selectedDatamodelId
98
+ ), n(
99
+ (e) => e.selectedDatabaseName
100
+ ), n((e) => e.selectedTableName), n(
101
+ (e) => e.selectedConnectionId
102
+ ), n((e) => e.isShowingVisual), r.sql;
103
+ const t = n((e) => e.onSave), { getUpdatedFrame: c } = V();
104
+ function l() {
105
+ const e = c();
106
+ t == null || t(e);
107
+ }
108
+ return /* @__PURE__ */ f(
109
+ N,
110
+ {
111
+ onClick: l,
112
+ className: g("h-8", s),
113
+ size: "sm",
114
+ variant: o,
115
+ children: [
116
+ /* @__PURE__ */ h(X, { className: "mr-2 size-4 font-bold" }),
117
+ "Accept"
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ function ye({
123
+ className: s,
124
+ variant: o = "default"
125
+ }) {
126
+ const a = F(), [r, t] = P(!1), c = T(
127
+ (i) => i.actions.setIsDashboardPanelOpen
128
+ ), { setIsVisualEditing: l } = k(), { getUpdatedFrame: u } = V(), e = w(), p = n((i) => i.frame), m = H();
129
+ return /* @__PURE__ */ f(
130
+ N,
131
+ {
132
+ onClick: () => {
133
+ const i = u(), v = (p == null ? void 0 : p.visualId) || (e == null ? void 0 : e.id);
134
+ if (!v) {
135
+ C.error("No visual to save");
136
+ return;
137
+ }
138
+ t(!0), m.mutate(
139
+ {
140
+ visualId: v,
141
+ data: {
142
+ frameObject: i
143
+ }
144
+ },
145
+ {
146
+ onSuccess: () => {
147
+ t(!1), c(!0), C.success("Visual updated successfully"), a.invalidateQueries({
148
+ queryKey: ["resource-by-id", "visual", v],
149
+ exact: !0
150
+ });
151
+ },
152
+ onError: () => {
153
+ t(!1), C.error("Failed to update visual");
154
+ }
155
+ }
156
+ );
157
+ },
158
+ className: g("h-8", s),
159
+ size: "sm",
160
+ variant: o,
161
+ children: [
162
+ r && /* @__PURE__ */ f(I, { children: [
163
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
164
+ " Saving"
165
+ ] }),
166
+ !r && /* @__PURE__ */ f(I, { children: [
167
+ /* @__PURE__ */ h(J, { className: "mr-2 size-4 font-bold" }),
168
+ "Save to Library"
169
+ ] })
170
+ ]
171
+ }
172
+ );
173
+ }
174
+ function fe({
175
+ className: s
176
+ }) {
177
+ const o = F(), [a, r] = P(!1), t = w(), c = n((i) => i.frame), l = T((i) => i.selectedSheetId), { updateFrame: u, setIsVisualEditing: e } = k(), { getUpdatedFrame: p } = V(), m = H();
178
+ return /* @__PURE__ */ h(
179
+ N,
180
+ {
181
+ onClick: async () => {
182
+ if (!l) {
183
+ C.error("No sheet selected");
184
+ return;
185
+ }
186
+ const i = (c == null ? void 0 : c.visualId) || (t == null ? void 0 : t.id);
187
+ if (!i) {
188
+ C.error("No visual to update");
189
+ return;
190
+ }
191
+ r(!0);
192
+ try {
193
+ const v = p();
194
+ await m.mutateAsync({
195
+ visualId: i,
196
+ data: {
197
+ frameObject: v
198
+ }
199
+ });
200
+ const D = {
201
+ ...v,
202
+ visualId: i
203
+ // Keep the link to library visual
204
+ };
205
+ u(l, D), o.invalidateQueries({ queryKey: ["visuals"] }), o.invalidateQueries({ queryKey: ["visual", i] }), C.success("Saved to library and applied locally"), setTimeout(() => {
206
+ e(!1);
207
+ }, 300);
208
+ } catch (v) {
209
+ console.error("Failed to save and apply:", v), C.error("Failed to save and apply changes");
210
+ } finally {
211
+ r(!1);
212
+ }
213
+ },
214
+ className: g("h-8", s),
215
+ size: "sm",
216
+ variant: "default",
217
+ disabled: a,
218
+ children: a ? /* @__PURE__ */ f(I, { children: [
219
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
220
+ " Saving..."
221
+ ] }) : /* @__PURE__ */ f(I, { children: [
222
+ /* @__PURE__ */ h(J, { className: "mr-2 size-4 font-bold" }),
223
+ "Save & Apply"
224
+ ] })
225
+ }
226
+ );
227
+ }
228
+ function ve({ className: s }) {
229
+ const { getUpdatedFrame: o } = V();
230
+ n((e) => e.frame);
231
+ const a = T((e) => e.selectedSheetId), { updateFrame: r, setIsVisualEditing: t } = k(), [c, l] = P(!1);
232
+ return /* @__PURE__ */ f(
233
+ N,
234
+ {
235
+ onClick: () => {
236
+ if (!a) {
237
+ C.error("No sheet selected");
238
+ return;
239
+ }
240
+ l(!0);
241
+ const p = {
242
+ ...o(),
243
+ visualId: void 0
244
+ // Remove the link to library visual
245
+ };
246
+ r(a, p), setTimeout(() => {
247
+ l(!1), C.success("Changes applied. Visual is now local to this dashboard"), t(!1);
248
+ }, 300);
249
+ },
250
+ className: g("h-8", s),
251
+ size: "sm",
252
+ variant: "outline",
253
+ children: [
254
+ c && /* @__PURE__ */ f(I, { children: [
255
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
256
+ " Applying"
257
+ ] }),
258
+ !c && /* @__PURE__ */ f(I, { children: [
259
+ /* @__PURE__ */ h(X, { className: "mr-2 size-4 font-bold" }),
260
+ "Apply Locally"
261
+ ] })
262
+ ]
263
+ }
264
+ );
265
+ }
266
+ function he({ className: s }) {
267
+ const { setTempQueryData: o, setSqlGen: a } = A(), r = F(), t = n((d) => d.tempQueryData), c = n((d) => d.onClose), l = n((d) => d.card), u = W(), e = S(() => u !== l.type ? { ...l, type: u } : l, [l, u]), { queryKey: p } = G(e);
268
+ function m() {
269
+ if (t) {
270
+ const { queryKey: d, queryData: i } = t;
271
+ d && i && r.setQueryData(d, i);
272
+ }
273
+ a({}), c == null || c();
274
+ }
275
+ return /* @__PURE__ */ f(
276
+ N,
277
+ {
278
+ onClick: m,
279
+ className: g("h-8", s),
280
+ size: "sm",
281
+ variant: "outline",
282
+ children: [
283
+ /* @__PURE__ */ h(R, { className: "mr-2 size-4" }),
284
+ "Close"
285
+ ]
286
+ }
287
+ );
288
+ }
289
+ function Ce() {
290
+ const { setTempQueryData: s } = A(), o = F();
291
+ n((b) => b.isDevMode);
292
+ const a = n((b) => b.tempQueryData), r = n((b) => b.card), t = W(), c = S(() => t !== r.type ? { ...r, type: t } : r, [r, t]), { queryKey: l } = G(c), {
293
+ setCardSql: u,
294
+ setSqlGen: e,
295
+ setCardPython: p,
296
+ setCardCustomCfg: m,
297
+ setCardPreferences: d,
298
+ updateDataSource: i,
299
+ clearQueryConfig: v,
300
+ setCardConfig: D,
301
+ setCardType: Y,
302
+ setFrame: Z,
303
+ setCard: _,
304
+ setActiveTabCardId: $
305
+ } = A();
306
+ function ee() {
307
+ var M, U, B, K;
308
+ const b = o.getQueryData(l);
309
+ a != null && a.queryData || s({
310
+ queryKey: l,
311
+ queryData: b
312
+ }), o.setQueryData(l, null), o.removeQueries({ queryKey: l, exact: !0 }), u(""), e({}), v(), D(void 0), p(""), m(""), d({});
313
+ const z = n.getState().frame, Q = n.getState().card, y = j(z, Q), x = ((M = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : M.visualType) === "multiple" || !!((U = y == null ? void 0 : y.customCardPreferences) != null && U.dataInputCardIds) || (((B = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : B.minInputs) || 0) > 1 || (((K = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : K.maxInputs) || 0) > 1, q = ce(Q, x);
314
+ Z({
315
+ ...z,
316
+ cards: z.cards.map(
317
+ (L) => L.id === q.id ? q : L
318
+ )
319
+ }), $(q.id), _(q), x || Y("bar");
320
+ }
321
+ return /* @__PURE__ */ f(
322
+ N,
323
+ {
324
+ onClick: ee,
325
+ className: "h-8",
326
+ size: "sm",
327
+ variant: "secondary",
328
+ children: [
329
+ /* @__PURE__ */ h(R, { className: "mr-2 size-3.5" }),
330
+ "Clear"
331
+ ]
332
+ }
333
+ );
334
+ }
335
+ export {
336
+ me as C,
337
+ pe as E,
338
+ J as S,
339
+ ve as V,
340
+ ye as a,
341
+ fe as b,
342
+ he as c,
343
+ Ce as d,
344
+ W as u
345
+ };