react-semaphor 0.1.534 → 0.1.535
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/brand-studio/index.js +25 -25
- package/dist/briefings/index.js +1 -1
- package/dist/chunks/{calculated-field-identity-Cz1ZU_UL.js → calculated-field-identity-BptYhyOP.js} +4 -4
- package/dist/chunks/{card-config-utils-BlIiFn0O.js → card-config-utils-C-QfuqEy.js} +50 -51
- package/dist/chunks/{dashboard-CCK80YKL.js → dashboard-B7y_WeF2.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-DwSxDtgZ.js +4224 -0
- package/dist/chunks/{dashboard-controls-CoiTGnEr.js → dashboard-controls-CzTh9J0s.js} +862 -873
- package/dist/chunks/{dashboard-json-BRGozO--.js → dashboard-json-o6tOjNhH.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CZFnhGZQ.js → edit-dashboard-visual-Lp_iKRGH.js} +8983 -8749
- package/dist/chunks/{index-BQl5rC54.js → index-P5aUuGF1.js} +1 -1
- package/dist/chunks/{matrix-control-sources-Tls-h3AN.js → matrix-control-sources-DTqcA2_L.js} +1 -1
- package/dist/chunks/report-preferences-dialog-BaUr346O.js +1623 -0
- package/dist/chunks/{layout-grid-CiubineE.js → save-kO6cIaob.js} +20 -2
- package/dist/chunks/{semaphor-ready-indicator-z4SNdxiC.js → semaphor-ready-indicator-B017OW6t.js} +61957 -76531
- package/dist/chunks/slider-CrLoCpsr.js +2383 -0
- package/dist/chunks/{switch-BR3Xgbqr.js → switch-ojmMsFMO.js} +4355 -4779
- package/dist/chunks/upload-CAIpsti1.js +15 -0
- package/dist/chunks/use-create-flow-overlay-state-BbwQ0gpQ.js +1457 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/index.js +221 -220
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/components/surfboard/controls/dashboard-filter-controls-launcher.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard-query.d.ts +0 -2
- package/dist/types/lib/hooks/use-dashboard.d.ts +0 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +1 -11
- package/dist/types/lib/stores/editor-store.d.ts +1 -10
- package/dist/types/lib/types/ai-context-types.d.ts +20 -0
- package/dist/types/lib/types/common-types.d.ts +1 -20
- package/dist/types/lib/types/token-types.d.ts +0 -7
- package/dist/types/lib/utils.d.ts +0 -2
- package/package.json +1 -7
- package/dist/chunks/dashboard-briefing-launcher-B9Fq2Rf3.js +0 -3489
- package/dist/chunks/editor-action-buttons-CVtSO3I3.js +0 -2067
- package/dist/chunks/report-preferences-dialog-CWdTlWsr.js +0 -1231
- package/dist/chunks/save-DgMfP0j8.js +0 -21
- package/dist/chunks/slider-DbwmuVB-.js +0 -875
- package/dist/dashboard-assistant/index.js +0 -11
- package/dist/types/dashboard-assistant/index.d.ts +0 -80
- package/dist/types/dashboard-assistant.d.ts +0 -2
- package/dist/types/lib/types/assistant-types.d.ts +0 -127
|
@@ -1,3489 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as r, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import Dt, { useState as E, useEffect as Y, useMemo as Z, useCallback as H, useLayoutEffect as yt, useRef as ue, useContext as Kt } from "react";
|
|
3
|
-
import { B as R, m as ke, r as at, L as ae, k as kt, d as Et, a6 as $, c as K, j as Xt, u as T, a2 as fe, a0 as ve, aN as nt, a3 as At, P as ze, a as $e, b as je, aY as Yt, S as It, aZ as Qt, a_ as Zt, a$ as Jt, b0 as er, a4 as tr } from "./switch-BR3Xgbqr.js";
|
|
4
|
-
import { cm as st, aK as Ee, aL as Ae, aN as Ie, b6 as Lt, ay as rr, cn as ar, co as nr, bn as xe, c0 as Ft, be as We, q as sr, m as or, cp as ir, ce as ot, cf as it, cg as lt, ch as dt, ci as ct, cj as ut, ck as ht, cl as Tt, bc as mt, cq as lr, cr as dr, cs as Je, c1 as Ge, c2 as Ke, ct as Bt, c3 as Xe, bJ as G, cc as cr, cb as He, cu as ur, bH as hr, aM as pt, aO as ft, cv as mr, aJ as pr, b5 as fr, bq as Rt, cw as gr, bQ as br, u as xr, cx as vr, cy as yr, aD as Ye, L as me, av as De, ar as Ut, as as qe, cz as z, N as Vt, aq as Cr, cA as wr, ax as Nr, R as Pt, cB as Sr, cC as Dr, at as Ct, P as kr, cD as Er, cE as Ar, cF as Ir, cG as Lr, cH as Fr, cI as Tr, cJ as Mt, cK as Br, cL as Rr, cM as Ur, c4 as _t, cN as Vr, cO as Pr, cP as Me, cQ as Mr, cR as _r, cS as Or, am as zr, an as $r, a2 as jr, a1 as Wr, a0 as Hr, $ as qr, Y as Gr, W as Kr, cT as Xr, cU as Yr, cV as Qr, cW as Zr, cX as Jr, ak as ea, cY as ta, cZ as ra, a8 as aa, c_ as na, c$ as sa, d0 as oa } from "./semaphor-ready-indicator-z4SNdxiC.js";
|
|
5
|
-
import { L as gt } from "./layout-grid-CiubineE.js";
|
|
6
|
-
import { c as Le, X as Qe, C as Ot } from "./x-CXDkqdur.js";
|
|
7
|
-
import { a as bt, V as ia, E as et, b as tt, c as la, d as da, L as ca, e as ua, g as zt, C as $t, F as ha, h as ma } from "./editor-action-buttons-CVtSO3I3.js";
|
|
8
|
-
import "./validators-DMSH81OM.js";
|
|
9
|
-
import "./matrix-operation-contract-BKupLHXL.js";
|
|
10
|
-
import "zod";
|
|
11
|
-
import "../value-format-preferences/index.js";
|
|
12
|
-
import { S as pa } from "./selection-reducer-CiDEtmAq.js";
|
|
13
|
-
import { s as _e } from "./normalize-dashboard-for-dirty-check-Bk3VYv_q.js";
|
|
14
|
-
import { v as wt, s as fa } from "./card-config-utils-BlIiFn0O.js";
|
|
15
|
-
import { l as Nt } from "./matrix-formatter-DJCk8Znf.js";
|
|
16
|
-
import { l as ga } from "./bookmark-state-B-I9BDD0.js";
|
|
17
|
-
import { d as oe, e as ba, h as xa } from "./index-BQl5rC54.js";
|
|
18
|
-
/**
|
|
19
|
-
* @license lucide-react v0.453.0 - ISC
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the ISC license.
|
|
22
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/
|
|
24
|
-
const va = Le("ArrowUpRight", [
|
|
25
|
-
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
26
|
-
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
27
|
-
]);
|
|
28
|
-
/**
|
|
29
|
-
* @license lucide-react v0.453.0 - ISC
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the ISC license.
|
|
32
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/
|
|
34
|
-
const ya = Le("CalendarRange", [
|
|
35
|
-
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
36
|
-
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
37
|
-
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
38
|
-
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
39
|
-
["path", { d: "M17 14h-6", key: "bkmgh3" }],
|
|
40
|
-
["path", { d: "M13 18H7", key: "bb0bb7" }],
|
|
41
|
-
["path", { d: "M7 14h.01", key: "1qa3f1" }],
|
|
42
|
-
["path", { d: "M17 18h.01", key: "1bdyru" }]
|
|
43
|
-
]);
|
|
44
|
-
/**
|
|
45
|
-
* @license lucide-react v0.453.0 - ISC
|
|
46
|
-
*
|
|
47
|
-
* This source code is licensed under the ISC license.
|
|
48
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/
|
|
50
|
-
const Ca = Le("FileDown", [
|
|
51
|
-
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
52
|
-
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
53
|
-
["path", { d: "M12 18v-6", key: "17g6i2" }],
|
|
54
|
-
["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
|
|
55
|
-
]);
|
|
56
|
-
/**
|
|
57
|
-
* @license lucide-react v0.453.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/
|
|
62
|
-
const wa = Le("MousePointer2", [
|
|
63
|
-
[
|
|
64
|
-
"path",
|
|
65
|
-
{
|
|
66
|
-
d: "M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",
|
|
67
|
-
key: "edeuup"
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
]);
|
|
71
|
-
/**
|
|
72
|
-
* @license lucide-react v0.453.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/
|
|
77
|
-
const Na = Le("Newspaper", [
|
|
78
|
-
[
|
|
79
|
-
"path",
|
|
80
|
-
{
|
|
81
|
-
d: "M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",
|
|
82
|
-
key: "7pis2x"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
["path", { d: "M18 14h-8", key: "sponae" }],
|
|
86
|
-
["path", { d: "M15 18h-5", key: "95g1m2" }],
|
|
87
|
-
["path", { d: "M10 6h8v4h-8V6Z", key: "smlsk5" }]
|
|
88
|
-
]);
|
|
89
|
-
function Sa() {
|
|
90
|
-
return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, a) => /* @__PURE__ */ r(
|
|
91
|
-
"div",
|
|
92
|
-
{
|
|
93
|
-
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
94
|
-
children: [
|
|
95
|
-
/* @__PURE__ */ t("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
96
|
-
/* @__PURE__ */ r("div", { className: "flex-1 space-y-1.5", children: [
|
|
97
|
-
/* @__PURE__ */ t("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
98
|
-
/* @__PURE__ */ t("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
99
|
-
] })
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
a
|
|
103
|
-
)) });
|
|
104
|
-
}
|
|
105
|
-
function Da({
|
|
106
|
-
open: e,
|
|
107
|
-
onOpenChange: a,
|
|
108
|
-
onSubmit: i,
|
|
109
|
-
isCreating: n
|
|
110
|
-
}) {
|
|
111
|
-
const l = st("interactive"), [s, u] = E(""), [p, o] = E("");
|
|
112
|
-
Y(() => {
|
|
113
|
-
e || (u(""), o(""));
|
|
114
|
-
}, [e]);
|
|
115
|
-
const c = () => {
|
|
116
|
-
s.trim() && i({ title: s, description: p });
|
|
117
|
-
}, d = (m) => {
|
|
118
|
-
a(m);
|
|
119
|
-
};
|
|
120
|
-
return /* @__PURE__ */ t(Ee, { open: e, onOpenChange: d, children: /* @__PURE__ */ r(
|
|
121
|
-
Ae,
|
|
122
|
-
{
|
|
123
|
-
showCloseButton: !1,
|
|
124
|
-
className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
125
|
-
style: l.dialogStyle,
|
|
126
|
-
children: [
|
|
127
|
-
/* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
128
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
129
|
-
/* @__PURE__ */ t(gt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
130
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
131
|
-
/* @__PURE__ */ t(Ie, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
|
|
132
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
|
|
133
|
-
] })
|
|
134
|
-
] }),
|
|
135
|
-
/* @__PURE__ */ t(
|
|
136
|
-
R,
|
|
137
|
-
{
|
|
138
|
-
size: "xs",
|
|
139
|
-
variant: "ghost",
|
|
140
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
141
|
-
onClick: () => d(!1),
|
|
142
|
-
"aria-label": "Close",
|
|
143
|
-
disabled: n,
|
|
144
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ r("div", { className: "space-y-3 px-4 py-3", children: [
|
|
149
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
|
|
150
|
-
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
151
|
-
/* @__PURE__ */ t(ke, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
|
|
152
|
-
/* @__PURE__ */ t(
|
|
153
|
-
at,
|
|
154
|
-
{
|
|
155
|
-
id: "visual-title",
|
|
156
|
-
size: "sm",
|
|
157
|
-
placeholder: "Untitled visual",
|
|
158
|
-
value: s,
|
|
159
|
-
onChange: (m) => u(m.target.value),
|
|
160
|
-
disabled: n,
|
|
161
|
-
onKeyDown: (m) => {
|
|
162
|
-
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), c());
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
168
|
-
/* @__PURE__ */ t(ke, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
|
|
169
|
-
/* @__PURE__ */ t(
|
|
170
|
-
at,
|
|
171
|
-
{
|
|
172
|
-
id: "visual-description",
|
|
173
|
-
size: "sm",
|
|
174
|
-
placeholder: "Optional",
|
|
175
|
-
value: p,
|
|
176
|
-
onChange: (m) => o(m.target.value),
|
|
177
|
-
disabled: n
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
] })
|
|
181
|
-
] }),
|
|
182
|
-
/* @__PURE__ */ r("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
183
|
-
/* @__PURE__ */ t(
|
|
184
|
-
R,
|
|
185
|
-
{
|
|
186
|
-
size: "xs",
|
|
187
|
-
variant: "outline",
|
|
188
|
-
onClick: () => d(!1),
|
|
189
|
-
disabled: n,
|
|
190
|
-
children: "Cancel"
|
|
191
|
-
}
|
|
192
|
-
),
|
|
193
|
-
/* @__PURE__ */ t(
|
|
194
|
-
R,
|
|
195
|
-
{
|
|
196
|
-
size: "xs",
|
|
197
|
-
onClick: c,
|
|
198
|
-
disabled: !s.trim() || n,
|
|
199
|
-
children: n ? /* @__PURE__ */ r(j, { children: [
|
|
200
|
-
/* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
201
|
-
"Creating..."
|
|
202
|
-
] }) : "Create library visual"
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
] })
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
) });
|
|
209
|
-
}
|
|
210
|
-
function jt(e) {
|
|
211
|
-
return e ? new Date(e).toLocaleDateString("en-US", {
|
|
212
|
-
month: "short",
|
|
213
|
-
day: "numeric",
|
|
214
|
-
year: "numeric"
|
|
215
|
-
}) : "Unknown";
|
|
216
|
-
}
|
|
217
|
-
function Wt(e, a) {
|
|
218
|
-
var n;
|
|
219
|
-
const i = (n = e.ownership.createdBy) == null ? void 0 : n.type;
|
|
220
|
-
return i === "tenant" || i === "organization" && a;
|
|
221
|
-
}
|
|
222
|
-
function xt(e, a) {
|
|
223
|
-
var i, n;
|
|
224
|
-
return Wt(e, a) ? ((i = e.ownership.createdBy) == null ? void 0 : i.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
|
|
225
|
-
}
|
|
226
|
-
function ka(e, a) {
|
|
227
|
-
return xt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
|
|
228
|
-
}
|
|
229
|
-
function Ea(e) {
|
|
230
|
-
const a = (e || "").toLowerCase();
|
|
231
|
-
return a.includes("table") ? kt : a.includes("pie") || a.includes("donut") ? lr : a.includes("line") ? dr : a.includes("bar") ? Xt : gt;
|
|
232
|
-
}
|
|
233
|
-
function Aa({ visual: e }) {
|
|
234
|
-
const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
|
|
235
|
-
return /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: a });
|
|
236
|
-
}
|
|
237
|
-
function qn({
|
|
238
|
-
open: e,
|
|
239
|
-
onOpenChange: a
|
|
240
|
-
}) {
|
|
241
|
-
const i = st("interactive"), [n, l] = E(""), [s, u] = E(/* @__PURE__ */ new Set()), [p, o] = E(!1), [c, d] = E(
|
|
242
|
-
null
|
|
243
|
-
), [m, h] = E(
|
|
244
|
-
null
|
|
245
|
-
), [f, b] = E(!1), [k, I] = E(null), [y, S] = E(null), D = () => {
|
|
246
|
-
u(/* @__PURE__ */ new Set()), d(null), h(null), b(!1), I(null);
|
|
247
|
-
}, w = () => {
|
|
248
|
-
a(!1), D();
|
|
249
|
-
}, { selectVisual: C } = Lt(), { handleAddLibraryVisual: F, handleEditLibraryVisual: g } = bt(), { isConsoleMode: v } = rr(), {
|
|
250
|
-
resources: U,
|
|
251
|
-
isLoading: A,
|
|
252
|
-
isError: q,
|
|
253
|
-
createResource: L,
|
|
254
|
-
updateResource: P,
|
|
255
|
-
deleteResourceAsync: J,
|
|
256
|
-
duplicateResource: ne,
|
|
257
|
-
isCreating: Fe,
|
|
258
|
-
isDeleting: ie
|
|
259
|
-
} = ar(
|
|
260
|
-
void 0,
|
|
261
|
-
(x) => {
|
|
262
|
-
o(!1), x && (C(x), g(x), w());
|
|
263
|
-
}
|
|
264
|
-
), {
|
|
265
|
-
startUpdating: Te,
|
|
266
|
-
stopUpdating: Be,
|
|
267
|
-
isUpdating: le
|
|
268
|
-
} = nr(), W = U, ee = Z(() => {
|
|
269
|
-
const x = n.trim().toLowerCase();
|
|
270
|
-
return x ? W.filter(
|
|
271
|
-
(B) => {
|
|
272
|
-
var M, re, ce;
|
|
273
|
-
return ((M = B.title) == null ? void 0 : M.toLowerCase().includes(x)) || ((re = B.description) == null ? void 0 : re.toLowerCase().includes(x)) || ((ce = B.kind) == null ? void 0 : ce.toLowerCase().includes(x));
|
|
274
|
-
}
|
|
275
|
-
) : W;
|
|
276
|
-
}, [n, W]), de = Z(
|
|
277
|
-
() => W.filter(
|
|
278
|
-
(x) => s.has(x.id)
|
|
279
|
-
),
|
|
280
|
-
[s, W]
|
|
281
|
-
), te = de.filter(
|
|
282
|
-
(x) => x.permissions.canDelete
|
|
283
|
-
), Re = de.filter(
|
|
284
|
-
(x) => x.permissions.canShare
|
|
285
|
-
), ye = ee.length > 0 && ee.every(
|
|
286
|
-
(x) => s.has(x.id)
|
|
287
|
-
), he = ee.some(
|
|
288
|
-
(x) => s.has(x.id)
|
|
289
|
-
), ge = (x) => {
|
|
290
|
-
const B = new Set(s);
|
|
291
|
-
x(B), u(B);
|
|
292
|
-
}, Q = (x) => {
|
|
293
|
-
ge((B) => {
|
|
294
|
-
B.has(x) ? B.delete(x) : B.add(x);
|
|
295
|
-
});
|
|
296
|
-
}, Ce = () => {
|
|
297
|
-
u((x) => {
|
|
298
|
-
const B = new Set(x);
|
|
299
|
-
return ye ? ee.forEach(
|
|
300
|
-
(M) => B.delete(M.id)
|
|
301
|
-
) : ee.forEach(
|
|
302
|
-
(M) => B.add(M.id)
|
|
303
|
-
), B;
|
|
304
|
-
});
|
|
305
|
-
}, _ = async (x) => {
|
|
306
|
-
(await F(x)).success && w();
|
|
307
|
-
}, O = async () => {
|
|
308
|
-
const x = de;
|
|
309
|
-
if (x.length === 0) return;
|
|
310
|
-
let B = !1;
|
|
311
|
-
for (const M of x)
|
|
312
|
-
if (!(await F(M)).success) {
|
|
313
|
-
B = !0;
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
B || w();
|
|
317
|
-
}, se = (x) => {
|
|
318
|
-
g(x), w();
|
|
319
|
-
}, be = (x) => {
|
|
320
|
-
S(x), ne(x, {
|
|
321
|
-
onSettled: () => S(null)
|
|
322
|
-
});
|
|
323
|
-
}, Ue = () => {
|
|
324
|
-
if (te.length === 0) {
|
|
325
|
-
$.error("Select a visual you can delete");
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
I(null), b(!0);
|
|
329
|
-
}, Ze = async () => {
|
|
330
|
-
const x = k ? [k] : te;
|
|
331
|
-
try {
|
|
332
|
-
for (const B of x)
|
|
333
|
-
await J(B.id);
|
|
334
|
-
u((B) => {
|
|
335
|
-
const M = new Set(B);
|
|
336
|
-
return x.forEach(
|
|
337
|
-
(re) => M.delete(re.id)
|
|
338
|
-
), M;
|
|
339
|
-
}), b(!1), I(null);
|
|
340
|
-
} catch {
|
|
341
|
-
}
|
|
342
|
-
}, we = () => {
|
|
343
|
-
if (de.length !== 1) {
|
|
344
|
-
$.error("Select one visual to share");
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const [x] = de;
|
|
348
|
-
if (!x.permissions.canShare) {
|
|
349
|
-
$.error("You do not have permission to share this visual");
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
d(x);
|
|
353
|
-
}, Ne = ({
|
|
354
|
-
title: x,
|
|
355
|
-
description: B
|
|
356
|
-
}) => {
|
|
357
|
-
if (!m) return;
|
|
358
|
-
const M = {};
|
|
359
|
-
if (x !== m.title && (M.title = x), (m.description || "") !== B && (M.description = B), Object.keys(M).length === 0) {
|
|
360
|
-
h(null);
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
const re = Object.keys(M), ce = re.length === 1 ? re[0] : void 0;
|
|
364
|
-
Te(m.id, ce), P(
|
|
365
|
-
{
|
|
366
|
-
resourceId: m.id,
|
|
367
|
-
data: M
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
onSuccess: () => {
|
|
371
|
-
Be(m.id, ce), h(null);
|
|
372
|
-
},
|
|
373
|
-
onError: () => {
|
|
374
|
-
Be(m.id, ce);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
);
|
|
378
|
-
}, X = (x) => {
|
|
379
|
-
a(x), x || D();
|
|
380
|
-
}, Se = k ? 1 : te.length;
|
|
381
|
-
return /* @__PURE__ */ r(j, { children: [
|
|
382
|
-
/* @__PURE__ */ t(Ee, { open: e, onOpenChange: X, children: /* @__PURE__ */ r(
|
|
383
|
-
Ae,
|
|
384
|
-
{
|
|
385
|
-
showCloseButton: !1,
|
|
386
|
-
className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
387
|
-
style: i.dialogStyle,
|
|
388
|
-
children: [
|
|
389
|
-
/* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
390
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
391
|
-
/* @__PURE__ */ t(kt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
392
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
393
|
-
/* @__PURE__ */ t(Ie, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
|
|
394
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
|
|
395
|
-
] })
|
|
396
|
-
] }),
|
|
397
|
-
/* @__PURE__ */ t(
|
|
398
|
-
R,
|
|
399
|
-
{
|
|
400
|
-
size: "xs",
|
|
401
|
-
variant: "ghost",
|
|
402
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
403
|
-
onClick: () => X(!1),
|
|
404
|
-
"aria-label": "Close visuals library",
|
|
405
|
-
children: "×"
|
|
406
|
-
}
|
|
407
|
-
)
|
|
408
|
-
] }),
|
|
409
|
-
/* @__PURE__ */ r("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
|
|
410
|
-
/* @__PURE__ */ r("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
|
|
411
|
-
/* @__PURE__ */ t(pa, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
412
|
-
/* @__PURE__ */ t(
|
|
413
|
-
"input",
|
|
414
|
-
{
|
|
415
|
-
autoFocus: !0,
|
|
416
|
-
value: n,
|
|
417
|
-
onChange: (x) => l(x.target.value),
|
|
418
|
-
placeholder: "Search visuals...",
|
|
419
|
-
className: "h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none",
|
|
420
|
-
"aria-label": "Search visuals"
|
|
421
|
-
}
|
|
422
|
-
)
|
|
423
|
-
] }),
|
|
424
|
-
/* @__PURE__ */ r(
|
|
425
|
-
R,
|
|
426
|
-
{
|
|
427
|
-
size: "xs",
|
|
428
|
-
variant: "outline",
|
|
429
|
-
className: "ml-auto",
|
|
430
|
-
onClick: () => o(!0),
|
|
431
|
-
children: [
|
|
432
|
-
/* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5" }),
|
|
433
|
-
"New library visual"
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
] }),
|
|
438
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: A ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Sa, {}) }) : q ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : ee.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
|
|
439
|
-
/* @__PURE__ */ t(gt, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
440
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
|
|
441
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
|
|
442
|
-
] }) : /* @__PURE__ */ t(
|
|
443
|
-
Ia,
|
|
444
|
-
{
|
|
445
|
-
visuals: ee,
|
|
446
|
-
selectedIds: s,
|
|
447
|
-
allFilteredSelected: ye,
|
|
448
|
-
someFilteredSelected: he,
|
|
449
|
-
onSelectAll: Ce,
|
|
450
|
-
onToggleSelection: Q,
|
|
451
|
-
onAddVisual: _,
|
|
452
|
-
onOpenVisual: se,
|
|
453
|
-
onEditDetails: h,
|
|
454
|
-
onShareVisual: d,
|
|
455
|
-
onDeleteVisual: (x) => {
|
|
456
|
-
I(x), b(!0);
|
|
457
|
-
},
|
|
458
|
-
onDuplicateVisual: be,
|
|
459
|
-
duplicatingId: y,
|
|
460
|
-
isDeleting: ie,
|
|
461
|
-
isConsoleMode: v
|
|
462
|
-
}
|
|
463
|
-
) }),
|
|
464
|
-
/* @__PURE__ */ r("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
|
|
465
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: s.size > 0 && /* @__PURE__ */ r(j, { children: [
|
|
466
|
-
/* @__PURE__ */ r("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
467
|
-
/* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: s.size }),
|
|
468
|
-
" ",
|
|
469
|
-
"selected"
|
|
470
|
-
] }),
|
|
471
|
-
/* @__PURE__ */ t(
|
|
472
|
-
R,
|
|
473
|
-
{
|
|
474
|
-
size: "xs",
|
|
475
|
-
variant: "ghost",
|
|
476
|
-
onClick: () => u(/* @__PURE__ */ new Set()),
|
|
477
|
-
children: "Clear"
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
/* @__PURE__ */ r(
|
|
481
|
-
R,
|
|
482
|
-
{
|
|
483
|
-
size: "xs",
|
|
484
|
-
variant: "outline",
|
|
485
|
-
onClick: we,
|
|
486
|
-
disabled: de.length !== 1 || Re.length !== 1,
|
|
487
|
-
children: [
|
|
488
|
-
/* @__PURE__ */ t(Ft, { className: "h-3.5 w-3.5" }),
|
|
489
|
-
"Share"
|
|
490
|
-
]
|
|
491
|
-
}
|
|
492
|
-
),
|
|
493
|
-
/* @__PURE__ */ r(
|
|
494
|
-
R,
|
|
495
|
-
{
|
|
496
|
-
size: "xs",
|
|
497
|
-
variant: "outline",
|
|
498
|
-
className: "text-destructive hover:text-destructive",
|
|
499
|
-
onClick: Ue,
|
|
500
|
-
disabled: te.length === 0,
|
|
501
|
-
children: [
|
|
502
|
-
/* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" }),
|
|
503
|
-
"Delete ",
|
|
504
|
-
te.length || s.size
|
|
505
|
-
]
|
|
506
|
-
}
|
|
507
|
-
)
|
|
508
|
-
] }) }),
|
|
509
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
510
|
-
/* @__PURE__ */ t(
|
|
511
|
-
R,
|
|
512
|
-
{
|
|
513
|
-
size: "xs",
|
|
514
|
-
variant: "outline",
|
|
515
|
-
onClick: () => X(!1),
|
|
516
|
-
children: "Close"
|
|
517
|
-
}
|
|
518
|
-
),
|
|
519
|
-
/* @__PURE__ */ r(
|
|
520
|
-
R,
|
|
521
|
-
{
|
|
522
|
-
size: "xs",
|
|
523
|
-
onClick: O,
|
|
524
|
-
disabled: s.size === 0,
|
|
525
|
-
children: [
|
|
526
|
-
/* @__PURE__ */ t(Et, { className: "h-3.5 w-3.5" }),
|
|
527
|
-
s.size === 0 ? "Add to dashboard" : `Add ${s.size} visual${s.size === 1 ? "" : "s"}`
|
|
528
|
-
]
|
|
529
|
-
}
|
|
530
|
-
)
|
|
531
|
-
] })
|
|
532
|
-
] })
|
|
533
|
-
]
|
|
534
|
-
}
|
|
535
|
-
) }),
|
|
536
|
-
/* @__PURE__ */ t(
|
|
537
|
-
Da,
|
|
538
|
-
{
|
|
539
|
-
open: p,
|
|
540
|
-
onOpenChange: o,
|
|
541
|
-
onSubmit: L,
|
|
542
|
-
isCreating: Fe
|
|
543
|
-
}
|
|
544
|
-
),
|
|
545
|
-
c && /* @__PURE__ */ t(
|
|
546
|
-
sr,
|
|
547
|
-
{
|
|
548
|
-
resource: c,
|
|
549
|
-
resourceType: or.VISUAL,
|
|
550
|
-
onClose: () => d(null)
|
|
551
|
-
}
|
|
552
|
-
),
|
|
553
|
-
m && /* @__PURE__ */ t(
|
|
554
|
-
ir,
|
|
555
|
-
{
|
|
556
|
-
open: !!m,
|
|
557
|
-
resourceLabel: "Visual",
|
|
558
|
-
initialTitle: m.title || "",
|
|
559
|
-
initialDescription: m.description || "",
|
|
560
|
-
onClose: () => h(null),
|
|
561
|
-
onSave: Ne,
|
|
562
|
-
isSaving: le(m.id)
|
|
563
|
-
}
|
|
564
|
-
),
|
|
565
|
-
/* @__PURE__ */ t(
|
|
566
|
-
ot,
|
|
567
|
-
{
|
|
568
|
-
open: f,
|
|
569
|
-
onOpenChange: (x) => {
|
|
570
|
-
!x && ie || (b(x), x || I(null));
|
|
571
|
-
},
|
|
572
|
-
children: /* @__PURE__ */ r(it, { children: [
|
|
573
|
-
/* @__PURE__ */ r(lt, { children: [
|
|
574
|
-
/* @__PURE__ */ r(dt, { children: [
|
|
575
|
-
"Delete ",
|
|
576
|
-
Se,
|
|
577
|
-
" visual",
|
|
578
|
-
Se === 1 ? "" : "s",
|
|
579
|
-
"?"
|
|
580
|
-
] }),
|
|
581
|
-
/* @__PURE__ */ t(ct, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
|
|
582
|
-
] }),
|
|
583
|
-
/* @__PURE__ */ r(ut, { children: [
|
|
584
|
-
/* @__PURE__ */ t(ht, { disabled: ie, children: "Cancel" }),
|
|
585
|
-
/* @__PURE__ */ r(
|
|
586
|
-
Tt,
|
|
587
|
-
{
|
|
588
|
-
onClick: (x) => {
|
|
589
|
-
x.preventDefault(), Ze();
|
|
590
|
-
},
|
|
591
|
-
disabled: ie || Se === 0,
|
|
592
|
-
children: [
|
|
593
|
-
ie ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" }),
|
|
594
|
-
ie ? "Deleting..." : "Delete"
|
|
595
|
-
]
|
|
596
|
-
}
|
|
597
|
-
)
|
|
598
|
-
] })
|
|
599
|
-
] })
|
|
600
|
-
}
|
|
601
|
-
)
|
|
602
|
-
] });
|
|
603
|
-
}
|
|
604
|
-
function Ia({
|
|
605
|
-
visuals: e,
|
|
606
|
-
selectedIds: a,
|
|
607
|
-
allFilteredSelected: i,
|
|
608
|
-
someFilteredSelected: n,
|
|
609
|
-
onSelectAll: l,
|
|
610
|
-
onToggleSelection: s,
|
|
611
|
-
onAddVisual: u,
|
|
612
|
-
onOpenVisual: p,
|
|
613
|
-
onEditDetails: o,
|
|
614
|
-
onShareVisual: c,
|
|
615
|
-
onDeleteVisual: d,
|
|
616
|
-
onDuplicateVisual: m,
|
|
617
|
-
duplicatingId: h,
|
|
618
|
-
isDeleting: f,
|
|
619
|
-
isConsoleMode: b
|
|
620
|
-
}) {
|
|
621
|
-
return /* @__PURE__ */ r("div", { className: "min-w-[48rem]", children: [
|
|
622
|
-
/* @__PURE__ */ r("div", { className: "grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: [
|
|
623
|
-
/* @__PURE__ */ t(
|
|
624
|
-
mt,
|
|
625
|
-
{
|
|
626
|
-
checked: i ? !0 : n ? "indeterminate" : !1,
|
|
627
|
-
onCheckedChange: l,
|
|
628
|
-
"aria-label": "Select all visuals"
|
|
629
|
-
}
|
|
630
|
-
),
|
|
631
|
-
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
632
|
-
/* @__PURE__ */ t("span", { children: "Created by" }),
|
|
633
|
-
/* @__PURE__ */ t("span", { children: "Updated" }),
|
|
634
|
-
/* @__PURE__ */ t("span", { children: "Visibility" }),
|
|
635
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Shared" }),
|
|
636
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
|
|
637
|
-
] }),
|
|
638
|
-
e.map((k) => /* @__PURE__ */ t(
|
|
639
|
-
La,
|
|
640
|
-
{
|
|
641
|
-
visual: k,
|
|
642
|
-
selected: a.has(k.id),
|
|
643
|
-
onToggleSelection: s,
|
|
644
|
-
onAddVisual: u,
|
|
645
|
-
onOpenVisual: p,
|
|
646
|
-
onEditDetails: o,
|
|
647
|
-
onShareVisual: c,
|
|
648
|
-
onDeleteVisual: d,
|
|
649
|
-
onDuplicateVisual: m,
|
|
650
|
-
duplicatingId: h,
|
|
651
|
-
isDeleting: f,
|
|
652
|
-
isConsoleMode: b
|
|
653
|
-
},
|
|
654
|
-
k.id
|
|
655
|
-
))
|
|
656
|
-
] });
|
|
657
|
-
}
|
|
658
|
-
function La({
|
|
659
|
-
visual: e,
|
|
660
|
-
selected: a,
|
|
661
|
-
onToggleSelection: i,
|
|
662
|
-
onAddVisual: n,
|
|
663
|
-
onOpenVisual: l,
|
|
664
|
-
onEditDetails: s,
|
|
665
|
-
onShareVisual: u,
|
|
666
|
-
onDeleteVisual: p,
|
|
667
|
-
onDuplicateVisual: o,
|
|
668
|
-
duplicatingId: c,
|
|
669
|
-
isDeleting: d,
|
|
670
|
-
isConsoleMode: m
|
|
671
|
-
}) {
|
|
672
|
-
var b;
|
|
673
|
-
const h = Ea(e.kind), f = () => {
|
|
674
|
-
n(e);
|
|
675
|
-
};
|
|
676
|
-
return /* @__PURE__ */ r(
|
|
677
|
-
"div",
|
|
678
|
-
{
|
|
679
|
-
className: K(
|
|
680
|
-
"group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",
|
|
681
|
-
a && "bg-muted/70"
|
|
682
|
-
),
|
|
683
|
-
children: [
|
|
684
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
685
|
-
mt,
|
|
686
|
-
{
|
|
687
|
-
checked: a,
|
|
688
|
-
onCheckedChange: () => i(e.id),
|
|
689
|
-
"aria-label": `Select ${e.title || "visual"}`
|
|
690
|
-
}
|
|
691
|
-
) }),
|
|
692
|
-
/* @__PURE__ */ r(
|
|
693
|
-
"button",
|
|
694
|
-
{
|
|
695
|
-
type: "button",
|
|
696
|
-
className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
697
|
-
onClick: f,
|
|
698
|
-
"aria-label": `Add ${e.title || "visual"} to dashboard`,
|
|
699
|
-
children: [
|
|
700
|
-
/* @__PURE__ */ t(h, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
701
|
-
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
702
|
-
/* @__PURE__ */ t(
|
|
703
|
-
"div",
|
|
704
|
-
{
|
|
705
|
-
className: "truncate font-medium text-foreground",
|
|
706
|
-
title: e.title || "Untitled Visual",
|
|
707
|
-
children: e.title || "Untitled Visual"
|
|
708
|
-
}
|
|
709
|
-
),
|
|
710
|
-
((b = e.description) == null ? void 0 : b.trim()) && /* @__PURE__ */ t(
|
|
711
|
-
"div",
|
|
712
|
-
{
|
|
713
|
-
className: "truncate text-[11px] text-muted-foreground",
|
|
714
|
-
title: e.description,
|
|
715
|
-
children: e.description
|
|
716
|
-
}
|
|
717
|
-
)
|
|
718
|
-
] })
|
|
719
|
-
]
|
|
720
|
-
}
|
|
721
|
-
),
|
|
722
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
723
|
-
/* @__PURE__ */ t("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: ka(e, m) }),
|
|
724
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: xt(e, m) })
|
|
725
|
-
] }),
|
|
726
|
-
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: jt(e.updatedAt) }),
|
|
727
|
-
/* @__PURE__ */ t(Aa, { visual: e }),
|
|
728
|
-
/* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
|
|
729
|
-
/* @__PURE__ */ t(
|
|
730
|
-
Fa,
|
|
731
|
-
{
|
|
732
|
-
visual: e,
|
|
733
|
-
onOpenVisual: l,
|
|
734
|
-
onEditDetails: s,
|
|
735
|
-
onShareVisual: u,
|
|
736
|
-
onDeleteVisual: p,
|
|
737
|
-
onDuplicateVisual: o,
|
|
738
|
-
duplicatingId: c,
|
|
739
|
-
isDeleting: d,
|
|
740
|
-
isConsoleMode: m
|
|
741
|
-
}
|
|
742
|
-
)
|
|
743
|
-
]
|
|
744
|
-
}
|
|
745
|
-
);
|
|
746
|
-
}
|
|
747
|
-
function Fa({
|
|
748
|
-
visual: e,
|
|
749
|
-
onOpenVisual: a,
|
|
750
|
-
onEditDetails: i,
|
|
751
|
-
onShareVisual: n,
|
|
752
|
-
onDeleteVisual: l,
|
|
753
|
-
onDuplicateVisual: s,
|
|
754
|
-
duplicatingId: u,
|
|
755
|
-
isDeleting: p,
|
|
756
|
-
isConsoleMode: o
|
|
757
|
-
}) {
|
|
758
|
-
return /* @__PURE__ */ r(
|
|
759
|
-
"div",
|
|
760
|
-
{
|
|
761
|
-
className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
762
|
-
onClick: (c) => c.stopPropagation(),
|
|
763
|
-
children: [
|
|
764
|
-
/* @__PURE__ */ t(
|
|
765
|
-
R,
|
|
766
|
-
{
|
|
767
|
-
size: "xs",
|
|
768
|
-
variant: "ghost",
|
|
769
|
-
className: "w-7 px-0",
|
|
770
|
-
onClick: () => a(e),
|
|
771
|
-
"aria-label": "Edit visual",
|
|
772
|
-
children: /* @__PURE__ */ t(Je, { className: "h-3.5 w-3.5" })
|
|
773
|
-
}
|
|
774
|
-
),
|
|
775
|
-
/* @__PURE__ */ r(Ge, { modal: !1, children: [
|
|
776
|
-
/* @__PURE__ */ t(Ke, { asChild: !0, children: /* @__PURE__ */ t(
|
|
777
|
-
R,
|
|
778
|
-
{
|
|
779
|
-
size: "xs",
|
|
780
|
-
variant: "ghost",
|
|
781
|
-
className: "w-7 px-0",
|
|
782
|
-
"aria-label": "More actions",
|
|
783
|
-
children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
|
|
784
|
-
}
|
|
785
|
-
) }),
|
|
786
|
-
/* @__PURE__ */ r(
|
|
787
|
-
Xe,
|
|
788
|
-
{
|
|
789
|
-
align: "end",
|
|
790
|
-
className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
|
|
791
|
-
children: [
|
|
792
|
-
/* @__PURE__ */ r(G, { onClick: () => a(e), children: [
|
|
793
|
-
/* @__PURE__ */ t(Je, { className: "h-3.5 w-3.5" }),
|
|
794
|
-
"Edit visual"
|
|
795
|
-
] }),
|
|
796
|
-
/* @__PURE__ */ r(
|
|
797
|
-
G,
|
|
798
|
-
{
|
|
799
|
-
onClick: () => s(e.id),
|
|
800
|
-
disabled: u === e.id,
|
|
801
|
-
children: [
|
|
802
|
-
u === e.id ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(cr, { className: "h-3.5 w-3.5" }),
|
|
803
|
-
u === e.id ? "Duplicating..." : "Duplicate"
|
|
804
|
-
]
|
|
805
|
-
}
|
|
806
|
-
),
|
|
807
|
-
e.permissions.canEdit && /* @__PURE__ */ r(G, { onClick: () => i(e), children: [
|
|
808
|
-
/* @__PURE__ */ t(Je, { className: "h-3.5 w-3.5" }),
|
|
809
|
-
"Edit details"
|
|
810
|
-
] }),
|
|
811
|
-
e.permissions.canShare && /* @__PURE__ */ r(G, { onClick: () => n(e), children: [
|
|
812
|
-
/* @__PURE__ */ t(Ft, { className: "h-3.5 w-3.5" }),
|
|
813
|
-
"Share"
|
|
814
|
-
] }),
|
|
815
|
-
e.permissions.canDelete && /* @__PURE__ */ r(j, { children: [
|
|
816
|
-
/* @__PURE__ */ t(He, {}),
|
|
817
|
-
/* @__PURE__ */ r(
|
|
818
|
-
G,
|
|
819
|
-
{
|
|
820
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
821
|
-
onClick: () => l(e),
|
|
822
|
-
disabled: p,
|
|
823
|
-
children: [
|
|
824
|
-
/* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" }),
|
|
825
|
-
p ? "Deleting..." : "Delete"
|
|
826
|
-
]
|
|
827
|
-
}
|
|
828
|
-
)
|
|
829
|
-
] }),
|
|
830
|
-
/* @__PURE__ */ t(He, {}),
|
|
831
|
-
/* @__PURE__ */ r("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
832
|
-
Wt(e, o) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
833
|
-
/* @__PURE__ */ t(ur, { className: "h-3 w-3" }),
|
|
834
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: xt(e, o) })
|
|
835
|
-
] }),
|
|
836
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
837
|
-
/* @__PURE__ */ t(hr, { className: "h-3 w-3" }),
|
|
838
|
-
/* @__PURE__ */ t("span", { children: jt(e.updatedAt) })
|
|
839
|
-
] })
|
|
840
|
-
] })
|
|
841
|
-
]
|
|
842
|
-
}
|
|
843
|
-
)
|
|
844
|
-
] })
|
|
845
|
-
]
|
|
846
|
-
}
|
|
847
|
-
);
|
|
848
|
-
}
|
|
849
|
-
function Gn(e, a, i = !1) {
|
|
850
|
-
const n = T((c) => c.dashboard), l = T(
|
|
851
|
-
(c) => c.isDashboardEditing
|
|
852
|
-
), s = T(
|
|
853
|
-
(c) => c.onDashboardLifecycleEvent
|
|
854
|
-
), u = H(() => {
|
|
855
|
-
const c = T.getState().dashboard;
|
|
856
|
-
return a || !e || !c || c.id !== e.id ? !1 : _e(c) !== _e(e);
|
|
857
|
-
}, [e, a]);
|
|
858
|
-
yt(() => (T.setState({ checkUnsavedDashboardChanges: u }), () => {
|
|
859
|
-
T.getState().checkUnsavedDashboardChanges === u && T.setState({ checkUnsavedDashboardChanges: null });
|
|
860
|
-
}), [u]);
|
|
861
|
-
const p = Z(() => !i || a || !n || l && (!e || n.id !== e.id) ? null : {
|
|
862
|
-
dashboardId: n.id,
|
|
863
|
-
dirty: l && e ? _e(n) !== _e(e) : !1
|
|
864
|
-
}, [
|
|
865
|
-
l,
|
|
866
|
-
a,
|
|
867
|
-
i,
|
|
868
|
-
e,
|
|
869
|
-
n
|
|
870
|
-
]), o = ue(null);
|
|
871
|
-
return yt(() => {
|
|
872
|
-
if (!s || !p) {
|
|
873
|
-
o.current = null;
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
const c = o.current;
|
|
877
|
-
(c == null ? void 0 : c.callback) === s && c.dashboardId === p.dashboardId && c.dirty === p.dirty || (o.current = {
|
|
878
|
-
callback: s,
|
|
879
|
-
dashboardId: p.dashboardId,
|
|
880
|
-
dirty: p.dirty
|
|
881
|
-
}, s({
|
|
882
|
-
type: "dashboard:dirty-state",
|
|
883
|
-
dashboardId: p.dashboardId,
|
|
884
|
-
payload: { dirty: p.dirty }
|
|
885
|
-
}));
|
|
886
|
-
}, [p, s]), u;
|
|
887
|
-
}
|
|
888
|
-
function Ta({
|
|
889
|
-
open: e,
|
|
890
|
-
onOpenChange: a,
|
|
891
|
-
isLibraryVisual: i,
|
|
892
|
-
currentVisualName: n,
|
|
893
|
-
isSaving: l = !1,
|
|
894
|
-
destinationMode: s = "both",
|
|
895
|
-
onConfirm: u
|
|
896
|
-
}) {
|
|
897
|
-
const [p, o] = E(
|
|
898
|
-
i && n ? `Copy of ${n}` : n || ""
|
|
899
|
-
), [c, d] = E("");
|
|
900
|
-
Dt.useEffect(() => {
|
|
901
|
-
e && (o(
|
|
902
|
-
i && n ? `Copy of ${n}` : n || ""
|
|
903
|
-
), d(""));
|
|
904
|
-
}, [e, i, n]);
|
|
905
|
-
const m = !!p.trim(), h = s === "local" ? {
|
|
906
|
-
saveToLibrary: !1,
|
|
907
|
-
saveToCurrentDashboard: !0,
|
|
908
|
-
badgeType: "local",
|
|
909
|
-
description: "Creates a local copy on the current dashboard.",
|
|
910
|
-
actionLabel: "Add to Dashboard (Local)"
|
|
911
|
-
} : s === "library" ? {
|
|
912
|
-
saveToLibrary: !0,
|
|
913
|
-
saveToCurrentDashboard: !1,
|
|
914
|
-
badgeType: "library",
|
|
915
|
-
description: "Creates a reusable visual in Visual Library.",
|
|
916
|
-
actionLabel: "Save as Library Visual"
|
|
917
|
-
} : {
|
|
918
|
-
saveToLibrary: !0,
|
|
919
|
-
saveToCurrentDashboard: !0,
|
|
920
|
-
badgeType: "linked",
|
|
921
|
-
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
922
|
-
actionLabel: "Save Copy as Linked Visual"
|
|
923
|
-
}, f = () => {
|
|
924
|
-
!m || l || u({
|
|
925
|
-
name: p.trim(),
|
|
926
|
-
description: c.trim() || void 0,
|
|
927
|
-
saveToLibrary: h.saveToLibrary,
|
|
928
|
-
saveToCurrentDashboard: h.saveToCurrentDashboard
|
|
929
|
-
});
|
|
930
|
-
};
|
|
931
|
-
return /* @__PURE__ */ t(Ee, { open: e, onOpenChange: a, children: /* @__PURE__ */ r(Ae, { className: "sm:max-w-[500px]", children: [
|
|
932
|
-
/* @__PURE__ */ r(pt, { children: [
|
|
933
|
-
/* @__PURE__ */ r(Ie, { className: "flex items-center gap-2", children: [
|
|
934
|
-
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
935
|
-
h.badgeType !== "local" && /* @__PURE__ */ t(
|
|
936
|
-
ia,
|
|
937
|
-
{
|
|
938
|
-
type: h.badgeType,
|
|
939
|
-
showLabel: !0,
|
|
940
|
-
className: "px-2 py-0.5"
|
|
941
|
-
}
|
|
942
|
-
)
|
|
943
|
-
] }),
|
|
944
|
-
/* @__PURE__ */ t(ft, { children: h.description })
|
|
945
|
-
] }),
|
|
946
|
-
/* @__PURE__ */ r("div", { className: "grid gap-4 py-4", children: [
|
|
947
|
-
/* @__PURE__ */ r("div", { className: "grid gap-2", children: [
|
|
948
|
-
/* @__PURE__ */ t(ke, { htmlFor: "name", children: "Name" }),
|
|
949
|
-
/* @__PURE__ */ t(
|
|
950
|
-
at,
|
|
951
|
-
{
|
|
952
|
-
id: "name",
|
|
953
|
-
value: p,
|
|
954
|
-
onChange: (b) => o(b.target.value),
|
|
955
|
-
placeholder: "Enter visual name",
|
|
956
|
-
disabled: l
|
|
957
|
-
}
|
|
958
|
-
)
|
|
959
|
-
] }),
|
|
960
|
-
/* @__PURE__ */ r("div", { className: "grid gap-2", children: [
|
|
961
|
-
/* @__PURE__ */ t(ke, { htmlFor: "description", children: "Description (optional)" }),
|
|
962
|
-
/* @__PURE__ */ t(
|
|
963
|
-
mr,
|
|
964
|
-
{
|
|
965
|
-
id: "description",
|
|
966
|
-
value: c,
|
|
967
|
-
onChange: (b) => d(b.target.value),
|
|
968
|
-
placeholder: "Enter visual description",
|
|
969
|
-
rows: 3,
|
|
970
|
-
disabled: l
|
|
971
|
-
}
|
|
972
|
-
)
|
|
973
|
-
] })
|
|
974
|
-
] }),
|
|
975
|
-
/* @__PURE__ */ r(pr, { children: [
|
|
976
|
-
/* @__PURE__ */ t(
|
|
977
|
-
R,
|
|
978
|
-
{
|
|
979
|
-
variant: "outline",
|
|
980
|
-
onClick: () => a(!1),
|
|
981
|
-
disabled: l,
|
|
982
|
-
children: "Cancel"
|
|
983
|
-
}
|
|
984
|
-
),
|
|
985
|
-
/* @__PURE__ */ r(R, { onClick: f, disabled: !m || l, children: [
|
|
986
|
-
l && /* @__PURE__ */ t(ae, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
987
|
-
h.actionLabel
|
|
988
|
-
] })
|
|
989
|
-
] })
|
|
990
|
-
] }) });
|
|
991
|
-
}
|
|
992
|
-
function Ba() {
|
|
993
|
-
const [e, a] = E(!1), [i, n] = E(!1), [l, s] = E(null), [u, p] = E(null), o = fe((g) => g.frame), c = fe((g) => g.card), d = fr(), m = T((g) => g.selectedSheetId), h = T((g) => g.dashboard), { getUpdatedFrame: f } = bt(), { selectVisual: b } = Lt(), { addFrame: k, setSelectedFrameId: I, setIsVisualEditing: y } = ve(), S = Rt(), D = !!(o != null && o.visualId), w = (() => {
|
|
994
|
-
var g, v;
|
|
995
|
-
return ((g = o == null ? void 0 : o.cards) == null ? void 0 : g.length) === 1 && ((v = o.cards[0]) != null && v.title) ? o.cards[0].title : d != null && d.title ? d.title : (c == null ? void 0 : c.title) || "Untitled Visual";
|
|
996
|
-
})(), C = gr((g) => {
|
|
997
|
-
g != null && g.id && (b(g), i && l && u && m && (async () => {
|
|
998
|
-
try {
|
|
999
|
-
const v = {
|
|
1000
|
-
...l,
|
|
1001
|
-
id: wt(),
|
|
1002
|
-
visualId: g.id
|
|
1003
|
-
// Link to the newly created library visual
|
|
1004
|
-
};
|
|
1005
|
-
k(m, v, {
|
|
1006
|
-
position: "end",
|
|
1007
|
-
semanticExecutionPayload: u
|
|
1008
|
-
}), I(v.id), n(!1), s(null), p(null), y(!1);
|
|
1009
|
-
} catch (v) {
|
|
1010
|
-
console.error(
|
|
1011
|
-
"Failed to promote semantic metadata for saved visual:",
|
|
1012
|
-
v
|
|
1013
|
-
), $.error(
|
|
1014
|
-
v instanceof Error ? v.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
})(), a(!1));
|
|
1018
|
-
});
|
|
1019
|
-
return {
|
|
1020
|
-
saveAsDialogOpen: e,
|
|
1021
|
-
setSaveAsDialogOpen: a,
|
|
1022
|
-
handleSaveAs: async (g) => {
|
|
1023
|
-
if (!m) {
|
|
1024
|
-
$.error("No sheet selected");
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
const v = f(), A = v.cards.length === 1 ? {
|
|
1028
|
-
...v,
|
|
1029
|
-
cards: v.cards.map((q) => ({
|
|
1030
|
-
...q,
|
|
1031
|
-
title: g.name
|
|
1032
|
-
// Use visual name as card title
|
|
1033
|
-
}))
|
|
1034
|
-
} : v;
|
|
1035
|
-
if (g.saveToLibrary) {
|
|
1036
|
-
let q = null;
|
|
1037
|
-
if (g.saveToCurrentDashboard)
|
|
1038
|
-
try {
|
|
1039
|
-
q = await S(A, {
|
|
1040
|
-
previousFrame: nt(h, A.id)
|
|
1041
|
-
});
|
|
1042
|
-
} catch (P) {
|
|
1043
|
-
console.error(
|
|
1044
|
-
"Failed to prepare semantic metadata before saving visual:",
|
|
1045
|
-
P
|
|
1046
|
-
), $.error(
|
|
1047
|
-
P instanceof Error ? P.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1048
|
-
);
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
n(g.saveToCurrentDashboard), s(A), p(q);
|
|
1052
|
-
const L = {
|
|
1053
|
-
title: g.name,
|
|
1054
|
-
description: g.description,
|
|
1055
|
-
frameObject: A,
|
|
1056
|
-
// Card title synced for single-card frames
|
|
1057
|
-
isPrivate: !1
|
|
1058
|
-
};
|
|
1059
|
-
C.mutate(L);
|
|
1060
|
-
} else if (g.saveToCurrentDashboard) {
|
|
1061
|
-
const q = {
|
|
1062
|
-
...A,
|
|
1063
|
-
// Card title already synced
|
|
1064
|
-
id: wt(),
|
|
1065
|
-
visualId: void 0
|
|
1066
|
-
// Explicitly no visualId for local visuals
|
|
1067
|
-
};
|
|
1068
|
-
try {
|
|
1069
|
-
const L = await S(A, {
|
|
1070
|
-
previousFrame: nt(h, A.id)
|
|
1071
|
-
});
|
|
1072
|
-
k(m, q, {
|
|
1073
|
-
position: "end",
|
|
1074
|
-
semanticExecutionPayload: L
|
|
1075
|
-
}), I(q.id), $.success("Visual saved to dashboard"), a(!1), y(!1);
|
|
1076
|
-
} catch (L) {
|
|
1077
|
-
console.error("Failed to save visual to dashboard:", L), $.error(
|
|
1078
|
-
L instanceof Error ? L.message : "Failed to prepare semantic metadata for the visual"
|
|
1079
|
-
);
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
},
|
|
1083
|
-
isLibraryVisual: D,
|
|
1084
|
-
currentVisualName: w,
|
|
1085
|
-
isSaving: C.isPending
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
function Kn(e = {}) {
|
|
1089
|
-
const { isInspectionMode: a } = br(), i = fe((L) => L.frame), n = fe((L) => L.editorContext), l = xr((L) => L.selectedVisual), s = T((L) => L.selectedFrameId), u = T((L) => L.selectedSheetId), p = T((L) => L.dashboard), { setIsVisualEditing: o, updateFrame: c } = ve(), [d, m] = E(!1), [h, f] = E("both"), b = Rt(), k = (n == null ? void 0 : n.type) === "documentSection", I = !!(i != null && i.visualId || l != null && l.id), y = !!(i != null && i.visualId && s), S = I && !y, {
|
|
1090
|
-
saveAsDialogOpen: D,
|
|
1091
|
-
setSaveAsDialogOpen: w,
|
|
1092
|
-
handleSaveAs: C,
|
|
1093
|
-
isLibraryVisual: F,
|
|
1094
|
-
currentVisualName: g,
|
|
1095
|
-
isSaving: v
|
|
1096
|
-
} = Ba(), { getUpdatedFrame: U } = bt();
|
|
1097
|
-
if (a)
|
|
1098
|
-
return /* @__PURE__ */ r(j, { children: [
|
|
1099
|
-
/* @__PURE__ */ t(
|
|
1100
|
-
et,
|
|
1101
|
-
{
|
|
1102
|
-
className: "rounded-control",
|
|
1103
|
-
variant: "default"
|
|
1104
|
-
}
|
|
1105
|
-
),
|
|
1106
|
-
/* @__PURE__ */ t(tt, {})
|
|
1107
|
-
] });
|
|
1108
|
-
if (k)
|
|
1109
|
-
return /* @__PURE__ */ r(j, { children: [
|
|
1110
|
-
/* @__PURE__ */ t(et, { className: "rounded-control", variant: "default" }),
|
|
1111
|
-
/* @__PURE__ */ t(tt, {})
|
|
1112
|
-
] });
|
|
1113
|
-
const A = async () => {
|
|
1114
|
-
if (!u) {
|
|
1115
|
-
$.error("No sheet selected");
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
if (d) return;
|
|
1119
|
-
m(!0);
|
|
1120
|
-
const P = {
|
|
1121
|
-
...U(),
|
|
1122
|
-
visualId: void 0
|
|
1123
|
-
}, J = nt(p, P.id);
|
|
1124
|
-
try {
|
|
1125
|
-
const ne = await b(P, {
|
|
1126
|
-
previousFrame: J
|
|
1127
|
-
});
|
|
1128
|
-
c(u, P, {
|
|
1129
|
-
semanticExecutionPayload: ne
|
|
1130
|
-
});
|
|
1131
|
-
} catch (ne) {
|
|
1132
|
-
console.error("Failed to apply local semantic metadata:", ne), m(!1), $.error(
|
|
1133
|
-
ne instanceof Error ? ne.message : "Failed to prepare semantic metadata for this visual"
|
|
1134
|
-
);
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
setTimeout(() => {
|
|
1138
|
-
m(!1), $.success("Changes applied. Visual is now local to this dashboard"), o(!1);
|
|
1139
|
-
}, 300);
|
|
1140
|
-
}, q = (L) => {
|
|
1141
|
-
f(L), w(!0);
|
|
1142
|
-
};
|
|
1143
|
-
return /* @__PURE__ */ r(j, { children: [
|
|
1144
|
-
/* @__PURE__ */ r("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
|
|
1145
|
-
!I && /* @__PURE__ */ t(et, { className: "!rounded-none", variant: "default" }),
|
|
1146
|
-
I && S && /* @__PURE__ */ t(la, { className: "!rounded-none", variant: "default" }),
|
|
1147
|
-
I && y && /* @__PURE__ */ t(da, { className: "!rounded-none" }),
|
|
1148
|
-
/* @__PURE__ */ r(Ge, { modal: !1, children: [
|
|
1149
|
-
/* @__PURE__ */ t(Ke, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1150
|
-
R,
|
|
1151
|
-
{
|
|
1152
|
-
variant: "default",
|
|
1153
|
-
size: "xs",
|
|
1154
|
-
className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
|
|
1155
|
-
"aria-label": "Open visual save options",
|
|
1156
|
-
disabled: v || d,
|
|
1157
|
-
children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
|
|
1158
|
-
}
|
|
1159
|
-
) }),
|
|
1160
|
-
/* @__PURE__ */ r(
|
|
1161
|
-
Xe,
|
|
1162
|
-
{
|
|
1163
|
-
align: "end",
|
|
1164
|
-
className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
|
|
1165
|
-
children: [
|
|
1166
|
-
y && /* @__PURE__ */ r(j, { children: [
|
|
1167
|
-
/* @__PURE__ */ r(
|
|
1168
|
-
G,
|
|
1169
|
-
{
|
|
1170
|
-
onClick: A,
|
|
1171
|
-
disabled: d,
|
|
1172
|
-
children: [
|
|
1173
|
-
/* @__PURE__ */ t(Et, { className: "h-3.5 w-3.5" }),
|
|
1174
|
-
d ? "Applying..." : "Apply Locally"
|
|
1175
|
-
]
|
|
1176
|
-
}
|
|
1177
|
-
),
|
|
1178
|
-
/* @__PURE__ */ t(He, {})
|
|
1179
|
-
] }),
|
|
1180
|
-
/* @__PURE__ */ r(
|
|
1181
|
-
G,
|
|
1182
|
-
{
|
|
1183
|
-
onClick: () => q("local"),
|
|
1184
|
-
disabled: v,
|
|
1185
|
-
children: [
|
|
1186
|
-
/* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5" }),
|
|
1187
|
-
"Add to Dashboard (Local)"
|
|
1188
|
-
]
|
|
1189
|
-
}
|
|
1190
|
-
),
|
|
1191
|
-
/* @__PURE__ */ r(
|
|
1192
|
-
G,
|
|
1193
|
-
{
|
|
1194
|
-
onClick: () => q("library"),
|
|
1195
|
-
disabled: v,
|
|
1196
|
-
children: [
|
|
1197
|
-
/* @__PURE__ */ t(ca, { className: "h-3.5 w-3.5" }),
|
|
1198
|
-
"Save as Library Visual"
|
|
1199
|
-
]
|
|
1200
|
-
}
|
|
1201
|
-
),
|
|
1202
|
-
/* @__PURE__ */ r(
|
|
1203
|
-
G,
|
|
1204
|
-
{
|
|
1205
|
-
onClick: () => q("both"),
|
|
1206
|
-
disabled: v,
|
|
1207
|
-
children: [
|
|
1208
|
-
/* @__PURE__ */ t(ua, { className: "h-3.5 w-3.5" }),
|
|
1209
|
-
"Save Copy as Linked Visual"
|
|
1210
|
-
]
|
|
1211
|
-
}
|
|
1212
|
-
)
|
|
1213
|
-
]
|
|
1214
|
-
}
|
|
1215
|
-
)
|
|
1216
|
-
] })
|
|
1217
|
-
] }),
|
|
1218
|
-
/* @__PURE__ */ t(tt, {}),
|
|
1219
|
-
/* @__PURE__ */ t(
|
|
1220
|
-
Ta,
|
|
1221
|
-
{
|
|
1222
|
-
open: D,
|
|
1223
|
-
onOpenChange: (L) => {
|
|
1224
|
-
v || w(L);
|
|
1225
|
-
},
|
|
1226
|
-
isLibraryVisual: F,
|
|
1227
|
-
currentVisualName: g,
|
|
1228
|
-
isSaving: v,
|
|
1229
|
-
destinationMode: h,
|
|
1230
|
-
onConfirm: C
|
|
1231
|
-
}
|
|
1232
|
-
)
|
|
1233
|
-
] });
|
|
1234
|
-
}
|
|
1235
|
-
function Xn({ className: e }) {
|
|
1236
|
-
const a = fe((d) => d.isDevMode), i = fe((d) => d.card.type), n = T((d) => d.isVisualEditing), { setIsDevMode: l } = At(), { config: s } = Kt(vr).tokenProps, u = (s == null ? void 0 : s.showAdvancedMode) !== !1;
|
|
1237
|
-
if (!n || !u || !fa(i))
|
|
1238
|
-
return null;
|
|
1239
|
-
const p = a ? wa : yr, o = a ? "Visual editor" : "SQL editor", c = a ? "Switch to visual editor" : "Switch to SQL editor";
|
|
1240
|
-
return /* @__PURE__ */ r(
|
|
1241
|
-
"button",
|
|
1242
|
-
{
|
|
1243
|
-
type: "button",
|
|
1244
|
-
"aria-label": c,
|
|
1245
|
-
title: c,
|
|
1246
|
-
onClick: () => l(!a),
|
|
1247
|
-
className: K(
|
|
1248
|
-
"inline-flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:outline-none",
|
|
1249
|
-
e
|
|
1250
|
-
),
|
|
1251
|
-
children: [
|
|
1252
|
-
/* @__PURE__ */ t(p, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1253
|
-
o
|
|
1254
|
-
]
|
|
1255
|
-
}
|
|
1256
|
-
);
|
|
1257
|
-
}
|
|
1258
|
-
function Yn({
|
|
1259
|
-
open: e,
|
|
1260
|
-
onOpenChange: a,
|
|
1261
|
-
onSave: i,
|
|
1262
|
-
onDiscard: n,
|
|
1263
|
-
isSaving: l,
|
|
1264
|
-
title: s = "Unsaved changes",
|
|
1265
|
-
description: u = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
1266
|
-
cancelLabel: p = "Cancel",
|
|
1267
|
-
discardLabel: o = "Discard changes",
|
|
1268
|
-
saveLabel: c = "Save"
|
|
1269
|
-
}) {
|
|
1270
|
-
return /* @__PURE__ */ t(ot, { open: e, onOpenChange: (m) => {
|
|
1271
|
-
!m && l || a(m);
|
|
1272
|
-
}, children: /* @__PURE__ */ r(it, { children: [
|
|
1273
|
-
/* @__PURE__ */ r(lt, { children: [
|
|
1274
|
-
/* @__PURE__ */ t(dt, { children: s }),
|
|
1275
|
-
/* @__PURE__ */ t(ct, { children: u })
|
|
1276
|
-
] }),
|
|
1277
|
-
/* @__PURE__ */ r(ut, { children: [
|
|
1278
|
-
/* @__PURE__ */ t(
|
|
1279
|
-
R,
|
|
1280
|
-
{
|
|
1281
|
-
type: "button",
|
|
1282
|
-
size: "xs",
|
|
1283
|
-
onClick: n,
|
|
1284
|
-
disabled: l,
|
|
1285
|
-
variant: "outline",
|
|
1286
|
-
className: "mr-auto text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
|
|
1287
|
-
children: o
|
|
1288
|
-
}
|
|
1289
|
-
),
|
|
1290
|
-
/* @__PURE__ */ t(ht, { disabled: l, children: p }),
|
|
1291
|
-
/* @__PURE__ */ t(R, { type: "button", size: "xs", onClick: i, disabled: l, children: l ? /* @__PURE__ */ r(j, { children: [
|
|
1292
|
-
/* @__PURE__ */ t(ae, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
1293
|
-
"Saving..."
|
|
1294
|
-
] }) : c })
|
|
1295
|
-
] })
|
|
1296
|
-
] }) });
|
|
1297
|
-
}
|
|
1298
|
-
function vt(e, a) {
|
|
1299
|
-
return {
|
|
1300
|
-
id: e.id,
|
|
1301
|
-
status: e.status,
|
|
1302
|
-
progress: e.progress !== void 0 ? e.progress : e.status === "completed" ? 100 : e.totalChunks === null ? null : e.totalChunks > 0 ? Math.round(e.completedChunks / e.totalChunks * 100) : 0,
|
|
1303
|
-
totalRows: e.totalRows,
|
|
1304
|
-
totalChunks: e.totalChunks,
|
|
1305
|
-
rowsProcessed: e.processedRows,
|
|
1306
|
-
completedChunks: e.completedChunks,
|
|
1307
|
-
completedAt: e.completedAt ? new Date(e.completedAt) : void 0,
|
|
1308
|
-
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
1309
|
-
fileSize: e.fileSize,
|
|
1310
|
-
error: e.error,
|
|
1311
|
-
phase: e.phase,
|
|
1312
|
-
deadlineAt: e.deadlineAt ? new Date(e.deadlineAt) : void 0,
|
|
1313
|
-
// A refreshed result replaces prior authorization, including a failed URL fetch.
|
|
1314
|
-
downloadUrl: a
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
const Ra = 15e3;
|
|
1318
|
-
function pe(e) {
|
|
1319
|
-
const a = new AbortController();
|
|
1320
|
-
let i;
|
|
1321
|
-
const n = new Promise((l, s) => {
|
|
1322
|
-
i = setTimeout(() => {
|
|
1323
|
-
a.abort(), s(new Error("Export request timed out."));
|
|
1324
|
-
}, Ra);
|
|
1325
|
-
});
|
|
1326
|
-
return Promise.race([e(a.signal), n]).finally(() => clearTimeout(i));
|
|
1327
|
-
}
|
|
1328
|
-
const Ua = 1e4, Va = 15e3, Pa = 3e4, Ma = 3e4, _a = 12e4, Oa = 5 * 6e4, za = 2 * 60 * 60 * 1e3;
|
|
1329
|
-
function $a(e) {
|
|
1330
|
-
return e.deadlineAt ? e.deadlineAt.getTime() + Oa : e.startedAt.getTime() + za;
|
|
1331
|
-
}
|
|
1332
|
-
function ja(e) {
|
|
1333
|
-
const a = Date.now() - e.getTime();
|
|
1334
|
-
return a < Ma ? Ua : a < _a ? Va : Pa;
|
|
1335
|
-
}
|
|
1336
|
-
function Qn() {
|
|
1337
|
-
const { authToken: e, tokenProps: a } = Ye(), i = me((h) => h.activeExports), [n, l] = E(
|
|
1338
|
-
typeof document < "u" ? !document.hidden : !0
|
|
1339
|
-
), s = ue(null), u = ue(!1), p = ue(void 0), o = a == null ? void 0 : a.apiServiceUrl, c = e == null ? void 0 : e.accessToken, d = H(() => {
|
|
1340
|
-
const h = me.getState().activeExports;
|
|
1341
|
-
return Array.from(h.values()).filter(
|
|
1342
|
-
(f) => De(f.status)
|
|
1343
|
-
);
|
|
1344
|
-
}, []);
|
|
1345
|
-
Y(() => {
|
|
1346
|
-
if (typeof document > "u") return;
|
|
1347
|
-
const h = () => {
|
|
1348
|
-
l(!document.hidden);
|
|
1349
|
-
};
|
|
1350
|
-
return document.addEventListener("visibilitychange", h), () => {
|
|
1351
|
-
document.removeEventListener("visibilitychange", h);
|
|
1352
|
-
};
|
|
1353
|
-
}, []);
|
|
1354
|
-
const m = H(async () => {
|
|
1355
|
-
if (!o || !c) {
|
|
1356
|
-
u.current = !1;
|
|
1357
|
-
return;
|
|
1358
|
-
}
|
|
1359
|
-
const h = d();
|
|
1360
|
-
if (h.length === 0) {
|
|
1361
|
-
u.current = !1;
|
|
1362
|
-
return;
|
|
1363
|
-
}
|
|
1364
|
-
const f = Date.now(), b = await Promise.allSettled(
|
|
1365
|
-
h.map(async (D) => {
|
|
1366
|
-
try {
|
|
1367
|
-
const w = await pe((F) => Ut(o, c, D.id, F));
|
|
1368
|
-
let C;
|
|
1369
|
-
if (w.status === "completed")
|
|
1370
|
-
try {
|
|
1371
|
-
C = await pe((F) => qe(o, c, D.id, F));
|
|
1372
|
-
} catch (F) {
|
|
1373
|
-
console.error(
|
|
1374
|
-
`[useExportPolling] Failed to get download URL for ${D.id}:`,
|
|
1375
|
-
F
|
|
1376
|
-
);
|
|
1377
|
-
}
|
|
1378
|
-
return vt(w, C);
|
|
1379
|
-
} catch (w) {
|
|
1380
|
-
return console.error(
|
|
1381
|
-
`[useExportPolling] Failed to poll export ${D.id}:`,
|
|
1382
|
-
w
|
|
1383
|
-
), null;
|
|
1384
|
-
}
|
|
1385
|
-
})
|
|
1386
|
-
), { updateExport: k, applyServerStatus: I } = me.getState().actions, y = (D) => {
|
|
1387
|
-
const w = me.getState().activeExports.get(D);
|
|
1388
|
-
return !!w && De(w.status);
|
|
1389
|
-
};
|
|
1390
|
-
h.forEach((D, w) => {
|
|
1391
|
-
if (!y(D.id)) return;
|
|
1392
|
-
const C = b[w], F = C.status === "fulfilled" ? C.value : null;
|
|
1393
|
-
if (f > $a(D) && !(F && !De(F.status))) {
|
|
1394
|
-
k(D.id, {
|
|
1395
|
-
status: "failed",
|
|
1396
|
-
error: z.unconfirmed,
|
|
1397
|
-
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
1398
|
-
});
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
F && I(F.id, F);
|
|
1402
|
-
});
|
|
1403
|
-
const S = d();
|
|
1404
|
-
if (S.length > 0 && !document.hidden) {
|
|
1405
|
-
const D = S.reduce(
|
|
1406
|
-
(C, F) => F.startedAt < C ? F.startedAt : C,
|
|
1407
|
-
S[0].startedAt
|
|
1408
|
-
), w = ja(D);
|
|
1409
|
-
s.current && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
1410
|
-
var C;
|
|
1411
|
-
(C = p.current) == null || C.call(p);
|
|
1412
|
-
}, w);
|
|
1413
|
-
} else
|
|
1414
|
-
u.current = !1;
|
|
1415
|
-
}, [o, c, d]);
|
|
1416
|
-
return Y(() => {
|
|
1417
|
-
p.current = m;
|
|
1418
|
-
}, [m]), Y(() => {
|
|
1419
|
-
var f;
|
|
1420
|
-
d().length > 0 && n && !u.current && (u.current = !0, (f = p.current) == null || f.call(p));
|
|
1421
|
-
}, [i, n, d]), Y(() => {
|
|
1422
|
-
var f;
|
|
1423
|
-
const h = d();
|
|
1424
|
-
n && h.length > 0 && !u.current && (u.current = !0, (f = p.current) == null || f.call(p));
|
|
1425
|
-
}, [n, d]), Y(() => {
|
|
1426
|
-
!n && s.current && (clearTimeout(s.current), s.current = null, u.current = !1);
|
|
1427
|
-
}, [n]), Y(() => () => {
|
|
1428
|
-
s.current && (clearTimeout(s.current), s.current = null);
|
|
1429
|
-
}, []), {
|
|
1430
|
-
isPolling: u.current,
|
|
1431
|
-
isTabVisible: n,
|
|
1432
|
-
inProgressCount: d().length
|
|
1433
|
-
};
|
|
1434
|
-
}
|
|
1435
|
-
function Zn() {
|
|
1436
|
-
const { authToken: e, tokenProps: a } = Ye(), i = me((p) => p.activeExports), { recoverExport: n } = Vt(), l = ue(!1), s = a == null ? void 0 : a.apiServiceUrl, u = e == null ? void 0 : e.accessToken;
|
|
1437
|
-
Y(() => {
|
|
1438
|
-
if (l.current || !s || !u) return;
|
|
1439
|
-
(async () => {
|
|
1440
|
-
try {
|
|
1441
|
-
const { exports: o } = await pe((c) => Cr(s, u, {
|
|
1442
|
-
status: ["pending", "processing", "chunking", "compacting", "completed", "failed", "cancelled"],
|
|
1443
|
-
limit: 20
|
|
1444
|
-
// Limit to recent exports
|
|
1445
|
-
}, c));
|
|
1446
|
-
for (const c of o) {
|
|
1447
|
-
if (i.has(c.id)) continue;
|
|
1448
|
-
let d;
|
|
1449
|
-
if (c.status === "completed")
|
|
1450
|
-
try {
|
|
1451
|
-
d = await pe((h) => qe(s, u, c.id, h));
|
|
1452
|
-
} catch (h) {
|
|
1453
|
-
console.error(
|
|
1454
|
-
`[useExportRecovery] Failed to get download URL for ${c.id}:`,
|
|
1455
|
-
h
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
const m = {
|
|
1459
|
-
...vt(c, d),
|
|
1460
|
-
title: Wa(c),
|
|
1461
|
-
startedAt: new Date(c.createdAt),
|
|
1462
|
-
expiresAt: new Date(c.expiresAt)
|
|
1463
|
-
};
|
|
1464
|
-
n(m);
|
|
1465
|
-
}
|
|
1466
|
-
l.current = !0;
|
|
1467
|
-
} catch (o) {
|
|
1468
|
-
console.error("[useExportRecovery] Failed to recover exports:", o), l.current = !0;
|
|
1469
|
-
}
|
|
1470
|
-
})();
|
|
1471
|
-
}, [s, u, n, i]);
|
|
1472
|
-
}
|
|
1473
|
-
function Wa(e) {
|
|
1474
|
-
return e.title ? e.title : De(
|
|
1475
|
-
e.status
|
|
1476
|
-
) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
|
|
1477
|
-
}
|
|
1478
|
-
function Ha({
|
|
1479
|
-
export: e,
|
|
1480
|
-
onRemove: a,
|
|
1481
|
-
onDownload: i
|
|
1482
|
-
}) {
|
|
1483
|
-
const [n, l] = E("idle");
|
|
1484
|
-
Y(() => {
|
|
1485
|
-
e.downloadUrl && l("idle");
|
|
1486
|
-
}, [e.downloadUrl]);
|
|
1487
|
-
const s = async () => {
|
|
1488
|
-
if (!i) {
|
|
1489
|
-
e.downloadUrl && window.open(e.downloadUrl, "_blank");
|
|
1490
|
-
return;
|
|
1491
|
-
}
|
|
1492
|
-
l("preparing");
|
|
1493
|
-
const k = await i(e);
|
|
1494
|
-
l(k === "denied" ? "denied" : "idle");
|
|
1495
|
-
}, u = (k) => {
|
|
1496
|
-
k.stopPropagation(), a == null || a(e.id);
|
|
1497
|
-
}, p = De(e.status), o = e.status === "pending" ? { text: z.queued } : e.status === "compacting" || e.phase === "finalizing" ? { text: z.finalizing } : e.phase === "preparing" ? { text: z.preparing } : e.phase === "acquiring" ? { text: z.fetchingRows(e.rowsProcessed ?? 0) } : {
|
|
1498
|
-
text: z.processing,
|
|
1499
|
-
detail: e.progress !== null ? z.percentComplete(e.progress) : e.rowsProcessed !== void 0 ? z.rowsProcessed(e.rowsProcessed) : void 0,
|
|
1500
|
-
bar: e.progress
|
|
1501
|
-
}, c = p && Date.now() - e.startedAt.getTime() >= wr, d = e.status === "completed" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "pending" || e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", m = e.status === "completed" ? z.ready : e.status === "failed" ? z.failed : e.status === "cancelled" ? z.cancelled : z.inProgress, h = Nt(e.startedAt, { addSuffix: !0 }), f = [
|
|
1502
|
-
e.status === "completed" && e.totalRows !== null ? `${e.totalRows.toLocaleString()} rows` : null,
|
|
1503
|
-
e.status === "completed" && e.fileSize ? Nr(e.fileSize) : null
|
|
1504
|
-
].filter((k) => !!k), b = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
|
|
1505
|
-
return /* @__PURE__ */ r("div", { className: "group flex items-start gap-2.5 px-3 py-2 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
1506
|
-
/* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${d}` }) }),
|
|
1507
|
-
/* @__PURE__ */ t("span", { className: "sr-only", children: m }),
|
|
1508
|
-
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
|
|
1509
|
-
/* @__PURE__ */ r("div", { className: "flex h-5 items-center gap-2", children: [
|
|
1510
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: e.title }),
|
|
1511
|
-
e.status === "completed" && n === "preparing" && /* @__PURE__ */ r("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: [
|
|
1512
|
-
/* @__PURE__ */ t(Pt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }),
|
|
1513
|
-
"Preparing"
|
|
1514
|
-
] }),
|
|
1515
|
-
e.status === "completed" && n !== "preparing" && /* @__PURE__ */ t(
|
|
1516
|
-
"button",
|
|
1517
|
-
{
|
|
1518
|
-
type: "button",
|
|
1519
|
-
onClick: () => void s(),
|
|
1520
|
-
className: "shrink-0 text-[12px] font-medium text-foreground/80 underline-offset-2 hover:text-foreground hover:underline focus-visible:underline focus-visible:outline-none",
|
|
1521
|
-
children: "Download"
|
|
1522
|
-
}
|
|
1523
|
-
),
|
|
1524
|
-
/* @__PURE__ */ t(
|
|
1525
|
-
R,
|
|
1526
|
-
{
|
|
1527
|
-
variant: "ghost",
|
|
1528
|
-
size: "xs",
|
|
1529
|
-
className: "-mr-1.5 h-5 w-5 shrink-0 px-0 text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1530
|
-
onClick: u,
|
|
1531
|
-
"aria-label": "Remove notification",
|
|
1532
|
-
title: "Remove",
|
|
1533
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
|
|
1534
|
-
}
|
|
1535
|
-
)
|
|
1536
|
-
] }),
|
|
1537
|
-
e.status === "completed" && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
1538
|
-
f.length > 0 && // Disclosed on hover or focus only; the time is what a reader scans.
|
|
1539
|
-
/* @__PURE__ */ r("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
|
|
1540
|
-
f.map((k, I) => /* @__PURE__ */ r(Dt.Fragment, { children: [
|
|
1541
|
-
I > 0 && b,
|
|
1542
|
-
/* @__PURE__ */ t("span", { children: k })
|
|
1543
|
-
] }, I)),
|
|
1544
|
-
b
|
|
1545
|
-
] }),
|
|
1546
|
-
/* @__PURE__ */ t("span", { children: h })
|
|
1547
|
-
] }),
|
|
1548
|
-
e.status === "completed" && n === "denied" && /* @__PURE__ */ r("div", { role: "alert", className: "mt-1 flex items-start gap-1.5 text-[12px] leading-4 text-foreground", children: [
|
|
1549
|
-
/* @__PURE__ */ t(Sr, { className: "mt-0.5 h-3 w-3 shrink-0 text-destructive", strokeWidth: 1.75 }),
|
|
1550
|
-
/* @__PURE__ */ t("span", { children: z.linkExpired })
|
|
1551
|
-
] }),
|
|
1552
|
-
p && /* @__PURE__ */ r("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
|
|
1553
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: o.text }),
|
|
1554
|
-
o.detail && /* @__PURE__ */ r(j, { children: [
|
|
1555
|
-
" ",
|
|
1556
|
-
b,
|
|
1557
|
-
" ",
|
|
1558
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: o.detail })
|
|
1559
|
-
] }),
|
|
1560
|
-
" ",
|
|
1561
|
-
b,
|
|
1562
|
-
" ",
|
|
1563
|
-
/* @__PURE__ */ t("span", { children: z.started(Nt(e.startedAt)) }),
|
|
1564
|
-
o.bar !== void 0 && o.bar !== null && /* @__PURE__ */ t(Dr, { value: o.bar, className: "mt-1.5 h-1" }),
|
|
1565
|
-
c && /* @__PURE__ */ t("div", { className: "mt-1", children: z.longRunning })
|
|
1566
|
-
] }),
|
|
1567
|
-
e.status === "cancelled" && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
1568
|
-
/* @__PURE__ */ t("span", { children: z.cancelled }),
|
|
1569
|
-
b,
|
|
1570
|
-
/* @__PURE__ */ t("span", { children: h })
|
|
1571
|
-
] }),
|
|
1572
|
-
e.status === "failed" && /* @__PURE__ */ r(j, { children: [
|
|
1573
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
1574
|
-
/* @__PURE__ */ t("span", { children: z.failed }),
|
|
1575
|
-
b,
|
|
1576
|
-
/* @__PURE__ */ t("span", { children: h })
|
|
1577
|
-
] }),
|
|
1578
|
-
/* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: e.error || z.failedFallback })
|
|
1579
|
-
] })
|
|
1580
|
-
] })
|
|
1581
|
-
] });
|
|
1582
|
-
}
|
|
1583
|
-
function qa() {
|
|
1584
|
-
const { authToken: e, tokenProps: a } = Ye(), i = me((y) => y.activeExports), { clearCompleted: n, removeExport: l, updateExport: s, applyServerStatus: u } = Vt(), [p, o] = E(!1), [c, d] = E(!1), m = Array.from(i.values()).sort(
|
|
1585
|
-
(y, S) => S.startedAt.getTime() - y.startedAt.getTime()
|
|
1586
|
-
), h = m.some(
|
|
1587
|
-
(y) => y.status === "completed" || y.status === "failed" || y.status === "cancelled"
|
|
1588
|
-
), f = H(async () => {
|
|
1589
|
-
const y = a == null ? void 0 : a.apiServiceUrl, S = e == null ? void 0 : e.accessToken;
|
|
1590
|
-
if (!(!y || !S)) {
|
|
1591
|
-
o(!0);
|
|
1592
|
-
try {
|
|
1593
|
-
const D = Array.from(i.values());
|
|
1594
|
-
await Promise.all(
|
|
1595
|
-
D.map(async (w) => {
|
|
1596
|
-
try {
|
|
1597
|
-
const C = await pe((g) => Ut(y, S, w.id, g));
|
|
1598
|
-
let F;
|
|
1599
|
-
if (C.status === "completed")
|
|
1600
|
-
try {
|
|
1601
|
-
F = await pe((g) => qe(
|
|
1602
|
-
y,
|
|
1603
|
-
S,
|
|
1604
|
-
w.id,
|
|
1605
|
-
g
|
|
1606
|
-
));
|
|
1607
|
-
} catch (g) {
|
|
1608
|
-
console.error(`Failed to get download URL for ${w.id}:`, g);
|
|
1609
|
-
}
|
|
1610
|
-
u(w.id, vt(C, F));
|
|
1611
|
-
} catch (C) {
|
|
1612
|
-
s(w.id, { downloadUrl: void 0 }), console.error(`Failed to refresh export ${w.id}:`, C);
|
|
1613
|
-
}
|
|
1614
|
-
})
|
|
1615
|
-
);
|
|
1616
|
-
} finally {
|
|
1617
|
-
o(!1);
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
}, [
|
|
1621
|
-
i,
|
|
1622
|
-
e == null ? void 0 : e.accessToken,
|
|
1623
|
-
a == null ? void 0 : a.apiServiceUrl,
|
|
1624
|
-
s,
|
|
1625
|
-
u
|
|
1626
|
-
]), b = H(async () => {
|
|
1627
|
-
const y = a == null ? void 0 : a.apiServiceUrl, S = e == null ? void 0 : e.accessToken;
|
|
1628
|
-
if (!y || !S) {
|
|
1629
|
-
n();
|
|
1630
|
-
return;
|
|
1631
|
-
}
|
|
1632
|
-
d(!0);
|
|
1633
|
-
try {
|
|
1634
|
-
const D = m.filter(
|
|
1635
|
-
(C) => C.status === "completed" || C.status === "failed" || C.status === "cancelled"
|
|
1636
|
-
), w = await Promise.allSettled(
|
|
1637
|
-
D.map(async (C) => (await Ct(y, S, C.id), C.id))
|
|
1638
|
-
);
|
|
1639
|
-
for (const C of w)
|
|
1640
|
-
C.status === "fulfilled" ? l(C.value) : console.error("Failed to delete export:", C.reason);
|
|
1641
|
-
} finally {
|
|
1642
|
-
d(!1);
|
|
1643
|
-
}
|
|
1644
|
-
}, [
|
|
1645
|
-
m,
|
|
1646
|
-
a == null ? void 0 : a.apiServiceUrl,
|
|
1647
|
-
e == null ? void 0 : e.accessToken,
|
|
1648
|
-
n,
|
|
1649
|
-
l
|
|
1650
|
-
]), k = H(
|
|
1651
|
-
async (y) => {
|
|
1652
|
-
const S = a == null ? void 0 : a.apiServiceUrl, D = e == null ? void 0 : e.accessToken;
|
|
1653
|
-
if (S && D)
|
|
1654
|
-
try {
|
|
1655
|
-
await Ct(S, D, y), l(y);
|
|
1656
|
-
return;
|
|
1657
|
-
} catch (w) {
|
|
1658
|
-
console.error(`Failed to cancel export ${y}:`, w);
|
|
1659
|
-
}
|
|
1660
|
-
l(y);
|
|
1661
|
-
},
|
|
1662
|
-
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, l]
|
|
1663
|
-
), I = H(
|
|
1664
|
-
async (y) => {
|
|
1665
|
-
if (y.downloadUrl)
|
|
1666
|
-
return window.open(y.downloadUrl, "_blank"), "opened";
|
|
1667
|
-
const S = a == null ? void 0 : a.apiServiceUrl, D = e == null ? void 0 : e.accessToken;
|
|
1668
|
-
if (!S || !D) return "denied";
|
|
1669
|
-
try {
|
|
1670
|
-
const w = await pe((C) => qe(S, D, y.id, C));
|
|
1671
|
-
return s(y.id, { downloadUrl: w }), window.open(w, "_blank"), "opened";
|
|
1672
|
-
} catch (w) {
|
|
1673
|
-
return console.error(`Failed to get download URL for ${y.id}:`, w), s(y.id, { downloadUrl: void 0 }), "denied";
|
|
1674
|
-
}
|
|
1675
|
-
},
|
|
1676
|
-
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, s]
|
|
1677
|
-
);
|
|
1678
|
-
return m.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
|
|
1679
|
-
/* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(Ca, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
1680
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: "No exports yet" }),
|
|
1681
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Large exports run in the background and land here." })
|
|
1682
|
-
] }) : /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
|
|
1683
|
-
/* @__PURE__ */ r("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
|
|
1684
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Exports" }),
|
|
1685
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: m.length }),
|
|
1686
|
-
/* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
1687
|
-
h && /* @__PURE__ */ t(
|
|
1688
|
-
R,
|
|
1689
|
-
{
|
|
1690
|
-
variant: "ghost",
|
|
1691
|
-
size: "xs",
|
|
1692
|
-
className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
|
|
1693
|
-
onClick: b,
|
|
1694
|
-
disabled: c,
|
|
1695
|
-
children: c ? "Clearing" : "Clear all"
|
|
1696
|
-
}
|
|
1697
|
-
),
|
|
1698
|
-
/* @__PURE__ */ t(
|
|
1699
|
-
R,
|
|
1700
|
-
{
|
|
1701
|
-
variant: "ghost",
|
|
1702
|
-
size: "xs",
|
|
1703
|
-
className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
|
|
1704
|
-
onClick: f,
|
|
1705
|
-
disabled: p,
|
|
1706
|
-
title: "Refresh status",
|
|
1707
|
-
"aria-label": "Refresh status",
|
|
1708
|
-
children: /* @__PURE__ */ t(
|
|
1709
|
-
Pt,
|
|
1710
|
-
{
|
|
1711
|
-
strokeWidth: 1.75,
|
|
1712
|
-
className: `h-3.5 w-3.5 ${p ? "animate-spin" : ""}`
|
|
1713
|
-
}
|
|
1714
|
-
)
|
|
1715
|
-
}
|
|
1716
|
-
)
|
|
1717
|
-
] })
|
|
1718
|
-
] }),
|
|
1719
|
-
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y divide-border/70", children: m.map((y) => /* @__PURE__ */ t(
|
|
1720
|
-
Ha,
|
|
1721
|
-
{
|
|
1722
|
-
export: y,
|
|
1723
|
-
onRemove: k,
|
|
1724
|
-
onDownload: I
|
|
1725
|
-
},
|
|
1726
|
-
y.id
|
|
1727
|
-
)) }) })
|
|
1728
|
-
] });
|
|
1729
|
-
}
|
|
1730
|
-
function Jn({
|
|
1731
|
-
variant: e
|
|
1732
|
-
}) {
|
|
1733
|
-
const a = me((o) => o.activeExports), i = kr(), n = a.size > 0, l = Array.from(a.values()).some(
|
|
1734
|
-
(o) => o.status === "completed" || o.status === "failed"
|
|
1735
|
-
), u = i > 0 ? i > 9 ? "9+" : String(i) : null;
|
|
1736
|
-
return /* @__PURE__ */ r(ze, { children: [
|
|
1737
|
-
/* @__PURE__ */ t($e, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1738
|
-
R,
|
|
1739
|
-
{
|
|
1740
|
-
variant: e ?? "ghost",
|
|
1741
|
-
size: "xs",
|
|
1742
|
-
className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
1743
|
-
"aria-label": "Export notifications",
|
|
1744
|
-
children: [
|
|
1745
|
-
/* @__PURE__ */ t(Er, { className: "h-3.5 w-3.5" }),
|
|
1746
|
-
n && /* @__PURE__ */ t(
|
|
1747
|
-
"span",
|
|
1748
|
-
{
|
|
1749
|
-
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${u ? "-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"}`,
|
|
1750
|
-
children: u
|
|
1751
|
-
}
|
|
1752
|
-
)
|
|
1753
|
-
]
|
|
1754
|
-
}
|
|
1755
|
-
) }),
|
|
1756
|
-
/* @__PURE__ */ t(je, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(qa, {}) })
|
|
1757
|
-
] });
|
|
1758
|
-
}
|
|
1759
|
-
function Ga(e) {
|
|
1760
|
-
if (e)
|
|
1761
|
-
return {
|
|
1762
|
-
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
1763
|
-
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
1764
|
-
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
1765
|
-
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
1766
|
-
};
|
|
1767
|
-
}
|
|
1768
|
-
function Ka({
|
|
1769
|
-
open: e,
|
|
1770
|
-
onOpenChange: a,
|
|
1771
|
-
trigger: i,
|
|
1772
|
-
showTrigger: n = !0,
|
|
1773
|
-
initialMode: l = "manage"
|
|
1774
|
-
}) {
|
|
1775
|
-
const s = l === "create", {
|
|
1776
|
-
forceClose: u,
|
|
1777
|
-
handleOpenChange: p,
|
|
1778
|
-
isCreateFlowActive: o,
|
|
1779
|
-
preventPassiveDismissDuringCreate: c,
|
|
1780
|
-
resolvedOpen: d,
|
|
1781
|
-
setIsCreateFlowActive: m
|
|
1782
|
-
} = zt({
|
|
1783
|
-
open: e,
|
|
1784
|
-
onOpenChange: a,
|
|
1785
|
-
initialCreateFlowActive: l === "create",
|
|
1786
|
-
// Dialog mode renders a built-in X close button — allow explicit
|
|
1787
|
-
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
1788
|
-
// only close-via-trigger path is a re-click that would silently
|
|
1789
|
-
// wipe the in-progress create flow, so block everything during
|
|
1790
|
-
// create and make consumers use `forceClose()` from a dedicated
|
|
1791
|
-
// button.
|
|
1792
|
-
dismissMode: n ? "passive" : "explicit-only"
|
|
1793
|
-
}), h = T((v) => v.dashboard), { setDashboardControlsModel: f } = ve(), { participants: b } = Ar(ga(h)), k = Array.from(
|
|
1794
|
-
new Map(
|
|
1795
|
-
b.flatMap(
|
|
1796
|
-
(v) => v.fieldChoices.map((U) => {
|
|
1797
|
-
var A;
|
|
1798
|
-
return [
|
|
1799
|
-
U.value,
|
|
1800
|
-
{
|
|
1801
|
-
option: U,
|
|
1802
|
-
target: (A = v.fieldTargetMap) == null ? void 0 : A[U.value]
|
|
1803
|
-
}
|
|
1804
|
-
];
|
|
1805
|
-
})
|
|
1806
|
-
)
|
|
1807
|
-
).values()
|
|
1808
|
-
), I = Array.from(
|
|
1809
|
-
new Map(
|
|
1810
|
-
b.flatMap(
|
|
1811
|
-
(v) => v.metricChoices.map((U) => {
|
|
1812
|
-
var A;
|
|
1813
|
-
return [
|
|
1814
|
-
U.value,
|
|
1815
|
-
{
|
|
1816
|
-
option: U,
|
|
1817
|
-
target: (A = v.metricTargetMap) == null ? void 0 : A[U.value]
|
|
1818
|
-
}
|
|
1819
|
-
];
|
|
1820
|
-
})
|
|
1821
|
-
)
|
|
1822
|
-
).values()
|
|
1823
|
-
), y = Yt({
|
|
1824
|
-
...h || {},
|
|
1825
|
-
controls: []
|
|
1826
|
-
}), S = Ir(h), D = (v, U, A) => {
|
|
1827
|
-
f(
|
|
1828
|
-
v,
|
|
1829
|
-
U,
|
|
1830
|
-
Ga(A)
|
|
1831
|
-
);
|
|
1832
|
-
}, w = H(() => {
|
|
1833
|
-
if (s) {
|
|
1834
|
-
u();
|
|
1835
|
-
return;
|
|
1836
|
-
}
|
|
1837
|
-
m(!1);
|
|
1838
|
-
}, [s, u, m]), C = /* @__PURE__ */ t(
|
|
1839
|
-
$t,
|
|
1840
|
-
{
|
|
1841
|
-
scope: "dashboard",
|
|
1842
|
-
controls: h.controls || [],
|
|
1843
|
-
reservedControlIds: y,
|
|
1844
|
-
defaultValues: h.defaultControlValues || {},
|
|
1845
|
-
usageByControlId: Lr(h),
|
|
1846
|
-
availableFieldChoices: k,
|
|
1847
|
-
availableMetricChoices: I,
|
|
1848
|
-
structuralParticipants: b,
|
|
1849
|
-
structuralParticipantIdsByControlId: S,
|
|
1850
|
-
initialCreateFlow: l === "create",
|
|
1851
|
-
onCreateFlowActiveChange: m,
|
|
1852
|
-
onCreateFlowComplete: w,
|
|
1853
|
-
onChange: D,
|
|
1854
|
-
emptyMessage: "No dashboard controls yet."
|
|
1855
|
-
}
|
|
1856
|
-
), F = o ? "Add dashboard control" : "Dashboard Controls", g = /* @__PURE__ */ r(j, { children: [
|
|
1857
|
-
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
1858
|
-
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
1859
|
-
/* @__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." })
|
|
1860
|
-
] }),
|
|
1861
|
-
C
|
|
1862
|
-
] });
|
|
1863
|
-
return n ? /* @__PURE__ */ r(ze, { open: d, onOpenChange: p, children: [
|
|
1864
|
-
/* @__PURE__ */ t($e, { asChild: !0, children: i || /* @__PURE__ */ r(R, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
1865
|
-
/* @__PURE__ */ t(It, { className: "mr-2 h-4 w-4" }),
|
|
1866
|
-
"Controls"
|
|
1867
|
-
] }) }),
|
|
1868
|
-
/* @__PURE__ */ t(
|
|
1869
|
-
je,
|
|
1870
|
-
{
|
|
1871
|
-
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
1872
|
-
align: "end",
|
|
1873
|
-
onEscapeKeyDown: c,
|
|
1874
|
-
onPointerDownOutside: c,
|
|
1875
|
-
children: g
|
|
1876
|
-
}
|
|
1877
|
-
)
|
|
1878
|
-
] }) : /* @__PURE__ */ t(Ee, { open: d, onOpenChange: p, children: /* @__PURE__ */ r(
|
|
1879
|
-
Ae,
|
|
1880
|
-
{
|
|
1881
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
1882
|
-
onEscapeKeyDown: c,
|
|
1883
|
-
onPointerDownOutside: c,
|
|
1884
|
-
children: [
|
|
1885
|
-
/* @__PURE__ */ r(
|
|
1886
|
-
pt,
|
|
1887
|
-
{
|
|
1888
|
-
className: o ? "space-y-0" : void 0,
|
|
1889
|
-
children: [
|
|
1890
|
-
/* @__PURE__ */ t(Ie, { className: "text-[15px]", children: F }),
|
|
1891
|
-
/* @__PURE__ */ t(
|
|
1892
|
-
ft,
|
|
1893
|
-
{
|
|
1894
|
-
className: o ? "sr-only" : "text-[13px]",
|
|
1895
|
-
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."
|
|
1896
|
-
}
|
|
1897
|
-
)
|
|
1898
|
-
]
|
|
1899
|
-
}
|
|
1900
|
-
),
|
|
1901
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: C })
|
|
1902
|
-
]
|
|
1903
|
-
}
|
|
1904
|
-
) });
|
|
1905
|
-
}
|
|
1906
|
-
const Xa = [
|
|
1907
|
-
"enum",
|
|
1908
|
-
"multi_enum",
|
|
1909
|
-
"text",
|
|
1910
|
-
"number",
|
|
1911
|
-
"boolean",
|
|
1912
|
-
"date"
|
|
1913
|
-
];
|
|
1914
|
-
function Ya({
|
|
1915
|
-
open: e,
|
|
1916
|
-
onOpenChange: a,
|
|
1917
|
-
initialMode: i = "manage"
|
|
1918
|
-
}) {
|
|
1919
|
-
var g;
|
|
1920
|
-
const n = i === "create", {
|
|
1921
|
-
forceClose: l,
|
|
1922
|
-
handleOpenChange: s,
|
|
1923
|
-
isCreateFlowActive: u,
|
|
1924
|
-
preventPassiveDismissDuringCreate: p,
|
|
1925
|
-
resolvedOpen: o,
|
|
1926
|
-
setIsCreateFlowActive: c
|
|
1927
|
-
} = zt({
|
|
1928
|
-
open: e,
|
|
1929
|
-
onOpenChange: a,
|
|
1930
|
-
initialCreateFlowActive: i === "create",
|
|
1931
|
-
dismissMode: "explicit-only"
|
|
1932
|
-
}), d = T((v) => v.dashboard), m = T((v) => v.selectedSheetId), { setDashboardInputs: h } = ve(), f = (g = d.sheets) == null ? void 0 : g.find(
|
|
1933
|
-
(v) => v.id === m
|
|
1934
|
-
), b = (f == null ? void 0 : f.kind) === "document" && !!f.document, k = Z(
|
|
1935
|
-
() => b && (f != null && f.document) ? Fr(d, f.id) : [],
|
|
1936
|
-
[d, b, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
|
|
1937
|
-
), I = Z(
|
|
1938
|
-
() => k.filter(
|
|
1939
|
-
(v) => v.kind === "control"
|
|
1940
|
-
),
|
|
1941
|
-
[k]
|
|
1942
|
-
), y = Z(
|
|
1943
|
-
() => I.map((v) => v.control),
|
|
1944
|
-
[I]
|
|
1945
|
-
), S = Z(
|
|
1946
|
-
() => Za(y),
|
|
1947
|
-
[y]
|
|
1948
|
-
), D = Z(
|
|
1949
|
-
() => Qa(d),
|
|
1950
|
-
[d]
|
|
1951
|
-
), w = H(() => {
|
|
1952
|
-
if (n) {
|
|
1953
|
-
l();
|
|
1954
|
-
return;
|
|
1955
|
-
}
|
|
1956
|
-
c(!1);
|
|
1957
|
-
}, [n, l, c]), C = H(
|
|
1958
|
-
(v, U, A) => {
|
|
1959
|
-
!b || !(f != null && f.document) || h(
|
|
1960
|
-
en({
|
|
1961
|
-
allInputs: d.inputs || [],
|
|
1962
|
-
documentSheetId: f.id,
|
|
1963
|
-
currentDocumentInputs: k,
|
|
1964
|
-
nextControls: v,
|
|
1965
|
-
nextDefaultValues: U,
|
|
1966
|
-
change: A
|
|
1967
|
-
})
|
|
1968
|
-
);
|
|
1969
|
-
},
|
|
1970
|
-
[
|
|
1971
|
-
d.inputs,
|
|
1972
|
-
k,
|
|
1973
|
-
b,
|
|
1974
|
-
f,
|
|
1975
|
-
h
|
|
1976
|
-
]
|
|
1977
|
-
);
|
|
1978
|
-
return !b || !(f != null && f.document) ? null : /* @__PURE__ */ t(Ee, { open: o, onOpenChange: s, children: /* @__PURE__ */ r(
|
|
1979
|
-
Ae,
|
|
1980
|
-
{
|
|
1981
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
1982
|
-
onEscapeKeyDown: p,
|
|
1983
|
-
onPointerDownOutside: p,
|
|
1984
|
-
children: [
|
|
1985
|
-
/* @__PURE__ */ r(pt, { className: u ? "space-y-0" : void 0, children: [
|
|
1986
|
-
/* @__PURE__ */ t(Ie, { className: "text-[15px]", children: u ? "Add document control" : "Document Controls" }),
|
|
1987
|
-
/* @__PURE__ */ t(
|
|
1988
|
-
ft,
|
|
1989
|
-
{
|
|
1990
|
-
className: u ? "sr-only" : "text-[13px]",
|
|
1991
|
-
children: u ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
|
|
1992
|
-
}
|
|
1993
|
-
)
|
|
1994
|
-
] }),
|
|
1995
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ t(
|
|
1996
|
-
$t,
|
|
1997
|
-
{
|
|
1998
|
-
scope: "dashboard",
|
|
1999
|
-
controls: y,
|
|
2000
|
-
reservedControlIds: D,
|
|
2001
|
-
defaultValues: S,
|
|
2002
|
-
usageByControlId: {},
|
|
2003
|
-
availableFieldChoices: [],
|
|
2004
|
-
availableMetricChoices: [],
|
|
2005
|
-
structuralParticipants: [],
|
|
2006
|
-
structuralParticipantIdsByControlId: {},
|
|
2007
|
-
allowedControlTypes: Xa,
|
|
2008
|
-
initialCreateFlow: i === "create",
|
|
2009
|
-
onCreateFlowActiveChange: c,
|
|
2010
|
-
onCreateFlowComplete: w,
|
|
2011
|
-
onChange: C,
|
|
2012
|
-
emptyMessage: "No document controls yet."
|
|
2013
|
-
}
|
|
2014
|
-
) })
|
|
2015
|
-
]
|
|
2016
|
-
}
|
|
2017
|
-
) });
|
|
2018
|
-
}
|
|
2019
|
-
function Qa(e) {
|
|
2020
|
-
return (e.controls || []).map((a) => a.id);
|
|
2021
|
-
}
|
|
2022
|
-
function Za(e) {
|
|
2023
|
-
const a = {};
|
|
2024
|
-
for (const i of e)
|
|
2025
|
-
i.defaultValue !== void 0 && (a[i.id] = i.defaultValue);
|
|
2026
|
-
return a;
|
|
2027
|
-
}
|
|
2028
|
-
function Ja(e, a) {
|
|
2029
|
-
return a ? Object.prototype.hasOwnProperty.call(a, e.id) ? {
|
|
2030
|
-
...e,
|
|
2031
|
-
defaultValue: a[e.id]
|
|
2032
|
-
} : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
|
|
2033
|
-
}
|
|
2034
|
-
function en({
|
|
2035
|
-
allInputs: e,
|
|
2036
|
-
documentSheetId: a,
|
|
2037
|
-
currentDocumentInputs: i,
|
|
2038
|
-
nextControls: n,
|
|
2039
|
-
nextDefaultValues: l,
|
|
2040
|
-
change: s
|
|
2041
|
-
}) {
|
|
2042
|
-
const u = new Map(
|
|
2043
|
-
n.map((h) => [
|
|
2044
|
-
h.id,
|
|
2045
|
-
Ja(h, l)
|
|
2046
|
-
])
|
|
2047
|
-
), p = (s == null ? void 0 : s.type) === "rename" ? { oldId: s.oldId, newId: s.newId } : null, o = /* @__PURE__ */ new Set(), c = [];
|
|
2048
|
-
for (const h of i) {
|
|
2049
|
-
if (h.kind !== "control") {
|
|
2050
|
-
c.push(h);
|
|
2051
|
-
continue;
|
|
2052
|
-
}
|
|
2053
|
-
const f = u.get(h.control.id) || ((p == null ? void 0 : p.oldId) === h.control.id ? u.get(p.newId) : void 0);
|
|
2054
|
-
if (!f)
|
|
2055
|
-
continue;
|
|
2056
|
-
o.add(f.id);
|
|
2057
|
-
const b = Qt(
|
|
2058
|
-
f.id,
|
|
2059
|
-
[...e, ...c].filter(
|
|
2060
|
-
(I) => I.id !== h.id
|
|
2061
|
-
)
|
|
2062
|
-
), k = f.id === b ? f : { ...f, id: b };
|
|
2063
|
-
c.push({
|
|
2064
|
-
...h,
|
|
2065
|
-
label: k.label,
|
|
2066
|
-
variableName: b,
|
|
2067
|
-
requiredAtExecution: k.requiredAtExecution,
|
|
2068
|
-
control: k
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
|
-
for (const h of u.values())
|
|
2072
|
-
o.has(h.id) || c.push(
|
|
2073
|
-
Tr({
|
|
2074
|
-
control: h,
|
|
2075
|
-
existingInputs: [...e, ...c],
|
|
2076
|
-
sheetId: a
|
|
2077
|
-
})
|
|
2078
|
-
);
|
|
2079
|
-
const d = new Set(
|
|
2080
|
-
i.map((h) => h.id)
|
|
2081
|
-
);
|
|
2082
|
-
return [...e.filter(
|
|
2083
|
-
(h) => !d.has(h.id)
|
|
2084
|
-
), ...c];
|
|
2085
|
-
}
|
|
2086
|
-
function tn({
|
|
2087
|
-
showFilters: e,
|
|
2088
|
-
onShowFiltersChange: a,
|
|
2089
|
-
pickerContent: i,
|
|
2090
|
-
settingsContent: n,
|
|
2091
|
-
size: l = "default",
|
|
2092
|
-
className: s,
|
|
2093
|
-
primaryButtonClassName: u,
|
|
2094
|
-
secondaryButtonClassName: p,
|
|
2095
|
-
pickerContentClassName: o,
|
|
2096
|
-
settingsContentClassName: c
|
|
2097
|
-
}) {
|
|
2098
|
-
const d = l === "toolbar", [m, h] = E(!1), f = st("interactive");
|
|
2099
|
-
return /* @__PURE__ */ r(
|
|
2100
|
-
"div",
|
|
2101
|
-
{
|
|
2102
|
-
className: K(
|
|
2103
|
-
// Height lives on the shell so the outer border is part of the
|
|
2104
|
-
// h-7 box (matches regular `size="xs"` buttons). Inner triggers
|
|
2105
|
-
// stretch to fill via `h-full`.
|
|
2106
|
-
"relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
|
|
2107
|
-
d ? "h-8" : "h-7",
|
|
2108
|
-
s
|
|
2109
|
-
),
|
|
2110
|
-
children: [
|
|
2111
|
-
/* @__PURE__ */ r(ze, { open: e, onOpenChange: a, children: [
|
|
2112
|
-
/* @__PURE__ */ t($e, { asChild: !0, children: /* @__PURE__ */ r(
|
|
2113
|
-
R,
|
|
2114
|
-
{
|
|
2115
|
-
variant: "ghost",
|
|
2116
|
-
size: "xs",
|
|
2117
|
-
className: K(
|
|
2118
|
-
"h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2119
|
-
u
|
|
2120
|
-
),
|
|
2121
|
-
children: [
|
|
2122
|
-
e ? /* @__PURE__ */ t(ha, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" }),
|
|
2123
|
-
"Filter"
|
|
2124
|
-
]
|
|
2125
|
-
}
|
|
2126
|
-
) }),
|
|
2127
|
-
/* @__PURE__ */ t(
|
|
2128
|
-
je,
|
|
2129
|
-
{
|
|
2130
|
-
align: "end",
|
|
2131
|
-
sideOffset: 6,
|
|
2132
|
-
className: K(
|
|
2133
|
-
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2134
|
-
o
|
|
2135
|
-
),
|
|
2136
|
-
style: f.contentStyle,
|
|
2137
|
-
children: i
|
|
2138
|
-
}
|
|
2139
|
-
)
|
|
2140
|
-
] }),
|
|
2141
|
-
/* @__PURE__ */ r(ze, { open: m, onOpenChange: h, children: [
|
|
2142
|
-
/* @__PURE__ */ t($e, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2143
|
-
R,
|
|
2144
|
-
{
|
|
2145
|
-
variant: "ghost",
|
|
2146
|
-
size: "xs",
|
|
2147
|
-
className: K(
|
|
2148
|
-
"h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2149
|
-
p
|
|
2150
|
-
),
|
|
2151
|
-
"aria-label": "Filter and control actions",
|
|
2152
|
-
children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
|
|
2153
|
-
}
|
|
2154
|
-
) }),
|
|
2155
|
-
/* @__PURE__ */ t(
|
|
2156
|
-
je,
|
|
2157
|
-
{
|
|
2158
|
-
align: "end",
|
|
2159
|
-
sideOffset: 6,
|
|
2160
|
-
className: K(
|
|
2161
|
-
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2162
|
-
c
|
|
2163
|
-
),
|
|
2164
|
-
style: f.contentStyle,
|
|
2165
|
-
children: n(() => h(!1))
|
|
2166
|
-
}
|
|
2167
|
-
)
|
|
2168
|
-
] })
|
|
2169
|
-
]
|
|
2170
|
-
}
|
|
2171
|
-
);
|
|
2172
|
-
}
|
|
2173
|
-
function rn() {
|
|
2174
|
-
ma();
|
|
2175
|
-
const e = T((o) => o.selectedSheetId), a = T((o) => o.selectedFrameId), i = T((o) => o.dashboard), n = T((o) => o.actions.getSelectedFrame), { setSelectedFrameId: l } = ve(), { setCard: s } = At(), u = fe((o) => o.card.dataSource);
|
|
2176
|
-
return Y(() => {
|
|
2177
|
-
var c, d;
|
|
2178
|
-
let o = n();
|
|
2179
|
-
if (!o) {
|
|
2180
|
-
const m = (c = i == null ? void 0 : i.sheets) == null ? void 0 : c.find((f) => f.id === e), h = (d = m == null ? void 0 : m.frames) == null ? void 0 : d[0];
|
|
2181
|
-
h && (l(h.id), o = h);
|
|
2182
|
-
}
|
|
2183
|
-
if (o) {
|
|
2184
|
-
const m = o.cards.find((h) => h.id === o.activeCardId);
|
|
2185
|
-
m && s(m);
|
|
2186
|
-
}
|
|
2187
|
-
}, [n, e, a, i, l, s]), {
|
|
2188
|
-
hasEntities: !!(u != null && u.selectedEntities && u.selectedEntities.length > 0)
|
|
2189
|
-
};
|
|
2190
|
-
}
|
|
2191
|
-
function an() {
|
|
2192
|
-
const e = T((o) => o.dashboard), a = T(
|
|
2193
|
-
(o) => o.semanticExecutionPayload
|
|
2194
|
-
), i = T((o) => o.actions.addFilter), { hasEntities: n } = rn(), { isLoading: l } = Br(), s = Z(
|
|
2195
|
-
() => Zt(e, a),
|
|
2196
|
-
[e, a]
|
|
2197
|
-
), p = !Jt(e.filters) && s.hasEligibleCards && !l;
|
|
2198
|
-
return /* @__PURE__ */ r("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
|
|
2199
|
-
p && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ r(
|
|
2200
|
-
"button",
|
|
2201
|
-
{
|
|
2202
|
-
type: "button",
|
|
2203
|
-
onClick: () => i(er()),
|
|
2204
|
-
title: `Applies to ${s.eligibleCardCount} of ${s.totalCardCount} date-aware cards`,
|
|
2205
|
-
className: "flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
|
|
2206
|
-
children: [
|
|
2207
|
-
/* @__PURE__ */ t(ya, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2208
|
-
/* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col", children: [
|
|
2209
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
|
|
2210
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
|
|
2211
|
-
] })
|
|
2212
|
-
]
|
|
2213
|
-
}
|
|
2214
|
-
) }),
|
|
2215
|
-
!n && /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
|
|
2216
|
-
/* @__PURE__ */ t(Rr, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
|
|
2217
|
-
/* @__PURE__ */ t("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
|
|
2218
|
-
/* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
|
|
2219
|
-
] }),
|
|
2220
|
-
n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(Ur, { context: "filter" }) })
|
|
2221
|
-
] });
|
|
2222
|
-
}
|
|
2223
|
-
const St = !1;
|
|
2224
|
-
function nn({
|
|
2225
|
-
onAddFilter: e,
|
|
2226
|
-
onAddControl: a,
|
|
2227
|
-
onManageControls: i,
|
|
2228
|
-
onDismiss: n
|
|
2229
|
-
}) {
|
|
2230
|
-
const l = T(
|
|
2231
|
-
(p) => p.dashboard.filterLayout
|
|
2232
|
-
), { setFilterLayout: s } = ve();
|
|
2233
|
-
l != null && l.displayMode;
|
|
2234
|
-
const u = (l == null ? void 0 : l.toolbarWrap) ?? !1;
|
|
2235
|
-
return l == null || l.showDownloadButton, /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
|
|
2236
|
-
/* @__PURE__ */ r("div", { className: "p-1", children: [
|
|
2237
|
-
/* @__PURE__ */ t(
|
|
2238
|
-
rt,
|
|
2239
|
-
{
|
|
2240
|
-
icon: Mt,
|
|
2241
|
-
label: "Add filter",
|
|
2242
|
-
onClick: () => {
|
|
2243
|
-
e(), n();
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
),
|
|
2247
|
-
/* @__PURE__ */ t(
|
|
2248
|
-
rt,
|
|
2249
|
-
{
|
|
2250
|
-
icon: It,
|
|
2251
|
-
label: "Add control",
|
|
2252
|
-
onClick: () => {
|
|
2253
|
-
a(), n();
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
),
|
|
2257
|
-
/* @__PURE__ */ t(
|
|
2258
|
-
rt,
|
|
2259
|
-
{
|
|
2260
|
-
icon: _t,
|
|
2261
|
-
label: "Manage controls",
|
|
2262
|
-
onClick: () => {
|
|
2263
|
-
i(), n();
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
)
|
|
2267
|
-
] }),
|
|
2268
|
-
/* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
|
|
2269
|
-
/* @__PURE__ */ r("div", { className: "space-y-1 p-2", children: [
|
|
2270
|
-
/* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
|
|
2271
|
-
St,
|
|
2272
|
-
/* @__PURE__ */ t(
|
|
2273
|
-
sn,
|
|
2274
|
-
{
|
|
2275
|
-
id: "filter-display-wrap",
|
|
2276
|
-
label: "Wrap to multiple lines",
|
|
2277
|
-
checked: u,
|
|
2278
|
-
onCheckedChange: (p) => s({ toolbarWrap: p === !0 })
|
|
2279
|
-
}
|
|
2280
|
-
),
|
|
2281
|
-
St
|
|
2282
|
-
] })
|
|
2283
|
-
] });
|
|
2284
|
-
}
|
|
2285
|
-
function rt({
|
|
2286
|
-
icon: e,
|
|
2287
|
-
label: a,
|
|
2288
|
-
onClick: i
|
|
2289
|
-
}) {
|
|
2290
|
-
return /* @__PURE__ */ r(
|
|
2291
|
-
"button",
|
|
2292
|
-
{
|
|
2293
|
-
type: "button",
|
|
2294
|
-
onClick: i,
|
|
2295
|
-
className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",
|
|
2296
|
-
children: [
|
|
2297
|
-
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
2298
|
-
a
|
|
2299
|
-
]
|
|
2300
|
-
}
|
|
2301
|
-
);
|
|
2302
|
-
}
|
|
2303
|
-
function sn({
|
|
2304
|
-
id: e,
|
|
2305
|
-
label: a,
|
|
2306
|
-
checked: i,
|
|
2307
|
-
onCheckedChange: n
|
|
2308
|
-
}) {
|
|
2309
|
-
return /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
2310
|
-
/* @__PURE__ */ t(mt, { id: e, checked: i, onCheckedChange: n }),
|
|
2311
|
-
/* @__PURE__ */ t(
|
|
2312
|
-
ke,
|
|
2313
|
-
{
|
|
2314
|
-
htmlFor: e,
|
|
2315
|
-
className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
|
|
2316
|
-
children: a
|
|
2317
|
-
}
|
|
2318
|
-
)
|
|
2319
|
-
] });
|
|
2320
|
-
}
|
|
2321
|
-
function es({
|
|
2322
|
-
size: e,
|
|
2323
|
-
className: a,
|
|
2324
|
-
primaryButtonClassName: i,
|
|
2325
|
-
secondaryButtonClassName: n,
|
|
2326
|
-
pickerContentClassName: l,
|
|
2327
|
-
settingsContentClassName: s
|
|
2328
|
-
}) {
|
|
2329
|
-
var F;
|
|
2330
|
-
const [u, p] = E(null), o = T((g) => g.dashboard), c = T((g) => g.selectedSheetId), d = T((g) => g.showFilters), m = Vr((g) => g.setPanelOpen), h = T((g) => g.actions), { setDocumentPanelTarget: f, setShowFilters: b } = h, k = (F = o.sheets) == null ? void 0 : F.find(
|
|
2331
|
-
(g) => g.id === c
|
|
2332
|
-
), I = tr(k), y = H((g) => {
|
|
2333
|
-
window.setTimeout(() => {
|
|
2334
|
-
p(g);
|
|
2335
|
-
}, 0);
|
|
2336
|
-
}, []), S = H(
|
|
2337
|
-
(g) => {
|
|
2338
|
-
if (I && c) {
|
|
2339
|
-
g && f(c, {
|
|
2340
|
-
kind: "document",
|
|
2341
|
-
group: "inputs"
|
|
2342
|
-
});
|
|
2343
|
-
return;
|
|
2344
|
-
}
|
|
2345
|
-
g && m("dashboard", !1), b(g);
|
|
2346
|
-
},
|
|
2347
|
-
[
|
|
2348
|
-
I,
|
|
2349
|
-
c,
|
|
2350
|
-
f,
|
|
2351
|
-
m,
|
|
2352
|
-
b
|
|
2353
|
-
]
|
|
2354
|
-
), D = H(() => {
|
|
2355
|
-
S(!0);
|
|
2356
|
-
}, [S]), w = H(() => {
|
|
2357
|
-
y("create");
|
|
2358
|
-
}, [y]), C = H(() => {
|
|
2359
|
-
y("manage");
|
|
2360
|
-
}, [y]);
|
|
2361
|
-
return /* @__PURE__ */ r(j, { children: [
|
|
2362
|
-
/* @__PURE__ */ t(
|
|
2363
|
-
tn,
|
|
2364
|
-
{
|
|
2365
|
-
showFilters: I ? !1 : d,
|
|
2366
|
-
onShowFiltersChange: S,
|
|
2367
|
-
pickerContent: /* @__PURE__ */ t(an, {}),
|
|
2368
|
-
settingsContent: (g) => /* @__PURE__ */ t(
|
|
2369
|
-
nn,
|
|
2370
|
-
{
|
|
2371
|
-
onAddFilter: D,
|
|
2372
|
-
onAddControl: w,
|
|
2373
|
-
onManageControls: C,
|
|
2374
|
-
onDismiss: g
|
|
2375
|
-
}
|
|
2376
|
-
),
|
|
2377
|
-
size: e,
|
|
2378
|
-
className: a,
|
|
2379
|
-
primaryButtonClassName: i,
|
|
2380
|
-
secondaryButtonClassName: n,
|
|
2381
|
-
pickerContentClassName: l,
|
|
2382
|
-
settingsContentClassName: s
|
|
2383
|
-
}
|
|
2384
|
-
),
|
|
2385
|
-
u ? I ? /* @__PURE__ */ t(
|
|
2386
|
-
Ya,
|
|
2387
|
-
{
|
|
2388
|
-
open: !0,
|
|
2389
|
-
onOpenChange: (g) => {
|
|
2390
|
-
g || p(null);
|
|
2391
|
-
},
|
|
2392
|
-
initialMode: u
|
|
2393
|
-
}
|
|
2394
|
-
) : /* @__PURE__ */ t(
|
|
2395
|
-
Ka,
|
|
2396
|
-
{
|
|
2397
|
-
open: !0,
|
|
2398
|
-
onOpenChange: (g) => {
|
|
2399
|
-
g || p(null);
|
|
2400
|
-
},
|
|
2401
|
-
showTrigger: !1,
|
|
2402
|
-
initialMode: u
|
|
2403
|
-
}
|
|
2404
|
-
) : null
|
|
2405
|
-
] });
|
|
2406
|
-
}
|
|
2407
|
-
function on({
|
|
2408
|
-
disabled: e,
|
|
2409
|
-
briefingCount: a,
|
|
2410
|
-
className: i,
|
|
2411
|
-
onClick: n
|
|
2412
|
-
}) {
|
|
2413
|
-
const l = typeof a == "number" && a > 0;
|
|
2414
|
-
return /* @__PURE__ */ r(
|
|
2415
|
-
R,
|
|
2416
|
-
{
|
|
2417
|
-
type: "button",
|
|
2418
|
-
size: "xs",
|
|
2419
|
-
variant: "outline",
|
|
2420
|
-
disabled: e,
|
|
2421
|
-
className: K("gap-1.5", i),
|
|
2422
|
-
onClick: n,
|
|
2423
|
-
"aria-label": "Reports & briefings",
|
|
2424
|
-
children: [
|
|
2425
|
-
/* @__PURE__ */ t(Na, { className: "h-3.5 w-3.5" }),
|
|
2426
|
-
"Reports & briefings",
|
|
2427
|
-
l ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
|
|
2428
|
-
]
|
|
2429
|
-
}
|
|
2430
|
-
);
|
|
2431
|
-
}
|
|
2432
|
-
const ln = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ht = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Oe = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
|
|
2433
|
-
function dn(e) {
|
|
2434
|
-
return e === "dashboard" ? "This dashboard" : "Project";
|
|
2435
|
-
}
|
|
2436
|
-
function cn(e) {
|
|
2437
|
-
if (!e) return "Never";
|
|
2438
|
-
const a = new Date(e);
|
|
2439
|
-
if (Number.isNaN(a.getTime())) return "Unknown";
|
|
2440
|
-
const i = Date.now() - a.getTime(), n = Math.round(i / 6e4);
|
|
2441
|
-
if (n < 1) return "now";
|
|
2442
|
-
if (n < 60) return `${n}m ago`;
|
|
2443
|
-
const l = Math.round(n / 60);
|
|
2444
|
-
if (l < 24) return `${l}h ago`;
|
|
2445
|
-
const s = Math.round(l / 24);
|
|
2446
|
-
if (s < 7) return `${s}d ago`;
|
|
2447
|
-
const u = Math.round(s / 7);
|
|
2448
|
-
return u < 5 ? `${u}w ago` : `${Math.round(s / 30)}mo ago`;
|
|
2449
|
-
}
|
|
2450
|
-
function un(e) {
|
|
2451
|
-
return e.scheduleExpr ? ba(
|
|
2452
|
-
e.scheduleExpr,
|
|
2453
|
-
e.timezone || "UTC"
|
|
2454
|
-
) ?? "Invalid schedule" : "On demand";
|
|
2455
|
-
}
|
|
2456
|
-
function hn(e) {
|
|
2457
|
-
if (e.lastRunStatus) {
|
|
2458
|
-
const a = e.lastRunStatus.toString().toUpperCase();
|
|
2459
|
-
return a === "SUCCESS" ? "Last run completed." : a === "FAILED" ? "Last run failed." : `Last run ${e.lastRunStatus.toString().toLowerCase()}`;
|
|
2460
|
-
}
|
|
2461
|
-
return null;
|
|
2462
|
-
}
|
|
2463
|
-
function qt(e) {
|
|
2464
|
-
return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
|
|
2465
|
-
}
|
|
2466
|
-
function mn(e) {
|
|
2467
|
-
return e.source.type === "dashboard" ? "This dashboard" : "Project";
|
|
2468
|
-
}
|
|
2469
|
-
function pn({
|
|
2470
|
-
activeView: e,
|
|
2471
|
-
onChange: a
|
|
2472
|
-
}) {
|
|
2473
|
-
return /* @__PURE__ */ t(
|
|
2474
|
-
"div",
|
|
2475
|
-
{
|
|
2476
|
-
className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
|
|
2477
|
-
role: "tablist",
|
|
2478
|
-
"aria-label": "Briefing source view",
|
|
2479
|
-
children: ["dashboard", "project"].map((i) => {
|
|
2480
|
-
const n = e === i;
|
|
2481
|
-
return /* @__PURE__ */ t(
|
|
2482
|
-
"button",
|
|
2483
|
-
{
|
|
2484
|
-
type: "button",
|
|
2485
|
-
role: "tab",
|
|
2486
|
-
"aria-selected": n,
|
|
2487
|
-
onClick: () => a(i),
|
|
2488
|
-
className: K(
|
|
2489
|
-
"h-6 rounded-[3px] px-2 text-[11px] transition-colors",
|
|
2490
|
-
n ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
2491
|
-
),
|
|
2492
|
-
children: dn(i)
|
|
2493
|
-
},
|
|
2494
|
-
i
|
|
2495
|
-
);
|
|
2496
|
-
})
|
|
2497
|
-
}
|
|
2498
|
-
);
|
|
2499
|
-
}
|
|
2500
|
-
function fn({
|
|
2501
|
-
briefings: e,
|
|
2502
|
-
dashboardLabel: a,
|
|
2503
|
-
sourceView: i,
|
|
2504
|
-
error: n,
|
|
2505
|
-
loading: l,
|
|
2506
|
-
onSourceViewChange: s,
|
|
2507
|
-
onClose: u,
|
|
2508
|
-
onEdit: p,
|
|
2509
|
-
onNew: o,
|
|
2510
|
-
canCreate: c,
|
|
2511
|
-
canCreateScheduledReport: d,
|
|
2512
|
-
analyticalBriefingsEnabled: m,
|
|
2513
|
-
onRunNow: h,
|
|
2514
|
-
onTogglePause: f,
|
|
2515
|
-
onDelete: b,
|
|
2516
|
-
selectingId: k,
|
|
2517
|
-
busyId: I,
|
|
2518
|
-
manageBriefingsHref: y,
|
|
2519
|
-
contentKind: S,
|
|
2520
|
-
hideHeader: D = !1
|
|
2521
|
-
}) {
|
|
2522
|
-
const w = e.length, C = e.filter((A) => A.status === "ACTIVE").length, F = S === "reports" ? w === 1 ? "report" : "reports" : S === "briefings" ? w === 1 ? "briefing" : "briefings" : w === 1 ? "item" : "items", g = e.find((A) => A.hasActiveRun) ?? null, v = S ?? "reports & briefings", U = i === "dashboard" ? a : `Project ${v}`;
|
|
2523
|
-
return /* @__PURE__ */ r(
|
|
2524
|
-
"section",
|
|
2525
|
-
{
|
|
2526
|
-
"aria-label": `Dashboard ${v.replace("&", "and")}`,
|
|
2527
|
-
className: "flex h-full min-h-0 flex-col bg-background text-foreground",
|
|
2528
|
-
children: [
|
|
2529
|
-
D ? null : /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
2530
|
-
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
2531
|
-
/* @__PURE__ */ t("div", { className: ln, children: v }),
|
|
2532
|
-
/* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: U })
|
|
2533
|
-
] }),
|
|
2534
|
-
/* @__PURE__ */ t(
|
|
2535
|
-
"button",
|
|
2536
|
-
{
|
|
2537
|
-
type: "button",
|
|
2538
|
-
onClick: u,
|
|
2539
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
2540
|
-
"aria-label": `Close ${v.replace("&", "and")} panel`,
|
|
2541
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
2542
|
-
}
|
|
2543
|
-
)
|
|
2544
|
-
] }),
|
|
2545
|
-
/* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
|
|
2546
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
2547
|
-
/* @__PURE__ */ t(
|
|
2548
|
-
pn,
|
|
2549
|
-
{
|
|
2550
|
-
activeView: i,
|
|
2551
|
-
onChange: s
|
|
2552
|
-
}
|
|
2553
|
-
),
|
|
2554
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: l && w === 0 ? /* @__PURE__ */ r("span", { children: [
|
|
2555
|
-
"Loading ",
|
|
2556
|
-
v,
|
|
2557
|
-
"…"
|
|
2558
|
-
] }) : w === 0 ? /* @__PURE__ */ r("span", { children: [
|
|
2559
|
-
"No ",
|
|
2560
|
-
v,
|
|
2561
|
-
" yet"
|
|
2562
|
-
] }) : /* @__PURE__ */ r(j, { children: [
|
|
2563
|
-
/* @__PURE__ */ r("span", { className: "font-medium text-foreground/80", children: [
|
|
2564
|
-
w,
|
|
2565
|
-
" ",
|
|
2566
|
-
F
|
|
2567
|
-
] }),
|
|
2568
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2569
|
-
/* @__PURE__ */ r("span", { children: [
|
|
2570
|
-
C,
|
|
2571
|
-
" active"
|
|
2572
|
-
] })
|
|
2573
|
-
] }) })
|
|
2574
|
-
] }),
|
|
2575
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
2576
|
-
l ? (
|
|
2577
|
-
// Auto-refresh on open; surface a quiet spinner near the count
|
|
2578
|
-
// when a manual reload is in flight, but don't show a separate
|
|
2579
|
-
// refresh button — close+reopen handles the rare "stale list"
|
|
2580
|
-
// case without crowding the toolbar.
|
|
2581
|
-
/* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
|
|
2582
|
-
) : null,
|
|
2583
|
-
w > 0 && c ? m && d ? /* @__PURE__ */ r(Ge, { children: [
|
|
2584
|
-
/* @__PURE__ */ t(Ke, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Oe, children: [
|
|
2585
|
-
/* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
2586
|
-
" New"
|
|
2587
|
-
] }) }),
|
|
2588
|
-
/* @__PURE__ */ r(Xe, { align: "end", children: [
|
|
2589
|
-
/* @__PURE__ */ t(G, { onClick: () => o("scheduled_report"), children: "Schedule a report" }),
|
|
2590
|
-
/* @__PURE__ */ t(
|
|
2591
|
-
G,
|
|
2592
|
-
{
|
|
2593
|
-
onClick: () => o("analytical_briefing"),
|
|
2594
|
-
children: "Create analytical briefing"
|
|
2595
|
-
}
|
|
2596
|
-
)
|
|
2597
|
-
] })
|
|
2598
|
-
] }) : d ? /* @__PURE__ */ r(
|
|
2599
|
-
"button",
|
|
2600
|
-
{
|
|
2601
|
-
onClick: () => o("scheduled_report"),
|
|
2602
|
-
className: Oe,
|
|
2603
|
-
children: [
|
|
2604
|
-
/* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
2605
|
-
" Schedule report"
|
|
2606
|
-
]
|
|
2607
|
-
}
|
|
2608
|
-
) : m ? /* @__PURE__ */ r(
|
|
2609
|
-
"button",
|
|
2610
|
-
{
|
|
2611
|
-
onClick: () => o("analytical_briefing"),
|
|
2612
|
-
className: Oe,
|
|
2613
|
-
children: [
|
|
2614
|
-
/* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
2615
|
-
" New briefing"
|
|
2616
|
-
]
|
|
2617
|
-
}
|
|
2618
|
-
) : null : null
|
|
2619
|
-
] })
|
|
2620
|
-
] }),
|
|
2621
|
-
g ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
|
|
2622
|
-
/* @__PURE__ */ t(ae, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
|
|
2623
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: g.name }),
|
|
2624
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2625
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: qt(g) })
|
|
2626
|
-
] }) : null,
|
|
2627
|
-
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: [
|
|
2628
|
-
n ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
|
|
2629
|
-
!l && e.length === 0 && !n ? /* @__PURE__ */ t(
|
|
2630
|
-
gn,
|
|
2631
|
-
{
|
|
2632
|
-
onNew: o,
|
|
2633
|
-
canCreate: c,
|
|
2634
|
-
canCreateScheduledReport: d,
|
|
2635
|
-
analyticalBriefingsEnabled: m,
|
|
2636
|
-
contentKind: S
|
|
2637
|
-
}
|
|
2638
|
-
) : null,
|
|
2639
|
-
e.map((A) => /* @__PURE__ */ t(
|
|
2640
|
-
xn,
|
|
2641
|
-
{
|
|
2642
|
-
briefing: A,
|
|
2643
|
-
isOpening: k === A.id,
|
|
2644
|
-
isBusy: I === A.id,
|
|
2645
|
-
onOpen: () => p(A.id),
|
|
2646
|
-
onRunNow: () => h(A),
|
|
2647
|
-
onTogglePause: () => f(A),
|
|
2648
|
-
onDelete: () => b(A)
|
|
2649
|
-
},
|
|
2650
|
-
A.id
|
|
2651
|
-
))
|
|
2652
|
-
] }),
|
|
2653
|
-
y ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ r(
|
|
2654
|
-
"a",
|
|
2655
|
-
{
|
|
2656
|
-
href: y,
|
|
2657
|
-
className: K(Ht, "h-6 px-1 text-[11px]"),
|
|
2658
|
-
children: [
|
|
2659
|
-
"Manage all reports & briefings",
|
|
2660
|
-
/* @__PURE__ */ t(va, { className: "h-3 w-3" })
|
|
2661
|
-
]
|
|
2662
|
-
}
|
|
2663
|
-
) }) : null
|
|
2664
|
-
]
|
|
2665
|
-
}
|
|
2666
|
-
);
|
|
2667
|
-
}
|
|
2668
|
-
function gn({
|
|
2669
|
-
onNew: e,
|
|
2670
|
-
canCreate: a,
|
|
2671
|
-
canCreateScheduledReport: i,
|
|
2672
|
-
analyticalBriefingsEnabled: n,
|
|
2673
|
-
contentKind: l
|
|
2674
|
-
}) {
|
|
2675
|
-
const s = l === "reports" ? {
|
|
2676
|
-
title: "No reports yet",
|
|
2677
|
-
description: "Schedule an emailed dashboard or visual report to see it here."
|
|
2678
|
-
} : l === "briefings" ? {
|
|
2679
|
-
title: "No briefings yet",
|
|
2680
|
-
description: "Create an analytical briefing to monitor this dashboard and brief your team."
|
|
2681
|
-
} : null;
|
|
2682
|
-
return /* @__PURE__ */ r("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
|
|
2683
|
-
/* @__PURE__ */ t(bn, { className: "mb-5 h-[88px] w-[112px] text-border" }),
|
|
2684
|
-
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: (s == null ? void 0 : s.title) ?? "Have an analyst brief your team" }),
|
|
2685
|
-
/* @__PURE__ */ t("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (s == null ? void 0 : s.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
|
|
2686
|
-
a ? /* @__PURE__ */ r("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
2687
|
-
i ? /* @__PURE__ */ r(
|
|
2688
|
-
"button",
|
|
2689
|
-
{
|
|
2690
|
-
onClick: () => e("scheduled_report"),
|
|
2691
|
-
className: Oe,
|
|
2692
|
-
children: [
|
|
2693
|
-
/* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
2694
|
-
" Schedule a report"
|
|
2695
|
-
]
|
|
2696
|
-
}
|
|
2697
|
-
) : null,
|
|
2698
|
-
n ? /* @__PURE__ */ t(
|
|
2699
|
-
"button",
|
|
2700
|
-
{
|
|
2701
|
-
onClick: () => e("analytical_briefing"),
|
|
2702
|
-
className: Ht,
|
|
2703
|
-
children: "Create analytical briefing"
|
|
2704
|
-
}
|
|
2705
|
-
) : null
|
|
2706
|
-
] }) : null
|
|
2707
|
-
] });
|
|
2708
|
-
}
|
|
2709
|
-
function bn({ className: e }) {
|
|
2710
|
-
return /* @__PURE__ */ r(
|
|
2711
|
-
"svg",
|
|
2712
|
-
{
|
|
2713
|
-
viewBox: "0 0 112 88",
|
|
2714
|
-
fill: "none",
|
|
2715
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2716
|
-
role: "presentation",
|
|
2717
|
-
"aria-hidden": "true",
|
|
2718
|
-
className: e,
|
|
2719
|
-
children: [
|
|
2720
|
-
/* @__PURE__ */ t(
|
|
2721
|
-
"rect",
|
|
2722
|
-
{
|
|
2723
|
-
x: "22",
|
|
2724
|
-
y: "6",
|
|
2725
|
-
width: "60",
|
|
2726
|
-
height: "72",
|
|
2727
|
-
rx: "3",
|
|
2728
|
-
stroke: "currentColor",
|
|
2729
|
-
strokeWidth: "1.25"
|
|
2730
|
-
}
|
|
2731
|
-
),
|
|
2732
|
-
/* @__PURE__ */ t(
|
|
2733
|
-
"line",
|
|
2734
|
-
{
|
|
2735
|
-
x1: "30",
|
|
2736
|
-
y1: "16",
|
|
2737
|
-
x2: "64",
|
|
2738
|
-
y2: "16",
|
|
2739
|
-
stroke: "currentColor",
|
|
2740
|
-
strokeWidth: "1.5",
|
|
2741
|
-
strokeLinecap: "round"
|
|
2742
|
-
}
|
|
2743
|
-
),
|
|
2744
|
-
/* @__PURE__ */ t(
|
|
2745
|
-
"line",
|
|
2746
|
-
{
|
|
2747
|
-
x1: "30",
|
|
2748
|
-
y1: "21",
|
|
2749
|
-
x2: "52",
|
|
2750
|
-
y2: "21",
|
|
2751
|
-
stroke: "currentColor",
|
|
2752
|
-
strokeWidth: "1",
|
|
2753
|
-
strokeLinecap: "round",
|
|
2754
|
-
opacity: "0.5"
|
|
2755
|
-
}
|
|
2756
|
-
),
|
|
2757
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "32", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
2758
|
-
/* @__PURE__ */ t(
|
|
2759
|
-
"line",
|
|
2760
|
-
{
|
|
2761
|
-
x1: "35",
|
|
2762
|
-
y1: "32",
|
|
2763
|
-
x2: "72",
|
|
2764
|
-
y2: "32",
|
|
2765
|
-
stroke: "currentColor",
|
|
2766
|
-
strokeWidth: "1",
|
|
2767
|
-
opacity: "0.4",
|
|
2768
|
-
strokeLinecap: "round"
|
|
2769
|
-
}
|
|
2770
|
-
),
|
|
2771
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "38", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
2772
|
-
/* @__PURE__ */ t(
|
|
2773
|
-
"line",
|
|
2774
|
-
{
|
|
2775
|
-
x1: "35",
|
|
2776
|
-
y1: "38",
|
|
2777
|
-
x2: "68",
|
|
2778
|
-
y2: "38",
|
|
2779
|
-
stroke: "currentColor",
|
|
2780
|
-
strokeWidth: "1",
|
|
2781
|
-
opacity: "0.4",
|
|
2782
|
-
strokeLinecap: "round"
|
|
2783
|
-
}
|
|
2784
|
-
),
|
|
2785
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "44", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
2786
|
-
/* @__PURE__ */ t(
|
|
2787
|
-
"line",
|
|
2788
|
-
{
|
|
2789
|
-
x1: "35",
|
|
2790
|
-
y1: "44",
|
|
2791
|
-
x2: "74",
|
|
2792
|
-
y2: "44",
|
|
2793
|
-
stroke: "currentColor",
|
|
2794
|
-
strokeWidth: "1",
|
|
2795
|
-
opacity: "0.4",
|
|
2796
|
-
strokeLinecap: "round"
|
|
2797
|
-
}
|
|
2798
|
-
),
|
|
2799
|
-
/* @__PURE__ */ t(
|
|
2800
|
-
"rect",
|
|
2801
|
-
{
|
|
2802
|
-
x: "30",
|
|
2803
|
-
y: "64",
|
|
2804
|
-
width: "5",
|
|
2805
|
-
height: "8",
|
|
2806
|
-
rx: "0.5",
|
|
2807
|
-
fill: "currentColor",
|
|
2808
|
-
opacity: "0.55"
|
|
2809
|
-
}
|
|
2810
|
-
),
|
|
2811
|
-
/* @__PURE__ */ t(
|
|
2812
|
-
"rect",
|
|
2813
|
-
{
|
|
2814
|
-
x: "38",
|
|
2815
|
-
y: "60",
|
|
2816
|
-
width: "5",
|
|
2817
|
-
height: "12",
|
|
2818
|
-
rx: "0.5",
|
|
2819
|
-
fill: "currentColor",
|
|
2820
|
-
opacity: "0.7"
|
|
2821
|
-
}
|
|
2822
|
-
),
|
|
2823
|
-
/* @__PURE__ */ t(
|
|
2824
|
-
"rect",
|
|
2825
|
-
{
|
|
2826
|
-
x: "46",
|
|
2827
|
-
y: "56",
|
|
2828
|
-
width: "5",
|
|
2829
|
-
height: "16",
|
|
2830
|
-
rx: "0.5",
|
|
2831
|
-
fill: "currentColor",
|
|
2832
|
-
opacity: "0.85"
|
|
2833
|
-
}
|
|
2834
|
-
),
|
|
2835
|
-
/* @__PURE__ */ t(
|
|
2836
|
-
"rect",
|
|
2837
|
-
{
|
|
2838
|
-
x: "54",
|
|
2839
|
-
y: "62",
|
|
2840
|
-
width: "5",
|
|
2841
|
-
height: "10",
|
|
2842
|
-
rx: "0.5",
|
|
2843
|
-
fill: "currentColor",
|
|
2844
|
-
opacity: "0.6"
|
|
2845
|
-
}
|
|
2846
|
-
),
|
|
2847
|
-
/* @__PURE__ */ t(
|
|
2848
|
-
"rect",
|
|
2849
|
-
{
|
|
2850
|
-
x: "62",
|
|
2851
|
-
y: "58",
|
|
2852
|
-
width: "5",
|
|
2853
|
-
height: "14",
|
|
2854
|
-
rx: "0.5",
|
|
2855
|
-
fill: "currentColor",
|
|
2856
|
-
opacity: "0.75"
|
|
2857
|
-
}
|
|
2858
|
-
),
|
|
2859
|
-
/* @__PURE__ */ t(
|
|
2860
|
-
"circle",
|
|
2861
|
-
{
|
|
2862
|
-
cx: "86",
|
|
2863
|
-
cy: "62",
|
|
2864
|
-
r: "10",
|
|
2865
|
-
fill: "var(--background, white)",
|
|
2866
|
-
stroke: "currentColor",
|
|
2867
|
-
strokeWidth: "1.25"
|
|
2868
|
-
}
|
|
2869
|
-
),
|
|
2870
|
-
/* @__PURE__ */ t(
|
|
2871
|
-
"line",
|
|
2872
|
-
{
|
|
2873
|
-
x1: "93.5",
|
|
2874
|
-
y1: "69.5",
|
|
2875
|
-
x2: "100",
|
|
2876
|
-
y2: "76",
|
|
2877
|
-
stroke: "currentColor",
|
|
2878
|
-
strokeWidth: "1.5",
|
|
2879
|
-
strokeLinecap: "round"
|
|
2880
|
-
}
|
|
2881
|
-
)
|
|
2882
|
-
]
|
|
2883
|
-
}
|
|
2884
|
-
);
|
|
2885
|
-
}
|
|
2886
|
-
function xn({
|
|
2887
|
-
briefing: e,
|
|
2888
|
-
isOpening: a,
|
|
2889
|
-
isBusy: i,
|
|
2890
|
-
onOpen: n,
|
|
2891
|
-
onRunNow: l,
|
|
2892
|
-
onTogglePause: s,
|
|
2893
|
-
onDelete: u
|
|
2894
|
-
}) {
|
|
2895
|
-
const p = e.status === "PAUSED", o = e.hasActiveRun, c = hn(e), d = cn(e.lastRunAt), m = e.lastRunStatus, h = oe(e), f = m === "SUCCESS" ? Me.success.dot : m === "FAILED" ? Me.danger.dot : m ? Me.warning.dot : Me.neutral.dot;
|
|
2896
|
-
return /* @__PURE__ */ r(
|
|
2897
|
-
"div",
|
|
2898
|
-
{
|
|
2899
|
-
className: K(
|
|
2900
|
-
"group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
|
|
2901
|
-
p && "opacity-70"
|
|
2902
|
-
),
|
|
2903
|
-
children: [
|
|
2904
|
-
/* @__PURE__ */ r(
|
|
2905
|
-
"div",
|
|
2906
|
-
{
|
|
2907
|
-
role: "button",
|
|
2908
|
-
tabIndex: 0,
|
|
2909
|
-
onClick: n,
|
|
2910
|
-
onKeyDown: (b) => {
|
|
2911
|
-
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), n());
|
|
2912
|
-
},
|
|
2913
|
-
className: "cursor-pointer pr-8",
|
|
2914
|
-
children: [
|
|
2915
|
-
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2916
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
|
|
2917
|
-
p ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
|
|
2918
|
-
] }),
|
|
2919
|
-
/* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
|
|
2920
|
-
/* @__PURE__ */ t("span", { children: h.typeLabel }),
|
|
2921
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2922
|
-
/* @__PURE__ */ t("span", { children: mn(e) }),
|
|
2923
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2924
|
-
/* @__PURE__ */ t(Pr, { className: "h-3 w-3" }),
|
|
2925
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: un(e) }),
|
|
2926
|
-
e.lastRunAt ? /* @__PURE__ */ r(j, { children: [
|
|
2927
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2928
|
-
/* @__PURE__ */ r("span", { children: [
|
|
2929
|
-
"Last run ",
|
|
2930
|
-
d
|
|
2931
|
-
] })
|
|
2932
|
-
] }) : null
|
|
2933
|
-
] }),
|
|
2934
|
-
c || o ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
|
|
2935
|
-
o ? /* @__PURE__ */ t(ae, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
|
|
2936
|
-
"span",
|
|
2937
|
-
{
|
|
2938
|
-
className: K(
|
|
2939
|
-
"inline-block h-1.5 w-1.5 shrink-0 rounded-full",
|
|
2940
|
-
f
|
|
2941
|
-
)
|
|
2942
|
-
}
|
|
2943
|
-
),
|
|
2944
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: o ? qt(e) : c })
|
|
2945
|
-
] }) : null
|
|
2946
|
-
]
|
|
2947
|
-
}
|
|
2948
|
-
),
|
|
2949
|
-
/* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: i ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r(Ge, { children: [
|
|
2950
|
-
/* @__PURE__ */ t(Ke, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2951
|
-
"button",
|
|
2952
|
-
{
|
|
2953
|
-
type: "button",
|
|
2954
|
-
onClick: (b) => b.stopPropagation(),
|
|
2955
|
-
className: "inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100",
|
|
2956
|
-
"aria-label": `${h.noun === "report" ? "Report" : "Briefing"} actions`,
|
|
2957
|
-
children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
|
|
2958
|
-
}
|
|
2959
|
-
) }),
|
|
2960
|
-
/* @__PURE__ */ r(Xe, { align: "end", className: "w-44", children: [
|
|
2961
|
-
/* @__PURE__ */ r(G, { onClick: n, children: [
|
|
2962
|
-
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
2963
|
-
"Edit ",
|
|
2964
|
-
h.noun
|
|
2965
|
-
] }),
|
|
2966
|
-
/* @__PURE__ */ r(
|
|
2967
|
-
G,
|
|
2968
|
-
{
|
|
2969
|
-
onClick: (b) => {
|
|
2970
|
-
b.preventDefault(), l();
|
|
2971
|
-
},
|
|
2972
|
-
children: [
|
|
2973
|
-
/* @__PURE__ */ t(Mr, { className: "h-3.5 w-3.5" }),
|
|
2974
|
-
"Run now"
|
|
2975
|
-
]
|
|
2976
|
-
}
|
|
2977
|
-
),
|
|
2978
|
-
e.scheduleExpr ? /* @__PURE__ */ t(
|
|
2979
|
-
G,
|
|
2980
|
-
{
|
|
2981
|
-
onClick: (b) => {
|
|
2982
|
-
b.preventDefault(), s();
|
|
2983
|
-
},
|
|
2984
|
-
children: p ? /* @__PURE__ */ r(j, { children: [
|
|
2985
|
-
/* @__PURE__ */ t(_r, { className: "h-3.5 w-3.5" }),
|
|
2986
|
-
"Resume"
|
|
2987
|
-
] }) : /* @__PURE__ */ r(j, { children: [
|
|
2988
|
-
/* @__PURE__ */ t(Or, { className: "h-3.5 w-3.5" }),
|
|
2989
|
-
"Pause"
|
|
2990
|
-
] })
|
|
2991
|
-
}
|
|
2992
|
-
) : null,
|
|
2993
|
-
/* @__PURE__ */ t(He, {}),
|
|
2994
|
-
/* @__PURE__ */ r(
|
|
2995
|
-
G,
|
|
2996
|
-
{
|
|
2997
|
-
onClick: (b) => {
|
|
2998
|
-
b.preventDefault(), u();
|
|
2999
|
-
},
|
|
3000
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
3001
|
-
children: [
|
|
3002
|
-
/* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" }),
|
|
3003
|
-
"Delete ",
|
|
3004
|
-
h.noun
|
|
3005
|
-
]
|
|
3006
|
-
}
|
|
3007
|
-
)
|
|
3008
|
-
] })
|
|
3009
|
-
] }) })
|
|
3010
|
-
]
|
|
3011
|
-
}
|
|
3012
|
-
);
|
|
3013
|
-
}
|
|
3014
|
-
const vn = 2e3, yn = 20 * 6e4;
|
|
3015
|
-
function Cn(e) {
|
|
3016
|
-
return (e == null ? void 0 : e.trim()) || "This dashboard";
|
|
3017
|
-
}
|
|
3018
|
-
function wn(e) {
|
|
3019
|
-
return e === "This dashboard" ? "Watch this dashboard" : `Watch ${e}`;
|
|
3020
|
-
}
|
|
3021
|
-
function Nn(e, a, i) {
|
|
3022
|
-
return a !== "dashboard" ? e : e.filter(
|
|
3023
|
-
(n) => n.source.type === "dashboard" && n.source.dashboardId === i
|
|
3024
|
-
);
|
|
3025
|
-
}
|
|
3026
|
-
async function Sn(e) {
|
|
3027
|
-
const i = [];
|
|
3028
|
-
let n = 1, l = 0, s = Number.POSITIVE_INFINITY;
|
|
3029
|
-
for (; l < s; ) {
|
|
3030
|
-
const u = await e.apiClient.listBriefings(
|
|
3031
|
-
e.apiServiceUrl,
|
|
3032
|
-
e.token,
|
|
3033
|
-
{ scope: "organization", page: n, pageSize: 100 }
|
|
3034
|
-
);
|
|
3035
|
-
if (i.push(...u.briefings), l += u.briefings.length, s = u.total, u.briefings.length === 0 || l >= s) break;
|
|
3036
|
-
n += 1;
|
|
3037
|
-
}
|
|
3038
|
-
return i;
|
|
3039
|
-
}
|
|
3040
|
-
const Dn = {
|
|
3041
|
-
listBriefings: Kr,
|
|
3042
|
-
getBriefing: Gr,
|
|
3043
|
-
pauseBriefing: qr,
|
|
3044
|
-
resumeBriefing: Hr,
|
|
3045
|
-
deleteBriefing: Wr,
|
|
3046
|
-
runBriefingNow: jr
|
|
3047
|
-
};
|
|
3048
|
-
function kn({
|
|
3049
|
-
briefingId: e,
|
|
3050
|
-
initialRun: a,
|
|
3051
|
-
apiServiceUrl: i,
|
|
3052
|
-
token: n,
|
|
3053
|
-
onTerminal: l,
|
|
3054
|
-
onTimeout: s,
|
|
3055
|
-
onExpand: u
|
|
3056
|
-
}) {
|
|
3057
|
-
const [p, o] = E(a), { startRun: c } = ra({
|
|
3058
|
-
apiServiceUrl: i,
|
|
3059
|
-
token: n,
|
|
3060
|
-
intervalMs: vn,
|
|
3061
|
-
timeoutMs: yn,
|
|
3062
|
-
fetchRun: ({
|
|
3063
|
-
apiServiceUrl: m,
|
|
3064
|
-
token: h,
|
|
3065
|
-
runId: f
|
|
3066
|
-
}) => aa(m, h, e, f),
|
|
3067
|
-
onRun: (m) => {
|
|
3068
|
-
o(m);
|
|
3069
|
-
},
|
|
3070
|
-
onTerminalRun: (m) => {
|
|
3071
|
-
l(m);
|
|
3072
|
-
},
|
|
3073
|
-
onTimeout: () => {
|
|
3074
|
-
s();
|
|
3075
|
-
}
|
|
3076
|
-
}), d = ue(!1);
|
|
3077
|
-
return Y(() => {
|
|
3078
|
-
d.current || (d.current = !0, na(a.status) ? c(a) : sa(a.status) && l(a));
|
|
3079
|
-
}, [a, l, c]), /* @__PURE__ */ t(oa, { run: p, onExpand: u });
|
|
3080
|
-
}
|
|
3081
|
-
function ts(e) {
|
|
3082
|
-
return /* @__PURE__ */ t(zr, { children: /* @__PURE__ */ t(En, { ...e }) });
|
|
3083
|
-
}
|
|
3084
|
-
function En({
|
|
3085
|
-
dashboardId: e,
|
|
3086
|
-
dashboardTitle: a,
|
|
3087
|
-
apiServiceUrl: i,
|
|
3088
|
-
token: n,
|
|
3089
|
-
disabled: l,
|
|
3090
|
-
className: s,
|
|
3091
|
-
manageBriefingsHref: u,
|
|
3092
|
-
open: p,
|
|
3093
|
-
onOpenChange: o,
|
|
3094
|
-
hideTrigger: c = !1,
|
|
3095
|
-
workflowIntent: d,
|
|
3096
|
-
client: m
|
|
3097
|
-
}) {
|
|
3098
|
-
const { authToken: h, tokenProps: f } = Ye(), b = $r(), k = !d || b.canCreate && (d === "scheduled_report" || b.analyticalBriefingsEnabled), [I, y] = E(!1), S = p ?? I, D = (N) => {
|
|
3099
|
-
p === void 0 && y(N), o == null || o(N);
|
|
3100
|
-
}, [w, C] = E(
|
|
3101
|
-
d ? "author" : "list"
|
|
3102
|
-
), [F, g] = E(
|
|
3103
|
-
d ?? "analytical_briefing"
|
|
3104
|
-
), [v, U] = E("dashboard"), [A, q] = E(
|
|
3105
|
-
[]
|
|
3106
|
-
), [L, P] = E(null), J = d && !k && !L ? "list" : w, [ne, Fe] = E(!1), [ie, Te] = E(null), [Be, le] = E(null), [W, ee] = E(
|
|
3107
|
-
null
|
|
3108
|
-
), [de, te] = E(null), Re = ue(null), ye = ue(S);
|
|
3109
|
-
Y(() => {
|
|
3110
|
-
const N = S && !ye.current;
|
|
3111
|
-
ye.current = S, !(!N || !d) && (P(null), U("dashboard"), g(d), C("author"), te(null));
|
|
3112
|
-
}, [S, d]);
|
|
3113
|
-
const [he, ge] = E(
|
|
3114
|
-
null
|
|
3115
|
-
), [Q, Ce] = E(null), _ = i ?? (f == null ? void 0 : f.apiServiceUrl), O = n ?? (h == null ? void 0 : h.accessToken), se = Z(() => ({ ...Dn, ...m }), [m]), be = Cn(a), Ue = Z(() => {
|
|
3116
|
-
const N = Nn(
|
|
3117
|
-
A,
|
|
3118
|
-
v,
|
|
3119
|
-
e
|
|
3120
|
-
);
|
|
3121
|
-
if (!d)
|
|
3122
|
-
return N;
|
|
3123
|
-
const V = d === "scheduled_report" ? "report" : "briefing";
|
|
3124
|
-
return N.filter(
|
|
3125
|
-
(Ve) => oe(Ve).noun === V
|
|
3126
|
-
);
|
|
3127
|
-
}, [e, A, v, d]), Ze = Z(() => v === "dashboard" ? {
|
|
3128
|
-
source: { type: "dashboard", dashboardId: e },
|
|
3129
|
-
label: be,
|
|
3130
|
-
detail: wn(be)
|
|
3131
|
-
} : {
|
|
3132
|
-
source: { type: "project" },
|
|
3133
|
-
label: "This project",
|
|
3134
|
-
detail: "Use any data in this project."
|
|
3135
|
-
}, [e, be, v]), we = !!(_ && O), Ne = xa({
|
|
3136
|
-
canCreate: b.canCreate,
|
|
3137
|
-
analyticalBriefingsEnabled: b.analyticalBriefingsEnabled,
|
|
3138
|
-
scheduledReportAvailable: v === "dashboard"
|
|
3139
|
-
}), X = H(async () => {
|
|
3140
|
-
if (!(!_ || !O)) {
|
|
3141
|
-
Fe(!0), te(null);
|
|
3142
|
-
try {
|
|
3143
|
-
q(
|
|
3144
|
-
await Sn({
|
|
3145
|
-
apiClient: se,
|
|
3146
|
-
apiServiceUrl: _,
|
|
3147
|
-
token: O
|
|
3148
|
-
})
|
|
3149
|
-
);
|
|
3150
|
-
} catch (N) {
|
|
3151
|
-
te(
|
|
3152
|
-
N instanceof Error ? N.message : "Could not load briefings."
|
|
3153
|
-
);
|
|
3154
|
-
} finally {
|
|
3155
|
-
Fe(!1);
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3158
|
-
}, [se, _, O]);
|
|
3159
|
-
Y(() => {
|
|
3160
|
-
!S || J !== "list" || !we || X();
|
|
3161
|
-
}, [we, J, X, S]);
|
|
3162
|
-
const Se = () => {
|
|
3163
|
-
P(null), U("dashboard"), C("list"), D(!0);
|
|
3164
|
-
}, x = (N) => {
|
|
3165
|
-
P(null), g(N), C("author");
|
|
3166
|
-
}, B = async (N) => {
|
|
3167
|
-
if (!(!_ || !O)) {
|
|
3168
|
-
Te(N), te(null);
|
|
3169
|
-
try {
|
|
3170
|
-
const V = await se.getBriefing(
|
|
3171
|
-
_,
|
|
3172
|
-
O,
|
|
3173
|
-
N
|
|
3174
|
-
);
|
|
3175
|
-
P(V.briefing), C("author");
|
|
3176
|
-
} catch (V) {
|
|
3177
|
-
te(
|
|
3178
|
-
V instanceof Error ? V.message : "Could not open briefing."
|
|
3179
|
-
);
|
|
3180
|
-
} finally {
|
|
3181
|
-
Te(null);
|
|
3182
|
-
}
|
|
3183
|
-
}
|
|
3184
|
-
}, M = async (N) => {
|
|
3185
|
-
if (!(!_ || !O)) {
|
|
3186
|
-
le(N.id);
|
|
3187
|
-
try {
|
|
3188
|
-
await se.runBriefingNow(
|
|
3189
|
-
_,
|
|
3190
|
-
O,
|
|
3191
|
-
N.id,
|
|
3192
|
-
{ requestId: An() }
|
|
3193
|
-
), X();
|
|
3194
|
-
} catch (V) {
|
|
3195
|
-
$.error(
|
|
3196
|
-
V instanceof Error ? V.message : "Could not start the run."
|
|
3197
|
-
);
|
|
3198
|
-
} finally {
|
|
3199
|
-
le(null);
|
|
3200
|
-
}
|
|
3201
|
-
}
|
|
3202
|
-
}, re = async (N) => {
|
|
3203
|
-
if (!_ || !O) return;
|
|
3204
|
-
const { noun: V } = oe(N), Ve = V === "report" ? "Report" : "Briefing";
|
|
3205
|
-
le(N.id);
|
|
3206
|
-
try {
|
|
3207
|
-
const Pe = N.status === "PAUSED" ? await se.resumeBriefing(
|
|
3208
|
-
_,
|
|
3209
|
-
O,
|
|
3210
|
-
N.id
|
|
3211
|
-
) : await se.pauseBriefing(
|
|
3212
|
-
_,
|
|
3213
|
-
O,
|
|
3214
|
-
N.id
|
|
3215
|
-
);
|
|
3216
|
-
$.success(
|
|
3217
|
-
Pe.briefing.status === "PAUSED" ? `${Ve} paused` : `${Ve} resumed`
|
|
3218
|
-
), X();
|
|
3219
|
-
} catch (Pe) {
|
|
3220
|
-
$.error(
|
|
3221
|
-
Pe instanceof Error ? Pe.message : `Could not update the ${V} status.`
|
|
3222
|
-
);
|
|
3223
|
-
} finally {
|
|
3224
|
-
le(null);
|
|
3225
|
-
}
|
|
3226
|
-
}, ce = async () => {
|
|
3227
|
-
if (!W || !_ || !O) return;
|
|
3228
|
-
const N = W;
|
|
3229
|
-
le(N.id);
|
|
3230
|
-
try {
|
|
3231
|
-
await se.deleteBriefing(
|
|
3232
|
-
_,
|
|
3233
|
-
O,
|
|
3234
|
-
N.id
|
|
3235
|
-
);
|
|
3236
|
-
const { noun: V } = oe(N);
|
|
3237
|
-
$.success(`${V === "report" ? "Report" : "Briefing"} deleted`), ee(null), X();
|
|
3238
|
-
} catch (V) {
|
|
3239
|
-
$.error(
|
|
3240
|
-
V instanceof Error ? V.message : "Could not delete the briefing."
|
|
3241
|
-
);
|
|
3242
|
-
} finally {
|
|
3243
|
-
le(null);
|
|
3244
|
-
}
|
|
3245
|
-
}, Gt = Ue.length;
|
|
3246
|
-
return b.surfaceVisible ? /* @__PURE__ */ r(Xr, { open: S, onOpenChange: D, children: [
|
|
3247
|
-
c ? null : /* @__PURE__ */ t(
|
|
3248
|
-
on,
|
|
3249
|
-
{
|
|
3250
|
-
disabled: l || !we,
|
|
3251
|
-
briefingCount: Gt,
|
|
3252
|
-
className: s,
|
|
3253
|
-
onClick: Se
|
|
3254
|
-
}
|
|
3255
|
-
),
|
|
3256
|
-
/* @__PURE__ */ r(
|
|
3257
|
-
Yr,
|
|
3258
|
-
{
|
|
3259
|
-
ref: Re,
|
|
3260
|
-
side: "right",
|
|
3261
|
-
hideClose: !0,
|
|
3262
|
-
className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
|
|
3263
|
-
onOpenAutoFocus: (N) => {
|
|
3264
|
-
var V;
|
|
3265
|
-
N.preventDefault(), (V = Re.current) == null || V.focus({ preventScroll: !0 });
|
|
3266
|
-
},
|
|
3267
|
-
children: [
|
|
3268
|
-
/* @__PURE__ */ r(Qr, { className: "sr-only", children: [
|
|
3269
|
-
/* @__PURE__ */ t(Zr, { children: "Reports & briefings" }),
|
|
3270
|
-
/* @__PURE__ */ t(Jr, { children: "Manage reports and briefings for this dashboard." })
|
|
3271
|
-
] }),
|
|
3272
|
-
d ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
|
|
3273
|
-
/* @__PURE__ */ r(
|
|
3274
|
-
"div",
|
|
3275
|
-
{
|
|
3276
|
-
className: "flex items-center gap-5",
|
|
3277
|
-
role: "tablist",
|
|
3278
|
-
"aria-label": d === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
|
|
3279
|
-
children: [
|
|
3280
|
-
/* @__PURE__ */ t(
|
|
3281
|
-
"button",
|
|
3282
|
-
{
|
|
3283
|
-
type: "button",
|
|
3284
|
-
role: "tab",
|
|
3285
|
-
"aria-selected": J === "author",
|
|
3286
|
-
disabled: !k,
|
|
3287
|
-
className: K(
|
|
3288
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3289
|
-
J === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
|
|
3290
|
-
!k && "cursor-not-allowed opacity-50"
|
|
3291
|
-
),
|
|
3292
|
-
onClick: () => {
|
|
3293
|
-
k && (P(null), g(d), U("dashboard"), C("author"));
|
|
3294
|
-
},
|
|
3295
|
-
children: L ? `Edit ${oe(L).noun}` : d === "scheduled_report" ? "Schedule report" : "Create briefing"
|
|
3296
|
-
}
|
|
3297
|
-
),
|
|
3298
|
-
/* @__PURE__ */ t(
|
|
3299
|
-
"button",
|
|
3300
|
-
{
|
|
3301
|
-
type: "button",
|
|
3302
|
-
role: "tab",
|
|
3303
|
-
"aria-selected": J === "list",
|
|
3304
|
-
className: K(
|
|
3305
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3306
|
-
J === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
3307
|
-
),
|
|
3308
|
-
onClick: () => C("list"),
|
|
3309
|
-
children: d === "scheduled_report" ? "Manage reports" : "Manage briefings"
|
|
3310
|
-
}
|
|
3311
|
-
)
|
|
3312
|
-
]
|
|
3313
|
-
}
|
|
3314
|
-
),
|
|
3315
|
-
/* @__PURE__ */ t(
|
|
3316
|
-
"button",
|
|
3317
|
-
{
|
|
3318
|
-
type: "button",
|
|
3319
|
-
onClick: () => D(!1),
|
|
3320
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3321
|
-
"aria-label": d === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
|
|
3322
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
3323
|
-
}
|
|
3324
|
-
)
|
|
3325
|
-
] }) : null,
|
|
3326
|
-
J === "list" ? /* @__PURE__ */ t(
|
|
3327
|
-
fn,
|
|
3328
|
-
{
|
|
3329
|
-
briefings: Ue,
|
|
3330
|
-
dashboardLabel: be,
|
|
3331
|
-
sourceView: v,
|
|
3332
|
-
error: de,
|
|
3333
|
-
loading: ne,
|
|
3334
|
-
onSourceViewChange: U,
|
|
3335
|
-
onClose: () => D(!1),
|
|
3336
|
-
onEdit: (N) => {
|
|
3337
|
-
B(N);
|
|
3338
|
-
},
|
|
3339
|
-
onNew: x,
|
|
3340
|
-
canCreate: !d && Ne.length > 0,
|
|
3341
|
-
canCreateScheduledReport: Ne.includes(
|
|
3342
|
-
"scheduled_report"
|
|
3343
|
-
),
|
|
3344
|
-
analyticalBriefingsEnabled: Ne.includes(
|
|
3345
|
-
"analytical_briefing"
|
|
3346
|
-
),
|
|
3347
|
-
onRunNow: (N) => {
|
|
3348
|
-
M(N);
|
|
3349
|
-
},
|
|
3350
|
-
onTogglePause: (N) => {
|
|
3351
|
-
re(N);
|
|
3352
|
-
},
|
|
3353
|
-
onDelete: (N) => ee(N),
|
|
3354
|
-
selectingId: ie,
|
|
3355
|
-
busyId: Be,
|
|
3356
|
-
manageBriefingsHref: u,
|
|
3357
|
-
contentKind: d === "scheduled_report" ? "reports" : d === "analytical_briefing" ? "briefings" : void 0,
|
|
3358
|
-
hideHeader: !!d
|
|
3359
|
-
}
|
|
3360
|
-
) : /* @__PURE__ */ t(
|
|
3361
|
-
ea,
|
|
3362
|
-
{
|
|
3363
|
-
apiServiceUrl: _,
|
|
3364
|
-
token: O,
|
|
3365
|
-
briefing: L,
|
|
3366
|
-
intent: F,
|
|
3367
|
-
sourceContext: L ? void 0 : Ze,
|
|
3368
|
-
title: L ? `Edit ${oe(L).noun}` : F === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
|
|
3369
|
-
hideHeader: !!d,
|
|
3370
|
-
className: "h-full min-h-0 max-w-none border-0 shadow-none",
|
|
3371
|
-
onBack: d ? void 0 : () => C("list"),
|
|
3372
|
-
onCancel: () => D(!1),
|
|
3373
|
-
onDeleted: () => {
|
|
3374
|
-
const N = L ? oe(L).noun : "briefing";
|
|
3375
|
-
$.success(`${N === "report" ? "Report" : "Briefing"} deleted`), P(null), C("list"), X();
|
|
3376
|
-
},
|
|
3377
|
-
onRunStarted: () => {
|
|
3378
|
-
},
|
|
3379
|
-
onSaved: (N) => {
|
|
3380
|
-
P(N), X();
|
|
3381
|
-
},
|
|
3382
|
-
onMinimizeRun: ({ briefing: N, run: V }) => {
|
|
3383
|
-
ge({ briefing: N, run: V }), D(!1);
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
)
|
|
3387
|
-
]
|
|
3388
|
-
}
|
|
3389
|
-
),
|
|
3390
|
-
he && _ && O ? /* @__PURE__ */ t(
|
|
3391
|
-
kn,
|
|
3392
|
-
{
|
|
3393
|
-
briefingId: he.briefing.id,
|
|
3394
|
-
initialRun: he.run,
|
|
3395
|
-
apiServiceUrl: _,
|
|
3396
|
-
token: O,
|
|
3397
|
-
onTerminal: (N) => {
|
|
3398
|
-
Ce({
|
|
3399
|
-
briefing: he.briefing,
|
|
3400
|
-
run: N
|
|
3401
|
-
}), ge(null), X();
|
|
3402
|
-
},
|
|
3403
|
-
onTimeout: () => {
|
|
3404
|
-
ge(null), X();
|
|
3405
|
-
},
|
|
3406
|
-
onExpand: () => {
|
|
3407
|
-
P(he.briefing), C("author"), ge(null), D(!0);
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
) : null,
|
|
3411
|
-
Q ? /* @__PURE__ */ t("div", { className: "fixed bottom-4 right-4 z-50 w-[360px]", children: /* @__PURE__ */ t(
|
|
3412
|
-
ta,
|
|
3413
|
-
{
|
|
3414
|
-
title: Q.run.status === "SUCCESS" ? `${Q.briefing.name} is ready` : `${Q.briefing.name} run failed`,
|
|
3415
|
-
durationSeconds: Q.run.startedAt && Q.run.completedAt ? Math.max(
|
|
3416
|
-
0,
|
|
3417
|
-
Math.floor(
|
|
3418
|
-
(new Date(Q.run.completedAt).getTime() - new Date(Q.run.startedAt).getTime()) / 1e3
|
|
3419
|
-
)
|
|
3420
|
-
) : null,
|
|
3421
|
-
status: Q.run.status === "SUCCESS" ? "success" : "failed",
|
|
3422
|
-
onView: () => {
|
|
3423
|
-
P(Q.briefing), C("author"), Ce(null), D(!0);
|
|
3424
|
-
},
|
|
3425
|
-
onDismiss: () => Ce(null)
|
|
3426
|
-
}
|
|
3427
|
-
) }) : null,
|
|
3428
|
-
/* @__PURE__ */ t(
|
|
3429
|
-
ot,
|
|
3430
|
-
{
|
|
3431
|
-
open: !!W,
|
|
3432
|
-
onOpenChange: (N) => {
|
|
3433
|
-
N || ee(null);
|
|
3434
|
-
},
|
|
3435
|
-
children: /* @__PURE__ */ r(it, { children: [
|
|
3436
|
-
/* @__PURE__ */ r(lt, { children: [
|
|
3437
|
-
/* @__PURE__ */ r(dt, { children: [
|
|
3438
|
-
"Delete",
|
|
3439
|
-
" ",
|
|
3440
|
-
W ? oe(W).noun : "briefing",
|
|
3441
|
-
"?"
|
|
3442
|
-
] }),
|
|
3443
|
-
/* @__PURE__ */ r(ct, { children: [
|
|
3444
|
-
"This permanently deletes ",
|
|
3445
|
-
/* @__PURE__ */ t("strong", { children: W == null ? void 0 : W.name }),
|
|
3446
|
-
". Recipients will stop receiving it."
|
|
3447
|
-
] })
|
|
3448
|
-
] }),
|
|
3449
|
-
/* @__PURE__ */ r(ut, { children: [
|
|
3450
|
-
/* @__PURE__ */ t(ht, { children: "Cancel" }),
|
|
3451
|
-
/* @__PURE__ */ r(
|
|
3452
|
-
Tt,
|
|
3453
|
-
{
|
|
3454
|
-
className: "bg-destructive/90 hover:bg-destructive",
|
|
3455
|
-
onClick: ce,
|
|
3456
|
-
children: [
|
|
3457
|
-
"Delete",
|
|
3458
|
-
" ",
|
|
3459
|
-
W ? oe(W).noun : "briefing"
|
|
3460
|
-
]
|
|
3461
|
-
}
|
|
3462
|
-
)
|
|
3463
|
-
] })
|
|
3464
|
-
] })
|
|
3465
|
-
}
|
|
3466
|
-
)
|
|
3467
|
-
] }) : null;
|
|
3468
|
-
}
|
|
3469
|
-
function An() {
|
|
3470
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3471
|
-
}
|
|
3472
|
-
export {
|
|
3473
|
-
Xn as A,
|
|
3474
|
-
Ka as D,
|
|
3475
|
-
qa as E,
|
|
3476
|
-
Jn as N,
|
|
3477
|
-
Yn as U,
|
|
3478
|
-
qn as V,
|
|
3479
|
-
on as W,
|
|
3480
|
-
Kn as a,
|
|
3481
|
-
Ha as b,
|
|
3482
|
-
Qn as c,
|
|
3483
|
-
Zn as d,
|
|
3484
|
-
Ya as e,
|
|
3485
|
-
tn as f,
|
|
3486
|
-
es as g,
|
|
3487
|
-
ts as h,
|
|
3488
|
-
Gn as u
|
|
3489
|
-
};
|