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.
- package/dist/chunks/dashboard-controls-0hbftZxY.js +42 -0
- package/dist/chunks/dashboard-controls-BYi_r2lH.js +1971 -0
- package/dist/chunks/dashboard-filter-controls-button-BPCw1GMh.js +1066 -0
- package/dist/chunks/dashboard-filter-controls-button-f4pDkDUL.js +11 -0
- package/dist/chunks/{dashboard-json-B43n1l6C.js → dashboard-json-2NJCXsDD.js} +1 -1
- package/dist/chunks/{dashboard-json-D0oSxmLa.js → dashboard-json-Dpy-zKf2.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CxZAMb8B.js → dashboard-summary-settings-dialog-B9zRCvc-.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DMWYgbwB.js → dashboard-summary-settings-dialog-Be3JilRI.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-Bon08erH.js +188 -0
- package/dist/chunks/{edit-dashboard-visual-CCoz1oGX.js → edit-dashboard-visual-CqTlmuYL.js} +5970 -5492
- package/dist/chunks/index-BoJEr_9F.js +1114 -0
- package/dist/chunks/{index-DpSxZvI0.js → index-C2c-_lPE.js} +48682 -45193
- package/dist/chunks/{normalize-dashboard-for-dirty-check-Bn27S0PN.js → normalize-dashboard-for-dirty-check-5KpZN8xr.js} +20 -19
- package/dist/chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js +1 -0
- package/dist/chunks/{resource-management-panel-L51m1i4h.js → resource-management-panel-BtLPW2b4.js} +1 -1
- package/dist/chunks/{resource-management-panel-B_bDGuq_.js → resource-management-panel-Bva2_0OU.js} +70 -70
- package/dist/chunks/use-create-flow-overlay-state-9X7GyUzl.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-Vyd5mSnf.js +1445 -0
- package/dist/chunks/{use-visual-utils-V6paZich.js → use-visual-utils-Jv4hWSLm.js} +1 -1
- package/dist/chunks/{use-visual-utils-Cp5KVbr6.js → use-visual-utils-OPk_1t4I.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +102 -99
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +5 -4
- package/dist/types/dashboard.d.ts +105 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -3
- package/dist/types/main.d.ts +175 -1
- package/dist/types/shared.d.ts +89 -0
- package/dist/types/surfboard.d.ts +105 -0
- package/dist/types/types.d.ts +113 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-51P6aUVB.js +0 -1847
- package/dist/chunks/dashboard-controls-BC3hDGwD.js +0 -47
- package/dist/chunks/edit-dashboard-visual-D1mwhPGF.js +0 -193
- package/dist/chunks/editor-action-buttons-B6ElCCo2.js +0 -412
- package/dist/chunks/editor-action-buttons-Dbs6eczj.js +0 -21
- package/dist/chunks/index-DAhkssOV.js +0 -1109
- package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +0 -1
- package/dist/chunks/notification-bell-DoIAAZqX.js +0 -6
- package/dist/chunks/notification-bell-cYCkxEbp.js +0 -839
|
@@ -0,0 +1,1066 @@
|
|
|
1
|
+
import ve, { useState as L, useRef as O, useCallback as V, useEffect as F, useContext as ge } from "react";
|
|
2
|
+
import { bL as Z, b as $, aB as U, bI as j, bE as ee, bF as _, aC as te, bD as be, e as ae, f as se, g as re, h as oe, i as ne, L as G, c$ as we, d5 as Ce, v as xe, B as S, w as H, U as z, J as ye, u as P, K as Ne, N as X, d6 as De, d7 as K, x as R, ae as Ae, c as I, cy as ie, cz as le, a5 as de, cB as ce, cC as M, s as Ee, cG as Se, cp as Ie, M as Le, d8 as Te, d9 as Fe, da as ke, cO as Ue, cP as Me, cQ as Ve, db as Pe, cR as Be, cS as Oe, cT as ze, cU as Re, cV as $e, ar as je, bK as _e, X as He, dc as Xe, dd as Ge, cu as Ke, bG as q, a7 as qe, aE as Qe, P as ue, k as me, de as We, l as he, df as Je, dg as Ye, dh as Ze, di as et, dj as tt, dk as pe, dl as Q, dm as at } from "./index-C2c-_lPE.js";
|
|
3
|
+
import { jsx as t, jsxs as s, Fragment as B } from "react/jsx-runtime";
|
|
4
|
+
import { V as st, E as rt, a as ot, b as nt, L as it, c as lt, d as dt, C as ct, u as ut, e as mt } from "./use-create-flow-overlay-state-Vyd5mSnf.js";
|
|
5
|
+
import { a as fe } from "./use-visual-utils-OPk_1t4I.js";
|
|
6
|
+
import { k as W } 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 J = Z("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 ht = Z("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
|
+
]), pt = 1e4, ft = 15e3, vt = 3e4, gt = 3e4, bt = 12e4, Y = 2 * 60 * 60 * 1e3;
|
|
30
|
+
function wt(e) {
|
|
31
|
+
const a = Date.now() - e.getTime();
|
|
32
|
+
return a < gt ? pt : a < bt ? ft : vt;
|
|
33
|
+
}
|
|
34
|
+
function kt() {
|
|
35
|
+
const { authToken: e, tokenProps: a } = $(), p = U((h) => h.activeExports), [c, d] = L(
|
|
36
|
+
typeof document < "u" ? !document.hidden : !0
|
|
37
|
+
), u = O(null), n = O(!1), l = O(void 0), m = a == null ? void 0 : a.apiServiceUrl, o = e == null ? void 0 : e.accessToken, v = V(() => {
|
|
38
|
+
const h = U.getState().activeExports;
|
|
39
|
+
return Array.from(h.values()).filter(
|
|
40
|
+
(w) => j(w.status)
|
|
41
|
+
);
|
|
42
|
+
}, []);
|
|
43
|
+
F(() => {
|
|
44
|
+
if (typeof document > "u") return;
|
|
45
|
+
const h = () => {
|
|
46
|
+
d(!document.hidden);
|
|
47
|
+
};
|
|
48
|
+
return document.addEventListener("visibilitychange", h), () => {
|
|
49
|
+
document.removeEventListener("visibilitychange", h);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const b = V(async () => {
|
|
53
|
+
if (!m || !o) {
|
|
54
|
+
n.current = !1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const h = v();
|
|
58
|
+
if (h.length === 0) {
|
|
59
|
+
n.current = !1;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const w = Date.now(), D = h.filter(
|
|
63
|
+
(r) => w - r.startedAt.getTime() > Y
|
|
64
|
+
);
|
|
65
|
+
if (D.length > 0) {
|
|
66
|
+
const { updateExport: r } = U.getState().actions;
|
|
67
|
+
for (const i of D)
|
|
68
|
+
r(i.id, {
|
|
69
|
+
status: "failed",
|
|
70
|
+
error: "Export timed out. Please try again or contact support.",
|
|
71
|
+
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const f = h.filter(
|
|
75
|
+
(r) => w - r.startedAt.getTime() <= Y
|
|
76
|
+
);
|
|
77
|
+
if (f.length === 0) {
|
|
78
|
+
n.current = !1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const x = await Promise.allSettled(
|
|
82
|
+
f.map(async (r) => {
|
|
83
|
+
try {
|
|
84
|
+
const i = await ee(m, o, r.id);
|
|
85
|
+
let g;
|
|
86
|
+
if (i.status === "completed")
|
|
87
|
+
try {
|
|
88
|
+
g = await _(m, o, r.id);
|
|
89
|
+
} catch (E) {
|
|
90
|
+
console.error(
|
|
91
|
+
`[useExportPolling] Failed to get download URL for ${r.id}:`,
|
|
92
|
+
E
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
id: r.id,
|
|
97
|
+
status: i.status,
|
|
98
|
+
progress: i.progress,
|
|
99
|
+
completedChunks: i.completedChunks,
|
|
100
|
+
completedAt: i.completedAt ? new Date(i.completedAt) : void 0,
|
|
101
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
102
|
+
fileSize: i.fileSize,
|
|
103
|
+
error: i.error,
|
|
104
|
+
downloadUrl: g
|
|
105
|
+
};
|
|
106
|
+
} catch (i) {
|
|
107
|
+
return console.error(
|
|
108
|
+
`[useExportPolling] Failed to poll export ${r.id}:`,
|
|
109
|
+
i
|
|
110
|
+
), null;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
), { updateExport: A } = U.getState().actions;
|
|
114
|
+
for (const r of x)
|
|
115
|
+
r.status === "fulfilled" && r.value && A(r.value.id, r.value);
|
|
116
|
+
const C = v();
|
|
117
|
+
if (C.length > 0 && !document.hidden) {
|
|
118
|
+
const r = C.reduce(
|
|
119
|
+
(g, E) => E.startedAt < g ? E.startedAt : g,
|
|
120
|
+
C[0].startedAt
|
|
121
|
+
), i = wt(r);
|
|
122
|
+
u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
123
|
+
var g;
|
|
124
|
+
(g = l.current) == null || g.call(l);
|
|
125
|
+
}, i);
|
|
126
|
+
} else
|
|
127
|
+
n.current = !1;
|
|
128
|
+
}, [m, o, v]);
|
|
129
|
+
return F(() => {
|
|
130
|
+
l.current = b;
|
|
131
|
+
}, [b]), F(() => {
|
|
132
|
+
var w;
|
|
133
|
+
v().length > 0 && c && !n.current && (n.current = !0, (w = l.current) == null || w.call(l));
|
|
134
|
+
}, [p, c, v]), F(() => {
|
|
135
|
+
var w;
|
|
136
|
+
const h = v();
|
|
137
|
+
c && h.length > 0 && !n.current && (n.current = !0, (w = l.current) == null || w.call(l));
|
|
138
|
+
}, [c, v]), F(() => {
|
|
139
|
+
!c && u.current && (clearTimeout(u.current), u.current = null, n.current = !1);
|
|
140
|
+
}, [c]), F(() => () => {
|
|
141
|
+
u.current && (clearTimeout(u.current), u.current = null);
|
|
142
|
+
}, []), {
|
|
143
|
+
isPolling: n.current,
|
|
144
|
+
isTabVisible: c,
|
|
145
|
+
inProgressCount: v().length
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function Ut() {
|
|
149
|
+
const { authToken: e, tokenProps: a } = $(), p = U((l) => l.activeExports), { addExport: c } = te(), d = O(!1), u = a == null ? void 0 : a.apiServiceUrl, n = e == null ? void 0 : e.accessToken;
|
|
150
|
+
F(() => {
|
|
151
|
+
if (d.current || !u || !n) return;
|
|
152
|
+
(async () => {
|
|
153
|
+
try {
|
|
154
|
+
const { exports: m } = await be(u, n, {
|
|
155
|
+
status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
|
|
156
|
+
limit: 20
|
|
157
|
+
// Limit to recent exports
|
|
158
|
+
});
|
|
159
|
+
for (const o of m) {
|
|
160
|
+
if (p.has(o.id)) continue;
|
|
161
|
+
const v = o.totalChunks ? Math.round(o.completedChunks / o.totalChunks * 100) : 0;
|
|
162
|
+
let b;
|
|
163
|
+
if (o.status === "completed")
|
|
164
|
+
try {
|
|
165
|
+
b = await _(u, n, o.id);
|
|
166
|
+
} catch (w) {
|
|
167
|
+
console.error(
|
|
168
|
+
`[useExportRecovery] Failed to get download URL for ${o.id}:`,
|
|
169
|
+
w
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const h = {
|
|
173
|
+
id: o.id,
|
|
174
|
+
status: o.status,
|
|
175
|
+
progress: v,
|
|
176
|
+
title: Ct(o),
|
|
177
|
+
totalRows: o.totalRows,
|
|
178
|
+
totalChunks: o.totalChunks,
|
|
179
|
+
completedChunks: o.completedChunks,
|
|
180
|
+
startedAt: new Date(o.createdAt),
|
|
181
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
182
|
+
completedAt: o.completedAt ? new Date(o.completedAt) : void 0,
|
|
183
|
+
fileSize: o.fileSize,
|
|
184
|
+
error: o.error,
|
|
185
|
+
expiresAt: new Date(o.expiresAt),
|
|
186
|
+
downloadUrl: b
|
|
187
|
+
};
|
|
188
|
+
c(h);
|
|
189
|
+
}
|
|
190
|
+
d.current = !0;
|
|
191
|
+
} catch (m) {
|
|
192
|
+
console.error("[useExportRecovery] Failed to recover exports:", m), d.current = !0;
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
}, [u, n, c, p]);
|
|
196
|
+
}
|
|
197
|
+
function Ct(e) {
|
|
198
|
+
return e.title ? e.title : j(
|
|
199
|
+
e.status
|
|
200
|
+
) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
|
|
201
|
+
}
|
|
202
|
+
function xt({
|
|
203
|
+
open: e,
|
|
204
|
+
onOpenChange: a,
|
|
205
|
+
isLibraryVisual: p,
|
|
206
|
+
currentVisualName: c,
|
|
207
|
+
isSaving: d = !1,
|
|
208
|
+
destinationMode: u = "both",
|
|
209
|
+
onConfirm: n
|
|
210
|
+
}) {
|
|
211
|
+
const [l, m] = L(
|
|
212
|
+
p && c ? `Copy of ${c}` : c || ""
|
|
213
|
+
), [o, v] = L("");
|
|
214
|
+
ve.useEffect(() => {
|
|
215
|
+
e && (m(
|
|
216
|
+
p && c ? `Copy of ${c}` : c || ""
|
|
217
|
+
), v(""));
|
|
218
|
+
}, [e, p, c]);
|
|
219
|
+
const b = !!l.trim(), h = u === "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
|
+
} : u === "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
|
+
}, w = () => {
|
|
238
|
+
!b || d || n({
|
|
239
|
+
name: l.trim(),
|
|
240
|
+
description: o.trim() || void 0,
|
|
241
|
+
saveToLibrary: h.saveToLibrary,
|
|
242
|
+
saveToCurrentDashboard: h.saveToCurrentDashboard
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
return /* @__PURE__ */ t(ae, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(se, { className: "sm:max-w-[500px]", children: [
|
|
246
|
+
/* @__PURE__ */ s(re, { children: [
|
|
247
|
+
/* @__PURE__ */ s(oe, { className: "flex items-center gap-2", children: [
|
|
248
|
+
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
249
|
+
h.badgeType !== "local" && /* @__PURE__ */ t(
|
|
250
|
+
st,
|
|
251
|
+
{
|
|
252
|
+
type: h.badgeType,
|
|
253
|
+
showLabel: !0,
|
|
254
|
+
className: "px-2 py-0.5"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ t(ne, { children: h.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(G, { htmlFor: "name", children: "Name" }),
|
|
263
|
+
/* @__PURE__ */ t(
|
|
264
|
+
we,
|
|
265
|
+
{
|
|
266
|
+
id: "name",
|
|
267
|
+
value: l,
|
|
268
|
+
onChange: (D) => m(D.target.value),
|
|
269
|
+
placeholder: "Enter visual name",
|
|
270
|
+
disabled: d
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
275
|
+
/* @__PURE__ */ t(G, { htmlFor: "description", children: "Description (optional)" }),
|
|
276
|
+
/* @__PURE__ */ t(
|
|
277
|
+
Ce,
|
|
278
|
+
{
|
|
279
|
+
id: "description",
|
|
280
|
+
value: o,
|
|
281
|
+
onChange: (D) => v(D.target.value),
|
|
282
|
+
placeholder: "Enter visual description",
|
|
283
|
+
rows: 3,
|
|
284
|
+
disabled: d
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
] })
|
|
288
|
+
] }),
|
|
289
|
+
/* @__PURE__ */ s(xe, { children: [
|
|
290
|
+
/* @__PURE__ */ t(
|
|
291
|
+
S,
|
|
292
|
+
{
|
|
293
|
+
variant: "outline",
|
|
294
|
+
onClick: () => a(!1),
|
|
295
|
+
disabled: d,
|
|
296
|
+
children: "Cancel"
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ s(S, { onClick: w, disabled: !b || d, children: [
|
|
300
|
+
d && /* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
301
|
+
h.actionLabel
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
] }) });
|
|
305
|
+
}
|
|
306
|
+
function yt() {
|
|
307
|
+
const [e, a] = L(!1), [p, c] = L(!1), [d, u] = L(null), n = z((i) => i.frame), l = z((i) => i.card), m = ye(), o = P((i) => i.selectedSheetId), v = P(
|
|
308
|
+
(i) => i.actions.setIsDashboardPanelOpen
|
|
309
|
+
), { getUpdatedFrame: b } = fe(), { selectVisual: h } = Ne(), { addFrame: w, setSelectedFrameId: D, setIsVisualEditing: f } = X(), x = !!(n != null && n.visualId), A = (() => {
|
|
310
|
+
var i, g;
|
|
311
|
+
return ((i = n == null ? void 0 : n.cards) == null ? void 0 : i.length) === 1 && ((g = n.cards[0]) != null && g.title) ? n.cards[0].title : m != null && m.title ? m.title : (l == null ? void 0 : l.title) || "Untitled Visual";
|
|
312
|
+
})(), C = De((i) => {
|
|
313
|
+
if (i != null && i.id) {
|
|
314
|
+
if (h(i), p && d && o) {
|
|
315
|
+
const g = {
|
|
316
|
+
...d,
|
|
317
|
+
id: K(),
|
|
318
|
+
visualId: i.id
|
|
319
|
+
// Link to the newly created library visual
|
|
320
|
+
};
|
|
321
|
+
w(o, g, "end"), D(g.id), c(!1), u(null), f(!1);
|
|
322
|
+
}
|
|
323
|
+
v(!0), a(!1);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
saveAsDialogOpen: e,
|
|
328
|
+
setSaveAsDialogOpen: a,
|
|
329
|
+
handleSaveAs: async (i) => {
|
|
330
|
+
if (!o) {
|
|
331
|
+
R.error("No sheet selected");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const g = b(), y = g.cards.length === 1 ? {
|
|
335
|
+
...g,
|
|
336
|
+
cards: g.cards.map((N) => ({
|
|
337
|
+
...N,
|
|
338
|
+
title: i.name
|
|
339
|
+
// Use visual name as card title
|
|
340
|
+
}))
|
|
341
|
+
} : g;
|
|
342
|
+
if (i.saveToLibrary) {
|
|
343
|
+
c(i.saveToCurrentDashboard), u(y);
|
|
344
|
+
const N = {
|
|
345
|
+
title: i.name,
|
|
346
|
+
description: i.description,
|
|
347
|
+
frameObject: y,
|
|
348
|
+
// Card title synced for single-card frames
|
|
349
|
+
isPrivate: !1
|
|
350
|
+
};
|
|
351
|
+
C.mutate(N);
|
|
352
|
+
} else if (i.saveToCurrentDashboard) {
|
|
353
|
+
const N = {
|
|
354
|
+
...y,
|
|
355
|
+
// Card title already synced
|
|
356
|
+
id: K(),
|
|
357
|
+
visualId: void 0
|
|
358
|
+
// Explicitly no visualId for local visuals
|
|
359
|
+
};
|
|
360
|
+
w(o, N, "end"), D(N.id), R.success("Visual saved to dashboard"), a(!1), f(!1);
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
isLibraryVisual: x,
|
|
364
|
+
currentVisualName: A,
|
|
365
|
+
isSaving: C.isPending
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function Mt({
|
|
369
|
+
className: e
|
|
370
|
+
}) {
|
|
371
|
+
const a = z((y) => y.frame), p = Ae((y) => y.selectedVisual), c = P((y) => y.selectedFrameId), d = P((y) => y.selectedSheetId), { setIsVisualEditing: u, updateFrame: n } = X(), [l, m] = L(!1), [o, v] = L("both"), b = !!(a != null && a.visualId || p != null && p.id), h = !!(a != null && a.visualId && c), w = b && !h, {
|
|
372
|
+
saveAsDialogOpen: D,
|
|
373
|
+
setSaveAsDialogOpen: f,
|
|
374
|
+
handleSaveAs: x,
|
|
375
|
+
isLibraryVisual: A,
|
|
376
|
+
currentVisualName: C,
|
|
377
|
+
isSaving: r
|
|
378
|
+
} = yt(), { getUpdatedFrame: i } = fe(), g = () => {
|
|
379
|
+
if (!d) {
|
|
380
|
+
R.error("No sheet selected");
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (l) return;
|
|
384
|
+
m(!0);
|
|
385
|
+
const N = {
|
|
386
|
+
...i(),
|
|
387
|
+
visualId: void 0
|
|
388
|
+
};
|
|
389
|
+
n(d, N), setTimeout(() => {
|
|
390
|
+
m(!1), R.success("Changes applied. Visual is now local to this dashboard"), u(!1);
|
|
391
|
+
}, 300);
|
|
392
|
+
}, E = (y) => {
|
|
393
|
+
v(y), f(!0);
|
|
394
|
+
};
|
|
395
|
+
return /* @__PURE__ */ s(B, { children: [
|
|
396
|
+
/* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-md border border-input", children: [
|
|
397
|
+
!b && /* @__PURE__ */ t(
|
|
398
|
+
rt,
|
|
399
|
+
{
|
|
400
|
+
className: I(e, "rounded-none border-0"),
|
|
401
|
+
variant: "default"
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
b && w && /* @__PURE__ */ t(
|
|
405
|
+
ot,
|
|
406
|
+
{
|
|
407
|
+
className: I(e, "rounded-none border-0"),
|
|
408
|
+
variant: "default"
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
b && h && /* @__PURE__ */ t(
|
|
412
|
+
nt,
|
|
413
|
+
{
|
|
414
|
+
className: I(e, "rounded-none border-0")
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
/* @__PURE__ */ s(ie, { modal: !1, children: [
|
|
418
|
+
/* @__PURE__ */ t(le, { className: "h-8", asChild: !0, children: /* @__PURE__ */ t(
|
|
419
|
+
S,
|
|
420
|
+
{
|
|
421
|
+
variant: "default",
|
|
422
|
+
size: "sm",
|
|
423
|
+
className: I(
|
|
424
|
+
e,
|
|
425
|
+
"w-8 rounded-none border-0 border-l border-primary-foreground/30 px-2"
|
|
426
|
+
),
|
|
427
|
+
"aria-label": "Open visual save options",
|
|
428
|
+
disabled: r || l,
|
|
429
|
+
children: /* @__PURE__ */ t(de, { className: "h-4 w-4" })
|
|
430
|
+
}
|
|
431
|
+
) }),
|
|
432
|
+
/* @__PURE__ */ s(ce, { align: "end", children: [
|
|
433
|
+
h && /* @__PURE__ */ s(B, { children: [
|
|
434
|
+
/* @__PURE__ */ s(
|
|
435
|
+
M,
|
|
436
|
+
{
|
|
437
|
+
onClick: g,
|
|
438
|
+
disabled: l,
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ t(Ee, { className: "mr-2 h-4 w-4" }),
|
|
441
|
+
l ? "Applying..." : "Apply Locally"
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ t(Se, {})
|
|
446
|
+
] }),
|
|
447
|
+
/* @__PURE__ */ s(
|
|
448
|
+
M,
|
|
449
|
+
{
|
|
450
|
+
onClick: () => E("local"),
|
|
451
|
+
disabled: r,
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ t(Ie, { className: "mr-2 h-4 w-4" }),
|
|
454
|
+
"Add to Dashboard (Local)"
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ s(
|
|
459
|
+
M,
|
|
460
|
+
{
|
|
461
|
+
onClick: () => E("library"),
|
|
462
|
+
disabled: r,
|
|
463
|
+
children: [
|
|
464
|
+
/* @__PURE__ */ t(it, { className: "mr-2 h-4 w-4" }),
|
|
465
|
+
"Save as Library Visual"
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
/* @__PURE__ */ s(
|
|
470
|
+
M,
|
|
471
|
+
{
|
|
472
|
+
onClick: () => E("both"),
|
|
473
|
+
disabled: r,
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ t(lt, { className: "mr-2 h-4 w-4" }),
|
|
476
|
+
"Save Copy as Linked Visual"
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
] })
|
|
481
|
+
] })
|
|
482
|
+
] }),
|
|
483
|
+
/* @__PURE__ */ t(dt, { className: e }),
|
|
484
|
+
/* @__PURE__ */ t(
|
|
485
|
+
xt,
|
|
486
|
+
{
|
|
487
|
+
open: D,
|
|
488
|
+
onOpenChange: (y) => {
|
|
489
|
+
r || f(y);
|
|
490
|
+
},
|
|
491
|
+
isLibraryVisual: A,
|
|
492
|
+
currentVisualName: C,
|
|
493
|
+
isSaving: r,
|
|
494
|
+
destinationMode: o,
|
|
495
|
+
onConfirm: x
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
] });
|
|
499
|
+
}
|
|
500
|
+
function Vt({
|
|
501
|
+
className: e,
|
|
502
|
+
//labelClassName,
|
|
503
|
+
switchClassName: a
|
|
504
|
+
}) {
|
|
505
|
+
const p = z((l) => l.isDevMode), c = P((l) => l.isVisualEditing), { setIsDevMode: d } = Le(), { config: u } = ge(Te).tokenProps, n = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
506
|
+
return !c || !n ? null : /* @__PURE__ */ s("div", { className: I("flex items-center space-x-2", e), children: [
|
|
507
|
+
/* @__PURE__ */ t(
|
|
508
|
+
Fe,
|
|
509
|
+
{
|
|
510
|
+
className: I("", a),
|
|
511
|
+
checked: p,
|
|
512
|
+
onCheckedChange: () => d(!p),
|
|
513
|
+
id: "advanced-mode",
|
|
514
|
+
icon: /* @__PURE__ */ t(ke, { className: "h-4 w-4" }),
|
|
515
|
+
tooltip: "Advanced Mode"
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ t("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
519
|
+
] });
|
|
520
|
+
}
|
|
521
|
+
function Pt({
|
|
522
|
+
open: e,
|
|
523
|
+
onOpenChange: a,
|
|
524
|
+
onSave: p,
|
|
525
|
+
onDiscard: c,
|
|
526
|
+
isSaving: d,
|
|
527
|
+
title: u = "Unsaved Changes",
|
|
528
|
+
description: n = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
529
|
+
cancelLabel: l = "Cancel",
|
|
530
|
+
discardLabel: m = "Discard",
|
|
531
|
+
saveLabel: o = "Save & Close"
|
|
532
|
+
}) {
|
|
533
|
+
return /* @__PURE__ */ t(Ue, { open: e, onOpenChange: (b) => {
|
|
534
|
+
!b && d || a(b);
|
|
535
|
+
}, children: /* @__PURE__ */ s(Me, { className: "max-w-[520px] border-border/70 p-6", children: [
|
|
536
|
+
/* @__PURE__ */ s(Ve, { className: "space-y-3", children: [
|
|
537
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
538
|
+
/* @__PURE__ */ t("div", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-amber-50 ring-1 ring-amber-200/70", children: /* @__PURE__ */ t(Pe, { className: "h-[18px] w-[18px] text-amber-600" }) }),
|
|
539
|
+
/* @__PURE__ */ t(Be, { className: "text-lg font-semibold tracking-tight", children: u })
|
|
540
|
+
] }),
|
|
541
|
+
/* @__PURE__ */ t(Oe, { className: "text-sm leading-6 text-muted-foreground", children: n })
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ s(ze, { className: "mt-2 flex-col gap-1.5 sm:flex-row sm:justify-end", children: [
|
|
544
|
+
/* @__PURE__ */ t(
|
|
545
|
+
Re,
|
|
546
|
+
{
|
|
547
|
+
disabled: d,
|
|
548
|
+
className: "order-1 m-0 h-auto min-h-9 whitespace-normal border-border/60 px-4 py-2 text-center leading-5 sm:order-1",
|
|
549
|
+
children: l
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ t(
|
|
553
|
+
"button",
|
|
554
|
+
{
|
|
555
|
+
onClick: c,
|
|
556
|
+
disabled: d,
|
|
557
|
+
className: "order-2 h-auto min-h-9 whitespace-normal rounded-md border border-destructive/30 bg-destructive/10 px-4 py-2 text-center text-sm font-medium leading-5 text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",
|
|
558
|
+
children: m
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ t(
|
|
562
|
+
$e,
|
|
563
|
+
{
|
|
564
|
+
onClick: p,
|
|
565
|
+
disabled: d,
|
|
566
|
+
className: "order-3 m-0 h-auto min-h-9 whitespace-normal px-4 py-2 text-center leading-5 sm:order-3",
|
|
567
|
+
children: d ? /* @__PURE__ */ s(B, { children: [
|
|
568
|
+
/* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
569
|
+
"Saving..."
|
|
570
|
+
] }) : o
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
] })
|
|
574
|
+
] }) });
|
|
575
|
+
}
|
|
576
|
+
function Bt(e, a, p, c) {
|
|
577
|
+
F(() => {
|
|
578
|
+
e && !p && a && c(je(a));
|
|
579
|
+
}, [e, p, a, c]);
|
|
580
|
+
}
|
|
581
|
+
function Nt({
|
|
582
|
+
export: e,
|
|
583
|
+
onRemove: a
|
|
584
|
+
}) {
|
|
585
|
+
const p = () => {
|
|
586
|
+
e.downloadUrl && window.open(e.downloadUrl, "_blank");
|
|
587
|
+
}, c = (l) => {
|
|
588
|
+
l.stopPropagation(), a == null || a(e.id);
|
|
589
|
+
}, d = () => {
|
|
590
|
+
switch (e.status) {
|
|
591
|
+
case "completed":
|
|
592
|
+
return /* @__PURE__ */ t(Ke, { className: "mt-0.5 h-5 w-5 shrink-0 text-green-600" });
|
|
593
|
+
case "failed":
|
|
594
|
+
return /* @__PURE__ */ t(ct, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" });
|
|
595
|
+
default:
|
|
596
|
+
return /* @__PURE__ */ t(H, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
|
|
597
|
+
}
|
|
598
|
+
}, u = j(e.status), n = (() => {
|
|
599
|
+
switch (e.status) {
|
|
600
|
+
case "pending":
|
|
601
|
+
return "Queued...";
|
|
602
|
+
case "processing":
|
|
603
|
+
return "Processing...";
|
|
604
|
+
case "chunking":
|
|
605
|
+
return "Processing...";
|
|
606
|
+
case "compacting":
|
|
607
|
+
return "Finalizing...";
|
|
608
|
+
default:
|
|
609
|
+
return "Processing...";
|
|
610
|
+
}
|
|
611
|
+
})();
|
|
612
|
+
return /* @__PURE__ */ s("div", { className: "group p-4 transition-colors hover:bg-muted/50", children: [
|
|
613
|
+
/* @__PURE__ */ s("div", { className: "mb-2 flex items-start justify-between gap-3", children: [
|
|
614
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
|
|
615
|
+
d(),
|
|
616
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
617
|
+
/* @__PURE__ */ t("h4", { className: "mb-1 truncate text-sm font-medium", children: e.title }),
|
|
618
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
619
|
+
/* @__PURE__ */ s("span", { children: [
|
|
620
|
+
e.totalRows.toLocaleString(),
|
|
621
|
+
" rows"
|
|
622
|
+
] }),
|
|
623
|
+
e.fileSize && /* @__PURE__ */ s(B, { children: [
|
|
624
|
+
/* @__PURE__ */ t("span", { children: "•" }),
|
|
625
|
+
/* @__PURE__ */ t("span", { children: _e(e.fileSize) })
|
|
626
|
+
] })
|
|
627
|
+
] }),
|
|
628
|
+
u && /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: n }),
|
|
629
|
+
e.status === "failed" && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-xs text-destructive", children: e.error || "Export failed" })
|
|
630
|
+
] })
|
|
631
|
+
] }),
|
|
632
|
+
/* @__PURE__ */ t(
|
|
633
|
+
S,
|
|
634
|
+
{
|
|
635
|
+
variant: "ghost",
|
|
636
|
+
size: "icon",
|
|
637
|
+
className: "h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",
|
|
638
|
+
onClick: c,
|
|
639
|
+
"aria-label": "Remove notification",
|
|
640
|
+
children: /* @__PURE__ */ t(He, { className: "h-4 w-4" })
|
|
641
|
+
}
|
|
642
|
+
)
|
|
643
|
+
] }),
|
|
644
|
+
/* @__PURE__ */ s("div", { className: "ml-8", children: [
|
|
645
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
646
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: W(e.startedAt, { addSuffix: !0 }) }),
|
|
647
|
+
e.downloadUrl && /* @__PURE__ */ s(
|
|
648
|
+
S,
|
|
649
|
+
{
|
|
650
|
+
size: "sm",
|
|
651
|
+
variant: "outline",
|
|
652
|
+
className: "h-8 bg-transparent",
|
|
653
|
+
onClick: p,
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ t(Xe, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
656
|
+
"Download"
|
|
657
|
+
]
|
|
658
|
+
}
|
|
659
|
+
)
|
|
660
|
+
] }),
|
|
661
|
+
u && /* @__PURE__ */ s("div", { children: [
|
|
662
|
+
/* @__PURE__ */ t(Ge, { value: e.progress, className: "h-1.5" }),
|
|
663
|
+
/* @__PURE__ */ s("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
|
|
664
|
+
e.progress,
|
|
665
|
+
"% complete"
|
|
666
|
+
] })
|
|
667
|
+
] }),
|
|
668
|
+
e.status === "failed" && /* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: W(e.startedAt, { addSuffix: !0 }) })
|
|
669
|
+
] })
|
|
670
|
+
] });
|
|
671
|
+
}
|
|
672
|
+
function Dt() {
|
|
673
|
+
const { authToken: e, tokenProps: a } = $(), p = U((f) => f.activeExports), { clearCompleted: c, removeExport: d, updateExport: u } = te(), [n, l] = L(!1), [m, o] = L(!1), v = Array.from(p.values()).sort(
|
|
674
|
+
(f, x) => x.startedAt.getTime() - f.startedAt.getTime()
|
|
675
|
+
), b = v.some(
|
|
676
|
+
(f) => f.status === "completed" || f.status === "failed"
|
|
677
|
+
), h = V(async () => {
|
|
678
|
+
const f = a == null ? void 0 : a.apiServiceUrl, x = e == null ? void 0 : e.accessToken;
|
|
679
|
+
if (!(!f || !x)) {
|
|
680
|
+
l(!0);
|
|
681
|
+
try {
|
|
682
|
+
const A = Array.from(p.values());
|
|
683
|
+
await Promise.all(
|
|
684
|
+
A.map(async (C) => {
|
|
685
|
+
try {
|
|
686
|
+
const r = await ee(f, x, C.id);
|
|
687
|
+
let i;
|
|
688
|
+
if (r.status === "completed")
|
|
689
|
+
try {
|
|
690
|
+
i = await _(
|
|
691
|
+
f,
|
|
692
|
+
x,
|
|
693
|
+
C.id
|
|
694
|
+
);
|
|
695
|
+
} catch (g) {
|
|
696
|
+
console.error(`Failed to get download URL for ${C.id}:`, g);
|
|
697
|
+
}
|
|
698
|
+
u(C.id, {
|
|
699
|
+
status: r.status,
|
|
700
|
+
progress: r.progress,
|
|
701
|
+
completedChunks: r.completedChunks,
|
|
702
|
+
completedAt: r.completedAt ? new Date(r.completedAt) : void 0,
|
|
703
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
704
|
+
fileSize: r.fileSize,
|
|
705
|
+
error: r.error,
|
|
706
|
+
downloadUrl: i
|
|
707
|
+
});
|
|
708
|
+
} catch (r) {
|
|
709
|
+
console.error(`Failed to refresh export ${C.id}:`, r);
|
|
710
|
+
}
|
|
711
|
+
})
|
|
712
|
+
);
|
|
713
|
+
} finally {
|
|
714
|
+
l(!1);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}, [
|
|
718
|
+
p,
|
|
719
|
+
e == null ? void 0 : e.accessToken,
|
|
720
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
721
|
+
u
|
|
722
|
+
]), w = V(async () => {
|
|
723
|
+
const f = a == null ? void 0 : a.apiServiceUrl, x = e == null ? void 0 : e.accessToken;
|
|
724
|
+
if (!f || !x) {
|
|
725
|
+
c();
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
o(!0);
|
|
729
|
+
try {
|
|
730
|
+
const A = v.filter(
|
|
731
|
+
(r) => r.status === "completed" || r.status === "failed"
|
|
732
|
+
), C = await Promise.allSettled(
|
|
733
|
+
A.map(async (r) => (await q(f, x, r.id), r.id))
|
|
734
|
+
);
|
|
735
|
+
for (const r of C)
|
|
736
|
+
r.status === "fulfilled" ? d(r.value) : console.error("Failed to delete export:", r.reason);
|
|
737
|
+
} finally {
|
|
738
|
+
o(!1);
|
|
739
|
+
}
|
|
740
|
+
}, [
|
|
741
|
+
v,
|
|
742
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
743
|
+
e == null ? void 0 : e.accessToken,
|
|
744
|
+
c,
|
|
745
|
+
d
|
|
746
|
+
]), D = V(
|
|
747
|
+
async (f) => {
|
|
748
|
+
const x = a == null ? void 0 : a.apiServiceUrl, A = e == null ? void 0 : e.accessToken;
|
|
749
|
+
if (x && A)
|
|
750
|
+
try {
|
|
751
|
+
await q(x, A, f), d(f);
|
|
752
|
+
return;
|
|
753
|
+
} catch (C) {
|
|
754
|
+
console.error(`Failed to cancel export ${f}:`, C);
|
|
755
|
+
}
|
|
756
|
+
d(f);
|
|
757
|
+
},
|
|
758
|
+
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, d]
|
|
759
|
+
);
|
|
760
|
+
return v.length === 0 ? /* @__PURE__ */ s("div", { className: "p-6 text-center", children: [
|
|
761
|
+
/* @__PURE__ */ t(J, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
|
|
762
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No active exports" }),
|
|
763
|
+
/* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Large exports will appear here" })
|
|
764
|
+
] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
|
|
765
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
|
|
766
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
767
|
+
/* @__PURE__ */ t(J, { className: "h-5 w-5 text-muted-foreground" }),
|
|
768
|
+
/* @__PURE__ */ t("h4", { className: "font-semibold", children: "Exports" })
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
771
|
+
/* @__PURE__ */ t(
|
|
772
|
+
S,
|
|
773
|
+
{
|
|
774
|
+
variant: "ghost",
|
|
775
|
+
size: "sm",
|
|
776
|
+
className: "h-7 w-7 p-0",
|
|
777
|
+
onClick: h,
|
|
778
|
+
disabled: n,
|
|
779
|
+
title: "Refresh status",
|
|
780
|
+
children: /* @__PURE__ */ t(
|
|
781
|
+
qe,
|
|
782
|
+
{
|
|
783
|
+
className: `h-4 w-4 ${n ? "animate-spin" : ""}`
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
b && /* @__PURE__ */ t(
|
|
789
|
+
S,
|
|
790
|
+
{
|
|
791
|
+
variant: "ghost",
|
|
792
|
+
size: "sm",
|
|
793
|
+
className: "h-7 px-2 text-sm",
|
|
794
|
+
onClick: w,
|
|
795
|
+
disabled: m,
|
|
796
|
+
children: m ? "Clearing..." : "Clear all"
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
] })
|
|
800
|
+
] }),
|
|
801
|
+
/* @__PURE__ */ t("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y", children: v.map((f) => /* @__PURE__ */ t(
|
|
802
|
+
Nt,
|
|
803
|
+
{
|
|
804
|
+
export: f,
|
|
805
|
+
onRemove: D
|
|
806
|
+
},
|
|
807
|
+
f.id
|
|
808
|
+
)) }) })
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
function Ot({
|
|
812
|
+
variant: e
|
|
813
|
+
}) {
|
|
814
|
+
const a = U((m) => m.activeExports), p = Qe(), c = a.size > 0, d = Array.from(a.values()).some(
|
|
815
|
+
(m) => m.status === "completed" || m.status === "failed"
|
|
816
|
+
), n = p > 0 ? p > 9 ? "9+" : String(p) : null;
|
|
817
|
+
return /* @__PURE__ */ s(ue, { children: [
|
|
818
|
+
/* @__PURE__ */ t(me, { asChild: !0, children: /* @__PURE__ */ s(
|
|
819
|
+
S,
|
|
820
|
+
{
|
|
821
|
+
variant: e ?? "ghost",
|
|
822
|
+
size: "icon",
|
|
823
|
+
className: "relative h-8 w-8",
|
|
824
|
+
"aria-label": "Export notifications",
|
|
825
|
+
children: [
|
|
826
|
+
/* @__PURE__ */ t(We, { className: "h-4 w-4" }),
|
|
827
|
+
c && /* @__PURE__ */ t(
|
|
828
|
+
"span",
|
|
829
|
+
{
|
|
830
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${n ? "-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold" : "right-0.5 top-0.5 h-2 w-2"}`,
|
|
831
|
+
children: n
|
|
832
|
+
}
|
|
833
|
+
)
|
|
834
|
+
]
|
|
835
|
+
}
|
|
836
|
+
) }),
|
|
837
|
+
/* @__PURE__ */ t(he, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(Dt, {}) })
|
|
838
|
+
] });
|
|
839
|
+
}
|
|
840
|
+
function At(e) {
|
|
841
|
+
if (e)
|
|
842
|
+
return {
|
|
843
|
+
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
844
|
+
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
845
|
+
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
846
|
+
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function zt({
|
|
850
|
+
open: e,
|
|
851
|
+
onOpenChange: a,
|
|
852
|
+
trigger: p,
|
|
853
|
+
showTrigger: c = !0,
|
|
854
|
+
initialMode: d = "manage"
|
|
855
|
+
}) {
|
|
856
|
+
const u = d === "create", {
|
|
857
|
+
forceClose: n,
|
|
858
|
+
handleOpenChange: l,
|
|
859
|
+
isCreateFlowActive: m,
|
|
860
|
+
preventPassiveDismissDuringCreate: o,
|
|
861
|
+
resolvedOpen: v,
|
|
862
|
+
setIsCreateFlowActive: b
|
|
863
|
+
} = ut({
|
|
864
|
+
open: e,
|
|
865
|
+
onOpenChange: a,
|
|
866
|
+
initialCreateFlowActive: d === "create"
|
|
867
|
+
}), h = P((N) => N.dashboard), { setDashboardControlsModel: w } = X(), { participants: D } = Je(Ye(h)), f = Array.from(
|
|
868
|
+
new Map(
|
|
869
|
+
D.flatMap(
|
|
870
|
+
(N) => N.fieldChoices.map((T) => {
|
|
871
|
+
var k;
|
|
872
|
+
return [
|
|
873
|
+
T.value,
|
|
874
|
+
{
|
|
875
|
+
option: T,
|
|
876
|
+
target: (k = N.fieldTargetMap) == null ? void 0 : k[T.value]
|
|
877
|
+
}
|
|
878
|
+
];
|
|
879
|
+
})
|
|
880
|
+
)
|
|
881
|
+
).values()
|
|
882
|
+
), x = Array.from(
|
|
883
|
+
new Map(
|
|
884
|
+
D.flatMap(
|
|
885
|
+
(N) => N.metricChoices.map((T) => {
|
|
886
|
+
var k;
|
|
887
|
+
return [
|
|
888
|
+
T.value,
|
|
889
|
+
{
|
|
890
|
+
option: T,
|
|
891
|
+
target: (k = N.metricTargetMap) == null ? void 0 : k[T.value]
|
|
892
|
+
}
|
|
893
|
+
];
|
|
894
|
+
})
|
|
895
|
+
)
|
|
896
|
+
).values()
|
|
897
|
+
), A = Ze({
|
|
898
|
+
...h || {},
|
|
899
|
+
controls: []
|
|
900
|
+
}), C = et(h), r = (N, T, k) => {
|
|
901
|
+
w(
|
|
902
|
+
N,
|
|
903
|
+
T,
|
|
904
|
+
At(k)
|
|
905
|
+
);
|
|
906
|
+
}, i = V(() => {
|
|
907
|
+
if (u) {
|
|
908
|
+
n();
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
b(!1);
|
|
912
|
+
}, [u, n, b]), g = /* @__PURE__ */ t(
|
|
913
|
+
mt,
|
|
914
|
+
{
|
|
915
|
+
scope: "dashboard",
|
|
916
|
+
controls: h.controls || [],
|
|
917
|
+
reservedControlIds: A,
|
|
918
|
+
defaultValues: h.defaultControlValues || {},
|
|
919
|
+
usageByControlId: tt(h),
|
|
920
|
+
availableFieldChoices: f,
|
|
921
|
+
availableMetricChoices: x,
|
|
922
|
+
structuralParticipants: D,
|
|
923
|
+
structuralParticipantIdsByControlId: C,
|
|
924
|
+
initialCreateFlow: d === "create",
|
|
925
|
+
onCreateFlowActiveChange: b,
|
|
926
|
+
onCreateFlowComplete: i,
|
|
927
|
+
onChange: r,
|
|
928
|
+
emptyMessage: "No dashboard controls yet."
|
|
929
|
+
}
|
|
930
|
+
), E = m ? "Add dashboard control" : "Dashboard Controls", y = /* @__PURE__ */ s(B, { children: [
|
|
931
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
932
|
+
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
933
|
+
/* @__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." })
|
|
934
|
+
] }),
|
|
935
|
+
g
|
|
936
|
+
] });
|
|
937
|
+
return c ? /* @__PURE__ */ s(ue, { open: v, onOpenChange: l, children: [
|
|
938
|
+
/* @__PURE__ */ t(me, { asChild: !0, children: p || /* @__PURE__ */ s(S, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
939
|
+
/* @__PURE__ */ t(pe, { className: "mr-2 h-4 w-4" }),
|
|
940
|
+
"Controls"
|
|
941
|
+
] }) }),
|
|
942
|
+
/* @__PURE__ */ t(
|
|
943
|
+
he,
|
|
944
|
+
{
|
|
945
|
+
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
946
|
+
align: "end",
|
|
947
|
+
onEscapeKeyDown: o,
|
|
948
|
+
onPointerDownOutside: o,
|
|
949
|
+
children: y
|
|
950
|
+
}
|
|
951
|
+
)
|
|
952
|
+
] }) : /* @__PURE__ */ t(ae, { open: v, onOpenChange: l, children: /* @__PURE__ */ s(
|
|
953
|
+
se,
|
|
954
|
+
{
|
|
955
|
+
className: "flex max-h-[88vh] max-w-[980px] flex-col overflow-hidden",
|
|
956
|
+
showCloseButton: !m,
|
|
957
|
+
onEscapeKeyDown: o,
|
|
958
|
+
onPointerDownOutside: o,
|
|
959
|
+
children: [
|
|
960
|
+
/* @__PURE__ */ s(
|
|
961
|
+
re,
|
|
962
|
+
{
|
|
963
|
+
className: m ? "space-y-0" : void 0,
|
|
964
|
+
children: [
|
|
965
|
+
/* @__PURE__ */ t(oe, { children: E }),
|
|
966
|
+
/* @__PURE__ */ t(ne, { className: m ? "sr-only" : void 0, children: m ? "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." })
|
|
967
|
+
]
|
|
968
|
+
}
|
|
969
|
+
),
|
|
970
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: g })
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
) });
|
|
974
|
+
}
|
|
975
|
+
function Rt({
|
|
976
|
+
showFilters: e,
|
|
977
|
+
onToggleFilters: a,
|
|
978
|
+
onAddFilter: p,
|
|
979
|
+
onAddControl: c,
|
|
980
|
+
onManageControls: d,
|
|
981
|
+
size: u = "default",
|
|
982
|
+
className: n,
|
|
983
|
+
primaryButtonClassName: l,
|
|
984
|
+
secondaryButtonClassName: m,
|
|
985
|
+
dropdownContentClassName: o
|
|
986
|
+
}) {
|
|
987
|
+
const v = u === "toolbar";
|
|
988
|
+
return /* @__PURE__ */ s(
|
|
989
|
+
"div",
|
|
990
|
+
{
|
|
991
|
+
className: I(
|
|
992
|
+
"relative inline-flex items-stretch overflow-visible rounded-md border border-input bg-background shadow-none",
|
|
993
|
+
n
|
|
994
|
+
),
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ s(
|
|
997
|
+
S,
|
|
998
|
+
{
|
|
999
|
+
variant: "ghost",
|
|
1000
|
+
className: I(
|
|
1001
|
+
v ? "h-8" : "h-7",
|
|
1002
|
+
"rounded-none border-0 bg-transparent pl-3 pr-2 shadow-none hover:bg-accent/50",
|
|
1003
|
+
l
|
|
1004
|
+
),
|
|
1005
|
+
onClick: a,
|
|
1006
|
+
size: "sm",
|
|
1007
|
+
children: [
|
|
1008
|
+
e ? /* @__PURE__ */ t(ht, { className: "mr-2 h-4 w-4" }) : /* @__PURE__ */ t(Q, { className: "mr-2 h-4 w-4" }),
|
|
1009
|
+
"Filter"
|
|
1010
|
+
]
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
/* @__PURE__ */ s(ie, { children: [
|
|
1014
|
+
/* @__PURE__ */ t(le, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1015
|
+
S,
|
|
1016
|
+
{
|
|
1017
|
+
className: I(
|
|
1018
|
+
v ? "h-8 w-8" : "h-7 w-8",
|
|
1019
|
+
"rounded-none border-0 bg-transparent px-1 shadow-none hover:bg-accent/50",
|
|
1020
|
+
m
|
|
1021
|
+
),
|
|
1022
|
+
variant: "ghost",
|
|
1023
|
+
size: "sm",
|
|
1024
|
+
"aria-label": "Filter and control actions",
|
|
1025
|
+
children: /* @__PURE__ */ t(de, { className: "h-4 w-4" })
|
|
1026
|
+
}
|
|
1027
|
+
) }),
|
|
1028
|
+
/* @__PURE__ */ s(
|
|
1029
|
+
ce,
|
|
1030
|
+
{
|
|
1031
|
+
align: "start",
|
|
1032
|
+
className: I("rounded-xl border border-border/60 p-1 shadow-sm", o),
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ s(M, { onSelect: p, children: [
|
|
1035
|
+
/* @__PURE__ */ t(Q, { className: "mr-2 h-4 w-4" }),
|
|
1036
|
+
"Add filter"
|
|
1037
|
+
] }),
|
|
1038
|
+
/* @__PURE__ */ s(M, { onSelect: c, children: [
|
|
1039
|
+
/* @__PURE__ */ t(pe, { className: "mr-2 h-4 w-4" }),
|
|
1040
|
+
"Add control"
|
|
1041
|
+
] }),
|
|
1042
|
+
/* @__PURE__ */ s(M, { onSelect: d, children: [
|
|
1043
|
+
/* @__PURE__ */ t(at, { className: "mr-2 h-4 w-4" }),
|
|
1044
|
+
"Manage controls"
|
|
1045
|
+
] })
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
] })
|
|
1050
|
+
]
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
export {
|
|
1055
|
+
Vt as A,
|
|
1056
|
+
zt as D,
|
|
1057
|
+
Dt as E,
|
|
1058
|
+
Ot as N,
|
|
1059
|
+
Pt as U,
|
|
1060
|
+
Mt as V,
|
|
1061
|
+
Nt as a,
|
|
1062
|
+
Ut as b,
|
|
1063
|
+
Rt as c,
|
|
1064
|
+
Bt as d,
|
|
1065
|
+
kt as u
|
|
1066
|
+
};
|