react-semaphor 0.1.292 → 0.1.294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{braces-hczcJsV8.js → braces-DR-GdaLC.js} +1 -1
- package/dist/chunks/{braces-0bzwctGp.js → braces-DfDQiR3J.js} +1 -1
- package/dist/chunks/dashboard-controls-C3Z9bpYE.js +2014 -0
- package/dist/chunks/dashboard-controls-DGEVXgP5.js +47 -0
- package/dist/chunks/dashboard-filter-controls-button-BIYT1ucX.js +11 -0
- package/dist/chunks/dashboard-filter-controls-button-DxgGUl00.js +1152 -0
- package/dist/chunks/{dashboard-json-COXiPm3N.js → dashboard-json-BvTeHePu.js} +1 -1
- package/dist/chunks/{dashboard-json-BDyKcoGT.js → dashboard-json-DQW8TN0I.js} +1 -1
- package/dist/chunks/dashboard-summary-settings-dialog-BsmKiGud.js +1 -0
- package/dist/chunks/dashboard-summary-settings-dialog-q7fx3YAK.js +543 -0
- package/dist/chunks/edit-dashboard-visual-ChKj-Lzr.js +183 -0
- package/dist/chunks/{edit-dashboard-visual-DLyimx6x.js → edit-dashboard-visual-RVl9nbDZ.js} +3018 -2989
- package/dist/chunks/index-BlspGR07.js +1435 -0
- package/dist/chunks/{index-72yod5pb.js → index-DerPpfv0.js} +40703 -39330
- package/dist/chunks/{resource-management-panel-DwPION_M.js → resource-management-panel-DnZ1rw1A.js} +64 -64
- package/dist/chunks/{resource-management-panel-CSLGSJjC.js → resource-management-panel-epydPwyM.js} +1 -1
- package/dist/chunks/use-create-flow-overlay-state-Bcg4EgoD.js +21 -0
- package/dist/chunks/{use-create-flow-overlay-state-UruHbtfS.js → use-create-flow-overlay-state-C5vdfXhM.js} +430 -425
- package/dist/chunks/use-visual-utils-D9Kknvjl.js +337 -0
- package/dist/chunks/use-visual-utils-Dw_yw9zU.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +258 -253
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +28 -0
- package/dist/types/main.d.ts +45 -5
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/surfboard.d.ts +28 -0
- package/dist/types/types.d.ts +28 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-Db0F38eK.js +0 -47
- package/dist/chunks/dashboard-controls-DeUHM4uL.js +0 -1970
- package/dist/chunks/dashboard-filter-controls-button-DDqEus_E.js +0 -1109
- package/dist/chunks/dashboard-filter-controls-button-DSQHVjjX.js +0 -11
- package/dist/chunks/dashboard-summary-settings-dialog-CryMC_4x.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DbcWMZsr.js +0 -536
- package/dist/chunks/edit-dashboard-visual-BqfzqW4i.js +0 -183
- package/dist/chunks/index-BQ6qu8FI.js +0 -1435
- package/dist/chunks/use-create-flow-overlay-state-zz9TYhdC.js +0 -21
- package/dist/chunks/use-visual-utils-Bm-ZnkON.js +0 -1
- package/dist/chunks/use-visual-utils-DPBqTRUC.js +0 -334
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
import De, { useState as L, useRef as H, useCallback as z, useEffect as V, useContext as Ee } from "react";
|
|
2
|
+
import { c as ne, d as W, aE as M, bL as q, bH as ie, bI as Q, aF as le, bG as Ae, e as de, f as ce, g as ue, h as me, i as he, L as Z, I as Se, db as Ie, w as Fe, B as A, x as J, W as j, M as Le, u as P, N as Te, Q as K, b_ as pe, dc as ke, dd as ee, y as T, c1 as fe, c0 as G, ai as Pe, cF as ve, cG as ge, a9 as be, cI as xe, cJ as B, t as Ue, cN as Ve, cw as Me, O as Be, de as Oe, b as O, df as Y, dg as ze, cV as Re, cW as _e, cX as $e, cY as He, cZ as je, c_ as Xe, c$ as Ge, bN as We, X as qe, dh as Qe, di as Je, cC as Ke, bJ as te, ab as Ye, aH as Ze, P as we, k as ye, dj as et, m as Ce, dk as tt, dl as at, dm as st, dn as rt, dp as ot, dq as ae, dr as nt } from "./index-DerPpfv0.js";
|
|
3
|
+
import { jsx as t, jsxs as s, Fragment as R } from "react/jsx-runtime";
|
|
4
|
+
import { V as it, E as lt, a as dt, b as ct, L as ut, c as mt, d as ht, C as pt, u as ft, e as vt } from "./use-create-flow-overlay-state-C5vdfXhM.js";
|
|
5
|
+
import { u as Ne } from "./use-visual-utils-D9Kknvjl.js";
|
|
6
|
+
import { k as se } from "./date-formatter-vkCj9Ct-.js";
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.453.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
const re = ne("FileDown", [
|
|
14
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
15
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
16
|
+
["path", { d: "M12 18v-6", key: "17g6i2" }],
|
|
17
|
+
["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* @license lucide-react v0.453.0 - ISC
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the ISC license.
|
|
23
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
const gt = ne("FilterX", [
|
|
26
|
+
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
27
|
+
["path", { d: "m22 3-5 5", key: "12jva0" }],
|
|
28
|
+
["path", { d: "m17 3 5 5", key: "k36vhe" }]
|
|
29
|
+
]), bt = 1e4, xt = 15e3, wt = 3e4, yt = 3e4, Ct = 12e4, oe = 2 * 60 * 60 * 1e3;
|
|
30
|
+
function Nt(e) {
|
|
31
|
+
const a = Date.now() - e.getTime();
|
|
32
|
+
return a < yt ? bt : a < Ct ? xt : wt;
|
|
33
|
+
}
|
|
34
|
+
function Mt() {
|
|
35
|
+
const { authToken: e, tokenProps: a } = W(), f = M((p) => p.activeExports), [d, i] = L(
|
|
36
|
+
typeof document < "u" ? !document.hidden : !0
|
|
37
|
+
), m = H(null), c = H(!1), h = H(void 0), o = a == null ? void 0 : a.apiServiceUrl, r = e == null ? void 0 : e.accessToken, v = z(() => {
|
|
38
|
+
const p = M.getState().activeExports;
|
|
39
|
+
return Array.from(p.values()).filter(
|
|
40
|
+
(b) => q(b.status)
|
|
41
|
+
);
|
|
42
|
+
}, []);
|
|
43
|
+
V(() => {
|
|
44
|
+
if (typeof document > "u") return;
|
|
45
|
+
const p = () => {
|
|
46
|
+
i(!document.hidden);
|
|
47
|
+
};
|
|
48
|
+
return document.addEventListener("visibilitychange", p), () => {
|
|
49
|
+
document.removeEventListener("visibilitychange", p);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const x = z(async () => {
|
|
53
|
+
if (!o || !r) {
|
|
54
|
+
c.current = !1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const p = v();
|
|
58
|
+
if (p.length === 0) {
|
|
59
|
+
c.current = !1;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const b = Date.now(), D = p.filter(
|
|
63
|
+
(n) => b - n.startedAt.getTime() > oe
|
|
64
|
+
);
|
|
65
|
+
if (D.length > 0) {
|
|
66
|
+
const { updateExport: n } = M.getState().actions;
|
|
67
|
+
for (const w of D)
|
|
68
|
+
n(w.id, {
|
|
69
|
+
status: "failed",
|
|
70
|
+
error: "Export timed out. Please try again or contact support.",
|
|
71
|
+
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const g = p.filter(
|
|
75
|
+
(n) => b - n.startedAt.getTime() <= oe
|
|
76
|
+
);
|
|
77
|
+
if (g.length === 0) {
|
|
78
|
+
c.current = !1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const C = await Promise.allSettled(
|
|
82
|
+
g.map(async (n) => {
|
|
83
|
+
try {
|
|
84
|
+
const w = await ie(o, r, n.id);
|
|
85
|
+
let y;
|
|
86
|
+
if (w.status === "completed")
|
|
87
|
+
try {
|
|
88
|
+
y = await Q(o, r, n.id);
|
|
89
|
+
} catch (F) {
|
|
90
|
+
console.error(
|
|
91
|
+
`[useExportPolling] Failed to get download URL for ${n.id}:`,
|
|
92
|
+
F
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
id: n.id,
|
|
97
|
+
status: w.status,
|
|
98
|
+
progress: w.progress,
|
|
99
|
+
completedChunks: w.completedChunks,
|
|
100
|
+
completedAt: w.completedAt ? new Date(w.completedAt) : void 0,
|
|
101
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
102
|
+
fileSize: w.fileSize,
|
|
103
|
+
error: w.error,
|
|
104
|
+
downloadUrl: y
|
|
105
|
+
};
|
|
106
|
+
} catch (w) {
|
|
107
|
+
return console.error(
|
|
108
|
+
`[useExportPolling] Failed to poll export ${n.id}:`,
|
|
109
|
+
w
|
|
110
|
+
), null;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
), { updateExport: E } = M.getState().actions;
|
|
114
|
+
for (const n of C)
|
|
115
|
+
n.status === "fulfilled" && n.value && E(n.value.id, n.value);
|
|
116
|
+
const N = v();
|
|
117
|
+
if (N.length > 0 && !document.hidden) {
|
|
118
|
+
const n = N.reduce(
|
|
119
|
+
(y, F) => F.startedAt < y ? F.startedAt : y,
|
|
120
|
+
N[0].startedAt
|
|
121
|
+
), w = Nt(n);
|
|
122
|
+
m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
123
|
+
var y;
|
|
124
|
+
(y = h.current) == null || y.call(h);
|
|
125
|
+
}, w);
|
|
126
|
+
} else
|
|
127
|
+
c.current = !1;
|
|
128
|
+
}, [o, r, v]);
|
|
129
|
+
return V(() => {
|
|
130
|
+
h.current = x;
|
|
131
|
+
}, [x]), V(() => {
|
|
132
|
+
var b;
|
|
133
|
+
v().length > 0 && d && !c.current && (c.current = !0, (b = h.current) == null || b.call(h));
|
|
134
|
+
}, [f, d, v]), V(() => {
|
|
135
|
+
var b;
|
|
136
|
+
const p = v();
|
|
137
|
+
d && p.length > 0 && !c.current && (c.current = !0, (b = h.current) == null || b.call(h));
|
|
138
|
+
}, [d, v]), V(() => {
|
|
139
|
+
!d && m.current && (clearTimeout(m.current), m.current = null, c.current = !1);
|
|
140
|
+
}, [d]), V(() => () => {
|
|
141
|
+
m.current && (clearTimeout(m.current), m.current = null);
|
|
142
|
+
}, []), {
|
|
143
|
+
isPolling: c.current,
|
|
144
|
+
isTabVisible: d,
|
|
145
|
+
inProgressCount: v().length
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function Bt() {
|
|
149
|
+
const { authToken: e, tokenProps: a } = W(), f = M((h) => h.activeExports), { addExport: d } = le(), i = H(!1), m = a == null ? void 0 : a.apiServiceUrl, c = e == null ? void 0 : e.accessToken;
|
|
150
|
+
V(() => {
|
|
151
|
+
if (i.current || !m || !c) return;
|
|
152
|
+
(async () => {
|
|
153
|
+
try {
|
|
154
|
+
const { exports: o } = await Ae(m, c, {
|
|
155
|
+
status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
|
|
156
|
+
limit: 20
|
|
157
|
+
// Limit to recent exports
|
|
158
|
+
});
|
|
159
|
+
for (const r of o) {
|
|
160
|
+
if (f.has(r.id)) continue;
|
|
161
|
+
const v = r.totalChunks ? Math.round(r.completedChunks / r.totalChunks * 100) : 0;
|
|
162
|
+
let x;
|
|
163
|
+
if (r.status === "completed")
|
|
164
|
+
try {
|
|
165
|
+
x = await Q(m, c, r.id);
|
|
166
|
+
} catch (b) {
|
|
167
|
+
console.error(
|
|
168
|
+
`[useExportRecovery] Failed to get download URL for ${r.id}:`,
|
|
169
|
+
b
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const p = {
|
|
173
|
+
id: r.id,
|
|
174
|
+
status: r.status,
|
|
175
|
+
progress: v,
|
|
176
|
+
title: Dt(r),
|
|
177
|
+
totalRows: r.totalRows,
|
|
178
|
+
totalChunks: r.totalChunks,
|
|
179
|
+
completedChunks: r.completedChunks,
|
|
180
|
+
startedAt: new Date(r.createdAt),
|
|
181
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
182
|
+
completedAt: r.completedAt ? new Date(r.completedAt) : void 0,
|
|
183
|
+
fileSize: r.fileSize,
|
|
184
|
+
error: r.error,
|
|
185
|
+
expiresAt: new Date(r.expiresAt),
|
|
186
|
+
downloadUrl: x
|
|
187
|
+
};
|
|
188
|
+
d(p);
|
|
189
|
+
}
|
|
190
|
+
i.current = !0;
|
|
191
|
+
} catch (o) {
|
|
192
|
+
console.error("[useExportRecovery] Failed to recover exports:", o), i.current = !0;
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
}, [m, c, d, f]);
|
|
196
|
+
}
|
|
197
|
+
function Dt(e) {
|
|
198
|
+
return e.title ? e.title : q(
|
|
199
|
+
e.status
|
|
200
|
+
) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
|
|
201
|
+
}
|
|
202
|
+
function Et({
|
|
203
|
+
open: e,
|
|
204
|
+
onOpenChange: a,
|
|
205
|
+
isLibraryVisual: f,
|
|
206
|
+
currentVisualName: d,
|
|
207
|
+
isSaving: i = !1,
|
|
208
|
+
destinationMode: m = "both",
|
|
209
|
+
onConfirm: c
|
|
210
|
+
}) {
|
|
211
|
+
const [h, o] = L(
|
|
212
|
+
f && d ? `Copy of ${d}` : d || ""
|
|
213
|
+
), [r, v] = L("");
|
|
214
|
+
De.useEffect(() => {
|
|
215
|
+
e && (o(
|
|
216
|
+
f && d ? `Copy of ${d}` : d || ""
|
|
217
|
+
), v(""));
|
|
218
|
+
}, [e, f, d]);
|
|
219
|
+
const x = !!h.trim(), p = m === "local" ? {
|
|
220
|
+
saveToLibrary: !1,
|
|
221
|
+
saveToCurrentDashboard: !0,
|
|
222
|
+
badgeType: "local",
|
|
223
|
+
description: "Creates a local copy on the current dashboard.",
|
|
224
|
+
actionLabel: "Add to Dashboard (Local)"
|
|
225
|
+
} : m === "library" ? {
|
|
226
|
+
saveToLibrary: !0,
|
|
227
|
+
saveToCurrentDashboard: !1,
|
|
228
|
+
badgeType: "library",
|
|
229
|
+
description: "Creates a reusable visual in Visual Library.",
|
|
230
|
+
actionLabel: "Save as Library Visual"
|
|
231
|
+
} : {
|
|
232
|
+
saveToLibrary: !0,
|
|
233
|
+
saveToCurrentDashboard: !0,
|
|
234
|
+
badgeType: "linked",
|
|
235
|
+
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
236
|
+
actionLabel: "Save Copy as Linked Visual"
|
|
237
|
+
}, b = () => {
|
|
238
|
+
!x || i || c({
|
|
239
|
+
name: h.trim(),
|
|
240
|
+
description: r.trim() || void 0,
|
|
241
|
+
saveToLibrary: p.saveToLibrary,
|
|
242
|
+
saveToCurrentDashboard: p.saveToCurrentDashboard
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
return /* @__PURE__ */ t(de, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(ce, { className: "sm:max-w-[500px]", children: [
|
|
246
|
+
/* @__PURE__ */ s(ue, { children: [
|
|
247
|
+
/* @__PURE__ */ s(me, { className: "flex items-center gap-2", children: [
|
|
248
|
+
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
249
|
+
p.badgeType !== "local" && /* @__PURE__ */ t(
|
|
250
|
+
it,
|
|
251
|
+
{
|
|
252
|
+
type: p.badgeType,
|
|
253
|
+
showLabel: !0,
|
|
254
|
+
className: "px-2 py-0.5"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ t(he, { children: p.description })
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 py-4", children: [
|
|
261
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
262
|
+
/* @__PURE__ */ t(Z, { htmlFor: "name", children: "Name" }),
|
|
263
|
+
/* @__PURE__ */ t(
|
|
264
|
+
Se,
|
|
265
|
+
{
|
|
266
|
+
id: "name",
|
|
267
|
+
value: h,
|
|
268
|
+
onChange: (D) => o(D.target.value),
|
|
269
|
+
placeholder: "Enter visual name",
|
|
270
|
+
disabled: i
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
275
|
+
/* @__PURE__ */ t(Z, { htmlFor: "description", children: "Description (optional)" }),
|
|
276
|
+
/* @__PURE__ */ t(
|
|
277
|
+
Ie,
|
|
278
|
+
{
|
|
279
|
+
id: "description",
|
|
280
|
+
value: r,
|
|
281
|
+
onChange: (D) => v(D.target.value),
|
|
282
|
+
placeholder: "Enter visual description",
|
|
283
|
+
rows: 3,
|
|
284
|
+
disabled: i
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
] })
|
|
288
|
+
] }),
|
|
289
|
+
/* @__PURE__ */ s(Fe, { children: [
|
|
290
|
+
/* @__PURE__ */ t(
|
|
291
|
+
A,
|
|
292
|
+
{
|
|
293
|
+
variant: "outline",
|
|
294
|
+
onClick: () => a(!1),
|
|
295
|
+
disabled: i,
|
|
296
|
+
children: "Cancel"
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ s(A, { onClick: b, disabled: !x || i, children: [
|
|
300
|
+
i && /* @__PURE__ */ t(J, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
301
|
+
p.actionLabel
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
] }) });
|
|
305
|
+
}
|
|
306
|
+
function At() {
|
|
307
|
+
const [e, a] = L(!1), [f, d] = L(!1), [i, m] = L(null), [c, h] = L(null), o = j((u) => u.frame), r = j((u) => u.card), v = Le(), x = P((u) => u.selectedSheetId), p = P((u) => u.dashboard), b = P(
|
|
308
|
+
(u) => u.actions.setIsDashboardPanelOpen
|
|
309
|
+
), { getUpdatedFrame: D } = Ne(), { selectVisual: g } = Te(), { addFrame: C, setSelectedFrameId: E, setIsVisualEditing: N } = K(), n = pe(), w = !!(o != null && o.visualId), y = (() => {
|
|
310
|
+
var u, l;
|
|
311
|
+
return ((u = o == null ? void 0 : o.cards) == null ? void 0 : u.length) === 1 && ((l = o.cards[0]) != null && l.title) ? o.cards[0].title : v != null && v.title ? v.title : (r == null ? void 0 : r.title) || "Untitled Visual";
|
|
312
|
+
})(), F = ke((u) => {
|
|
313
|
+
u != null && u.id && (g(u), f && i && c && x && (async () => {
|
|
314
|
+
try {
|
|
315
|
+
const l = {
|
|
316
|
+
...i,
|
|
317
|
+
id: ee(),
|
|
318
|
+
visualId: u.id
|
|
319
|
+
// Link to the newly created library visual
|
|
320
|
+
};
|
|
321
|
+
C(x, l, {
|
|
322
|
+
position: "end",
|
|
323
|
+
semanticExecutionPayload: c
|
|
324
|
+
}), E(l.id), d(!1), m(null), h(null), N(!1);
|
|
325
|
+
} catch (l) {
|
|
326
|
+
console.error(
|
|
327
|
+
"Failed to promote semantic metadata for saved visual:",
|
|
328
|
+
l
|
|
329
|
+
), T.error(
|
|
330
|
+
l instanceof Error ? l.message : "Failed to prepare semantic metadata for the saved visual"
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
})(), b(!0), a(!1));
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
saveAsDialogOpen: e,
|
|
337
|
+
setSaveAsDialogOpen: a,
|
|
338
|
+
handleSaveAs: async (u) => {
|
|
339
|
+
if (!x) {
|
|
340
|
+
T.error("No sheet selected");
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const l = D(), S = fe(l);
|
|
344
|
+
if (S) {
|
|
345
|
+
T.error(S);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const k = l.cards.length === 1 ? {
|
|
349
|
+
...l,
|
|
350
|
+
cards: l.cards.map((I) => ({
|
|
351
|
+
...I,
|
|
352
|
+
title: u.name
|
|
353
|
+
// Use visual name as card title
|
|
354
|
+
}))
|
|
355
|
+
} : l;
|
|
356
|
+
if (u.saveToLibrary) {
|
|
357
|
+
let I = null;
|
|
358
|
+
if (u.saveToCurrentDashboard)
|
|
359
|
+
try {
|
|
360
|
+
I = await n(k, {
|
|
361
|
+
previousFrame: G(p, k.id)
|
|
362
|
+
});
|
|
363
|
+
} catch (X) {
|
|
364
|
+
console.error(
|
|
365
|
+
"Failed to prepare semantic metadata before saving visual:",
|
|
366
|
+
X
|
|
367
|
+
), T.error(
|
|
368
|
+
X instanceof Error ? X.message : "Failed to prepare semantic metadata for the saved visual"
|
|
369
|
+
);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
d(u.saveToCurrentDashboard), m(k), h(I);
|
|
373
|
+
const U = {
|
|
374
|
+
title: u.name,
|
|
375
|
+
description: u.description,
|
|
376
|
+
frameObject: k,
|
|
377
|
+
// Card title synced for single-card frames
|
|
378
|
+
isPrivate: !1
|
|
379
|
+
};
|
|
380
|
+
F.mutate(U);
|
|
381
|
+
} else if (u.saveToCurrentDashboard) {
|
|
382
|
+
const I = {
|
|
383
|
+
...k,
|
|
384
|
+
// Card title already synced
|
|
385
|
+
id: ee(),
|
|
386
|
+
visualId: void 0
|
|
387
|
+
// Explicitly no visualId for local visuals
|
|
388
|
+
};
|
|
389
|
+
try {
|
|
390
|
+
const U = await n(k, {
|
|
391
|
+
previousFrame: G(p, k.id)
|
|
392
|
+
});
|
|
393
|
+
C(x, I, {
|
|
394
|
+
position: "end",
|
|
395
|
+
semanticExecutionPayload: U
|
|
396
|
+
}), E(I.id), T.success("Visual saved to dashboard"), a(!1), N(!1);
|
|
397
|
+
} catch (U) {
|
|
398
|
+
console.error("Failed to save visual to dashboard:", U), T.error(
|
|
399
|
+
U instanceof Error ? U.message : "Failed to prepare semantic metadata for the visual"
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
isLibraryVisual: w,
|
|
405
|
+
currentVisualName: y,
|
|
406
|
+
isSaving: F.isPending
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function Ot(e = {}) {
|
|
410
|
+
const a = j((l) => l.frame), f = Pe((l) => l.selectedVisual), d = P((l) => l.selectedFrameId), i = P((l) => l.selectedSheetId), m = P((l) => l.dashboard), { setIsVisualEditing: c, updateFrame: h } = K(), [o, r] = L(!1), [v, x] = L("both"), p = pe(), b = !!(a != null && a.visualId || f != null && f.id), D = !!(a != null && a.visualId && d), g = b && !D, {
|
|
411
|
+
saveAsDialogOpen: C,
|
|
412
|
+
setSaveAsDialogOpen: E,
|
|
413
|
+
handleSaveAs: N,
|
|
414
|
+
isLibraryVisual: n,
|
|
415
|
+
currentVisualName: w,
|
|
416
|
+
isSaving: y
|
|
417
|
+
} = At(), { getUpdatedFrame: F } = Ne(), _ = async () => {
|
|
418
|
+
if (!i) {
|
|
419
|
+
T.error("No sheet selected");
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (o) return;
|
|
423
|
+
r(!0);
|
|
424
|
+
const l = F(), S = fe(l);
|
|
425
|
+
if (S) {
|
|
426
|
+
r(!1), T.error(S);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const $ = {
|
|
430
|
+
...l,
|
|
431
|
+
visualId: void 0
|
|
432
|
+
}, k = G(m, $.id);
|
|
433
|
+
try {
|
|
434
|
+
const I = await p($, {
|
|
435
|
+
previousFrame: k
|
|
436
|
+
});
|
|
437
|
+
h(i, $, {
|
|
438
|
+
semanticExecutionPayload: I
|
|
439
|
+
});
|
|
440
|
+
} catch (I) {
|
|
441
|
+
console.error("Failed to apply local semantic metadata:", I), r(!1), T.error(
|
|
442
|
+
I instanceof Error ? I.message : "Failed to prepare semantic metadata for this visual"
|
|
443
|
+
);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
setTimeout(() => {
|
|
447
|
+
r(!1), T.success("Changes applied. Visual is now local to this dashboard"), c(!1);
|
|
448
|
+
}, 300);
|
|
449
|
+
}, u = (l) => {
|
|
450
|
+
x(l), E(!0);
|
|
451
|
+
};
|
|
452
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
453
|
+
/* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-[5px]", children: [
|
|
454
|
+
!b && /* @__PURE__ */ t(
|
|
455
|
+
lt,
|
|
456
|
+
{
|
|
457
|
+
className: "rounded-none",
|
|
458
|
+
variant: "default"
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
b && g && /* @__PURE__ */ t(
|
|
462
|
+
dt,
|
|
463
|
+
{
|
|
464
|
+
className: "rounded-none",
|
|
465
|
+
variant: "default"
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
b && D && /* @__PURE__ */ t(ct, { className: "rounded-none" }),
|
|
469
|
+
/* @__PURE__ */ s(ve, { modal: !1, children: [
|
|
470
|
+
/* @__PURE__ */ t(ge, { asChild: !0, children: /* @__PURE__ */ t(
|
|
471
|
+
A,
|
|
472
|
+
{
|
|
473
|
+
variant: "default",
|
|
474
|
+
size: "xs",
|
|
475
|
+
className: "w-7 rounded-none border-l border-primary-foreground/20 px-0",
|
|
476
|
+
"aria-label": "Open visual save options",
|
|
477
|
+
disabled: y || o,
|
|
478
|
+
children: /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" })
|
|
479
|
+
}
|
|
480
|
+
) }),
|
|
481
|
+
/* @__PURE__ */ s(
|
|
482
|
+
xe,
|
|
483
|
+
{
|
|
484
|
+
align: "end",
|
|
485
|
+
className: "min-w-[220px] rounded-[6px] border border-border/60 p-1 shadow-sm",
|
|
486
|
+
children: [
|
|
487
|
+
D && /* @__PURE__ */ s(R, { children: [
|
|
488
|
+
/* @__PURE__ */ s(
|
|
489
|
+
B,
|
|
490
|
+
{
|
|
491
|
+
onClick: _,
|
|
492
|
+
disabled: o,
|
|
493
|
+
children: [
|
|
494
|
+
/* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5" }),
|
|
495
|
+
o ? "Applying..." : "Apply Locally"
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ t(Ve, {})
|
|
500
|
+
] }),
|
|
501
|
+
/* @__PURE__ */ s(
|
|
502
|
+
B,
|
|
503
|
+
{
|
|
504
|
+
onClick: () => u("local"),
|
|
505
|
+
disabled: y,
|
|
506
|
+
children: [
|
|
507
|
+
/* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" }),
|
|
508
|
+
"Add to Dashboard (Local)"
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ s(
|
|
513
|
+
B,
|
|
514
|
+
{
|
|
515
|
+
onClick: () => u("library"),
|
|
516
|
+
disabled: y,
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" }),
|
|
519
|
+
"Save as Library Visual"
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ s(
|
|
524
|
+
B,
|
|
525
|
+
{
|
|
526
|
+
onClick: () => u("both"),
|
|
527
|
+
disabled: y,
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5" }),
|
|
530
|
+
"Save Copy as Linked Visual"
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
)
|
|
537
|
+
] })
|
|
538
|
+
] }),
|
|
539
|
+
/* @__PURE__ */ t(ht, {}),
|
|
540
|
+
/* @__PURE__ */ t(
|
|
541
|
+
Et,
|
|
542
|
+
{
|
|
543
|
+
open: C,
|
|
544
|
+
onOpenChange: (l) => {
|
|
545
|
+
y || E(l);
|
|
546
|
+
},
|
|
547
|
+
isLibraryVisual: n,
|
|
548
|
+
currentVisualName: w,
|
|
549
|
+
isSaving: y,
|
|
550
|
+
destinationMode: v,
|
|
551
|
+
onConfirm: N
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
] });
|
|
555
|
+
}
|
|
556
|
+
function zt({ className: e }) {
|
|
557
|
+
const a = j((o) => o.isDevMode), f = P((o) => o.isVisualEditing), { setIsDevMode: d } = Be(), { config: i } = Ee(Oe).tokenProps, m = (i == null ? void 0 : i.showAdvancedMode) !== !1;
|
|
558
|
+
if (!f || !m)
|
|
559
|
+
return null;
|
|
560
|
+
const c = "h-full rounded-none border-0 bg-transparent px-2.5 shadow-none text-muted-foreground hover:bg-accent/50 hover:text-foreground", h = "bg-muted text-foreground hover:bg-muted";
|
|
561
|
+
return /* @__PURE__ */ s(
|
|
562
|
+
"div",
|
|
563
|
+
{
|
|
564
|
+
role: "radiogroup",
|
|
565
|
+
"aria-label": "Editor mode",
|
|
566
|
+
className: O(
|
|
567
|
+
"inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-input bg-background",
|
|
568
|
+
e
|
|
569
|
+
),
|
|
570
|
+
children: [
|
|
571
|
+
/* @__PURE__ */ s(
|
|
572
|
+
A,
|
|
573
|
+
{
|
|
574
|
+
type: "button",
|
|
575
|
+
variant: "ghost",
|
|
576
|
+
size: "xs",
|
|
577
|
+
role: "radio",
|
|
578
|
+
"aria-checked": !a,
|
|
579
|
+
className: O(c, !a && h),
|
|
580
|
+
onClick: () => d(!1),
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ t(Y, { className: "h-3.5 w-3.5" }),
|
|
583
|
+
"Drag & drop"
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
),
|
|
587
|
+
/* @__PURE__ */ s(
|
|
588
|
+
A,
|
|
589
|
+
{
|
|
590
|
+
type: "button",
|
|
591
|
+
variant: "ghost",
|
|
592
|
+
size: "xs",
|
|
593
|
+
role: "radio",
|
|
594
|
+
"aria-checked": a,
|
|
595
|
+
className: O(
|
|
596
|
+
c,
|
|
597
|
+
"border-l border-border/60",
|
|
598
|
+
a && h
|
|
599
|
+
),
|
|
600
|
+
onClick: () => d(!0),
|
|
601
|
+
children: [
|
|
602
|
+
/* @__PURE__ */ t(ze, { className: "h-3.5 w-3.5" }),
|
|
603
|
+
"SQL"
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
)
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
function Rt({
|
|
612
|
+
open: e,
|
|
613
|
+
onOpenChange: a,
|
|
614
|
+
onSave: f,
|
|
615
|
+
onDiscard: d,
|
|
616
|
+
isSaving: i,
|
|
617
|
+
title: m = "Unsaved changes",
|
|
618
|
+
description: c = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
619
|
+
cancelLabel: h = "Cancel",
|
|
620
|
+
discardLabel: o = "Discard",
|
|
621
|
+
saveLabel: r = "Save"
|
|
622
|
+
}) {
|
|
623
|
+
return /* @__PURE__ */ t(Re, { open: e, onOpenChange: (x) => {
|
|
624
|
+
!x && i || a(x);
|
|
625
|
+
}, children: /* @__PURE__ */ s(_e, { children: [
|
|
626
|
+
/* @__PURE__ */ s($e, { children: [
|
|
627
|
+
/* @__PURE__ */ t(He, { children: m }),
|
|
628
|
+
/* @__PURE__ */ t(je, { children: c })
|
|
629
|
+
] }),
|
|
630
|
+
/* @__PURE__ */ s(Xe, { children: [
|
|
631
|
+
/* @__PURE__ */ t(
|
|
632
|
+
A,
|
|
633
|
+
{
|
|
634
|
+
type: "button",
|
|
635
|
+
size: "xs",
|
|
636
|
+
onClick: d,
|
|
637
|
+
disabled: i,
|
|
638
|
+
variant: "ghost",
|
|
639
|
+
className: "mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
|
|
640
|
+
children: o
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
/* @__PURE__ */ t(Ge, { disabled: i, children: h }),
|
|
644
|
+
/* @__PURE__ */ t(A, { type: "button", size: "xs", onClick: f, disabled: i, children: i ? /* @__PURE__ */ s(R, { children: [
|
|
645
|
+
/* @__PURE__ */ t(J, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
646
|
+
"Saving..."
|
|
647
|
+
] }) : r })
|
|
648
|
+
] })
|
|
649
|
+
] }) });
|
|
650
|
+
}
|
|
651
|
+
function St({
|
|
652
|
+
export: e,
|
|
653
|
+
onRemove: a
|
|
654
|
+
}) {
|
|
655
|
+
const f = () => {
|
|
656
|
+
e.downloadUrl && window.open(e.downloadUrl, "_blank");
|
|
657
|
+
}, d = (h) => {
|
|
658
|
+
h.stopPropagation(), a == null || a(e.id);
|
|
659
|
+
}, i = () => {
|
|
660
|
+
switch (e.status) {
|
|
661
|
+
case "completed":
|
|
662
|
+
return /* @__PURE__ */ t(Ke, { className: "mt-0.5 h-5 w-5 shrink-0 text-green-600" });
|
|
663
|
+
case "failed":
|
|
664
|
+
return /* @__PURE__ */ t(pt, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" });
|
|
665
|
+
default:
|
|
666
|
+
return /* @__PURE__ */ t(J, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
|
|
667
|
+
}
|
|
668
|
+
}, m = q(e.status), c = (() => {
|
|
669
|
+
switch (e.status) {
|
|
670
|
+
case "pending":
|
|
671
|
+
return "Queued...";
|
|
672
|
+
case "processing":
|
|
673
|
+
return "Processing...";
|
|
674
|
+
case "chunking":
|
|
675
|
+
return "Processing...";
|
|
676
|
+
case "compacting":
|
|
677
|
+
return "Finalizing...";
|
|
678
|
+
default:
|
|
679
|
+
return "Processing...";
|
|
680
|
+
}
|
|
681
|
+
})();
|
|
682
|
+
return /* @__PURE__ */ s("div", { className: "group p-4 transition-colors hover:bg-muted/50", children: [
|
|
683
|
+
/* @__PURE__ */ s("div", { className: "mb-2 flex items-start justify-between gap-3", children: [
|
|
684
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
|
|
685
|
+
i(),
|
|
686
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
687
|
+
/* @__PURE__ */ t("h4", { className: "mb-1 truncate text-sm font-medium", children: e.title }),
|
|
688
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
689
|
+
/* @__PURE__ */ s("span", { children: [
|
|
690
|
+
e.totalRows.toLocaleString(),
|
|
691
|
+
" rows"
|
|
692
|
+
] }),
|
|
693
|
+
e.fileSize && /* @__PURE__ */ s(R, { children: [
|
|
694
|
+
/* @__PURE__ */ t("span", { children: "•" }),
|
|
695
|
+
/* @__PURE__ */ t("span", { children: We(e.fileSize) })
|
|
696
|
+
] })
|
|
697
|
+
] }),
|
|
698
|
+
m && /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: c }),
|
|
699
|
+
e.status === "failed" && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-xs text-destructive", children: e.error || "Export failed" })
|
|
700
|
+
] })
|
|
701
|
+
] }),
|
|
702
|
+
/* @__PURE__ */ t(
|
|
703
|
+
A,
|
|
704
|
+
{
|
|
705
|
+
variant: "ghost",
|
|
706
|
+
size: "icon",
|
|
707
|
+
className: "h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",
|
|
708
|
+
onClick: d,
|
|
709
|
+
"aria-label": "Remove notification",
|
|
710
|
+
children: /* @__PURE__ */ t(qe, { className: "h-4 w-4" })
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
] }),
|
|
714
|
+
/* @__PURE__ */ s("div", { className: "ml-8", children: [
|
|
715
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
716
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: se(e.startedAt, { addSuffix: !0 }) }),
|
|
717
|
+
e.downloadUrl && /* @__PURE__ */ s(
|
|
718
|
+
A,
|
|
719
|
+
{
|
|
720
|
+
size: "sm",
|
|
721
|
+
variant: "outline",
|
|
722
|
+
className: "h-8 bg-transparent",
|
|
723
|
+
onClick: f,
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ t(Qe, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
726
|
+
"Download"
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
] }),
|
|
731
|
+
m && /* @__PURE__ */ s("div", { children: [
|
|
732
|
+
/* @__PURE__ */ t(Je, { value: e.progress, className: "h-1.5" }),
|
|
733
|
+
/* @__PURE__ */ s("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
|
|
734
|
+
e.progress,
|
|
735
|
+
"% complete"
|
|
736
|
+
] })
|
|
737
|
+
] }),
|
|
738
|
+
e.status === "failed" && /* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: se(e.startedAt, { addSuffix: !0 }) })
|
|
739
|
+
] })
|
|
740
|
+
] });
|
|
741
|
+
}
|
|
742
|
+
function It() {
|
|
743
|
+
const { authToken: e, tokenProps: a } = W(), f = M((g) => g.activeExports), { clearCompleted: d, removeExport: i, updateExport: m } = le(), [c, h] = L(!1), [o, r] = L(!1), v = Array.from(f.values()).sort(
|
|
744
|
+
(g, C) => C.startedAt.getTime() - g.startedAt.getTime()
|
|
745
|
+
), x = v.some(
|
|
746
|
+
(g) => g.status === "completed" || g.status === "failed"
|
|
747
|
+
), p = z(async () => {
|
|
748
|
+
const g = a == null ? void 0 : a.apiServiceUrl, C = e == null ? void 0 : e.accessToken;
|
|
749
|
+
if (!(!g || !C)) {
|
|
750
|
+
h(!0);
|
|
751
|
+
try {
|
|
752
|
+
const E = Array.from(f.values());
|
|
753
|
+
await Promise.all(
|
|
754
|
+
E.map(async (N) => {
|
|
755
|
+
try {
|
|
756
|
+
const n = await ie(g, C, N.id);
|
|
757
|
+
let w;
|
|
758
|
+
if (n.status === "completed")
|
|
759
|
+
try {
|
|
760
|
+
w = await Q(
|
|
761
|
+
g,
|
|
762
|
+
C,
|
|
763
|
+
N.id
|
|
764
|
+
);
|
|
765
|
+
} catch (y) {
|
|
766
|
+
console.error(`Failed to get download URL for ${N.id}:`, y);
|
|
767
|
+
}
|
|
768
|
+
m(N.id, {
|
|
769
|
+
status: n.status,
|
|
770
|
+
progress: n.progress,
|
|
771
|
+
completedChunks: n.completedChunks,
|
|
772
|
+
completedAt: n.completedAt ? new Date(n.completedAt) : void 0,
|
|
773
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
774
|
+
fileSize: n.fileSize,
|
|
775
|
+
error: n.error,
|
|
776
|
+
downloadUrl: w
|
|
777
|
+
});
|
|
778
|
+
} catch (n) {
|
|
779
|
+
console.error(`Failed to refresh export ${N.id}:`, n);
|
|
780
|
+
}
|
|
781
|
+
})
|
|
782
|
+
);
|
|
783
|
+
} finally {
|
|
784
|
+
h(!1);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}, [
|
|
788
|
+
f,
|
|
789
|
+
e == null ? void 0 : e.accessToken,
|
|
790
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
791
|
+
m
|
|
792
|
+
]), b = z(async () => {
|
|
793
|
+
const g = a == null ? void 0 : a.apiServiceUrl, C = e == null ? void 0 : e.accessToken;
|
|
794
|
+
if (!g || !C) {
|
|
795
|
+
d();
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
r(!0);
|
|
799
|
+
try {
|
|
800
|
+
const E = v.filter(
|
|
801
|
+
(n) => n.status === "completed" || n.status === "failed"
|
|
802
|
+
), N = await Promise.allSettled(
|
|
803
|
+
E.map(async (n) => (await te(g, C, n.id), n.id))
|
|
804
|
+
);
|
|
805
|
+
for (const n of N)
|
|
806
|
+
n.status === "fulfilled" ? i(n.value) : console.error("Failed to delete export:", n.reason);
|
|
807
|
+
} finally {
|
|
808
|
+
r(!1);
|
|
809
|
+
}
|
|
810
|
+
}, [
|
|
811
|
+
v,
|
|
812
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
813
|
+
e == null ? void 0 : e.accessToken,
|
|
814
|
+
d,
|
|
815
|
+
i
|
|
816
|
+
]), D = z(
|
|
817
|
+
async (g) => {
|
|
818
|
+
const C = a == null ? void 0 : a.apiServiceUrl, E = e == null ? void 0 : e.accessToken;
|
|
819
|
+
if (C && E)
|
|
820
|
+
try {
|
|
821
|
+
await te(C, E, g), i(g);
|
|
822
|
+
return;
|
|
823
|
+
} catch (N) {
|
|
824
|
+
console.error(`Failed to cancel export ${g}:`, N);
|
|
825
|
+
}
|
|
826
|
+
i(g);
|
|
827
|
+
},
|
|
828
|
+
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, i]
|
|
829
|
+
);
|
|
830
|
+
return v.length === 0 ? /* @__PURE__ */ s("div", { className: "p-6 text-center", children: [
|
|
831
|
+
/* @__PURE__ */ t(re, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
|
|
832
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No active exports" }),
|
|
833
|
+
/* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Large exports will appear here" })
|
|
834
|
+
] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
|
|
835
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
|
|
836
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
837
|
+
/* @__PURE__ */ t(re, { className: "h-5 w-5 text-muted-foreground" }),
|
|
838
|
+
/* @__PURE__ */ t("h4", { className: "font-semibold", children: "Exports" })
|
|
839
|
+
] }),
|
|
840
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
841
|
+
/* @__PURE__ */ t(
|
|
842
|
+
A,
|
|
843
|
+
{
|
|
844
|
+
variant: "ghost",
|
|
845
|
+
size: "sm",
|
|
846
|
+
className: "h-7 w-7 p-0",
|
|
847
|
+
onClick: p,
|
|
848
|
+
disabled: c,
|
|
849
|
+
title: "Refresh status",
|
|
850
|
+
children: /* @__PURE__ */ t(
|
|
851
|
+
Ye,
|
|
852
|
+
{
|
|
853
|
+
className: `h-4 w-4 ${c ? "animate-spin" : ""}`
|
|
854
|
+
}
|
|
855
|
+
)
|
|
856
|
+
}
|
|
857
|
+
),
|
|
858
|
+
x && /* @__PURE__ */ t(
|
|
859
|
+
A,
|
|
860
|
+
{
|
|
861
|
+
variant: "ghost",
|
|
862
|
+
size: "sm",
|
|
863
|
+
className: "h-7 px-2 text-sm",
|
|
864
|
+
onClick: b,
|
|
865
|
+
disabled: o,
|
|
866
|
+
children: o ? "Clearing..." : "Clear all"
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
] })
|
|
870
|
+
] }),
|
|
871
|
+
/* @__PURE__ */ t("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y", children: v.map((g) => /* @__PURE__ */ t(
|
|
872
|
+
St,
|
|
873
|
+
{
|
|
874
|
+
export: g,
|
|
875
|
+
onRemove: D
|
|
876
|
+
},
|
|
877
|
+
g.id
|
|
878
|
+
)) }) })
|
|
879
|
+
] });
|
|
880
|
+
}
|
|
881
|
+
function _t({
|
|
882
|
+
variant: e
|
|
883
|
+
}) {
|
|
884
|
+
const a = M((o) => o.activeExports), f = Ze(), d = a.size > 0, i = Array.from(a.values()).some(
|
|
885
|
+
(o) => o.status === "completed" || o.status === "failed"
|
|
886
|
+
), c = f > 0 ? f > 9 ? "9+" : String(f) : null;
|
|
887
|
+
return /* @__PURE__ */ s(we, { children: [
|
|
888
|
+
/* @__PURE__ */ t(ye, { asChild: !0, children: /* @__PURE__ */ s(
|
|
889
|
+
A,
|
|
890
|
+
{
|
|
891
|
+
variant: e ?? "ghost",
|
|
892
|
+
size: "xs",
|
|
893
|
+
className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
894
|
+
"aria-label": "Export notifications",
|
|
895
|
+
children: [
|
|
896
|
+
/* @__PURE__ */ t(et, { className: "h-3.5 w-3.5" }),
|
|
897
|
+
d && /* @__PURE__ */ t(
|
|
898
|
+
"span",
|
|
899
|
+
{
|
|
900
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${c ? "-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold" : "right-1 top-1 h-1.5 w-1.5"}`,
|
|
901
|
+
children: c
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
) }),
|
|
907
|
+
/* @__PURE__ */ t(Ce, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(It, {}) })
|
|
908
|
+
] });
|
|
909
|
+
}
|
|
910
|
+
function Ft(e) {
|
|
911
|
+
if (e)
|
|
912
|
+
return {
|
|
913
|
+
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
914
|
+
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
915
|
+
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
916
|
+
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function $t({
|
|
920
|
+
open: e,
|
|
921
|
+
onOpenChange: a,
|
|
922
|
+
trigger: f,
|
|
923
|
+
showTrigger: d = !0,
|
|
924
|
+
initialMode: i = "manage"
|
|
925
|
+
}) {
|
|
926
|
+
const m = i === "create", {
|
|
927
|
+
forceClose: c,
|
|
928
|
+
handleOpenChange: h,
|
|
929
|
+
isCreateFlowActive: o,
|
|
930
|
+
preventPassiveDismissDuringCreate: r,
|
|
931
|
+
resolvedOpen: v,
|
|
932
|
+
setIsCreateFlowActive: x
|
|
933
|
+
} = ft({
|
|
934
|
+
open: e,
|
|
935
|
+
onOpenChange: a,
|
|
936
|
+
initialCreateFlowActive: i === "create",
|
|
937
|
+
// Dialog mode renders a built-in X close button — allow explicit
|
|
938
|
+
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
939
|
+
// only close-via-trigger path is a re-click that would silently
|
|
940
|
+
// wipe the in-progress create flow, so block everything during
|
|
941
|
+
// create and make consumers use `forceClose()` from a dedicated
|
|
942
|
+
// button.
|
|
943
|
+
dismissMode: d ? "passive" : "explicit-only"
|
|
944
|
+
}), p = P((u) => u.dashboard), { setDashboardControlsModel: b } = K(), { participants: D } = tt(at(p)), g = Array.from(
|
|
945
|
+
new Map(
|
|
946
|
+
D.flatMap(
|
|
947
|
+
(u) => u.fieldChoices.map((l) => {
|
|
948
|
+
var S;
|
|
949
|
+
return [
|
|
950
|
+
l.value,
|
|
951
|
+
{
|
|
952
|
+
option: l,
|
|
953
|
+
target: (S = u.fieldTargetMap) == null ? void 0 : S[l.value]
|
|
954
|
+
}
|
|
955
|
+
];
|
|
956
|
+
})
|
|
957
|
+
)
|
|
958
|
+
).values()
|
|
959
|
+
), C = Array.from(
|
|
960
|
+
new Map(
|
|
961
|
+
D.flatMap(
|
|
962
|
+
(u) => u.metricChoices.map((l) => {
|
|
963
|
+
var S;
|
|
964
|
+
return [
|
|
965
|
+
l.value,
|
|
966
|
+
{
|
|
967
|
+
option: l,
|
|
968
|
+
target: (S = u.metricTargetMap) == null ? void 0 : S[l.value]
|
|
969
|
+
}
|
|
970
|
+
];
|
|
971
|
+
})
|
|
972
|
+
)
|
|
973
|
+
).values()
|
|
974
|
+
), E = st({
|
|
975
|
+
...p || {},
|
|
976
|
+
controls: []
|
|
977
|
+
}), N = rt(p), n = (u, l, S) => {
|
|
978
|
+
b(
|
|
979
|
+
u,
|
|
980
|
+
l,
|
|
981
|
+
Ft(S)
|
|
982
|
+
);
|
|
983
|
+
}, w = z(() => {
|
|
984
|
+
if (m) {
|
|
985
|
+
c();
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
x(!1);
|
|
989
|
+
}, [m, c, x]), y = /* @__PURE__ */ t(
|
|
990
|
+
vt,
|
|
991
|
+
{
|
|
992
|
+
scope: "dashboard",
|
|
993
|
+
controls: p.controls || [],
|
|
994
|
+
reservedControlIds: E,
|
|
995
|
+
defaultValues: p.defaultControlValues || {},
|
|
996
|
+
usageByControlId: ot(p),
|
|
997
|
+
availableFieldChoices: g,
|
|
998
|
+
availableMetricChoices: C,
|
|
999
|
+
structuralParticipants: D,
|
|
1000
|
+
structuralParticipantIdsByControlId: N,
|
|
1001
|
+
initialCreateFlow: i === "create",
|
|
1002
|
+
onCreateFlowActiveChange: x,
|
|
1003
|
+
onCreateFlowComplete: w,
|
|
1004
|
+
onChange: n,
|
|
1005
|
+
emptyMessage: "No dashboard controls yet."
|
|
1006
|
+
}
|
|
1007
|
+
), F = o ? "Add dashboard control" : "Dashboard Controls", _ = /* @__PURE__ */ s(R, { children: [
|
|
1008
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
1009
|
+
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
1010
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control." })
|
|
1011
|
+
] }),
|
|
1012
|
+
y
|
|
1013
|
+
] });
|
|
1014
|
+
return d ? /* @__PURE__ */ s(we, { open: v, onOpenChange: h, children: [
|
|
1015
|
+
/* @__PURE__ */ t(ye, { asChild: !0, children: f || /* @__PURE__ */ s(A, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
1016
|
+
/* @__PURE__ */ t(Y, { className: "mr-2 h-4 w-4" }),
|
|
1017
|
+
"Controls"
|
|
1018
|
+
] }) }),
|
|
1019
|
+
/* @__PURE__ */ t(
|
|
1020
|
+
Ce,
|
|
1021
|
+
{
|
|
1022
|
+
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
1023
|
+
align: "end",
|
|
1024
|
+
onEscapeKeyDown: r,
|
|
1025
|
+
onPointerDownOutside: r,
|
|
1026
|
+
children: _
|
|
1027
|
+
}
|
|
1028
|
+
)
|
|
1029
|
+
] }) : /* @__PURE__ */ t(de, { open: v, onOpenChange: h, children: /* @__PURE__ */ s(
|
|
1030
|
+
ce,
|
|
1031
|
+
{
|
|
1032
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
1033
|
+
onEscapeKeyDown: r,
|
|
1034
|
+
onPointerDownOutside: r,
|
|
1035
|
+
children: [
|
|
1036
|
+
/* @__PURE__ */ s(
|
|
1037
|
+
ue,
|
|
1038
|
+
{
|
|
1039
|
+
className: o ? "space-y-0" : void 0,
|
|
1040
|
+
children: [
|
|
1041
|
+
/* @__PURE__ */ t(me, { className: "text-[15px]", children: F }),
|
|
1042
|
+
/* @__PURE__ */ t(
|
|
1043
|
+
he,
|
|
1044
|
+
{
|
|
1045
|
+
className: o ? "sr-only" : "text-[13px]",
|
|
1046
|
+
children: o ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
]
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: y })
|
|
1053
|
+
]
|
|
1054
|
+
}
|
|
1055
|
+
) });
|
|
1056
|
+
}
|
|
1057
|
+
function Ht({
|
|
1058
|
+
showFilters: e,
|
|
1059
|
+
onToggleFilters: a,
|
|
1060
|
+
onAddFilter: f,
|
|
1061
|
+
onAddControl: d,
|
|
1062
|
+
onManageControls: i,
|
|
1063
|
+
size: m = "default",
|
|
1064
|
+
className: c,
|
|
1065
|
+
primaryButtonClassName: h,
|
|
1066
|
+
secondaryButtonClassName: o,
|
|
1067
|
+
dropdownContentClassName: r
|
|
1068
|
+
}) {
|
|
1069
|
+
return /* @__PURE__ */ s(
|
|
1070
|
+
"div",
|
|
1071
|
+
{
|
|
1072
|
+
className: O(
|
|
1073
|
+
// Height lives on the shell so the outer border is part of the
|
|
1074
|
+
// h-7 box (matches regular `size="xs"` buttons). Inner buttons
|
|
1075
|
+
// stretch to fill via `h-full`, avoiding the 2px stack-up that
|
|
1076
|
+
// makes the combo taller than a sibling `<Button size="xs">`.
|
|
1077
|
+
"relative inline-flex items-stretch overflow-hidden rounded-[5px] border border-input bg-background",
|
|
1078
|
+
m === "toolbar" ? "h-8" : "h-7",
|
|
1079
|
+
c
|
|
1080
|
+
),
|
|
1081
|
+
children: [
|
|
1082
|
+
/* @__PURE__ */ s(
|
|
1083
|
+
A,
|
|
1084
|
+
{
|
|
1085
|
+
variant: "ghost",
|
|
1086
|
+
size: "xs",
|
|
1087
|
+
className: O(
|
|
1088
|
+
"h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50",
|
|
1089
|
+
h
|
|
1090
|
+
),
|
|
1091
|
+
onClick: a,
|
|
1092
|
+
children: [
|
|
1093
|
+
e ? /* @__PURE__ */ t(gt, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5" }),
|
|
1094
|
+
"Filter"
|
|
1095
|
+
]
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
/* @__PURE__ */ s(ve, { children: [
|
|
1099
|
+
/* @__PURE__ */ t(ge, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1100
|
+
A,
|
|
1101
|
+
{
|
|
1102
|
+
variant: "ghost",
|
|
1103
|
+
size: "xs",
|
|
1104
|
+
className: O(
|
|
1105
|
+
"h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50",
|
|
1106
|
+
o
|
|
1107
|
+
),
|
|
1108
|
+
"aria-label": "Filter and control actions",
|
|
1109
|
+
children: /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" })
|
|
1110
|
+
}
|
|
1111
|
+
) }),
|
|
1112
|
+
/* @__PURE__ */ s(
|
|
1113
|
+
xe,
|
|
1114
|
+
{
|
|
1115
|
+
align: "start",
|
|
1116
|
+
className: O(
|
|
1117
|
+
"min-w-[180px] rounded-[6px] border border-border/60 p-1 shadow-sm",
|
|
1118
|
+
r
|
|
1119
|
+
),
|
|
1120
|
+
children: [
|
|
1121
|
+
/* @__PURE__ */ s(B, { onSelect: f, children: [
|
|
1122
|
+
/* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5" }),
|
|
1123
|
+
"Add filter"
|
|
1124
|
+
] }),
|
|
1125
|
+
/* @__PURE__ */ s(B, { onSelect: d, children: [
|
|
1126
|
+
/* @__PURE__ */ t(Y, { className: "h-3.5 w-3.5" }),
|
|
1127
|
+
"Add control"
|
|
1128
|
+
] }),
|
|
1129
|
+
/* @__PURE__ */ s(B, { onSelect: i, children: [
|
|
1130
|
+
/* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
|
|
1131
|
+
"Manage controls"
|
|
1132
|
+
] })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
)
|
|
1136
|
+
] })
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
export {
|
|
1142
|
+
zt as A,
|
|
1143
|
+
$t as D,
|
|
1144
|
+
It as E,
|
|
1145
|
+
_t as N,
|
|
1146
|
+
Rt as U,
|
|
1147
|
+
Ot as V,
|
|
1148
|
+
St as a,
|
|
1149
|
+
Bt as b,
|
|
1150
|
+
Ht as c,
|
|
1151
|
+
Mt as u
|
|
1152
|
+
};
|