react-semaphor 0.1.543 → 0.1.544
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/activity/index.js +73 -0
- package/dist/assistant-context/index.js +1 -1
- package/dist/briefings/index.js +51 -50
- package/dist/chunks/{apply-dashboard-operations-CG9S7MGt.js → apply-dashboard-operations-Bz4n1Lq6.js} +44 -44
- package/dist/chunks/{assistant-chat-BFMRUYoB.js → assistant-chat-BNLkCDml.js} +288 -288
- package/dist/chunks/{comparison-window-caption-Bv18samq.js → comparison-window-caption-BTkrN3W4.js} +467 -462
- package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +3725 -0
- package/dist/chunks/{dashboard-controls-UGpjOM2k.js → dashboard-controls-8RyBTQUO.js} +530 -525
- package/dist/chunks/dashboard-g5a4DKWq.js +14 -0
- package/dist/chunks/{dashboard-json-DG8dz0eX.js → dashboard-json-7qT9jmfL.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-OwqCbrVp.js → document-dashboard-inputs-BC6p-ESg.js} +4 -4
- package/dist/chunks/{document-sheet-utils-BTb3VZxV.js → document-sheet-utils-Duo9uLoH.js} +11 -11
- package/dist/chunks/{edit-dashboard-visual-CDpA4y5e.js → edit-dashboard-visual-BfJwnRIZ.js} +249 -248
- package/dist/chunks/export-file-format-C-tJsxsf.js +111 -0
- package/dist/chunks/{index-l5LclZvs.js → index-DkAyQvC6.js} +59 -58
- package/dist/chunks/{matrix-formatter-BnsTX90d.js → matrix-formatter-CxJLkztA.js} +1 -1
- package/dist/chunks/{numeric-presentation-F_-H6VAw.js → numeric-presentation-DESvLiu9.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DupbRk-R.js → pivot-result-lifecycle-DM4CyGKs.js} +285 -393
- package/dist/chunks/{raw-temporal-presentation-D-azM_98.js → raw-temporal-presentation-CLiVi90c.js} +2 -2
- package/dist/chunks/{report-preferences-dialog-CPwRwEJx.js → report-preferences-dialog-Df7VpRVW.js} +195 -195
- package/dist/chunks/{saved-dashboard-context-BKvMfRfC.js → saved-dashboard-context-B-mQ--nV.js} +3 -3
- package/dist/chunks/{semaphor-ready-indicator-CN2AHm2x.js → semaphor-ready-indicator-DDAxk8us.js} +39892 -39380
- package/dist/chunks/{shelf-drop-preview-context-BGl_rxcW.js → shelf-drop-preview-context-BSRPwaED.js} +414 -371
- package/dist/chunks/{table-export-sheet-BDRXLLdq.js → table-export-sheet-CPfGAQ9X.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BnclfB2k.js → use-create-flow-overlay-state-BxzFviM-.js} +67 -78
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +72 -72
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.js +226 -223
- package/dist/index.js +266 -271
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/activity.d.ts +2 -0
- package/dist/types/components/activity/activity-bell.d.ts +11 -0
- package/dist/types/components/activity/activity-instance.d.ts +50 -0
- package/dist/types/components/activity/activity-notices.d.ts +7 -0
- package/dist/types/components/activity/activity-provider.d.ts +21 -0
- package/dist/types/components/activity/activity-types.d.ts +177 -0
- package/dist/types/components/activity/index.d.ts +6 -0
- package/dist/types/components/activity/use-activity.d.ts +20 -0
- package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
- package/dist/types/components/briefings/briefing-author.d.ts +14 -12
- package/dist/types/components/briefings/dashboard-briefing-launcher.d.ts +5 -0
- package/dist/types/components/briefings/use-briefing-run-detail.d.ts +34 -0
- package/dist/types/components/index.d.ts +1 -4
- package/dist/types/lib/activity-identity.d.ts +21 -0
- package/dist/types/lib/api/exports-api.d.ts +4 -4
- package/dist/types/lib/hooks/index.d.ts +1 -3
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
- package/dist/types/shared/activity/activity-contract.d.ts +84 -0
- package/dist/types/shared/activity/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +6 -0
- package/dist/types/shared/format-utils/export-policy.d.ts +12 -0
- package/package.json +5 -1
- package/dist/chunks/dashboard-B9mKTJoy.js +0 -14
- package/dist/chunks/dashboard-briefing-launcher-Bdmry_oG.js +0 -4248
- package/dist/types/components/briefings/briefing-author/run-ui.d.ts +0 -81
- package/dist/types/components/briefings/use-briefing-run-polling.d.ts +0 -34
- package/dist/types/components/notifications/export-notification-item.d.ts +0 -24
- package/dist/types/components/notifications/export-notification-list.d.ts +0 -8
- package/dist/types/components/notifications/index.d.ts +0 -3
- package/dist/types/components/notifications/notification-bell.d.ts +0 -13
- package/dist/types/lib/exports/bounded-request.d.ts +0 -12
- package/dist/types/lib/hooks/use-export-polling.d.ts +0 -32
- package/dist/types/lib/hooks/use-export-recovery.d.ts +0 -11
- package/dist/types/lib/stores/export-store.d.ts +0 -62
|
@@ -1,4248 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as i, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
-
import * as ue from "react";
|
|
3
|
-
import _t, { useState as F, useEffect as J, useCallback as j, useMemo as oe, useLayoutEffect as Pt, useRef as ge, useContext as pr } from "react";
|
|
4
|
-
import { ae as V, ap as fr } from "./numeric-presentation-F_-H6VAw.js";
|
|
5
|
-
import { B as U, l as Le, q as dt, L as ie, j as Ot, c as ut, i as gr, Z as br, P as qe, a as He, b as Ge, S as $t } from "./switch-C3jLxlG0.js";
|
|
6
|
-
import { cr as ht, bu as Ue, bv as Ve, bx as Re, cs as vr, ct as xr, aX as Be, aV as Je, cu as yr, cv as et, cw as mt, _ as tt, X as pe, u as T, cx as Cr, cy as wr, cz as Nr, Z as ee, b6 as Sr, cA as Dr, cB as Er, aR as Se, cg as zt, aI as Qe, l as kr, h as Ar, cC as Ir, cj as pt, ck as ft, cl as gt, cm as bt, cn as vt, co as xt, cp as yt, cq as jt, aG as Ct, cD as Fr, cE as Pr, c8 as ot, c5 as rt, c6 as at, cF as Wt, c7 as nt, bR as X, ch as Tr, cf as Ke, cG as Lr, bP as Ur, bw as wt, by as Nt, cH as Vr, bt as Rr, cI as qt, cJ as St, cK as Br, bV as Mr, f as _r, cL as Or, J as xe, aB as Te, ax as Ht, ay as Xe, cM as G, K as Gt, aw as $r, cN as zr, aD as jr, R as Qt, cO as Wr, az as Tt, N as qr, cP as Hr, cQ as Gr, cR as Qr, cS as Kr, cT as Kt, cU as Xr, cV as Zr, cW as Yr, cX as Xt, cY as Jr, cZ as ze, c_ as ea, c$ as ta, d0 as ra, as as aa, at as na, a8 as sa, a7 as oa, a6 as ia, a5 as la, a2 as ca, a0 as da, d1 as ua, d2 as ha, d3 as ma, d4 as pa, d5 as fa, aq as ga, d6 as ba, d7 as va, ae as xa, d8 as ya, d9 as Ca, da as wa } from "./semaphor-ready-indicator-CN2AHm2x.js";
|
|
7
|
-
import { L as Dt } from "./layout-grid-Bgzth8vd.js";
|
|
8
|
-
import { c as De, X as Me, C as Zt } from "./x-4f5U2XwU.js";
|
|
9
|
-
import "./index-CuHybtft.js";
|
|
10
|
-
import { t as Na } from "./validators-DMHTpf7a.js";
|
|
11
|
-
import "./matrix-operation-contract-8OIO4gob.js";
|
|
12
|
-
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
13
|
-
import "zod";
|
|
14
|
-
import "../value-format-preferences/index.js";
|
|
15
|
-
import { c as Z } from "./class-utils-Df1OVOT1.js";
|
|
16
|
-
import { S as Sa } from "./selection-reducer-Dj_8xD69.js";
|
|
17
|
-
import { s as je } from "./normalize-dashboard-for-dirty-check-Bk3VYv_q.js";
|
|
18
|
-
import { f as Da } from "./editor-draft-sync-BN5qYHPF.js";
|
|
19
|
-
import { ad as Ze, ae as Ea, m as ka, af as Aa, ag as Ia, ah as Fa, ai as Pa, aj as Ta } from "./document-dashboard-inputs-OwqCbrVp.js";
|
|
20
|
-
import "react-dom";
|
|
21
|
-
import "./pivot-result-lifecycle-DupbRk-R.js";
|
|
22
|
-
import { F as La } from "./table-settings-CLZocegs.js";
|
|
23
|
-
import { S as Yt } from "./save-CfJpQQ68.js";
|
|
24
|
-
import { V as Ua, L as Va, a as Ra, u as Jt, C as er, F as Ba, b as Ma } from "./use-create-flow-overlay-state-BnclfB2k.js";
|
|
25
|
-
import { v as Lt } from "./custom-visual-inputs-DUtpYZOk.js";
|
|
26
|
-
import { w as Ut } from "./matrix-formatter-BnsTX90d.js";
|
|
27
|
-
import { x as _a } from "./document-sheet-utils-BTb3VZxV.js";
|
|
28
|
-
import { g as me, d as Oa, a as $a } from "./index-l5LclZvs.js";
|
|
29
|
-
/**
|
|
30
|
-
* @license lucide-react v0.453.0 - ISC
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the ISC license.
|
|
33
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/
|
|
35
|
-
const za = De("ArrowUpRight", [
|
|
36
|
-
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
37
|
-
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
38
|
-
]);
|
|
39
|
-
/**
|
|
40
|
-
* @license lucide-react v0.453.0 - ISC
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the ISC license.
|
|
43
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/
|
|
45
|
-
const ja = De("CalendarRange", [
|
|
46
|
-
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
47
|
-
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
48
|
-
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
49
|
-
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
50
|
-
["path", { d: "M17 14h-6", key: "bkmgh3" }],
|
|
51
|
-
["path", { d: "M13 18H7", key: "bb0bb7" }],
|
|
52
|
-
["path", { d: "M7 14h.01", key: "1qa3f1" }],
|
|
53
|
-
["path", { d: "M17 18h.01", key: "1bdyru" }]
|
|
54
|
-
]);
|
|
55
|
-
/**
|
|
56
|
-
* @license lucide-react v0.453.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/
|
|
61
|
-
const Wa = De("CodeXml", [
|
|
62
|
-
["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
|
|
63
|
-
["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
|
|
64
|
-
["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
|
|
65
|
-
]);
|
|
66
|
-
/**
|
|
67
|
-
* @license lucide-react v0.453.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/
|
|
72
|
-
const qa = De("FileDown", [
|
|
73
|
-
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
74
|
-
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
75
|
-
["path", { d: "M12 18v-6", key: "17g6i2" }],
|
|
76
|
-
["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
|
|
77
|
-
]);
|
|
78
|
-
/**
|
|
79
|
-
* @license lucide-react v0.453.0 - ISC
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the ISC license.
|
|
82
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/
|
|
84
|
-
const Ha = De("MousePointer2", [
|
|
85
|
-
[
|
|
86
|
-
"path",
|
|
87
|
-
{
|
|
88
|
-
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",
|
|
89
|
-
key: "edeuup"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
]);
|
|
93
|
-
/**
|
|
94
|
-
* @license lucide-react v0.453.0 - ISC
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the ISC license.
|
|
97
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/
|
|
99
|
-
const Ga = De("Newspaper", [
|
|
100
|
-
[
|
|
101
|
-
"path",
|
|
102
|
-
{
|
|
103
|
-
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",
|
|
104
|
-
key: "7pis2x"
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
["path", { d: "M18 14h-8", key: "sponae" }],
|
|
108
|
-
["path", { d: "M15 18h-5", key: "95g1m2" }],
|
|
109
|
-
["path", { d: "M10 6h8v4h-8V6Z", key: "smlsk5" }]
|
|
110
|
-
]);
|
|
111
|
-
function Qa() {
|
|
112
|
-
return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, r) => /* @__PURE__ */ i(
|
|
113
|
-
"div",
|
|
114
|
-
{
|
|
115
|
-
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
116
|
-
children: [
|
|
117
|
-
/* @__PURE__ */ t("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
118
|
-
/* @__PURE__ */ i("div", { className: "flex-1 space-y-1.5", children: [
|
|
119
|
-
/* @__PURE__ */ t("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
120
|
-
/* @__PURE__ */ t("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
121
|
-
] })
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
r
|
|
125
|
-
)) });
|
|
126
|
-
}
|
|
127
|
-
function Ka({
|
|
128
|
-
open: e,
|
|
129
|
-
onOpenChange: r,
|
|
130
|
-
onSubmit: o,
|
|
131
|
-
isCreating: a
|
|
132
|
-
}) {
|
|
133
|
-
const n = ht("interactive"), [s, d] = F(""), [c, l] = F("");
|
|
134
|
-
J(() => {
|
|
135
|
-
e || (d(""), l(""));
|
|
136
|
-
}, [e]);
|
|
137
|
-
const u = () => {
|
|
138
|
-
s.trim() && o({ title: s, description: c });
|
|
139
|
-
}, h = (p) => {
|
|
140
|
-
r(p);
|
|
141
|
-
};
|
|
142
|
-
return /* @__PURE__ */ t(Ue, { open: e, onOpenChange: h, children: /* @__PURE__ */ i(
|
|
143
|
-
Ve,
|
|
144
|
-
{
|
|
145
|
-
showCloseButton: !1,
|
|
146
|
-
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",
|
|
147
|
-
style: n.dialogStyle,
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ i("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
150
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
151
|
-
/* @__PURE__ */ t(Dt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
152
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
153
|
-
/* @__PURE__ */ t(Re, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
|
|
154
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
|
|
155
|
-
] })
|
|
156
|
-
] }),
|
|
157
|
-
/* @__PURE__ */ t(
|
|
158
|
-
U,
|
|
159
|
-
{
|
|
160
|
-
size: "xs",
|
|
161
|
-
variant: "ghost",
|
|
162
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
163
|
-
onClick: () => h(!1),
|
|
164
|
-
"aria-label": "Close",
|
|
165
|
-
disabled: a,
|
|
166
|
-
children: /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" })
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
] }),
|
|
170
|
-
/* @__PURE__ */ i("div", { className: "space-y-3 px-4 py-3", children: [
|
|
171
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
|
|
172
|
-
/* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
173
|
-
/* @__PURE__ */ t(Le, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
|
|
174
|
-
/* @__PURE__ */ t(
|
|
175
|
-
dt,
|
|
176
|
-
{
|
|
177
|
-
id: "visual-title",
|
|
178
|
-
size: "sm",
|
|
179
|
-
placeholder: "Untitled visual",
|
|
180
|
-
value: s,
|
|
181
|
-
onChange: (p) => d(p.target.value),
|
|
182
|
-
disabled: a,
|
|
183
|
-
onKeyDown: (p) => {
|
|
184
|
-
p.key === "Enter" && !p.shiftKey && (p.preventDefault(), u());
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
] }),
|
|
189
|
-
/* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
190
|
-
/* @__PURE__ */ t(Le, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
|
|
191
|
-
/* @__PURE__ */ t(
|
|
192
|
-
dt,
|
|
193
|
-
{
|
|
194
|
-
id: "visual-description",
|
|
195
|
-
size: "sm",
|
|
196
|
-
placeholder: "Optional",
|
|
197
|
-
value: c,
|
|
198
|
-
onChange: (p) => l(p.target.value),
|
|
199
|
-
disabled: a
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
] })
|
|
203
|
-
] }),
|
|
204
|
-
/* @__PURE__ */ i("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
205
|
-
/* @__PURE__ */ t(
|
|
206
|
-
U,
|
|
207
|
-
{
|
|
208
|
-
size: "xs",
|
|
209
|
-
variant: "outline",
|
|
210
|
-
onClick: () => h(!1),
|
|
211
|
-
disabled: a,
|
|
212
|
-
children: "Cancel"
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ t(
|
|
216
|
-
U,
|
|
217
|
-
{
|
|
218
|
-
size: "xs",
|
|
219
|
-
onClick: u,
|
|
220
|
-
disabled: !s.trim() || a,
|
|
221
|
-
children: a ? /* @__PURE__ */ i($, { children: [
|
|
222
|
-
/* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
223
|
-
"Creating..."
|
|
224
|
-
] }) : "Create library visual"
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
] })
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
) });
|
|
231
|
-
}
|
|
232
|
-
function Xa(e) {
|
|
233
|
-
const [r, o] = F(null), [a, n] = F(null), s = vr();
|
|
234
|
-
return J(() => {
|
|
235
|
-
if (!e || e.trim() === "") {
|
|
236
|
-
o(null), n(null);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (!s)
|
|
240
|
-
return;
|
|
241
|
-
(async () => {
|
|
242
|
-
try {
|
|
243
|
-
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
244
|
-
throw new Error(`Invalid URL format: ${e}`);
|
|
245
|
-
try {
|
|
246
|
-
new URL(e);
|
|
247
|
-
} catch {
|
|
248
|
-
throw new Error(`Invalid URL: ${e}`);
|
|
249
|
-
}
|
|
250
|
-
const l = `${e.endsWith("/") ? e : `${e}/`}index.js`;
|
|
251
|
-
try {
|
|
252
|
-
if (!(await fetch(l, { method: "HEAD" })).ok)
|
|
253
|
-
throw new Error(`Module not found at ${l}`);
|
|
254
|
-
} catch {
|
|
255
|
-
}
|
|
256
|
-
const u = await import(
|
|
257
|
-
/* @vite-ignore */
|
|
258
|
-
/* webpackIgnore: true */
|
|
259
|
-
l
|
|
260
|
-
);
|
|
261
|
-
if (typeof u.useChartStore != "function")
|
|
262
|
-
throw new Error("useChartStore is not a function");
|
|
263
|
-
o(() => u.useChartStore), n(null);
|
|
264
|
-
} catch (c) {
|
|
265
|
-
const l = c instanceof Error ? c.message : "Unknown error";
|
|
266
|
-
console.error("Failed to load remote chart store:", l), n(l), o(null);
|
|
267
|
-
}
|
|
268
|
-
})();
|
|
269
|
-
}, [e, s]), r;
|
|
270
|
-
}
|
|
271
|
-
function Za(e, r) {
|
|
272
|
-
if (e.length === 0)
|
|
273
|
-
return "";
|
|
274
|
-
const o = e.find(
|
|
275
|
-
(a) => {
|
|
276
|
-
var n, s;
|
|
277
|
-
return ((n = a.customCardPreferences) == null ? void 0 : n.visualType) === "multiple" || !!((s = a.customCardPreferences) != null && s.dataInputCardIds);
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
if (o)
|
|
281
|
-
return o.id;
|
|
282
|
-
if (r) {
|
|
283
|
-
const a = e.find((n) => n.id === r);
|
|
284
|
-
if (a) {
|
|
285
|
-
const n = a.tabTitle;
|
|
286
|
-
if (n == "All__Header")
|
|
287
|
-
return e[0].id;
|
|
288
|
-
if (n && n.endsWith("__Header")) {
|
|
289
|
-
const d = n.split("__")[0], c = e.find(
|
|
290
|
-
(l) => l.tabTitle === d
|
|
291
|
-
);
|
|
292
|
-
return c ? c.id : e[0].id;
|
|
293
|
-
}
|
|
294
|
-
return r;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return e[0].id;
|
|
298
|
-
}
|
|
299
|
-
function Ya(e, r) {
|
|
300
|
-
return r ? {
|
|
301
|
-
...e,
|
|
302
|
-
settings: r
|
|
303
|
-
} : e;
|
|
304
|
-
}
|
|
305
|
-
function Ja(e, r) {
|
|
306
|
-
const o = r.selectedConnectionId || e.connectionId || "";
|
|
307
|
-
if (!e.dataSource) {
|
|
308
|
-
if (!o)
|
|
309
|
-
return;
|
|
310
|
-
const a = r.selectedDatabaseName || e.lastSelectedDatabase, n = r.selectedSchemaName || e.lastSelectedSchema, s = r.selectedTableName || e.lastSelectedTable;
|
|
311
|
-
return {
|
|
312
|
-
connectionId: o,
|
|
313
|
-
connectionType: "",
|
|
314
|
-
mode: "database",
|
|
315
|
-
selectedEntities: [],
|
|
316
|
-
...a && n && s ? {
|
|
317
|
-
dbSelection: {
|
|
318
|
-
database: a,
|
|
319
|
-
schema: n,
|
|
320
|
-
entityType: "table"
|
|
321
|
-
}
|
|
322
|
-
} : {}
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
return {
|
|
326
|
-
...e.dataSource,
|
|
327
|
-
connectionId: r.selectedConnectionId || e.dataSource.connectionId || e.connectionId || ""
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function en(e, {
|
|
331
|
-
isDevMode: r,
|
|
332
|
-
cardSql: o,
|
|
333
|
-
selectedSchemaName: a,
|
|
334
|
-
selectedDatamodelId: n,
|
|
335
|
-
selectedDatabaseName: s,
|
|
336
|
-
selectedTableName: d,
|
|
337
|
-
selectedConnectionId: c,
|
|
338
|
-
remoteChartSettings: l,
|
|
339
|
-
stripConfig: u
|
|
340
|
-
}) {
|
|
341
|
-
const h = r || xr(e);
|
|
342
|
-
return {
|
|
343
|
-
...e,
|
|
344
|
-
dataSource: Ja(e, {
|
|
345
|
-
selectedConnectionId: c,
|
|
346
|
-
selectedDatabaseName: s,
|
|
347
|
-
selectedSchemaName: a,
|
|
348
|
-
selectedTableName: d
|
|
349
|
-
}),
|
|
350
|
-
lastSelectedSchema: a,
|
|
351
|
-
lastSelectedDatamodelId: n,
|
|
352
|
-
lastSelectedDatabase: s,
|
|
353
|
-
lastSelectedTable: d,
|
|
354
|
-
connectionId: c || e.connectionId,
|
|
355
|
-
sql: h ? o || e.sql : void 0,
|
|
356
|
-
python: h ? e.python : void 0,
|
|
357
|
-
config: r || !e.config ? void 0 : u(e.config),
|
|
358
|
-
customCfg: e.customCfg,
|
|
359
|
-
preferences: e.preferences,
|
|
360
|
-
customCardPreferences: Ya(
|
|
361
|
-
e.customCardPreferences,
|
|
362
|
-
l
|
|
363
|
-
)
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
const tn = (e) => {
|
|
367
|
-
if (!e || !("detailTableBackup" in e))
|
|
368
|
-
return e;
|
|
369
|
-
const { detailTableBackup: r, ...o } = e;
|
|
370
|
-
return o;
|
|
371
|
-
};
|
|
372
|
-
async function Vt(e, r, o, a, n = "Opening library visual...") {
|
|
373
|
-
if (!r || !o)
|
|
374
|
-
throw new Error("Missing auth token or visual ID");
|
|
375
|
-
const s = ["resource-by-id", "visual", o], d = a.getQueryData(s);
|
|
376
|
-
if (d)
|
|
377
|
-
return console.log("Using cached visual data for:", o), { data: d, fromCache: !0 };
|
|
378
|
-
console.log("Fetching visual data from network for:", o);
|
|
379
|
-
const c = V.loading(n, {
|
|
380
|
-
position: "top-center"
|
|
381
|
-
});
|
|
382
|
-
try {
|
|
383
|
-
const l = await fetch(
|
|
384
|
-
`${e}/management/v1/visuals/${o}`,
|
|
385
|
-
{
|
|
386
|
-
headers: {
|
|
387
|
-
Authorization: `Bearer ${r}`
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
if (!l.ok)
|
|
392
|
-
throw new Error("Failed to load visual");
|
|
393
|
-
const u = await l.json();
|
|
394
|
-
return a.setQueryData(s, u), V.dismiss(c), { data: u, fromCache: !1 };
|
|
395
|
-
} catch (l) {
|
|
396
|
-
throw V.dismiss(c), l;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function tr(e) {
|
|
400
|
-
if (typeof e == "string")
|
|
401
|
-
return JSON.parse(e);
|
|
402
|
-
if (typeof e == "object")
|
|
403
|
-
return e;
|
|
404
|
-
throw new Error("Invalid frame object format");
|
|
405
|
-
}
|
|
406
|
-
function rn(e, r) {
|
|
407
|
-
var s, d;
|
|
408
|
-
const o = (e == null ? void 0 : e.frameObject) ?? ((s = e == null ? void 0 : e.visual) == null ? void 0 : s.frameObject);
|
|
409
|
-
if (!o)
|
|
410
|
-
return !1;
|
|
411
|
-
const a = tr(o);
|
|
412
|
-
if (!(a != null && a.cards) || a.cards.length === 0)
|
|
413
|
-
return !1;
|
|
414
|
-
const n = (d = a.cards) == null ? void 0 : d.find(
|
|
415
|
-
(c) => c.id === a.activeCardId
|
|
416
|
-
);
|
|
417
|
-
return n ? (Nr({
|
|
418
|
-
...r,
|
|
419
|
-
frame: a,
|
|
420
|
-
card: n,
|
|
421
|
-
visualId: (e == null ? void 0 : e.id) || a.visualId
|
|
422
|
-
}), !0) : !1;
|
|
423
|
-
}
|
|
424
|
-
function an() {
|
|
425
|
-
const e = ee(
|
|
426
|
-
(a) => {
|
|
427
|
-
var n;
|
|
428
|
-
return ((n = a.card.customCardPreferences) == null ? void 0 : n.url) || "";
|
|
429
|
-
}
|
|
430
|
-
), r = Xa(e);
|
|
431
|
-
return { getUpdatedFrame: j(() => {
|
|
432
|
-
var b;
|
|
433
|
-
Da();
|
|
434
|
-
const {
|
|
435
|
-
frame: a,
|
|
436
|
-
card: n,
|
|
437
|
-
isDevMode: s,
|
|
438
|
-
selectedSchemaName: d,
|
|
439
|
-
selectedDatamodelId: c,
|
|
440
|
-
selectedDatabaseName: l,
|
|
441
|
-
selectedTableName: u,
|
|
442
|
-
selectedConnectionId: h
|
|
443
|
-
} = ee.getState(), p = n.sql, m = (b = r == null ? void 0 : r.getState()) == null ? void 0 : b.settings, g = en(n, {
|
|
444
|
-
isDevMode: s,
|
|
445
|
-
cardSql: p,
|
|
446
|
-
selectedSchemaName: d,
|
|
447
|
-
selectedDatamodelId: c,
|
|
448
|
-
selectedDatabaseName: l,
|
|
449
|
-
selectedTableName: u,
|
|
450
|
-
selectedConnectionId: h,
|
|
451
|
-
remoteChartSettings: m,
|
|
452
|
-
stripConfig: tn
|
|
453
|
-
}), f = a.cards.map(
|
|
454
|
-
(k) => k.id === n.id ? g : k
|
|
455
|
-
);
|
|
456
|
-
return {
|
|
457
|
-
...a,
|
|
458
|
-
cards: f,
|
|
459
|
-
activeCardId: Za(f, a.activeCardId)
|
|
460
|
-
};
|
|
461
|
-
}, [r]) };
|
|
462
|
-
}
|
|
463
|
-
function Ee() {
|
|
464
|
-
const { authToken: e, tokenProps: r } = Be(), o = Je(), a = yr(), n = et(), { selectVisual: s } = mt(), {
|
|
465
|
-
setFrame: d,
|
|
466
|
-
setCard: c,
|
|
467
|
-
setIsDevMode: l,
|
|
468
|
-
initializeModeDrafts: u,
|
|
469
|
-
setActiveTabCardId: h,
|
|
470
|
-
updateDataSource: p,
|
|
471
|
-
setQueryResultColumns: m,
|
|
472
|
-
setSelectedConnectionId: g,
|
|
473
|
-
setSelectedDatabaseName: f,
|
|
474
|
-
setSelectedSchemaName: b,
|
|
475
|
-
setSelectedTableName: k,
|
|
476
|
-
setSelectedDatamodelId: v,
|
|
477
|
-
setFilterValues: D,
|
|
478
|
-
setInlineFilterValuesMap: E,
|
|
479
|
-
setApplyFilters: N,
|
|
480
|
-
clearEditorContext: y
|
|
481
|
-
} = tt(), {
|
|
482
|
-
setIsDashboardEditing: w,
|
|
483
|
-
setIsVisualEditing: S,
|
|
484
|
-
setSelectedFrameId: x,
|
|
485
|
-
clearSelectedFrameId: B
|
|
486
|
-
} = pe(), I = T((O) => O.selectedSheetId), W = T((O) => O.selectedFrameId), P = T((O) => O.dashboard), M = T((O) => O.filterValues), Y = T(
|
|
487
|
-
(O) => O.inlineFilterValuesMap
|
|
488
|
-
), K = Cr((n == null ? void 0 : n.id) || "", {
|
|
489
|
-
enabled: !!(n != null && n.id) && !!(e != null && e.accessToken)
|
|
490
|
-
}), Ce = j(
|
|
491
|
-
async (O) => {
|
|
492
|
-
try {
|
|
493
|
-
s(O), B(), y();
|
|
494
|
-
const { data: te, fromCache: re } = await Vt(
|
|
495
|
-
r.apiServiceUrl,
|
|
496
|
-
(e == null ? void 0 : e.accessToken) || "",
|
|
497
|
-
O.id,
|
|
498
|
-
o,
|
|
499
|
-
"Opening library visual..."
|
|
500
|
-
);
|
|
501
|
-
if (!rn(te, {
|
|
502
|
-
setFrame: d,
|
|
503
|
-
setCard: c,
|
|
504
|
-
setIsDevMode: l,
|
|
505
|
-
initializeModeDrafts: u,
|
|
506
|
-
setActiveTabCardId: h,
|
|
507
|
-
updateDataSource: p,
|
|
508
|
-
setQueryResultColumns: m,
|
|
509
|
-
setSelectedConnectionId: g,
|
|
510
|
-
setSelectedDatabaseName: f,
|
|
511
|
-
setSelectedSchemaName: b,
|
|
512
|
-
setSelectedTableName: k,
|
|
513
|
-
setSelectedDatamodelId: v,
|
|
514
|
-
setFilterValues: D,
|
|
515
|
-
setInlineFilterValuesMap: E,
|
|
516
|
-
setApplyFilters: N,
|
|
517
|
-
setIsDashboardEditing: w,
|
|
518
|
-
setIsVisualEditing: S,
|
|
519
|
-
dashboard: P,
|
|
520
|
-
selectedSheetId: I,
|
|
521
|
-
selectedFrameId: W,
|
|
522
|
-
filterValues: M,
|
|
523
|
-
inlineFilterValuesMap: Y
|
|
524
|
-
}))
|
|
525
|
-
throw new Error("Failed to setup editor with visual data");
|
|
526
|
-
return { success: !0, fromCache: re };
|
|
527
|
-
} catch (te) {
|
|
528
|
-
return console.error("Error editing visual:", te), { success: !1, error: "Failed to load visual for editing" };
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
[
|
|
532
|
-
e == null ? void 0 : e.accessToken,
|
|
533
|
-
r.apiServiceUrl,
|
|
534
|
-
o,
|
|
535
|
-
s,
|
|
536
|
-
d,
|
|
537
|
-
c,
|
|
538
|
-
w,
|
|
539
|
-
S,
|
|
540
|
-
l,
|
|
541
|
-
u,
|
|
542
|
-
h,
|
|
543
|
-
p,
|
|
544
|
-
m,
|
|
545
|
-
g,
|
|
546
|
-
f,
|
|
547
|
-
b,
|
|
548
|
-
k,
|
|
549
|
-
v,
|
|
550
|
-
D,
|
|
551
|
-
E,
|
|
552
|
-
N,
|
|
553
|
-
y,
|
|
554
|
-
B,
|
|
555
|
-
P,
|
|
556
|
-
I,
|
|
557
|
-
W,
|
|
558
|
-
M,
|
|
559
|
-
Y
|
|
560
|
-
]
|
|
561
|
-
), ce = j(
|
|
562
|
-
async (O) => {
|
|
563
|
-
var re;
|
|
564
|
-
const te = (L) => (V.error(L), { success: !1, error: L });
|
|
565
|
-
try {
|
|
566
|
-
if (s(O), !I)
|
|
567
|
-
return te("No sheet selected. Please select a sheet first.");
|
|
568
|
-
const { data: L, fromCache: ae } = await Vt(
|
|
569
|
-
r.apiServiceUrl,
|
|
570
|
-
(e == null ? void 0 : e.accessToken) || "",
|
|
571
|
-
O.id,
|
|
572
|
-
o,
|
|
573
|
-
"Adding visual to dashboard..."
|
|
574
|
-
), le = (L == null ? void 0 : L.frameObject) ?? ((re = L == null ? void 0 : L.visual) == null ? void 0 : re.frameObject);
|
|
575
|
-
if (!le)
|
|
576
|
-
return te("Visual has no frame data");
|
|
577
|
-
const Q = tr(le);
|
|
578
|
-
if (!(Q != null && Q.cards) || Q.cards.length === 0)
|
|
579
|
-
return te("Visual frame is malformed");
|
|
580
|
-
const be = {
|
|
581
|
-
...wr(Q),
|
|
582
|
-
visualId: O.id
|
|
583
|
-
// Link this frame to the library visual
|
|
584
|
-
};
|
|
585
|
-
return await a(
|
|
586
|
-
I,
|
|
587
|
-
be,
|
|
588
|
-
"end"
|
|
589
|
-
), w(!0), x(be.id), { success: !0, fromCache: ae };
|
|
590
|
-
} catch (L) {
|
|
591
|
-
return console.error("Error adding visual:", L), te(
|
|
592
|
-
L instanceof Error ? L.message : "Failed to add visual to dashboard"
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
[
|
|
597
|
-
e == null ? void 0 : e.accessToken,
|
|
598
|
-
r.apiServiceUrl,
|
|
599
|
-
o,
|
|
600
|
-
s,
|
|
601
|
-
I,
|
|
602
|
-
w,
|
|
603
|
-
x,
|
|
604
|
-
a
|
|
605
|
-
]
|
|
606
|
-
);
|
|
607
|
-
return {
|
|
608
|
-
visual: K.data,
|
|
609
|
-
isLoading: K.isLoading,
|
|
610
|
-
isError: K.isError,
|
|
611
|
-
error: K.error,
|
|
612
|
-
handleEditLibraryVisual: Ce,
|
|
613
|
-
handleAddLibraryVisual: ce,
|
|
614
|
-
getUpdatedFrame: an().getUpdatedFrame,
|
|
615
|
-
refetch: K.refetch
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
function rr(e) {
|
|
619
|
-
return e ? new Date(e).toLocaleDateString("en-US", {
|
|
620
|
-
month: "short",
|
|
621
|
-
day: "numeric",
|
|
622
|
-
year: "numeric"
|
|
623
|
-
}) : "Unknown";
|
|
624
|
-
}
|
|
625
|
-
function ar(e, r) {
|
|
626
|
-
var a;
|
|
627
|
-
const o = (a = e.ownership.createdBy) == null ? void 0 : a.type;
|
|
628
|
-
return o === "tenant" || o === "organization" && r;
|
|
629
|
-
}
|
|
630
|
-
function Et(e, r) {
|
|
631
|
-
var o, a;
|
|
632
|
-
return ar(e, r) ? ((o = e.ownership.createdBy) == null ? void 0 : o.name) || ((a = e.createdByTenantUserRel) == null ? void 0 : a.name) || e.lastModifiedBy || "Unknown" : "Organization";
|
|
633
|
-
}
|
|
634
|
-
function nn(e, r) {
|
|
635
|
-
return Et(e, r).split(/\s+/).filter(Boolean).slice(0, 2).map((a) => a.charAt(0).toUpperCase()).join("") || "?";
|
|
636
|
-
}
|
|
637
|
-
function sn(e) {
|
|
638
|
-
const r = (e || "").toLowerCase();
|
|
639
|
-
return r.includes("table") ? Ot : r.includes("pie") || r.includes("donut") ? Fr : r.includes("line") ? Pr : r.includes("bar") ? gr : Dt;
|
|
640
|
-
}
|
|
641
|
-
function on({ visual: e }) {
|
|
642
|
-
const r = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
|
|
643
|
-
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: r });
|
|
644
|
-
}
|
|
645
|
-
function Hs({
|
|
646
|
-
open: e,
|
|
647
|
-
onOpenChange: r
|
|
648
|
-
}) {
|
|
649
|
-
const o = ht("interactive"), [a, n] = F(""), [s, d] = F(/* @__PURE__ */ new Set()), [c, l] = F(!1), [u, h] = F(
|
|
650
|
-
null
|
|
651
|
-
), [p, m] = F(
|
|
652
|
-
null
|
|
653
|
-
), [g, f] = F(!1), [b, k] = F(null), [v, D] = F(null), E = () => {
|
|
654
|
-
d(/* @__PURE__ */ new Set()), h(null), m(null), f(!1), k(null);
|
|
655
|
-
}, N = () => {
|
|
656
|
-
r(!1), E();
|
|
657
|
-
}, { selectVisual: y } = mt(), { handleAddLibraryVisual: w, handleEditLibraryVisual: S } = Ee(), { isConsoleMode: x } = Sr(), {
|
|
658
|
-
resources: B,
|
|
659
|
-
isLoading: I,
|
|
660
|
-
isError: W,
|
|
661
|
-
createResource: P,
|
|
662
|
-
updateResource: M,
|
|
663
|
-
deleteResourceAsync: Y,
|
|
664
|
-
duplicateResource: K,
|
|
665
|
-
isCreating: Ce,
|
|
666
|
-
isDeleting: ce
|
|
667
|
-
} = Dr(
|
|
668
|
-
void 0,
|
|
669
|
-
(C) => {
|
|
670
|
-
l(!1), C && (y(C), S(C), N());
|
|
671
|
-
}
|
|
672
|
-
), {
|
|
673
|
-
startUpdating: O,
|
|
674
|
-
stopUpdating: te,
|
|
675
|
-
isUpdating: re
|
|
676
|
-
} = Er(), L = B, ae = oe(() => {
|
|
677
|
-
const C = a.trim().toLowerCase();
|
|
678
|
-
return C ? L.filter(
|
|
679
|
-
(R) => {
|
|
680
|
-
var z, de, fe;
|
|
681
|
-
return ((z = R.title) == null ? void 0 : z.toLowerCase().includes(C)) || ((de = R.description) == null ? void 0 : de.toLowerCase().includes(C)) || ((fe = R.kind) == null ? void 0 : fe.toLowerCase().includes(C));
|
|
682
|
-
}
|
|
683
|
-
) : L;
|
|
684
|
-
}, [a, L]), le = oe(
|
|
685
|
-
() => L.filter(
|
|
686
|
-
(C) => s.has(C.id)
|
|
687
|
-
),
|
|
688
|
-
[s, L]
|
|
689
|
-
), Q = le.filter(
|
|
690
|
-
(C) => C.permissions.canDelete
|
|
691
|
-
), be = le.filter(
|
|
692
|
-
(C) => C.permissions.canShare
|
|
693
|
-
), ke = ae.length > 0 && ae.every(
|
|
694
|
-
(C) => s.has(C.id)
|
|
695
|
-
), ve = ae.some(
|
|
696
|
-
(C) => s.has(C.id)
|
|
697
|
-
), we = (C) => {
|
|
698
|
-
const R = new Set(s);
|
|
699
|
-
C(R), d(R);
|
|
700
|
-
}, se = (C) => {
|
|
701
|
-
we((R) => {
|
|
702
|
-
R.has(C) ? R.delete(C) : R.add(C);
|
|
703
|
-
});
|
|
704
|
-
}, Ae = () => {
|
|
705
|
-
d((C) => {
|
|
706
|
-
const R = new Set(C);
|
|
707
|
-
return ke ? ae.forEach(
|
|
708
|
-
(z) => R.delete(z.id)
|
|
709
|
-
) : ae.forEach(
|
|
710
|
-
(z) => R.add(z.id)
|
|
711
|
-
), R;
|
|
712
|
-
});
|
|
713
|
-
}, q = async (C) => {
|
|
714
|
-
(await w(C)).success && N();
|
|
715
|
-
}, H = async () => {
|
|
716
|
-
const C = le;
|
|
717
|
-
if (C.length === 0) return;
|
|
718
|
-
let R = !1;
|
|
719
|
-
for (const z of C)
|
|
720
|
-
if (!(await w(z)).success) {
|
|
721
|
-
R = !0;
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
R || N();
|
|
725
|
-
}, he = (C) => {
|
|
726
|
-
S(C), N();
|
|
727
|
-
}, Ne = (C) => {
|
|
728
|
-
D(C), K(C, {
|
|
729
|
-
onSettled: () => D(null)
|
|
730
|
-
});
|
|
731
|
-
}, _e = () => {
|
|
732
|
-
if (Q.length === 0) {
|
|
733
|
-
V.error("Select a visual you can delete");
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
k(null), f(!0);
|
|
737
|
-
}, st = async () => {
|
|
738
|
-
const C = b ? [b] : Q;
|
|
739
|
-
try {
|
|
740
|
-
for (const R of C)
|
|
741
|
-
await Y(R.id);
|
|
742
|
-
d((R) => {
|
|
743
|
-
const z = new Set(R);
|
|
744
|
-
return C.forEach(
|
|
745
|
-
(de) => z.delete(de.id)
|
|
746
|
-
), z;
|
|
747
|
-
}), f(!1), k(null);
|
|
748
|
-
} catch {
|
|
749
|
-
}
|
|
750
|
-
}, Ie = () => {
|
|
751
|
-
if (le.length !== 1) {
|
|
752
|
-
V.error("Select one visual to share");
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
const [C] = le;
|
|
756
|
-
if (!C.permissions.canShare) {
|
|
757
|
-
V.error("You do not have permission to share this visual");
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
h(C);
|
|
761
|
-
}, Fe = ({
|
|
762
|
-
title: C,
|
|
763
|
-
description: R
|
|
764
|
-
}) => {
|
|
765
|
-
if (!p) return;
|
|
766
|
-
const z = {};
|
|
767
|
-
if (C !== p.title && (z.title = C), (p.description || "") !== R && (z.description = R), Object.keys(z).length === 0) {
|
|
768
|
-
m(null);
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
const de = Object.keys(z), fe = de.length === 1 ? de[0] : void 0;
|
|
772
|
-
O(p.id, fe), M(
|
|
773
|
-
{
|
|
774
|
-
resourceId: p.id,
|
|
775
|
-
data: z
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
onSuccess: () => {
|
|
779
|
-
te(p.id, fe), m(null);
|
|
780
|
-
},
|
|
781
|
-
onError: () => {
|
|
782
|
-
te(p.id, fe);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
);
|
|
786
|
-
}, ne = (C) => {
|
|
787
|
-
r(C), C || E();
|
|
788
|
-
}, Pe = b ? 1 : Q.length;
|
|
789
|
-
return /* @__PURE__ */ i($, { children: [
|
|
790
|
-
/* @__PURE__ */ t(Ue, { open: e, onOpenChange: ne, children: /* @__PURE__ */ i(
|
|
791
|
-
Ve,
|
|
792
|
-
{
|
|
793
|
-
showCloseButton: !1,
|
|
794
|
-
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",
|
|
795
|
-
style: o.dialogStyle,
|
|
796
|
-
children: [
|
|
797
|
-
/* @__PURE__ */ i("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
798
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
799
|
-
/* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
800
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
801
|
-
/* @__PURE__ */ t(Re, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
|
|
802
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
|
|
803
|
-
] })
|
|
804
|
-
] }),
|
|
805
|
-
/* @__PURE__ */ t(
|
|
806
|
-
U,
|
|
807
|
-
{
|
|
808
|
-
size: "xs",
|
|
809
|
-
variant: "ghost",
|
|
810
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
811
|
-
onClick: () => ne(!1),
|
|
812
|
-
"aria-label": "Close visuals library",
|
|
813
|
-
children: "×"
|
|
814
|
-
}
|
|
815
|
-
)
|
|
816
|
-
] }),
|
|
817
|
-
/* @__PURE__ */ i("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
|
|
818
|
-
/* @__PURE__ */ i("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
|
|
819
|
-
/* @__PURE__ */ t(Sa, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
820
|
-
/* @__PURE__ */ t(
|
|
821
|
-
"input",
|
|
822
|
-
{
|
|
823
|
-
autoFocus: !0,
|
|
824
|
-
value: a,
|
|
825
|
-
onChange: (C) => n(C.target.value),
|
|
826
|
-
placeholder: "Search visuals...",
|
|
827
|
-
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",
|
|
828
|
-
"aria-label": "Search visuals"
|
|
829
|
-
}
|
|
830
|
-
)
|
|
831
|
-
] }),
|
|
832
|
-
/* @__PURE__ */ i(
|
|
833
|
-
U,
|
|
834
|
-
{
|
|
835
|
-
size: "xs",
|
|
836
|
-
variant: "outline",
|
|
837
|
-
className: "ml-auto",
|
|
838
|
-
onClick: () => l(!0),
|
|
839
|
-
children: [
|
|
840
|
-
/* @__PURE__ */ t(Se, { className: "h-3.5 w-3.5" }),
|
|
841
|
-
"New library visual"
|
|
842
|
-
]
|
|
843
|
-
}
|
|
844
|
-
)
|
|
845
|
-
] }),
|
|
846
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: I ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Qa, {}) }) : W ? /* @__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" }) }) : ae.length === 0 ? /* @__PURE__ */ i("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
|
|
847
|
-
/* @__PURE__ */ t(Dt, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
848
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: a ? "No visuals found" : "No visuals yet" }),
|
|
849
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: a ? "Try a different search." : "Create a saved visual to add it here." })
|
|
850
|
-
] }) : /* @__PURE__ */ t(
|
|
851
|
-
ln,
|
|
852
|
-
{
|
|
853
|
-
visuals: ae,
|
|
854
|
-
selectedIds: s,
|
|
855
|
-
allFilteredSelected: ke,
|
|
856
|
-
someFilteredSelected: ve,
|
|
857
|
-
onSelectAll: Ae,
|
|
858
|
-
onToggleSelection: se,
|
|
859
|
-
onAddVisual: q,
|
|
860
|
-
onOpenVisual: he,
|
|
861
|
-
onEditDetails: m,
|
|
862
|
-
onShareVisual: h,
|
|
863
|
-
onDeleteVisual: (C) => {
|
|
864
|
-
k(C), f(!0);
|
|
865
|
-
},
|
|
866
|
-
onDuplicateVisual: Ne,
|
|
867
|
-
duplicatingId: v,
|
|
868
|
-
isDeleting: ce,
|
|
869
|
-
isConsoleMode: x
|
|
870
|
-
}
|
|
871
|
-
) }),
|
|
872
|
-
/* @__PURE__ */ i("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
|
|
873
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: s.size > 0 && /* @__PURE__ */ i($, { children: [
|
|
874
|
-
/* @__PURE__ */ i("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
875
|
-
/* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: s.size }),
|
|
876
|
-
" ",
|
|
877
|
-
"selected"
|
|
878
|
-
] }),
|
|
879
|
-
/* @__PURE__ */ t(
|
|
880
|
-
U,
|
|
881
|
-
{
|
|
882
|
-
size: "xs",
|
|
883
|
-
variant: "ghost",
|
|
884
|
-
onClick: () => d(/* @__PURE__ */ new Set()),
|
|
885
|
-
children: "Clear"
|
|
886
|
-
}
|
|
887
|
-
),
|
|
888
|
-
/* @__PURE__ */ i(
|
|
889
|
-
U,
|
|
890
|
-
{
|
|
891
|
-
size: "xs",
|
|
892
|
-
variant: "outline",
|
|
893
|
-
onClick: Ie,
|
|
894
|
-
disabled: le.length !== 1 || be.length !== 1,
|
|
895
|
-
children: [
|
|
896
|
-
/* @__PURE__ */ t(zt, { className: "h-3.5 w-3.5" }),
|
|
897
|
-
"Share"
|
|
898
|
-
]
|
|
899
|
-
}
|
|
900
|
-
),
|
|
901
|
-
/* @__PURE__ */ i(
|
|
902
|
-
U,
|
|
903
|
-
{
|
|
904
|
-
size: "xs",
|
|
905
|
-
variant: "outline",
|
|
906
|
-
className: "text-destructive hover:text-destructive",
|
|
907
|
-
onClick: _e,
|
|
908
|
-
disabled: Q.length === 0,
|
|
909
|
-
children: [
|
|
910
|
-
/* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
|
|
911
|
-
"Delete ",
|
|
912
|
-
Q.length || s.size
|
|
913
|
-
]
|
|
914
|
-
}
|
|
915
|
-
)
|
|
916
|
-
] }) }),
|
|
917
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
918
|
-
/* @__PURE__ */ t(
|
|
919
|
-
U,
|
|
920
|
-
{
|
|
921
|
-
size: "xs",
|
|
922
|
-
variant: "outline",
|
|
923
|
-
onClick: () => ne(!1),
|
|
924
|
-
children: "Close"
|
|
925
|
-
}
|
|
926
|
-
),
|
|
927
|
-
/* @__PURE__ */ i(
|
|
928
|
-
U,
|
|
929
|
-
{
|
|
930
|
-
size: "xs",
|
|
931
|
-
onClick: H,
|
|
932
|
-
disabled: s.size === 0,
|
|
933
|
-
children: [
|
|
934
|
-
/* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" }),
|
|
935
|
-
s.size === 0 ? "Add to dashboard" : `Add ${s.size} visual${s.size === 1 ? "" : "s"}`
|
|
936
|
-
]
|
|
937
|
-
}
|
|
938
|
-
)
|
|
939
|
-
] })
|
|
940
|
-
] })
|
|
941
|
-
]
|
|
942
|
-
}
|
|
943
|
-
) }),
|
|
944
|
-
/* @__PURE__ */ t(
|
|
945
|
-
Ka,
|
|
946
|
-
{
|
|
947
|
-
open: c,
|
|
948
|
-
onOpenChange: l,
|
|
949
|
-
onSubmit: P,
|
|
950
|
-
isCreating: Ce
|
|
951
|
-
}
|
|
952
|
-
),
|
|
953
|
-
u && /* @__PURE__ */ t(
|
|
954
|
-
kr,
|
|
955
|
-
{
|
|
956
|
-
resource: u,
|
|
957
|
-
resourceType: Ar.VISUAL,
|
|
958
|
-
onClose: () => h(null)
|
|
959
|
-
}
|
|
960
|
-
),
|
|
961
|
-
p && /* @__PURE__ */ t(
|
|
962
|
-
Ir,
|
|
963
|
-
{
|
|
964
|
-
open: !!p,
|
|
965
|
-
resourceLabel: "Visual",
|
|
966
|
-
initialTitle: p.title || "",
|
|
967
|
-
initialDescription: p.description || "",
|
|
968
|
-
onClose: () => m(null),
|
|
969
|
-
onSave: Fe,
|
|
970
|
-
isSaving: re(p.id)
|
|
971
|
-
}
|
|
972
|
-
),
|
|
973
|
-
/* @__PURE__ */ t(
|
|
974
|
-
pt,
|
|
975
|
-
{
|
|
976
|
-
open: g,
|
|
977
|
-
onOpenChange: (C) => {
|
|
978
|
-
!C && ce || (f(C), C || k(null));
|
|
979
|
-
},
|
|
980
|
-
children: /* @__PURE__ */ i(ft, { children: [
|
|
981
|
-
/* @__PURE__ */ i(gt, { children: [
|
|
982
|
-
/* @__PURE__ */ i(bt, { children: [
|
|
983
|
-
"Delete ",
|
|
984
|
-
Pe,
|
|
985
|
-
" visual",
|
|
986
|
-
Pe === 1 ? "" : "s",
|
|
987
|
-
"?"
|
|
988
|
-
] }),
|
|
989
|
-
/* @__PURE__ */ t(vt, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
|
|
990
|
-
] }),
|
|
991
|
-
/* @__PURE__ */ i(xt, { children: [
|
|
992
|
-
/* @__PURE__ */ t(yt, { disabled: ce, children: "Cancel" }),
|
|
993
|
-
/* @__PURE__ */ i(
|
|
994
|
-
jt,
|
|
995
|
-
{
|
|
996
|
-
onClick: (C) => {
|
|
997
|
-
C.preventDefault(), st();
|
|
998
|
-
},
|
|
999
|
-
disabled: ce || Pe === 0,
|
|
1000
|
-
children: [
|
|
1001
|
-
ce ? /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
|
|
1002
|
-
ce ? "Deleting..." : "Delete"
|
|
1003
|
-
]
|
|
1004
|
-
}
|
|
1005
|
-
)
|
|
1006
|
-
] })
|
|
1007
|
-
] })
|
|
1008
|
-
}
|
|
1009
|
-
)
|
|
1010
|
-
] });
|
|
1011
|
-
}
|
|
1012
|
-
function ln({
|
|
1013
|
-
visuals: e,
|
|
1014
|
-
selectedIds: r,
|
|
1015
|
-
allFilteredSelected: o,
|
|
1016
|
-
someFilteredSelected: a,
|
|
1017
|
-
onSelectAll: n,
|
|
1018
|
-
onToggleSelection: s,
|
|
1019
|
-
onAddVisual: d,
|
|
1020
|
-
onOpenVisual: c,
|
|
1021
|
-
onEditDetails: l,
|
|
1022
|
-
onShareVisual: u,
|
|
1023
|
-
onDeleteVisual: h,
|
|
1024
|
-
onDuplicateVisual: p,
|
|
1025
|
-
duplicatingId: m,
|
|
1026
|
-
isDeleting: g,
|
|
1027
|
-
isConsoleMode: f
|
|
1028
|
-
}) {
|
|
1029
|
-
return /* @__PURE__ */ i("div", { className: "min-w-[48rem]", children: [
|
|
1030
|
-
/* @__PURE__ */ i("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: [
|
|
1031
|
-
/* @__PURE__ */ t(
|
|
1032
|
-
Ct,
|
|
1033
|
-
{
|
|
1034
|
-
checked: o ? !0 : a ? "indeterminate" : !1,
|
|
1035
|
-
onCheckedChange: n,
|
|
1036
|
-
"aria-label": "Select all visuals"
|
|
1037
|
-
}
|
|
1038
|
-
),
|
|
1039
|
-
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
1040
|
-
/* @__PURE__ */ t("span", { children: "Created by" }),
|
|
1041
|
-
/* @__PURE__ */ t("span", { children: "Updated" }),
|
|
1042
|
-
/* @__PURE__ */ t("span", { children: "Visibility" }),
|
|
1043
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Shared" }),
|
|
1044
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
|
|
1045
|
-
] }),
|
|
1046
|
-
e.map((b) => /* @__PURE__ */ t(
|
|
1047
|
-
cn,
|
|
1048
|
-
{
|
|
1049
|
-
visual: b,
|
|
1050
|
-
selected: r.has(b.id),
|
|
1051
|
-
onToggleSelection: s,
|
|
1052
|
-
onAddVisual: d,
|
|
1053
|
-
onOpenVisual: c,
|
|
1054
|
-
onEditDetails: l,
|
|
1055
|
-
onShareVisual: u,
|
|
1056
|
-
onDeleteVisual: h,
|
|
1057
|
-
onDuplicateVisual: p,
|
|
1058
|
-
duplicatingId: m,
|
|
1059
|
-
isDeleting: g,
|
|
1060
|
-
isConsoleMode: f
|
|
1061
|
-
},
|
|
1062
|
-
b.id
|
|
1063
|
-
))
|
|
1064
|
-
] });
|
|
1065
|
-
}
|
|
1066
|
-
function cn({
|
|
1067
|
-
visual: e,
|
|
1068
|
-
selected: r,
|
|
1069
|
-
onToggleSelection: o,
|
|
1070
|
-
onAddVisual: a,
|
|
1071
|
-
onOpenVisual: n,
|
|
1072
|
-
onEditDetails: s,
|
|
1073
|
-
onShareVisual: d,
|
|
1074
|
-
onDeleteVisual: c,
|
|
1075
|
-
onDuplicateVisual: l,
|
|
1076
|
-
duplicatingId: u,
|
|
1077
|
-
isDeleting: h,
|
|
1078
|
-
isConsoleMode: p
|
|
1079
|
-
}) {
|
|
1080
|
-
var f;
|
|
1081
|
-
const m = sn(e.kind), g = () => {
|
|
1082
|
-
a(e);
|
|
1083
|
-
};
|
|
1084
|
-
return /* @__PURE__ */ i(
|
|
1085
|
-
"div",
|
|
1086
|
-
{
|
|
1087
|
-
className: Z(
|
|
1088
|
-
"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",
|
|
1089
|
-
r && "bg-muted/70"
|
|
1090
|
-
),
|
|
1091
|
-
children: [
|
|
1092
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
1093
|
-
Ct,
|
|
1094
|
-
{
|
|
1095
|
-
checked: r,
|
|
1096
|
-
onCheckedChange: () => o(e.id),
|
|
1097
|
-
"aria-label": `Select ${e.title || "visual"}`
|
|
1098
|
-
}
|
|
1099
|
-
) }),
|
|
1100
|
-
/* @__PURE__ */ i(
|
|
1101
|
-
"button",
|
|
1102
|
-
{
|
|
1103
|
-
type: "button",
|
|
1104
|
-
className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1105
|
-
onClick: g,
|
|
1106
|
-
"aria-label": `Add ${e.title || "visual"} to dashboard`,
|
|
1107
|
-
children: [
|
|
1108
|
-
/* @__PURE__ */ t(m, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1109
|
-
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
1110
|
-
/* @__PURE__ */ t(
|
|
1111
|
-
"div",
|
|
1112
|
-
{
|
|
1113
|
-
className: "truncate font-medium text-foreground",
|
|
1114
|
-
title: e.title || "Untitled Visual",
|
|
1115
|
-
children: e.title || "Untitled Visual"
|
|
1116
|
-
}
|
|
1117
|
-
),
|
|
1118
|
-
((f = e.description) == null ? void 0 : f.trim()) && /* @__PURE__ */ t(
|
|
1119
|
-
"div",
|
|
1120
|
-
{
|
|
1121
|
-
className: "truncate text-[11px] text-muted-foreground",
|
|
1122
|
-
title: e.description,
|
|
1123
|
-
children: e.description
|
|
1124
|
-
}
|
|
1125
|
-
)
|
|
1126
|
-
] })
|
|
1127
|
-
]
|
|
1128
|
-
}
|
|
1129
|
-
),
|
|
1130
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1131
|
-
/* @__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: nn(e, p) }),
|
|
1132
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Et(e, p) })
|
|
1133
|
-
] }),
|
|
1134
|
-
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: rr(e.updatedAt) }),
|
|
1135
|
-
/* @__PURE__ */ t(on, { visual: e }),
|
|
1136
|
-
/* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
|
|
1137
|
-
/* @__PURE__ */ t(
|
|
1138
|
-
dn,
|
|
1139
|
-
{
|
|
1140
|
-
visual: e,
|
|
1141
|
-
onOpenVisual: n,
|
|
1142
|
-
onEditDetails: s,
|
|
1143
|
-
onShareVisual: d,
|
|
1144
|
-
onDeleteVisual: c,
|
|
1145
|
-
onDuplicateVisual: l,
|
|
1146
|
-
duplicatingId: u,
|
|
1147
|
-
isDeleting: h,
|
|
1148
|
-
isConsoleMode: p
|
|
1149
|
-
}
|
|
1150
|
-
)
|
|
1151
|
-
]
|
|
1152
|
-
}
|
|
1153
|
-
);
|
|
1154
|
-
}
|
|
1155
|
-
function dn({
|
|
1156
|
-
visual: e,
|
|
1157
|
-
onOpenVisual: r,
|
|
1158
|
-
onEditDetails: o,
|
|
1159
|
-
onShareVisual: a,
|
|
1160
|
-
onDeleteVisual: n,
|
|
1161
|
-
onDuplicateVisual: s,
|
|
1162
|
-
duplicatingId: d,
|
|
1163
|
-
isDeleting: c,
|
|
1164
|
-
isConsoleMode: l
|
|
1165
|
-
}) {
|
|
1166
|
-
return /* @__PURE__ */ i(
|
|
1167
|
-
"div",
|
|
1168
|
-
{
|
|
1169
|
-
className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1170
|
-
onClick: (u) => u.stopPropagation(),
|
|
1171
|
-
children: [
|
|
1172
|
-
/* @__PURE__ */ t(
|
|
1173
|
-
U,
|
|
1174
|
-
{
|
|
1175
|
-
size: "xs",
|
|
1176
|
-
variant: "ghost",
|
|
1177
|
-
className: "w-7 px-0",
|
|
1178
|
-
onClick: () => r(e),
|
|
1179
|
-
"aria-label": "Edit visual",
|
|
1180
|
-
children: /* @__PURE__ */ t(ot, { className: "h-3.5 w-3.5" })
|
|
1181
|
-
}
|
|
1182
|
-
),
|
|
1183
|
-
/* @__PURE__ */ i(rt, { modal: !1, children: [
|
|
1184
|
-
/* @__PURE__ */ t(at, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1185
|
-
U,
|
|
1186
|
-
{
|
|
1187
|
-
size: "xs",
|
|
1188
|
-
variant: "ghost",
|
|
1189
|
-
className: "w-7 px-0",
|
|
1190
|
-
"aria-label": "More actions",
|
|
1191
|
-
children: /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" })
|
|
1192
|
-
}
|
|
1193
|
-
) }),
|
|
1194
|
-
/* @__PURE__ */ i(
|
|
1195
|
-
nt,
|
|
1196
|
-
{
|
|
1197
|
-
align: "end",
|
|
1198
|
-
className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
|
|
1199
|
-
children: [
|
|
1200
|
-
/* @__PURE__ */ i(X, { onClick: () => r(e), children: [
|
|
1201
|
-
/* @__PURE__ */ t(ot, { className: "h-3.5 w-3.5" }),
|
|
1202
|
-
"Edit visual"
|
|
1203
|
-
] }),
|
|
1204
|
-
/* @__PURE__ */ i(
|
|
1205
|
-
X,
|
|
1206
|
-
{
|
|
1207
|
-
onClick: () => s(e.id),
|
|
1208
|
-
disabled: d === e.id,
|
|
1209
|
-
children: [
|
|
1210
|
-
d === e.id ? /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(Tr, { className: "h-3.5 w-3.5" }),
|
|
1211
|
-
d === e.id ? "Duplicating..." : "Duplicate"
|
|
1212
|
-
]
|
|
1213
|
-
}
|
|
1214
|
-
),
|
|
1215
|
-
e.permissions.canEdit && /* @__PURE__ */ i(X, { onClick: () => o(e), children: [
|
|
1216
|
-
/* @__PURE__ */ t(ot, { className: "h-3.5 w-3.5" }),
|
|
1217
|
-
"Edit details"
|
|
1218
|
-
] }),
|
|
1219
|
-
e.permissions.canShare && /* @__PURE__ */ i(X, { onClick: () => a(e), children: [
|
|
1220
|
-
/* @__PURE__ */ t(zt, { className: "h-3.5 w-3.5" }),
|
|
1221
|
-
"Share"
|
|
1222
|
-
] }),
|
|
1223
|
-
e.permissions.canDelete && /* @__PURE__ */ i($, { children: [
|
|
1224
|
-
/* @__PURE__ */ t(Ke, {}),
|
|
1225
|
-
/* @__PURE__ */ i(
|
|
1226
|
-
X,
|
|
1227
|
-
{
|
|
1228
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
1229
|
-
onClick: () => n(e),
|
|
1230
|
-
disabled: c,
|
|
1231
|
-
children: [
|
|
1232
|
-
/* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
|
|
1233
|
-
c ? "Deleting..." : "Delete"
|
|
1234
|
-
]
|
|
1235
|
-
}
|
|
1236
|
-
)
|
|
1237
|
-
] }),
|
|
1238
|
-
/* @__PURE__ */ t(Ke, {}),
|
|
1239
|
-
/* @__PURE__ */ i("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
1240
|
-
ar(e, l) && /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
1241
|
-
/* @__PURE__ */ t(Lr, { className: "h-3 w-3" }),
|
|
1242
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: Et(e, l) })
|
|
1243
|
-
] }),
|
|
1244
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
1245
|
-
/* @__PURE__ */ t(Ur, { className: "h-3 w-3" }),
|
|
1246
|
-
/* @__PURE__ */ t("span", { children: rr(e.updatedAt) })
|
|
1247
|
-
] })
|
|
1248
|
-
] })
|
|
1249
|
-
]
|
|
1250
|
-
}
|
|
1251
|
-
)
|
|
1252
|
-
] })
|
|
1253
|
-
]
|
|
1254
|
-
}
|
|
1255
|
-
);
|
|
1256
|
-
}
|
|
1257
|
-
function Gs(e, r, o = !1) {
|
|
1258
|
-
const a = T((u) => u.dashboard), n = T(
|
|
1259
|
-
(u) => u.isDashboardEditing
|
|
1260
|
-
), s = T(
|
|
1261
|
-
(u) => u.onDashboardLifecycleEvent
|
|
1262
|
-
), d = j(() => {
|
|
1263
|
-
const u = T.getState().dashboard;
|
|
1264
|
-
return r || !e || !u || u.id !== e.id ? !1 : je(u) !== je(e);
|
|
1265
|
-
}, [e, r]);
|
|
1266
|
-
Pt(() => (T.setState({ checkUnsavedDashboardChanges: d }), () => {
|
|
1267
|
-
T.getState().checkUnsavedDashboardChanges === d && T.setState({ checkUnsavedDashboardChanges: null });
|
|
1268
|
-
}), [d]);
|
|
1269
|
-
const c = oe(() => !o || r || !a || n && (!e || a.id !== e.id) ? null : {
|
|
1270
|
-
dashboardId: a.id,
|
|
1271
|
-
dirty: n && e ? je(a) !== je(e) : !1
|
|
1272
|
-
}, [
|
|
1273
|
-
n,
|
|
1274
|
-
r,
|
|
1275
|
-
o,
|
|
1276
|
-
e,
|
|
1277
|
-
a
|
|
1278
|
-
]), l = ge(null);
|
|
1279
|
-
return Pt(() => {
|
|
1280
|
-
if (!s || !c) {
|
|
1281
|
-
l.current = null;
|
|
1282
|
-
return;
|
|
1283
|
-
}
|
|
1284
|
-
const u = l.current;
|
|
1285
|
-
(u == null ? void 0 : u.callback) === s && u.dashboardId === c.dashboardId && u.dirty === c.dirty || (l.current = {
|
|
1286
|
-
callback: s,
|
|
1287
|
-
dashboardId: c.dashboardId,
|
|
1288
|
-
dirty: c.dirty
|
|
1289
|
-
}, s({
|
|
1290
|
-
type: "dashboard:dirty-state",
|
|
1291
|
-
dashboardId: c.dashboardId,
|
|
1292
|
-
payload: { dirty: c.dirty }
|
|
1293
|
-
}));
|
|
1294
|
-
}, [c, s]), d;
|
|
1295
|
-
}
|
|
1296
|
-
function un({
|
|
1297
|
-
open: e,
|
|
1298
|
-
onOpenChange: r,
|
|
1299
|
-
isLibraryVisual: o,
|
|
1300
|
-
currentVisualName: a,
|
|
1301
|
-
isSaving: n = !1,
|
|
1302
|
-
destinationMode: s = "both",
|
|
1303
|
-
onConfirm: d
|
|
1304
|
-
}) {
|
|
1305
|
-
const [c, l] = F(
|
|
1306
|
-
o && a ? `Copy of ${a}` : a || ""
|
|
1307
|
-
), [u, h] = F("");
|
|
1308
|
-
_t.useEffect(() => {
|
|
1309
|
-
e && (l(
|
|
1310
|
-
o && a ? `Copy of ${a}` : a || ""
|
|
1311
|
-
), h(""));
|
|
1312
|
-
}, [e, o, a]);
|
|
1313
|
-
const p = !!c.trim(), m = s === "local" ? {
|
|
1314
|
-
saveToLibrary: !1,
|
|
1315
|
-
saveToCurrentDashboard: !0,
|
|
1316
|
-
badgeType: "local",
|
|
1317
|
-
description: "Creates a local copy on the current dashboard.",
|
|
1318
|
-
actionLabel: "Add to Dashboard (Local)"
|
|
1319
|
-
} : s === "library" ? {
|
|
1320
|
-
saveToLibrary: !0,
|
|
1321
|
-
saveToCurrentDashboard: !1,
|
|
1322
|
-
badgeType: "library",
|
|
1323
|
-
description: "Creates a reusable visual in Visual Library.",
|
|
1324
|
-
actionLabel: "Save as Library Visual"
|
|
1325
|
-
} : {
|
|
1326
|
-
saveToLibrary: !0,
|
|
1327
|
-
saveToCurrentDashboard: !0,
|
|
1328
|
-
badgeType: "linked",
|
|
1329
|
-
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
1330
|
-
actionLabel: "Save Copy as Linked Visual"
|
|
1331
|
-
}, g = () => {
|
|
1332
|
-
!p || n || d({
|
|
1333
|
-
name: c.trim(),
|
|
1334
|
-
description: u.trim() || void 0,
|
|
1335
|
-
saveToLibrary: m.saveToLibrary,
|
|
1336
|
-
saveToCurrentDashboard: m.saveToCurrentDashboard
|
|
1337
|
-
});
|
|
1338
|
-
};
|
|
1339
|
-
return /* @__PURE__ */ t(Ue, { open: e, onOpenChange: r, children: /* @__PURE__ */ i(Ve, { className: "sm:max-w-[500px]", children: [
|
|
1340
|
-
/* @__PURE__ */ i(wt, { children: [
|
|
1341
|
-
/* @__PURE__ */ i(Re, { className: "flex items-center gap-2", children: [
|
|
1342
|
-
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
1343
|
-
m.badgeType !== "local" && /* @__PURE__ */ t(
|
|
1344
|
-
Ua,
|
|
1345
|
-
{
|
|
1346
|
-
type: m.badgeType,
|
|
1347
|
-
showLabel: !0,
|
|
1348
|
-
className: "px-2 py-0.5"
|
|
1349
|
-
}
|
|
1350
|
-
)
|
|
1351
|
-
] }),
|
|
1352
|
-
/* @__PURE__ */ t(Nt, { children: m.description })
|
|
1353
|
-
] }),
|
|
1354
|
-
/* @__PURE__ */ i("div", { className: "grid gap-4 py-4", children: [
|
|
1355
|
-
/* @__PURE__ */ i("div", { className: "grid gap-2", children: [
|
|
1356
|
-
/* @__PURE__ */ t(Le, { htmlFor: "name", children: "Name" }),
|
|
1357
|
-
/* @__PURE__ */ t(
|
|
1358
|
-
dt,
|
|
1359
|
-
{
|
|
1360
|
-
id: "name",
|
|
1361
|
-
value: c,
|
|
1362
|
-
onChange: (f) => l(f.target.value),
|
|
1363
|
-
placeholder: "Enter visual name",
|
|
1364
|
-
disabled: n
|
|
1365
|
-
}
|
|
1366
|
-
)
|
|
1367
|
-
] }),
|
|
1368
|
-
/* @__PURE__ */ i("div", { className: "grid gap-2", children: [
|
|
1369
|
-
/* @__PURE__ */ t(Le, { htmlFor: "description", children: "Description (optional)" }),
|
|
1370
|
-
/* @__PURE__ */ t(
|
|
1371
|
-
Vr,
|
|
1372
|
-
{
|
|
1373
|
-
id: "description",
|
|
1374
|
-
value: u,
|
|
1375
|
-
onChange: (f) => h(f.target.value),
|
|
1376
|
-
placeholder: "Enter visual description",
|
|
1377
|
-
rows: 3,
|
|
1378
|
-
disabled: n
|
|
1379
|
-
}
|
|
1380
|
-
)
|
|
1381
|
-
] })
|
|
1382
|
-
] }),
|
|
1383
|
-
/* @__PURE__ */ i(Rr, { children: [
|
|
1384
|
-
/* @__PURE__ */ t(
|
|
1385
|
-
U,
|
|
1386
|
-
{
|
|
1387
|
-
variant: "outline",
|
|
1388
|
-
onClick: () => r(!1),
|
|
1389
|
-
disabled: n,
|
|
1390
|
-
children: "Cancel"
|
|
1391
|
-
}
|
|
1392
|
-
),
|
|
1393
|
-
/* @__PURE__ */ i(U, { onClick: g, disabled: !p || n, children: [
|
|
1394
|
-
n && /* @__PURE__ */ t(ie, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1395
|
-
m.actionLabel
|
|
1396
|
-
] })
|
|
1397
|
-
] })
|
|
1398
|
-
] }) });
|
|
1399
|
-
}
|
|
1400
|
-
function kt(e) {
|
|
1401
|
-
var r;
|
|
1402
|
-
for (const o of e.cards)
|
|
1403
|
-
if (o.type === "matrixTable" && !Na.safeParse((r = o.config) == null ? void 0 : r.matrix).success)
|
|
1404
|
-
return V.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
|
|
1405
|
-
return !0;
|
|
1406
|
-
}
|
|
1407
|
-
function it({
|
|
1408
|
-
className: e,
|
|
1409
|
-
variant: r = "outline"
|
|
1410
|
-
}) {
|
|
1411
|
-
const o = ee((s) => s.onSave), { getUpdatedFrame: a } = Ee();
|
|
1412
|
-
function n() {
|
|
1413
|
-
const s = a();
|
|
1414
|
-
kt(s) && (o == null || o(s));
|
|
1415
|
-
}
|
|
1416
|
-
return /* @__PURE__ */ i(
|
|
1417
|
-
U,
|
|
1418
|
-
{
|
|
1419
|
-
onClick: n,
|
|
1420
|
-
className: e,
|
|
1421
|
-
size: "xs",
|
|
1422
|
-
variant: r,
|
|
1423
|
-
children: [
|
|
1424
|
-
/* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" }),
|
|
1425
|
-
"Done"
|
|
1426
|
-
]
|
|
1427
|
-
}
|
|
1428
|
-
);
|
|
1429
|
-
}
|
|
1430
|
-
function hn({
|
|
1431
|
-
className: e,
|
|
1432
|
-
variant: r = "default"
|
|
1433
|
-
}) {
|
|
1434
|
-
const o = Je(), [a, n] = F(!1), { setIsVisualEditing: s } = pe(), { getUpdatedFrame: d } = Ee(), c = et(), l = ee((p) => p.frame), u = qt();
|
|
1435
|
-
return /* @__PURE__ */ t(
|
|
1436
|
-
U,
|
|
1437
|
-
{
|
|
1438
|
-
onClick: () => {
|
|
1439
|
-
const p = d();
|
|
1440
|
-
if (!kt(p))
|
|
1441
|
-
return;
|
|
1442
|
-
const m = (l == null ? void 0 : l.visualId) || (c == null ? void 0 : c.id);
|
|
1443
|
-
if (!m) {
|
|
1444
|
-
V.error("No visual to save");
|
|
1445
|
-
return;
|
|
1446
|
-
}
|
|
1447
|
-
n(!0), u.mutate(
|
|
1448
|
-
{
|
|
1449
|
-
visualId: m,
|
|
1450
|
-
data: {
|
|
1451
|
-
frameObject: p
|
|
1452
|
-
}
|
|
1453
|
-
},
|
|
1454
|
-
{
|
|
1455
|
-
onSuccess: () => {
|
|
1456
|
-
n(!1), V.success("Visual updated successfully"), o.invalidateQueries({
|
|
1457
|
-
queryKey: ["resource-by-id", "visual", m],
|
|
1458
|
-
exact: !0
|
|
1459
|
-
});
|
|
1460
|
-
},
|
|
1461
|
-
onError: () => {
|
|
1462
|
-
n(!1), V.error("Failed to update visual");
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
);
|
|
1466
|
-
},
|
|
1467
|
-
className: e,
|
|
1468
|
-
size: "xs",
|
|
1469
|
-
variant: r,
|
|
1470
|
-
children: a ? /* @__PURE__ */ i($, { children: [
|
|
1471
|
-
/* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1472
|
-
"Saving"
|
|
1473
|
-
] }) : /* @__PURE__ */ i($, { children: [
|
|
1474
|
-
/* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5" }),
|
|
1475
|
-
"Save to Library"
|
|
1476
|
-
] })
|
|
1477
|
-
}
|
|
1478
|
-
);
|
|
1479
|
-
}
|
|
1480
|
-
function mn({
|
|
1481
|
-
className: e
|
|
1482
|
-
}) {
|
|
1483
|
-
const r = Je(), [o, a] = F(!1), n = et(), s = ee((f) => f.frame), d = T((f) => f.selectedSheetId), c = T((f) => f.dashboard), { updateFrame: l, setIsVisualEditing: u } = pe(), { getUpdatedFrame: h } = Ee(), p = qt(), m = St();
|
|
1484
|
-
return /* @__PURE__ */ t(
|
|
1485
|
-
U,
|
|
1486
|
-
{
|
|
1487
|
-
onClick: async () => {
|
|
1488
|
-
if (!d) {
|
|
1489
|
-
V.error("No sheet selected");
|
|
1490
|
-
return;
|
|
1491
|
-
}
|
|
1492
|
-
const f = (s == null ? void 0 : s.visualId) || (n == null ? void 0 : n.id);
|
|
1493
|
-
if (!f) {
|
|
1494
|
-
V.error("No visual to update");
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
a(!0);
|
|
1498
|
-
try {
|
|
1499
|
-
const b = h();
|
|
1500
|
-
if (!kt(b)) {
|
|
1501
|
-
a(!1);
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
const k = {
|
|
1505
|
-
...b,
|
|
1506
|
-
visualId: f
|
|
1507
|
-
// Keep the link to library visual
|
|
1508
|
-
}, v = Ze(c, k.id), D = await m(k, {
|
|
1509
|
-
previousFrame: v
|
|
1510
|
-
});
|
|
1511
|
-
await p.mutateAsync({
|
|
1512
|
-
visualId: f,
|
|
1513
|
-
data: {
|
|
1514
|
-
frameObject: b
|
|
1515
|
-
}
|
|
1516
|
-
}), l(d, k, {
|
|
1517
|
-
semanticExecutionPayload: D
|
|
1518
|
-
}), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", f] }), V.success("Saved to library and applied locally"), setTimeout(() => {
|
|
1519
|
-
u(!1);
|
|
1520
|
-
}, 300);
|
|
1521
|
-
} catch (b) {
|
|
1522
|
-
console.error("Failed to save and apply:", b), V.error(
|
|
1523
|
-
b instanceof Error ? b.message : "Failed to save and apply changes"
|
|
1524
|
-
);
|
|
1525
|
-
} finally {
|
|
1526
|
-
a(!1);
|
|
1527
|
-
}
|
|
1528
|
-
},
|
|
1529
|
-
className: e,
|
|
1530
|
-
size: "xs",
|
|
1531
|
-
variant: "default",
|
|
1532
|
-
disabled: o,
|
|
1533
|
-
children: o ? /* @__PURE__ */ i($, { children: [
|
|
1534
|
-
/* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1535
|
-
"Saving..."
|
|
1536
|
-
] }) : /* @__PURE__ */ i($, { children: [
|
|
1537
|
-
/* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5" }),
|
|
1538
|
-
"Save & Apply"
|
|
1539
|
-
] })
|
|
1540
|
-
}
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
function lt({ className: e }) {
|
|
1544
|
-
const { setTempQueryData: r, setSqlGen: o } = tt(), a = Je(), n = ee((c) => c.tempQueryData), s = ee((c) => c.onClose);
|
|
1545
|
-
function d() {
|
|
1546
|
-
if (n) {
|
|
1547
|
-
const { queryKey: c, queryData: l } = n;
|
|
1548
|
-
c && l && a.setQueryData(c, l);
|
|
1549
|
-
}
|
|
1550
|
-
o({}), s == null || s();
|
|
1551
|
-
}
|
|
1552
|
-
return /* @__PURE__ */ i(
|
|
1553
|
-
U,
|
|
1554
|
-
{
|
|
1555
|
-
onClick: d,
|
|
1556
|
-
className: e,
|
|
1557
|
-
size: "xs",
|
|
1558
|
-
variant: "outline",
|
|
1559
|
-
children: [
|
|
1560
|
-
/* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" }),
|
|
1561
|
-
"Close"
|
|
1562
|
-
]
|
|
1563
|
-
}
|
|
1564
|
-
);
|
|
1565
|
-
}
|
|
1566
|
-
function pn() {
|
|
1567
|
-
const [e, r] = F(!1), [o, a] = F(!1), [n, s] = F(null), [d, c] = F(null), l = ee((S) => S.frame), u = ee((S) => S.card), h = et(), p = T((S) => S.selectedSheetId), m = T((S) => S.dashboard), { getUpdatedFrame: g } = Ee(), { selectVisual: f } = mt(), { addFrame: b, setSelectedFrameId: k, setIsVisualEditing: v } = pe(), D = St(), E = !!(l != null && l.visualId), N = (() => {
|
|
1568
|
-
var S, x;
|
|
1569
|
-
return ((S = l == null ? void 0 : l.cards) == null ? void 0 : S.length) === 1 && ((x = l.cards[0]) != null && x.title) ? l.cards[0].title : h != null && h.title ? h.title : (u == null ? void 0 : u.title) || "Untitled Visual";
|
|
1570
|
-
})(), y = Br((S) => {
|
|
1571
|
-
S != null && S.id && (f(S), o && n && d && p && (async () => {
|
|
1572
|
-
try {
|
|
1573
|
-
const x = {
|
|
1574
|
-
...n,
|
|
1575
|
-
id: Lt(),
|
|
1576
|
-
visualId: S.id
|
|
1577
|
-
// Link to the newly created library visual
|
|
1578
|
-
};
|
|
1579
|
-
b(p, x, {
|
|
1580
|
-
placement: "end",
|
|
1581
|
-
semanticExecutionPayload: d
|
|
1582
|
-
}), k(x.id), a(!1), s(null), c(null), v(!1);
|
|
1583
|
-
} catch (x) {
|
|
1584
|
-
console.error(
|
|
1585
|
-
"Failed to promote semantic metadata for saved visual:",
|
|
1586
|
-
x
|
|
1587
|
-
), V.error(
|
|
1588
|
-
x instanceof Error ? x.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1589
|
-
);
|
|
1590
|
-
}
|
|
1591
|
-
})(), r(!1));
|
|
1592
|
-
});
|
|
1593
|
-
return {
|
|
1594
|
-
saveAsDialogOpen: e,
|
|
1595
|
-
setSaveAsDialogOpen: r,
|
|
1596
|
-
handleSaveAs: async (S) => {
|
|
1597
|
-
if (!p) {
|
|
1598
|
-
V.error("No sheet selected");
|
|
1599
|
-
return;
|
|
1600
|
-
}
|
|
1601
|
-
const x = g(), I = x.cards.length === 1 ? {
|
|
1602
|
-
...x,
|
|
1603
|
-
cards: x.cards.map((W) => ({
|
|
1604
|
-
...W,
|
|
1605
|
-
title: S.name
|
|
1606
|
-
// Use visual name as card title
|
|
1607
|
-
}))
|
|
1608
|
-
} : x;
|
|
1609
|
-
if (S.saveToLibrary) {
|
|
1610
|
-
let W = null;
|
|
1611
|
-
if (S.saveToCurrentDashboard)
|
|
1612
|
-
try {
|
|
1613
|
-
W = await D(I, {
|
|
1614
|
-
previousFrame: Ze(m, I.id)
|
|
1615
|
-
});
|
|
1616
|
-
} catch (M) {
|
|
1617
|
-
console.error(
|
|
1618
|
-
"Failed to prepare semantic metadata before saving visual:",
|
|
1619
|
-
M
|
|
1620
|
-
), V.error(
|
|
1621
|
-
M instanceof Error ? M.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1622
|
-
);
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
a(S.saveToCurrentDashboard), s(I), c(W);
|
|
1626
|
-
const P = {
|
|
1627
|
-
title: S.name,
|
|
1628
|
-
description: S.description,
|
|
1629
|
-
frameObject: I,
|
|
1630
|
-
// Card title synced for single-card frames
|
|
1631
|
-
isPrivate: !1
|
|
1632
|
-
};
|
|
1633
|
-
y.mutate(P);
|
|
1634
|
-
} else if (S.saveToCurrentDashboard) {
|
|
1635
|
-
const W = {
|
|
1636
|
-
...I,
|
|
1637
|
-
// Card title already synced
|
|
1638
|
-
id: Lt(),
|
|
1639
|
-
visualId: void 0
|
|
1640
|
-
// Explicitly no visualId for local visuals
|
|
1641
|
-
};
|
|
1642
|
-
try {
|
|
1643
|
-
const P = await D(I, {
|
|
1644
|
-
previousFrame: Ze(m, I.id)
|
|
1645
|
-
});
|
|
1646
|
-
b(p, W, {
|
|
1647
|
-
placement: "end",
|
|
1648
|
-
semanticExecutionPayload: P
|
|
1649
|
-
}), k(W.id), V.success("Visual saved to dashboard"), r(!1), v(!1);
|
|
1650
|
-
} catch (P) {
|
|
1651
|
-
console.error("Failed to save visual to dashboard:", P), V.error(
|
|
1652
|
-
P instanceof Error ? P.message : "Failed to prepare semantic metadata for the visual"
|
|
1653
|
-
);
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
},
|
|
1657
|
-
isLibraryVisual: E,
|
|
1658
|
-
currentVisualName: N,
|
|
1659
|
-
isSaving: y.isPending
|
|
1660
|
-
};
|
|
1661
|
-
}
|
|
1662
|
-
function Qs(e = {}) {
|
|
1663
|
-
const { isInspectionMode: r } = Mr(), o = ee((P) => P.frame), a = ee((P) => P.editorContext), n = _r((P) => P.selectedVisual), s = T((P) => P.selectedFrameId), d = T((P) => P.selectedSheetId), c = T((P) => P.dashboard), { setIsVisualEditing: l, updateFrame: u } = pe(), [h, p] = F(!1), [m, g] = F("both"), f = St(), b = (a == null ? void 0 : a.type) === "documentSection", k = !!(o != null && o.visualId || n != null && n.id), v = !!(o != null && o.visualId && s), D = k && !v, {
|
|
1664
|
-
saveAsDialogOpen: E,
|
|
1665
|
-
setSaveAsDialogOpen: N,
|
|
1666
|
-
handleSaveAs: y,
|
|
1667
|
-
isLibraryVisual: w,
|
|
1668
|
-
currentVisualName: S,
|
|
1669
|
-
isSaving: x
|
|
1670
|
-
} = pn(), { getUpdatedFrame: B } = Ee();
|
|
1671
|
-
if (r)
|
|
1672
|
-
return /* @__PURE__ */ i($, { children: [
|
|
1673
|
-
/* @__PURE__ */ t(
|
|
1674
|
-
it,
|
|
1675
|
-
{
|
|
1676
|
-
className: "rounded-control",
|
|
1677
|
-
variant: "default"
|
|
1678
|
-
}
|
|
1679
|
-
),
|
|
1680
|
-
/* @__PURE__ */ t(lt, {})
|
|
1681
|
-
] });
|
|
1682
|
-
if (b)
|
|
1683
|
-
return /* @__PURE__ */ i($, { children: [
|
|
1684
|
-
/* @__PURE__ */ t(it, { className: "rounded-control", variant: "default" }),
|
|
1685
|
-
/* @__PURE__ */ t(lt, {})
|
|
1686
|
-
] });
|
|
1687
|
-
const I = async () => {
|
|
1688
|
-
if (!d) {
|
|
1689
|
-
V.error("No sheet selected");
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
if (h) return;
|
|
1693
|
-
p(!0);
|
|
1694
|
-
const M = {
|
|
1695
|
-
...B(),
|
|
1696
|
-
visualId: void 0
|
|
1697
|
-
}, Y = Ze(c, M.id);
|
|
1698
|
-
try {
|
|
1699
|
-
const K = await f(M, {
|
|
1700
|
-
previousFrame: Y
|
|
1701
|
-
});
|
|
1702
|
-
u(d, M, {
|
|
1703
|
-
semanticExecutionPayload: K
|
|
1704
|
-
});
|
|
1705
|
-
} catch (K) {
|
|
1706
|
-
console.error("Failed to apply local semantic metadata:", K), p(!1), V.error(
|
|
1707
|
-
K instanceof Error ? K.message : "Failed to prepare semantic metadata for this visual"
|
|
1708
|
-
);
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
setTimeout(() => {
|
|
1712
|
-
p(!1), V.success("Changes applied. Visual is now local to this dashboard"), l(!1);
|
|
1713
|
-
}, 300);
|
|
1714
|
-
}, W = (P) => {
|
|
1715
|
-
g(P), N(!0);
|
|
1716
|
-
};
|
|
1717
|
-
return /* @__PURE__ */ i($, { children: [
|
|
1718
|
-
/* @__PURE__ */ i("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
|
|
1719
|
-
!k && /* @__PURE__ */ t(it, { className: "!rounded-none", variant: "default" }),
|
|
1720
|
-
k && D && /* @__PURE__ */ t(hn, { className: "!rounded-none", variant: "default" }),
|
|
1721
|
-
k && v && /* @__PURE__ */ t(mn, { className: "!rounded-none" }),
|
|
1722
|
-
/* @__PURE__ */ i(rt, { modal: !1, children: [
|
|
1723
|
-
/* @__PURE__ */ t(at, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1724
|
-
U,
|
|
1725
|
-
{
|
|
1726
|
-
variant: "default",
|
|
1727
|
-
size: "xs",
|
|
1728
|
-
className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
|
|
1729
|
-
"aria-label": "Open visual save options",
|
|
1730
|
-
disabled: x || h,
|
|
1731
|
-
children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
|
|
1732
|
-
}
|
|
1733
|
-
) }),
|
|
1734
|
-
/* @__PURE__ */ i(
|
|
1735
|
-
nt,
|
|
1736
|
-
{
|
|
1737
|
-
align: "end",
|
|
1738
|
-
className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
|
|
1739
|
-
children: [
|
|
1740
|
-
v && /* @__PURE__ */ i($, { children: [
|
|
1741
|
-
/* @__PURE__ */ i(
|
|
1742
|
-
X,
|
|
1743
|
-
{
|
|
1744
|
-
onClick: I,
|
|
1745
|
-
disabled: h,
|
|
1746
|
-
children: [
|
|
1747
|
-
/* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" }),
|
|
1748
|
-
h ? "Applying..." : "Apply Locally"
|
|
1749
|
-
]
|
|
1750
|
-
}
|
|
1751
|
-
),
|
|
1752
|
-
/* @__PURE__ */ t(Ke, {})
|
|
1753
|
-
] }),
|
|
1754
|
-
/* @__PURE__ */ i(
|
|
1755
|
-
X,
|
|
1756
|
-
{
|
|
1757
|
-
onClick: () => W("local"),
|
|
1758
|
-
disabled: x,
|
|
1759
|
-
children: [
|
|
1760
|
-
/* @__PURE__ */ t(Se, { className: "h-3.5 w-3.5" }),
|
|
1761
|
-
"Add to Dashboard (Local)"
|
|
1762
|
-
]
|
|
1763
|
-
}
|
|
1764
|
-
),
|
|
1765
|
-
/* @__PURE__ */ i(
|
|
1766
|
-
X,
|
|
1767
|
-
{
|
|
1768
|
-
onClick: () => W("library"),
|
|
1769
|
-
disabled: x,
|
|
1770
|
-
children: [
|
|
1771
|
-
/* @__PURE__ */ t(Va, { className: "h-3.5 w-3.5" }),
|
|
1772
|
-
"Save as Library Visual"
|
|
1773
|
-
]
|
|
1774
|
-
}
|
|
1775
|
-
),
|
|
1776
|
-
/* @__PURE__ */ i(
|
|
1777
|
-
X,
|
|
1778
|
-
{
|
|
1779
|
-
onClick: () => W("both"),
|
|
1780
|
-
disabled: x,
|
|
1781
|
-
children: [
|
|
1782
|
-
/* @__PURE__ */ t(Ra, { className: "h-3.5 w-3.5" }),
|
|
1783
|
-
"Save Copy as Linked Visual"
|
|
1784
|
-
]
|
|
1785
|
-
}
|
|
1786
|
-
)
|
|
1787
|
-
]
|
|
1788
|
-
}
|
|
1789
|
-
)
|
|
1790
|
-
] })
|
|
1791
|
-
] }),
|
|
1792
|
-
/* @__PURE__ */ t(lt, {}),
|
|
1793
|
-
/* @__PURE__ */ t(
|
|
1794
|
-
un,
|
|
1795
|
-
{
|
|
1796
|
-
open: E,
|
|
1797
|
-
onOpenChange: (P) => {
|
|
1798
|
-
x || N(P);
|
|
1799
|
-
},
|
|
1800
|
-
isLibraryVisual: w,
|
|
1801
|
-
currentVisualName: S,
|
|
1802
|
-
isSaving: x,
|
|
1803
|
-
destinationMode: m,
|
|
1804
|
-
onConfirm: y
|
|
1805
|
-
}
|
|
1806
|
-
)
|
|
1807
|
-
] });
|
|
1808
|
-
}
|
|
1809
|
-
function Ks({ className: e }) {
|
|
1810
|
-
const r = ee((h) => h.isDevMode), o = ee((h) => h.card.type), a = T((h) => h.isVisualEditing), { setIsDevMode: n } = tt(), { config: s } = pr(Or).tokenProps, d = (s == null ? void 0 : s.showAdvancedMode) !== !1;
|
|
1811
|
-
if (!a || !d || !fr(o))
|
|
1812
|
-
return null;
|
|
1813
|
-
const c = r ? Ha : Wa, l = r ? "Visual editor" : "SQL editor", u = r ? "Switch to visual editor" : "Switch to SQL editor";
|
|
1814
|
-
return /* @__PURE__ */ i(
|
|
1815
|
-
"button",
|
|
1816
|
-
{
|
|
1817
|
-
type: "button",
|
|
1818
|
-
"aria-label": u,
|
|
1819
|
-
title: u,
|
|
1820
|
-
onClick: () => n(!r),
|
|
1821
|
-
className: Z(
|
|
1822
|
-
"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",
|
|
1823
|
-
e
|
|
1824
|
-
),
|
|
1825
|
-
children: [
|
|
1826
|
-
/* @__PURE__ */ t(c, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1827
|
-
l
|
|
1828
|
-
]
|
|
1829
|
-
}
|
|
1830
|
-
);
|
|
1831
|
-
}
|
|
1832
|
-
function Xs({
|
|
1833
|
-
open: e,
|
|
1834
|
-
onOpenChange: r,
|
|
1835
|
-
onSave: o,
|
|
1836
|
-
onDiscard: a,
|
|
1837
|
-
isSaving: n,
|
|
1838
|
-
title: s = "Unsaved changes",
|
|
1839
|
-
description: d = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
1840
|
-
cancelLabel: c = "Cancel",
|
|
1841
|
-
discardLabel: l = "Discard changes",
|
|
1842
|
-
saveLabel: u = "Save"
|
|
1843
|
-
}) {
|
|
1844
|
-
return /* @__PURE__ */ t(pt, { open: e, onOpenChange: (p) => {
|
|
1845
|
-
!p && n || r(p);
|
|
1846
|
-
}, children: /* @__PURE__ */ i(ft, { children: [
|
|
1847
|
-
/* @__PURE__ */ i(gt, { children: [
|
|
1848
|
-
/* @__PURE__ */ t(bt, { children: s }),
|
|
1849
|
-
/* @__PURE__ */ t(vt, { children: d })
|
|
1850
|
-
] }),
|
|
1851
|
-
/* @__PURE__ */ i(xt, { children: [
|
|
1852
|
-
/* @__PURE__ */ t(
|
|
1853
|
-
U,
|
|
1854
|
-
{
|
|
1855
|
-
type: "button",
|
|
1856
|
-
size: "xs",
|
|
1857
|
-
onClick: a,
|
|
1858
|
-
disabled: n,
|
|
1859
|
-
variant: "outline",
|
|
1860
|
-
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",
|
|
1861
|
-
children: l
|
|
1862
|
-
}
|
|
1863
|
-
),
|
|
1864
|
-
/* @__PURE__ */ t(yt, { disabled: n, children: c }),
|
|
1865
|
-
/* @__PURE__ */ t(U, { type: "button", size: "xs", onClick: o, disabled: n, children: n ? /* @__PURE__ */ i($, { children: [
|
|
1866
|
-
/* @__PURE__ */ t(ie, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
1867
|
-
"Saving..."
|
|
1868
|
-
] }) : u })
|
|
1869
|
-
] })
|
|
1870
|
-
] }) });
|
|
1871
|
-
}
|
|
1872
|
-
async function Zs(e) {
|
|
1873
|
-
var s, d;
|
|
1874
|
-
const r = (d = (s = T.getState()) == null ? void 0 : s.authToken) == null ? void 0 : d.accessToken;
|
|
1875
|
-
if (!r)
|
|
1876
|
-
return;
|
|
1877
|
-
const o = `${e}/v1/invalidate-token`, a = await fetch(o, {
|
|
1878
|
-
method: "POST",
|
|
1879
|
-
headers: {
|
|
1880
|
-
Authorization: `Bearer ${r}`
|
|
1881
|
-
}
|
|
1882
|
-
});
|
|
1883
|
-
if (!a.ok)
|
|
1884
|
-
throw new Error("Failed to invalidate token");
|
|
1885
|
-
const n = await a.json();
|
|
1886
|
-
return console.log("invalidateToken", n), n;
|
|
1887
|
-
}
|
|
1888
|
-
function At(e, r) {
|
|
1889
|
-
return {
|
|
1890
|
-
id: e.id,
|
|
1891
|
-
status: e.status,
|
|
1892
|
-
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,
|
|
1893
|
-
totalRows: e.totalRows,
|
|
1894
|
-
totalChunks: e.totalChunks,
|
|
1895
|
-
rowsProcessed: e.processedRows,
|
|
1896
|
-
completedChunks: e.completedChunks,
|
|
1897
|
-
completedAt: e.completedAt ? new Date(e.completedAt) : void 0,
|
|
1898
|
-
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
1899
|
-
fileSize: e.fileSize,
|
|
1900
|
-
error: e.error,
|
|
1901
|
-
phase: e.phase,
|
|
1902
|
-
deadlineAt: e.deadlineAt ? new Date(e.deadlineAt) : void 0,
|
|
1903
|
-
// A refreshed result replaces prior authorization, including a failed URL fetch.
|
|
1904
|
-
downloadUrl: r
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
const fn = 15e3;
|
|
1908
|
-
function ye(e) {
|
|
1909
|
-
const r = new AbortController();
|
|
1910
|
-
let o;
|
|
1911
|
-
const a = new Promise((n, s) => {
|
|
1912
|
-
o = setTimeout(() => {
|
|
1913
|
-
r.abort(), s(new Error("Export request timed out."));
|
|
1914
|
-
}, fn);
|
|
1915
|
-
});
|
|
1916
|
-
return Promise.race([e(r.signal), a]).finally(() => clearTimeout(o));
|
|
1917
|
-
}
|
|
1918
|
-
const gn = 1e4, bn = 15e3, vn = 3e4, xn = 3e4, yn = 12e4, Cn = 5 * 6e4, wn = 2 * 60 * 60 * 1e3;
|
|
1919
|
-
function Nn(e) {
|
|
1920
|
-
return e.deadlineAt ? e.deadlineAt.getTime() + Cn : e.startedAt.getTime() + wn;
|
|
1921
|
-
}
|
|
1922
|
-
function Sn(e) {
|
|
1923
|
-
const r = Date.now() - e.getTime();
|
|
1924
|
-
return r < xn ? gn : r < yn ? bn : vn;
|
|
1925
|
-
}
|
|
1926
|
-
function Ys() {
|
|
1927
|
-
const { authToken: e, tokenProps: r } = Be(), o = xe((m) => m.activeExports), [a, n] = F(
|
|
1928
|
-
typeof document < "u" ? !document.hidden : !0
|
|
1929
|
-
), s = ge(null), d = ge(!1), c = ge(void 0), l = r == null ? void 0 : r.apiServiceUrl, u = e == null ? void 0 : e.accessToken, h = j(() => {
|
|
1930
|
-
const m = xe.getState().activeExports;
|
|
1931
|
-
return Array.from(m.values()).filter(
|
|
1932
|
-
(g) => Te(g.status)
|
|
1933
|
-
);
|
|
1934
|
-
}, []);
|
|
1935
|
-
J(() => {
|
|
1936
|
-
if (typeof document > "u") return;
|
|
1937
|
-
const m = () => {
|
|
1938
|
-
n(!document.hidden);
|
|
1939
|
-
};
|
|
1940
|
-
return document.addEventListener("visibilitychange", m), () => {
|
|
1941
|
-
document.removeEventListener("visibilitychange", m);
|
|
1942
|
-
};
|
|
1943
|
-
}, []);
|
|
1944
|
-
const p = j(async () => {
|
|
1945
|
-
if (!l || !u) {
|
|
1946
|
-
d.current = !1;
|
|
1947
|
-
return;
|
|
1948
|
-
}
|
|
1949
|
-
const m = h();
|
|
1950
|
-
if (m.length === 0) {
|
|
1951
|
-
d.current = !1;
|
|
1952
|
-
return;
|
|
1953
|
-
}
|
|
1954
|
-
const g = Date.now(), f = await Promise.allSettled(
|
|
1955
|
-
m.map(async (E) => {
|
|
1956
|
-
try {
|
|
1957
|
-
const N = await ye((w) => Ht(l, u, E.id, w));
|
|
1958
|
-
let y;
|
|
1959
|
-
if (N.status === "completed")
|
|
1960
|
-
try {
|
|
1961
|
-
y = await ye((w) => Xe(l, u, E.id, w));
|
|
1962
|
-
} catch (w) {
|
|
1963
|
-
console.error(
|
|
1964
|
-
`[useExportPolling] Failed to get download URL for ${E.id}:`,
|
|
1965
|
-
w
|
|
1966
|
-
);
|
|
1967
|
-
}
|
|
1968
|
-
return At(N, y);
|
|
1969
|
-
} catch (N) {
|
|
1970
|
-
return console.error(
|
|
1971
|
-
`[useExportPolling] Failed to poll export ${E.id}:`,
|
|
1972
|
-
N
|
|
1973
|
-
), null;
|
|
1974
|
-
}
|
|
1975
|
-
})
|
|
1976
|
-
), { updateExport: b, applyServerStatus: k } = xe.getState().actions, v = (E) => {
|
|
1977
|
-
const N = xe.getState().activeExports.get(E);
|
|
1978
|
-
return !!N && Te(N.status);
|
|
1979
|
-
};
|
|
1980
|
-
m.forEach((E, N) => {
|
|
1981
|
-
if (!v(E.id)) return;
|
|
1982
|
-
const y = f[N], w = y.status === "fulfilled" ? y.value : null;
|
|
1983
|
-
if (g > Nn(E) && !(w && !Te(w.status))) {
|
|
1984
|
-
b(E.id, {
|
|
1985
|
-
status: "failed",
|
|
1986
|
-
error: G.unconfirmed,
|
|
1987
|
-
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
1988
|
-
});
|
|
1989
|
-
return;
|
|
1990
|
-
}
|
|
1991
|
-
w && k(w.id, w);
|
|
1992
|
-
});
|
|
1993
|
-
const D = h();
|
|
1994
|
-
if (D.length > 0 && !document.hidden) {
|
|
1995
|
-
const E = D.reduce(
|
|
1996
|
-
(y, w) => w.startedAt < y ? w.startedAt : y,
|
|
1997
|
-
D[0].startedAt
|
|
1998
|
-
), N = Sn(E);
|
|
1999
|
-
s.current && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
2000
|
-
var y;
|
|
2001
|
-
(y = c.current) == null || y.call(c);
|
|
2002
|
-
}, N);
|
|
2003
|
-
} else
|
|
2004
|
-
d.current = !1;
|
|
2005
|
-
}, [l, u, h]);
|
|
2006
|
-
return J(() => {
|
|
2007
|
-
c.current = p;
|
|
2008
|
-
}, [p]), J(() => {
|
|
2009
|
-
var g;
|
|
2010
|
-
h().length > 0 && a && !d.current && (d.current = !0, (g = c.current) == null || g.call(c));
|
|
2011
|
-
}, [o, a, h]), J(() => {
|
|
2012
|
-
var g;
|
|
2013
|
-
const m = h();
|
|
2014
|
-
a && m.length > 0 && !d.current && (d.current = !0, (g = c.current) == null || g.call(c));
|
|
2015
|
-
}, [a, h]), J(() => {
|
|
2016
|
-
!a && s.current && (clearTimeout(s.current), s.current = null, d.current = !1);
|
|
2017
|
-
}, [a]), J(() => () => {
|
|
2018
|
-
s.current && (clearTimeout(s.current), s.current = null);
|
|
2019
|
-
}, []), {
|
|
2020
|
-
isPolling: d.current,
|
|
2021
|
-
isTabVisible: a,
|
|
2022
|
-
inProgressCount: h().length
|
|
2023
|
-
};
|
|
2024
|
-
}
|
|
2025
|
-
function Js() {
|
|
2026
|
-
const { authToken: e, tokenProps: r } = Be(), o = xe((c) => c.activeExports), { recoverExport: a } = Gt(), n = ge(!1), s = r == null ? void 0 : r.apiServiceUrl, d = e == null ? void 0 : e.accessToken;
|
|
2027
|
-
J(() => {
|
|
2028
|
-
if (n.current || !s || !d) return;
|
|
2029
|
-
(async () => {
|
|
2030
|
-
try {
|
|
2031
|
-
const { exports: l } = await ye((u) => $r(s, d, {
|
|
2032
|
-
status: ["pending", "processing", "chunking", "compacting", "completed", "failed", "cancelled"],
|
|
2033
|
-
limit: 20
|
|
2034
|
-
// Limit to recent exports
|
|
2035
|
-
}, u));
|
|
2036
|
-
for (const u of l) {
|
|
2037
|
-
if (o.has(u.id)) continue;
|
|
2038
|
-
let h;
|
|
2039
|
-
if (u.status === "completed")
|
|
2040
|
-
try {
|
|
2041
|
-
h = await ye((m) => Xe(s, d, u.id, m));
|
|
2042
|
-
} catch (m) {
|
|
2043
|
-
console.error(
|
|
2044
|
-
`[useExportRecovery] Failed to get download URL for ${u.id}:`,
|
|
2045
|
-
m
|
|
2046
|
-
);
|
|
2047
|
-
}
|
|
2048
|
-
const p = {
|
|
2049
|
-
...At(u, h),
|
|
2050
|
-
title: Dn(u),
|
|
2051
|
-
startedAt: new Date(u.createdAt),
|
|
2052
|
-
expiresAt: new Date(u.expiresAt)
|
|
2053
|
-
};
|
|
2054
|
-
a(p);
|
|
2055
|
-
}
|
|
2056
|
-
n.current = !0;
|
|
2057
|
-
} catch (l) {
|
|
2058
|
-
console.error("[useExportRecovery] Failed to recover exports:", l), n.current = !0;
|
|
2059
|
-
}
|
|
2060
|
-
})();
|
|
2061
|
-
}, [s, d, a, o]);
|
|
2062
|
-
}
|
|
2063
|
-
function Dn(e) {
|
|
2064
|
-
return e.title ? e.title : Te(
|
|
2065
|
-
e.status
|
|
2066
|
-
) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
|
|
2067
|
-
}
|
|
2068
|
-
function En(e, r = []) {
|
|
2069
|
-
let o = [];
|
|
2070
|
-
function a(s, d) {
|
|
2071
|
-
const c = ue.createContext(d);
|
|
2072
|
-
c.displayName = s + "Context";
|
|
2073
|
-
const l = o.length;
|
|
2074
|
-
o = [...o, d];
|
|
2075
|
-
const u = (p) => {
|
|
2076
|
-
var v;
|
|
2077
|
-
const { scope: m, children: g, ...f } = p, b = ((v = m == null ? void 0 : m[e]) == null ? void 0 : v[l]) || c, k = ue.useMemo(() => f, Object.values(f));
|
|
2078
|
-
return /* @__PURE__ */ t(b.Provider, { value: k, children: g });
|
|
2079
|
-
};
|
|
2080
|
-
u.displayName = s + "Provider";
|
|
2081
|
-
function h(p, m) {
|
|
2082
|
-
var b;
|
|
2083
|
-
const g = ((b = m == null ? void 0 : m[e]) == null ? void 0 : b[l]) || c, f = ue.useContext(g);
|
|
2084
|
-
if (f) return f;
|
|
2085
|
-
if (d !== void 0) return d;
|
|
2086
|
-
throw new Error(`\`${p}\` must be used within \`${s}\``);
|
|
2087
|
-
}
|
|
2088
|
-
return [u, h];
|
|
2089
|
-
}
|
|
2090
|
-
const n = () => {
|
|
2091
|
-
const s = o.map((d) => ue.createContext(d));
|
|
2092
|
-
return function(c) {
|
|
2093
|
-
const l = (c == null ? void 0 : c[e]) || s;
|
|
2094
|
-
return ue.useMemo(
|
|
2095
|
-
() => ({ [`__scope${e}`]: { ...c, [e]: l } }),
|
|
2096
|
-
[c, l]
|
|
2097
|
-
);
|
|
2098
|
-
};
|
|
2099
|
-
};
|
|
2100
|
-
return n.scopeName = e, [a, kn(n, ...r)];
|
|
2101
|
-
}
|
|
2102
|
-
function kn(...e) {
|
|
2103
|
-
const r = e[0];
|
|
2104
|
-
if (e.length === 1) return r;
|
|
2105
|
-
const o = () => {
|
|
2106
|
-
const a = e.map((n) => ({
|
|
2107
|
-
useScope: n(),
|
|
2108
|
-
scopeName: n.scopeName
|
|
2109
|
-
}));
|
|
2110
|
-
return function(s) {
|
|
2111
|
-
const d = a.reduce((c, { useScope: l, scopeName: u }) => {
|
|
2112
|
-
const p = l(s)[`__scope${u}`];
|
|
2113
|
-
return { ...c, ...p };
|
|
2114
|
-
}, {});
|
|
2115
|
-
return ue.useMemo(() => ({ [`__scope${r.scopeName}`]: d }), [d]);
|
|
2116
|
-
};
|
|
2117
|
-
};
|
|
2118
|
-
return o.scopeName = r.scopeName, o;
|
|
2119
|
-
}
|
|
2120
|
-
var An = [
|
|
2121
|
-
"a",
|
|
2122
|
-
"button",
|
|
2123
|
-
"div",
|
|
2124
|
-
"form",
|
|
2125
|
-
"h2",
|
|
2126
|
-
"h3",
|
|
2127
|
-
"img",
|
|
2128
|
-
"input",
|
|
2129
|
-
"label",
|
|
2130
|
-
"li",
|
|
2131
|
-
"nav",
|
|
2132
|
-
"ol",
|
|
2133
|
-
"p",
|
|
2134
|
-
"select",
|
|
2135
|
-
"span",
|
|
2136
|
-
"svg",
|
|
2137
|
-
"ul"
|
|
2138
|
-
], nr = An.reduce((e, r) => {
|
|
2139
|
-
const o = br(`Primitive.${r}`), a = ue.forwardRef((n, s) => {
|
|
2140
|
-
const { asChild: d, ...c } = n, l = d ? o : r;
|
|
2141
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ t(l, { ...c, ref: s });
|
|
2142
|
-
});
|
|
2143
|
-
return a.displayName = `Primitive.${r}`, { ...e, [r]: a };
|
|
2144
|
-
}, {}), It = "Progress", Ft = 100, [In] = En(It), [Fn, Pn] = In(It), sr = ue.forwardRef(
|
|
2145
|
-
(e, r) => {
|
|
2146
|
-
const {
|
|
2147
|
-
__scopeProgress: o,
|
|
2148
|
-
value: a = null,
|
|
2149
|
-
max: n,
|
|
2150
|
-
getValueLabel: s = Tn,
|
|
2151
|
-
...d
|
|
2152
|
-
} = e;
|
|
2153
|
-
(n || n === 0) && !Rt(n) && console.error(Ln(`${n}`, "Progress"));
|
|
2154
|
-
const c = Rt(n) ? n : Ft;
|
|
2155
|
-
a !== null && !Bt(a, c) && console.error(Un(`${a}`, "Progress"));
|
|
2156
|
-
const l = Bt(a, c) ? a : null, u = Ye(l) ? s(l, c) : void 0;
|
|
2157
|
-
return /* @__PURE__ */ t(Fn, { scope: o, value: l, max: c, children: /* @__PURE__ */ t(
|
|
2158
|
-
nr.div,
|
|
2159
|
-
{
|
|
2160
|
-
"aria-valuemax": c,
|
|
2161
|
-
"aria-valuemin": 0,
|
|
2162
|
-
"aria-valuenow": Ye(l) ? l : void 0,
|
|
2163
|
-
"aria-valuetext": u,
|
|
2164
|
-
role: "progressbar",
|
|
2165
|
-
"data-state": lr(l, c),
|
|
2166
|
-
"data-value": l ?? void 0,
|
|
2167
|
-
"data-max": c,
|
|
2168
|
-
...d,
|
|
2169
|
-
ref: r
|
|
2170
|
-
}
|
|
2171
|
-
) });
|
|
2172
|
-
}
|
|
2173
|
-
);
|
|
2174
|
-
sr.displayName = It;
|
|
2175
|
-
var or = "ProgressIndicator", ir = ue.forwardRef(
|
|
2176
|
-
(e, r) => {
|
|
2177
|
-
const { __scopeProgress: o, ...a } = e, n = Pn(or, o);
|
|
2178
|
-
return /* @__PURE__ */ t(
|
|
2179
|
-
nr.div,
|
|
2180
|
-
{
|
|
2181
|
-
"data-state": lr(n.value, n.max),
|
|
2182
|
-
"data-value": n.value ?? void 0,
|
|
2183
|
-
"data-max": n.max,
|
|
2184
|
-
...a,
|
|
2185
|
-
ref: r
|
|
2186
|
-
}
|
|
2187
|
-
);
|
|
2188
|
-
}
|
|
2189
|
-
);
|
|
2190
|
-
ir.displayName = or;
|
|
2191
|
-
function Tn(e, r) {
|
|
2192
|
-
return `${Math.round(e / r * 100)}%`;
|
|
2193
|
-
}
|
|
2194
|
-
function lr(e, r) {
|
|
2195
|
-
return e == null ? "indeterminate" : e === r ? "complete" : "loading";
|
|
2196
|
-
}
|
|
2197
|
-
function Ye(e) {
|
|
2198
|
-
return typeof e == "number";
|
|
2199
|
-
}
|
|
2200
|
-
function Rt(e) {
|
|
2201
|
-
return Ye(e) && !isNaN(e) && e > 0;
|
|
2202
|
-
}
|
|
2203
|
-
function Bt(e, r) {
|
|
2204
|
-
return Ye(e) && !isNaN(e) && e <= r && e >= 0;
|
|
2205
|
-
}
|
|
2206
|
-
function Ln(e, r) {
|
|
2207
|
-
return `Invalid prop \`max\` of value \`${e}\` supplied to \`${r}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ft}\`.`;
|
|
2208
|
-
}
|
|
2209
|
-
function Un(e, r) {
|
|
2210
|
-
return `Invalid prop \`value\` of value \`${e}\` supplied to \`${r}\`. The \`value\` prop must be:
|
|
2211
|
-
- a positive number
|
|
2212
|
-
- less than the value passed to \`max\` (or ${Ft} if no \`max\` prop is set)
|
|
2213
|
-
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
2214
|
-
|
|
2215
|
-
Defaulting to \`null\`.`;
|
|
2216
|
-
}
|
|
2217
|
-
var cr = sr, Vn = ir;
|
|
2218
|
-
const dr = ue.forwardRef(({ className: e, value: r, ...o }, a) => /* @__PURE__ */ t(
|
|
2219
|
-
cr,
|
|
2220
|
-
{
|
|
2221
|
-
ref: a,
|
|
2222
|
-
className: Z(
|
|
2223
|
-
"relative h-4 w-full overflow-hidden rounded-full bg-secondary",
|
|
2224
|
-
e
|
|
2225
|
-
),
|
|
2226
|
-
...o,
|
|
2227
|
-
children: /* @__PURE__ */ t(
|
|
2228
|
-
Vn,
|
|
2229
|
-
{
|
|
2230
|
-
className: "h-full w-full flex-1 bg-primary transition-all",
|
|
2231
|
-
style: { transform: `translateX(-${100 - (r || 0)}%)` }
|
|
2232
|
-
}
|
|
2233
|
-
)
|
|
2234
|
-
}
|
|
2235
|
-
));
|
|
2236
|
-
dr.displayName = cr.displayName;
|
|
2237
|
-
function Rn({
|
|
2238
|
-
export: e,
|
|
2239
|
-
onRemove: r,
|
|
2240
|
-
onDownload: o
|
|
2241
|
-
}) {
|
|
2242
|
-
const [a, n] = F("idle");
|
|
2243
|
-
J(() => {
|
|
2244
|
-
e.downloadUrl && n("idle");
|
|
2245
|
-
}, [e.downloadUrl]);
|
|
2246
|
-
const s = async () => {
|
|
2247
|
-
if (!o) {
|
|
2248
|
-
e.downloadUrl && window.open(e.downloadUrl, "_blank");
|
|
2249
|
-
return;
|
|
2250
|
-
}
|
|
2251
|
-
n("preparing");
|
|
2252
|
-
const b = await o(e);
|
|
2253
|
-
n(b === "denied" ? "denied" : "idle");
|
|
2254
|
-
}, d = (b) => {
|
|
2255
|
-
b.stopPropagation(), r == null || r(e.id);
|
|
2256
|
-
}, c = Te(e.status), l = e.status === "pending" ? { text: G.queued } : e.status === "compacting" || e.phase === "finalizing" ? { text: G.finalizing } : e.phase === "preparing" ? { text: G.preparing } : e.phase === "acquiring" ? { text: G.fetchingRows(e.rowsProcessed ?? 0) } : {
|
|
2257
|
-
text: G.processing,
|
|
2258
|
-
detail: e.progress !== null ? G.percentComplete(e.progress) : e.rowsProcessed !== void 0 ? G.rowsProcessed(e.rowsProcessed) : void 0,
|
|
2259
|
-
bar: e.progress
|
|
2260
|
-
}, u = c && Date.now() - e.startedAt.getTime() >= zr, h = 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", p = e.status === "completed" ? G.ready : e.status === "failed" ? G.failed : e.status === "cancelled" ? G.cancelled : G.inProgress, m = Ut(e.startedAt, { addSuffix: !0 }), g = [
|
|
2261
|
-
e.status === "completed" && e.totalRows !== null ? `${e.totalRows.toLocaleString()} rows` : null,
|
|
2262
|
-
e.status === "completed" && e.fileSize ? jr(e.fileSize) : null
|
|
2263
|
-
].filter((b) => !!b), f = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
|
|
2264
|
-
return /* @__PURE__ */ i("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: [
|
|
2265
|
-
/* @__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 ${h}` }) }),
|
|
2266
|
-
/* @__PURE__ */ t("span", { className: "sr-only", children: p }),
|
|
2267
|
-
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
2268
|
-
/* @__PURE__ */ i("div", { className: "flex h-5 items-center gap-2", children: [
|
|
2269
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: e.title }),
|
|
2270
|
-
e.status === "completed" && a === "preparing" && /* @__PURE__ */ i("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: [
|
|
2271
|
-
/* @__PURE__ */ t(Qt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }),
|
|
2272
|
-
"Preparing"
|
|
2273
|
-
] }),
|
|
2274
|
-
e.status === "completed" && a !== "preparing" && /* @__PURE__ */ t(
|
|
2275
|
-
"button",
|
|
2276
|
-
{
|
|
2277
|
-
type: "button",
|
|
2278
|
-
onClick: () => void s(),
|
|
2279
|
-
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",
|
|
2280
|
-
children: "Download"
|
|
2281
|
-
}
|
|
2282
|
-
),
|
|
2283
|
-
/* @__PURE__ */ t(
|
|
2284
|
-
U,
|
|
2285
|
-
{
|
|
2286
|
-
variant: "ghost",
|
|
2287
|
-
size: "xs",
|
|
2288
|
-
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",
|
|
2289
|
-
onClick: d,
|
|
2290
|
-
"aria-label": "Remove notification",
|
|
2291
|
-
title: "Remove",
|
|
2292
|
-
children: /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
|
|
2293
|
-
}
|
|
2294
|
-
)
|
|
2295
|
-
] }),
|
|
2296
|
-
e.status === "completed" && /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
2297
|
-
g.length > 0 && // Disclosed on hover or focus only; the time is what a reader scans.
|
|
2298
|
-
/* @__PURE__ */ i("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
|
|
2299
|
-
g.map((b, k) => /* @__PURE__ */ i(_t.Fragment, { children: [
|
|
2300
|
-
k > 0 && f,
|
|
2301
|
-
/* @__PURE__ */ t("span", { children: b })
|
|
2302
|
-
] }, k)),
|
|
2303
|
-
f
|
|
2304
|
-
] }),
|
|
2305
|
-
/* @__PURE__ */ t("span", { children: m })
|
|
2306
|
-
] }),
|
|
2307
|
-
e.status === "completed" && a === "denied" && /* @__PURE__ */ i("div", { role: "alert", className: "mt-1 flex items-start gap-1.5 text-[12px] leading-4 text-foreground", children: [
|
|
2308
|
-
/* @__PURE__ */ t(Wr, { className: "mt-0.5 h-3 w-3 shrink-0 text-destructive", strokeWidth: 1.75 }),
|
|
2309
|
-
/* @__PURE__ */ t("span", { children: G.linkExpired })
|
|
2310
|
-
] }),
|
|
2311
|
-
c && /* @__PURE__ */ i("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
|
|
2312
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: l.text }),
|
|
2313
|
-
l.detail && /* @__PURE__ */ i($, { children: [
|
|
2314
|
-
" ",
|
|
2315
|
-
f,
|
|
2316
|
-
" ",
|
|
2317
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: l.detail })
|
|
2318
|
-
] }),
|
|
2319
|
-
" ",
|
|
2320
|
-
f,
|
|
2321
|
-
" ",
|
|
2322
|
-
/* @__PURE__ */ t("span", { children: G.started(Ut(e.startedAt)) }),
|
|
2323
|
-
l.bar !== void 0 && l.bar !== null && /* @__PURE__ */ t(dr, { value: l.bar, className: "mt-1.5 h-1" }),
|
|
2324
|
-
u && /* @__PURE__ */ t("div", { className: "mt-1", children: G.longRunning })
|
|
2325
|
-
] }),
|
|
2326
|
-
e.status === "cancelled" && /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
2327
|
-
/* @__PURE__ */ t("span", { children: G.cancelled }),
|
|
2328
|
-
f,
|
|
2329
|
-
/* @__PURE__ */ t("span", { children: m })
|
|
2330
|
-
] }),
|
|
2331
|
-
e.status === "failed" && /* @__PURE__ */ i($, { children: [
|
|
2332
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
2333
|
-
/* @__PURE__ */ t("span", { children: G.failed }),
|
|
2334
|
-
f,
|
|
2335
|
-
/* @__PURE__ */ t("span", { children: m })
|
|
2336
|
-
] }),
|
|
2337
|
-
/* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: e.error || G.failedFallback })
|
|
2338
|
-
] })
|
|
2339
|
-
] })
|
|
2340
|
-
] });
|
|
2341
|
-
}
|
|
2342
|
-
function Bn() {
|
|
2343
|
-
const { authToken: e, tokenProps: r } = Be(), o = xe((v) => v.activeExports), { clearCompleted: a, removeExport: n, updateExport: s, applyServerStatus: d } = Gt(), [c, l] = F(!1), [u, h] = F(!1), p = Array.from(o.values()).sort(
|
|
2344
|
-
(v, D) => D.startedAt.getTime() - v.startedAt.getTime()
|
|
2345
|
-
), m = p.some(
|
|
2346
|
-
(v) => v.status === "completed" || v.status === "failed" || v.status === "cancelled"
|
|
2347
|
-
), g = j(async () => {
|
|
2348
|
-
const v = r == null ? void 0 : r.apiServiceUrl, D = e == null ? void 0 : e.accessToken;
|
|
2349
|
-
if (!(!v || !D)) {
|
|
2350
|
-
l(!0);
|
|
2351
|
-
try {
|
|
2352
|
-
const E = Array.from(o.values());
|
|
2353
|
-
await Promise.all(
|
|
2354
|
-
E.map(async (N) => {
|
|
2355
|
-
try {
|
|
2356
|
-
const y = await ye((S) => Ht(v, D, N.id, S));
|
|
2357
|
-
let w;
|
|
2358
|
-
if (y.status === "completed")
|
|
2359
|
-
try {
|
|
2360
|
-
w = await ye((S) => Xe(
|
|
2361
|
-
v,
|
|
2362
|
-
D,
|
|
2363
|
-
N.id,
|
|
2364
|
-
S
|
|
2365
|
-
));
|
|
2366
|
-
} catch (S) {
|
|
2367
|
-
console.error(`Failed to get download URL for ${N.id}:`, S);
|
|
2368
|
-
}
|
|
2369
|
-
d(N.id, At(y, w));
|
|
2370
|
-
} catch (y) {
|
|
2371
|
-
s(N.id, { downloadUrl: void 0 }), console.error(`Failed to refresh export ${N.id}:`, y);
|
|
2372
|
-
}
|
|
2373
|
-
})
|
|
2374
|
-
);
|
|
2375
|
-
} finally {
|
|
2376
|
-
l(!1);
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
}, [
|
|
2380
|
-
o,
|
|
2381
|
-
e == null ? void 0 : e.accessToken,
|
|
2382
|
-
r == null ? void 0 : r.apiServiceUrl,
|
|
2383
|
-
s,
|
|
2384
|
-
d
|
|
2385
|
-
]), f = j(async () => {
|
|
2386
|
-
const v = r == null ? void 0 : r.apiServiceUrl, D = e == null ? void 0 : e.accessToken;
|
|
2387
|
-
if (!v || !D) {
|
|
2388
|
-
a();
|
|
2389
|
-
return;
|
|
2390
|
-
}
|
|
2391
|
-
h(!0);
|
|
2392
|
-
try {
|
|
2393
|
-
const E = p.filter(
|
|
2394
|
-
(y) => y.status === "completed" || y.status === "failed" || y.status === "cancelled"
|
|
2395
|
-
), N = await Promise.allSettled(
|
|
2396
|
-
E.map(async (y) => (await Tt(v, D, y.id), y.id))
|
|
2397
|
-
);
|
|
2398
|
-
for (const y of N)
|
|
2399
|
-
y.status === "fulfilled" ? n(y.value) : console.error("Failed to delete export:", y.reason);
|
|
2400
|
-
} finally {
|
|
2401
|
-
h(!1);
|
|
2402
|
-
}
|
|
2403
|
-
}, [
|
|
2404
|
-
p,
|
|
2405
|
-
r == null ? void 0 : r.apiServiceUrl,
|
|
2406
|
-
e == null ? void 0 : e.accessToken,
|
|
2407
|
-
a,
|
|
2408
|
-
n
|
|
2409
|
-
]), b = j(
|
|
2410
|
-
async (v) => {
|
|
2411
|
-
const D = r == null ? void 0 : r.apiServiceUrl, E = e == null ? void 0 : e.accessToken;
|
|
2412
|
-
if (D && E)
|
|
2413
|
-
try {
|
|
2414
|
-
await Tt(D, E, v), n(v);
|
|
2415
|
-
return;
|
|
2416
|
-
} catch (N) {
|
|
2417
|
-
console.error(`Failed to cancel export ${v}:`, N);
|
|
2418
|
-
}
|
|
2419
|
-
n(v);
|
|
2420
|
-
},
|
|
2421
|
-
[r == null ? void 0 : r.apiServiceUrl, e == null ? void 0 : e.accessToken, n]
|
|
2422
|
-
), k = j(
|
|
2423
|
-
async (v) => {
|
|
2424
|
-
if (v.downloadUrl)
|
|
2425
|
-
return window.open(v.downloadUrl, "_blank"), "opened";
|
|
2426
|
-
const D = r == null ? void 0 : r.apiServiceUrl, E = e == null ? void 0 : e.accessToken;
|
|
2427
|
-
if (!D || !E) return "denied";
|
|
2428
|
-
try {
|
|
2429
|
-
const N = await ye((y) => Xe(D, E, v.id, y));
|
|
2430
|
-
return s(v.id, { downloadUrl: N }), window.open(N, "_blank"), "opened";
|
|
2431
|
-
} catch (N) {
|
|
2432
|
-
return console.error(`Failed to get download URL for ${v.id}:`, N), s(v.id, { downloadUrl: void 0 }), "denied";
|
|
2433
|
-
}
|
|
2434
|
-
},
|
|
2435
|
-
[r == null ? void 0 : r.apiServiceUrl, e == null ? void 0 : e.accessToken, s]
|
|
2436
|
-
);
|
|
2437
|
-
return p.length === 0 ? /* @__PURE__ */ i("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
|
|
2438
|
-
/* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(qa, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
2439
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: "No exports yet" }),
|
|
2440
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Large exports run in the background and land here." })
|
|
2441
|
-
] }) : /* @__PURE__ */ i("div", { className: "flex flex-col", children: [
|
|
2442
|
-
/* @__PURE__ */ i("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
|
|
2443
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Exports" }),
|
|
2444
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: p.length }),
|
|
2445
|
-
/* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2446
|
-
m && /* @__PURE__ */ t(
|
|
2447
|
-
U,
|
|
2448
|
-
{
|
|
2449
|
-
variant: "ghost",
|
|
2450
|
-
size: "xs",
|
|
2451
|
-
className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
|
|
2452
|
-
onClick: f,
|
|
2453
|
-
disabled: u,
|
|
2454
|
-
children: u ? "Clearing" : "Clear all"
|
|
2455
|
-
}
|
|
2456
|
-
),
|
|
2457
|
-
/* @__PURE__ */ t(
|
|
2458
|
-
U,
|
|
2459
|
-
{
|
|
2460
|
-
variant: "ghost",
|
|
2461
|
-
size: "xs",
|
|
2462
|
-
className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
|
|
2463
|
-
onClick: g,
|
|
2464
|
-
disabled: c,
|
|
2465
|
-
title: "Refresh status",
|
|
2466
|
-
"aria-label": "Refresh status",
|
|
2467
|
-
children: /* @__PURE__ */ t(
|
|
2468
|
-
Qt,
|
|
2469
|
-
{
|
|
2470
|
-
strokeWidth: 1.75,
|
|
2471
|
-
className: `h-3.5 w-3.5 ${c ? "animate-spin" : ""}`
|
|
2472
|
-
}
|
|
2473
|
-
)
|
|
2474
|
-
}
|
|
2475
|
-
)
|
|
2476
|
-
] })
|
|
2477
|
-
] }),
|
|
2478
|
-
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y divide-border/70", children: p.map((v) => /* @__PURE__ */ t(
|
|
2479
|
-
Rn,
|
|
2480
|
-
{
|
|
2481
|
-
export: v,
|
|
2482
|
-
onRemove: b,
|
|
2483
|
-
onDownload: k
|
|
2484
|
-
},
|
|
2485
|
-
v.id
|
|
2486
|
-
)) }) })
|
|
2487
|
-
] });
|
|
2488
|
-
}
|
|
2489
|
-
function eo({
|
|
2490
|
-
variant: e
|
|
2491
|
-
}) {
|
|
2492
|
-
const r = xe((l) => l.activeExports), o = qr(), a = r.size > 0, n = Array.from(r.values()).some(
|
|
2493
|
-
(l) => l.status === "completed" || l.status === "failed"
|
|
2494
|
-
), d = o > 0 ? o > 9 ? "9+" : String(o) : null;
|
|
2495
|
-
return /* @__PURE__ */ i(qe, { children: [
|
|
2496
|
-
/* @__PURE__ */ t(He, { asChild: !0, children: /* @__PURE__ */ i(
|
|
2497
|
-
U,
|
|
2498
|
-
{
|
|
2499
|
-
variant: e ?? "ghost",
|
|
2500
|
-
size: "xs",
|
|
2501
|
-
className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
2502
|
-
"aria-label": "Export notifications",
|
|
2503
|
-
children: [
|
|
2504
|
-
/* @__PURE__ */ t(Hr, { className: "h-3.5 w-3.5" }),
|
|
2505
|
-
a && /* @__PURE__ */ t(
|
|
2506
|
-
"span",
|
|
2507
|
-
{
|
|
2508
|
-
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${d ? "-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"}`,
|
|
2509
|
-
children: d
|
|
2510
|
-
}
|
|
2511
|
-
)
|
|
2512
|
-
]
|
|
2513
|
-
}
|
|
2514
|
-
) }),
|
|
2515
|
-
/* @__PURE__ */ t(Ge, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(Bn, {}) })
|
|
2516
|
-
] });
|
|
2517
|
-
}
|
|
2518
|
-
function Mn(e) {
|
|
2519
|
-
if (e)
|
|
2520
|
-
return {
|
|
2521
|
-
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
2522
|
-
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
2523
|
-
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
2524
|
-
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
2525
|
-
};
|
|
2526
|
-
}
|
|
2527
|
-
function _n({
|
|
2528
|
-
open: e,
|
|
2529
|
-
onOpenChange: r,
|
|
2530
|
-
trigger: o,
|
|
2531
|
-
showTrigger: a = !0,
|
|
2532
|
-
initialMode: n = "manage"
|
|
2533
|
-
}) {
|
|
2534
|
-
const s = n === "create", {
|
|
2535
|
-
forceClose: d,
|
|
2536
|
-
handleOpenChange: c,
|
|
2537
|
-
isCreateFlowActive: l,
|
|
2538
|
-
preventPassiveDismissDuringCreate: u,
|
|
2539
|
-
resolvedOpen: h,
|
|
2540
|
-
setIsCreateFlowActive: p
|
|
2541
|
-
} = Jt({
|
|
2542
|
-
open: e,
|
|
2543
|
-
onOpenChange: r,
|
|
2544
|
-
initialCreateFlowActive: n === "create",
|
|
2545
|
-
// Dialog mode renders a built-in X close button — allow explicit
|
|
2546
|
-
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
2547
|
-
// only close-via-trigger path is a re-click that would silently
|
|
2548
|
-
// wipe the in-progress create flow, so block everything during
|
|
2549
|
-
// create and make consumers use `forceClose()` from a dedicated
|
|
2550
|
-
// button.
|
|
2551
|
-
dismissMode: a ? "passive" : "explicit-only"
|
|
2552
|
-
}), m = T((x) => x.dashboard), { setDashboardControlsModel: g } = pe(), { participants: f } = Gr(La(m)), b = Array.from(
|
|
2553
|
-
new Map(
|
|
2554
|
-
f.flatMap(
|
|
2555
|
-
(x) => x.fieldChoices.map((B) => {
|
|
2556
|
-
var I;
|
|
2557
|
-
return [
|
|
2558
|
-
B.value,
|
|
2559
|
-
{
|
|
2560
|
-
option: B,
|
|
2561
|
-
target: (I = x.fieldTargetMap) == null ? void 0 : I[B.value]
|
|
2562
|
-
}
|
|
2563
|
-
];
|
|
2564
|
-
})
|
|
2565
|
-
)
|
|
2566
|
-
).values()
|
|
2567
|
-
), k = Array.from(
|
|
2568
|
-
new Map(
|
|
2569
|
-
f.flatMap(
|
|
2570
|
-
(x) => x.metricChoices.map((B) => {
|
|
2571
|
-
var I;
|
|
2572
|
-
return [
|
|
2573
|
-
B.value,
|
|
2574
|
-
{
|
|
2575
|
-
option: B,
|
|
2576
|
-
target: (I = x.metricTargetMap) == null ? void 0 : I[B.value]
|
|
2577
|
-
}
|
|
2578
|
-
];
|
|
2579
|
-
})
|
|
2580
|
-
)
|
|
2581
|
-
).values()
|
|
2582
|
-
), v = Ea({
|
|
2583
|
-
...m || {},
|
|
2584
|
-
controls: []
|
|
2585
|
-
}), D = Qr(m), E = (x, B, I) => {
|
|
2586
|
-
g(
|
|
2587
|
-
x,
|
|
2588
|
-
B,
|
|
2589
|
-
Mn(I)
|
|
2590
|
-
);
|
|
2591
|
-
}, N = j(() => {
|
|
2592
|
-
if (s) {
|
|
2593
|
-
d();
|
|
2594
|
-
return;
|
|
2595
|
-
}
|
|
2596
|
-
p(!1);
|
|
2597
|
-
}, [s, d, p]), y = /* @__PURE__ */ t(
|
|
2598
|
-
er,
|
|
2599
|
-
{
|
|
2600
|
-
scope: "dashboard",
|
|
2601
|
-
controls: m.controls || [],
|
|
2602
|
-
reservedControlIds: v,
|
|
2603
|
-
defaultValues: m.defaultControlValues || {},
|
|
2604
|
-
usageByControlId: Kr(m),
|
|
2605
|
-
availableFieldChoices: b,
|
|
2606
|
-
availableMetricChoices: k,
|
|
2607
|
-
structuralParticipants: f,
|
|
2608
|
-
structuralParticipantIdsByControlId: D,
|
|
2609
|
-
initialCreateFlow: n === "create",
|
|
2610
|
-
onCreateFlowActiveChange: p,
|
|
2611
|
-
onCreateFlowComplete: N,
|
|
2612
|
-
onChange: E,
|
|
2613
|
-
emptyMessage: "No dashboard controls yet."
|
|
2614
|
-
}
|
|
2615
|
-
), w = l ? "Add dashboard control" : "Dashboard Controls", S = /* @__PURE__ */ i($, { children: [
|
|
2616
|
-
/* @__PURE__ */ i("div", { className: "space-y-1", children: [
|
|
2617
|
-
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
2618
|
-
/* @__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." })
|
|
2619
|
-
] }),
|
|
2620
|
-
y
|
|
2621
|
-
] });
|
|
2622
|
-
return a ? /* @__PURE__ */ i(qe, { open: h, onOpenChange: c, children: [
|
|
2623
|
-
/* @__PURE__ */ t(He, { asChild: !0, children: o || /* @__PURE__ */ i(U, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
2624
|
-
/* @__PURE__ */ t($t, { className: "mr-2 h-4 w-4" }),
|
|
2625
|
-
"Controls"
|
|
2626
|
-
] }) }),
|
|
2627
|
-
/* @__PURE__ */ t(
|
|
2628
|
-
Ge,
|
|
2629
|
-
{
|
|
2630
|
-
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
2631
|
-
align: "end",
|
|
2632
|
-
onEscapeKeyDown: u,
|
|
2633
|
-
onPointerDownOutside: u,
|
|
2634
|
-
children: S
|
|
2635
|
-
}
|
|
2636
|
-
)
|
|
2637
|
-
] }) : /* @__PURE__ */ t(Ue, { open: h, onOpenChange: c, children: /* @__PURE__ */ i(
|
|
2638
|
-
Ve,
|
|
2639
|
-
{
|
|
2640
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2641
|
-
onEscapeKeyDown: u,
|
|
2642
|
-
onPointerDownOutside: u,
|
|
2643
|
-
children: [
|
|
2644
|
-
/* @__PURE__ */ i(
|
|
2645
|
-
wt,
|
|
2646
|
-
{
|
|
2647
|
-
className: l ? "space-y-0" : void 0,
|
|
2648
|
-
children: [
|
|
2649
|
-
/* @__PURE__ */ t(Re, { className: "text-[15px]", children: w }),
|
|
2650
|
-
/* @__PURE__ */ t(
|
|
2651
|
-
Nt,
|
|
2652
|
-
{
|
|
2653
|
-
className: l ? "sr-only" : "text-[13px]",
|
|
2654
|
-
children: l ? "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."
|
|
2655
|
-
}
|
|
2656
|
-
)
|
|
2657
|
-
]
|
|
2658
|
-
}
|
|
2659
|
-
),
|
|
2660
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: y })
|
|
2661
|
-
]
|
|
2662
|
-
}
|
|
2663
|
-
) });
|
|
2664
|
-
}
|
|
2665
|
-
const On = [
|
|
2666
|
-
"enum",
|
|
2667
|
-
"multi_enum",
|
|
2668
|
-
"text",
|
|
2669
|
-
"number",
|
|
2670
|
-
"boolean",
|
|
2671
|
-
"date"
|
|
2672
|
-
];
|
|
2673
|
-
function $n({
|
|
2674
|
-
open: e,
|
|
2675
|
-
onOpenChange: r,
|
|
2676
|
-
initialMode: o = "manage"
|
|
2677
|
-
}) {
|
|
2678
|
-
var S;
|
|
2679
|
-
const a = o === "create", {
|
|
2680
|
-
forceClose: n,
|
|
2681
|
-
handleOpenChange: s,
|
|
2682
|
-
isCreateFlowActive: d,
|
|
2683
|
-
preventPassiveDismissDuringCreate: c,
|
|
2684
|
-
resolvedOpen: l,
|
|
2685
|
-
setIsCreateFlowActive: u
|
|
2686
|
-
} = Jt({
|
|
2687
|
-
open: e,
|
|
2688
|
-
onOpenChange: r,
|
|
2689
|
-
initialCreateFlowActive: o === "create",
|
|
2690
|
-
dismissMode: "explicit-only"
|
|
2691
|
-
}), h = T((x) => x.dashboard), p = T((x) => x.selectedSheetId), { setDashboardInputs: m } = pe(), g = (S = h.sheets) == null ? void 0 : S.find(
|
|
2692
|
-
(x) => x.id === p
|
|
2693
|
-
), f = (g == null ? void 0 : g.kind) === "document" && !!g.document, b = oe(
|
|
2694
|
-
() => f && (g != null && g.document) ? ka(h, g.id) : [],
|
|
2695
|
-
[h, f, g == null ? void 0 : g.document, g == null ? void 0 : g.id]
|
|
2696
|
-
), k = oe(
|
|
2697
|
-
() => b.filter(
|
|
2698
|
-
(x) => x.kind === "control"
|
|
2699
|
-
),
|
|
2700
|
-
[b]
|
|
2701
|
-
), v = oe(
|
|
2702
|
-
() => k.map((x) => x.control),
|
|
2703
|
-
[k]
|
|
2704
|
-
), D = oe(
|
|
2705
|
-
() => jn(v),
|
|
2706
|
-
[v]
|
|
2707
|
-
), E = oe(
|
|
2708
|
-
() => zn(h),
|
|
2709
|
-
[h]
|
|
2710
|
-
), N = j(() => {
|
|
2711
|
-
if (a) {
|
|
2712
|
-
n();
|
|
2713
|
-
return;
|
|
2714
|
-
}
|
|
2715
|
-
u(!1);
|
|
2716
|
-
}, [a, n, u]), y = j(
|
|
2717
|
-
(x, B, I) => {
|
|
2718
|
-
!f || !(g != null && g.document) || m(
|
|
2719
|
-
qn({
|
|
2720
|
-
allInputs: h.inputs || [],
|
|
2721
|
-
documentSheetId: g.id,
|
|
2722
|
-
currentDocumentInputs: b,
|
|
2723
|
-
nextControls: x,
|
|
2724
|
-
nextDefaultValues: B,
|
|
2725
|
-
change: I
|
|
2726
|
-
})
|
|
2727
|
-
);
|
|
2728
|
-
},
|
|
2729
|
-
[
|
|
2730
|
-
h.inputs,
|
|
2731
|
-
b,
|
|
2732
|
-
f,
|
|
2733
|
-
g,
|
|
2734
|
-
m
|
|
2735
|
-
]
|
|
2736
|
-
);
|
|
2737
|
-
return !f || !(g != null && g.document) ? null : /* @__PURE__ */ t(Ue, { open: l, onOpenChange: s, children: /* @__PURE__ */ i(
|
|
2738
|
-
Ve,
|
|
2739
|
-
{
|
|
2740
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2741
|
-
onEscapeKeyDown: c,
|
|
2742
|
-
onPointerDownOutside: c,
|
|
2743
|
-
children: [
|
|
2744
|
-
/* @__PURE__ */ i(wt, { className: d ? "space-y-0" : void 0, children: [
|
|
2745
|
-
/* @__PURE__ */ t(Re, { className: "text-[15px]", children: d ? "Add document control" : "Document Controls" }),
|
|
2746
|
-
/* @__PURE__ */ t(
|
|
2747
|
-
Nt,
|
|
2748
|
-
{
|
|
2749
|
-
className: d ? "sr-only" : "text-[13px]",
|
|
2750
|
-
children: d ? "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."
|
|
2751
|
-
}
|
|
2752
|
-
)
|
|
2753
|
-
] }),
|
|
2754
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ t(
|
|
2755
|
-
er,
|
|
2756
|
-
{
|
|
2757
|
-
scope: "dashboard",
|
|
2758
|
-
controls: v,
|
|
2759
|
-
reservedControlIds: E,
|
|
2760
|
-
defaultValues: D,
|
|
2761
|
-
usageByControlId: {},
|
|
2762
|
-
availableFieldChoices: [],
|
|
2763
|
-
availableMetricChoices: [],
|
|
2764
|
-
structuralParticipants: [],
|
|
2765
|
-
structuralParticipantIdsByControlId: {},
|
|
2766
|
-
allowedControlTypes: On,
|
|
2767
|
-
initialCreateFlow: o === "create",
|
|
2768
|
-
onCreateFlowActiveChange: u,
|
|
2769
|
-
onCreateFlowComplete: N,
|
|
2770
|
-
onChange: y,
|
|
2771
|
-
emptyMessage: "No document controls yet."
|
|
2772
|
-
}
|
|
2773
|
-
) })
|
|
2774
|
-
]
|
|
2775
|
-
}
|
|
2776
|
-
) });
|
|
2777
|
-
}
|
|
2778
|
-
function zn(e) {
|
|
2779
|
-
return (e.controls || []).map((r) => r.id);
|
|
2780
|
-
}
|
|
2781
|
-
function jn(e) {
|
|
2782
|
-
const r = {};
|
|
2783
|
-
for (const o of e)
|
|
2784
|
-
o.defaultValue !== void 0 && (r[o.id] = o.defaultValue);
|
|
2785
|
-
return r;
|
|
2786
|
-
}
|
|
2787
|
-
function Wn(e, r) {
|
|
2788
|
-
return r ? Object.prototype.hasOwnProperty.call(r, e.id) ? {
|
|
2789
|
-
...e,
|
|
2790
|
-
defaultValue: r[e.id]
|
|
2791
|
-
} : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
|
|
2792
|
-
}
|
|
2793
|
-
function qn({
|
|
2794
|
-
allInputs: e,
|
|
2795
|
-
documentSheetId: r,
|
|
2796
|
-
currentDocumentInputs: o,
|
|
2797
|
-
nextControls: a,
|
|
2798
|
-
nextDefaultValues: n,
|
|
2799
|
-
change: s
|
|
2800
|
-
}) {
|
|
2801
|
-
const d = new Map(
|
|
2802
|
-
a.map((m) => [
|
|
2803
|
-
m.id,
|
|
2804
|
-
Wn(m, n)
|
|
2805
|
-
])
|
|
2806
|
-
), c = (s == null ? void 0 : s.type) === "rename" ? { oldId: s.oldId, newId: s.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
|
|
2807
|
-
for (const m of o) {
|
|
2808
|
-
if (m.kind !== "control") {
|
|
2809
|
-
u.push(m);
|
|
2810
|
-
continue;
|
|
2811
|
-
}
|
|
2812
|
-
const g = d.get(m.control.id) || ((c == null ? void 0 : c.oldId) === m.control.id ? d.get(c.newId) : void 0);
|
|
2813
|
-
if (!g)
|
|
2814
|
-
continue;
|
|
2815
|
-
l.add(g.id);
|
|
2816
|
-
const f = Aa(
|
|
2817
|
-
g.id,
|
|
2818
|
-
[...e, ...u].filter(
|
|
2819
|
-
(k) => k.id !== m.id
|
|
2820
|
-
)
|
|
2821
|
-
), b = g.id === f ? g : { ...g, id: f };
|
|
2822
|
-
u.push({
|
|
2823
|
-
...m,
|
|
2824
|
-
label: b.label,
|
|
2825
|
-
variableName: f,
|
|
2826
|
-
requiredAtExecution: b.requiredAtExecution,
|
|
2827
|
-
control: b
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
for (const m of d.values())
|
|
2831
|
-
l.has(m.id) || u.push(
|
|
2832
|
-
Ia({
|
|
2833
|
-
control: m,
|
|
2834
|
-
existingInputs: [...e, ...u],
|
|
2835
|
-
sheetId: r
|
|
2836
|
-
})
|
|
2837
|
-
);
|
|
2838
|
-
const h = new Set(
|
|
2839
|
-
o.map((m) => m.id)
|
|
2840
|
-
);
|
|
2841
|
-
return [...e.filter(
|
|
2842
|
-
(m) => !h.has(m.id)
|
|
2843
|
-
), ...u];
|
|
2844
|
-
}
|
|
2845
|
-
function Hn({
|
|
2846
|
-
showFilters: e,
|
|
2847
|
-
onShowFiltersChange: r,
|
|
2848
|
-
pickerContent: o,
|
|
2849
|
-
settingsContent: a,
|
|
2850
|
-
size: n = "default",
|
|
2851
|
-
className: s,
|
|
2852
|
-
primaryButtonClassName: d,
|
|
2853
|
-
secondaryButtonClassName: c,
|
|
2854
|
-
pickerContentClassName: l,
|
|
2855
|
-
settingsContentClassName: u
|
|
2856
|
-
}) {
|
|
2857
|
-
const h = n === "toolbar", [p, m] = F(!1), g = ht("interactive");
|
|
2858
|
-
return /* @__PURE__ */ i(
|
|
2859
|
-
"div",
|
|
2860
|
-
{
|
|
2861
|
-
className: Z(
|
|
2862
|
-
// Height lives on the shell so the outer border is part of the
|
|
2863
|
-
// h-7 box (matches regular `size="xs"` buttons). Inner triggers
|
|
2864
|
-
// stretch to fill via `h-full`.
|
|
2865
|
-
"relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
|
|
2866
|
-
h ? "h-8" : "h-7",
|
|
2867
|
-
s
|
|
2868
|
-
),
|
|
2869
|
-
children: [
|
|
2870
|
-
/* @__PURE__ */ i(qe, { open: e, onOpenChange: r, children: [
|
|
2871
|
-
/* @__PURE__ */ t(He, { asChild: !0, children: /* @__PURE__ */ i(
|
|
2872
|
-
U,
|
|
2873
|
-
{
|
|
2874
|
-
variant: "ghost",
|
|
2875
|
-
size: "xs",
|
|
2876
|
-
className: Z(
|
|
2877
|
-
"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",
|
|
2878
|
-
d
|
|
2879
|
-
),
|
|
2880
|
-
children: [
|
|
2881
|
-
e ? /* @__PURE__ */ t(Ba, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Kt, { className: "h-3.5 w-3.5" }),
|
|
2882
|
-
"Filter"
|
|
2883
|
-
]
|
|
2884
|
-
}
|
|
2885
|
-
) }),
|
|
2886
|
-
/* @__PURE__ */ t(
|
|
2887
|
-
Ge,
|
|
2888
|
-
{
|
|
2889
|
-
align: "end",
|
|
2890
|
-
sideOffset: 6,
|
|
2891
|
-
className: Z(
|
|
2892
|
-
"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)]",
|
|
2893
|
-
l
|
|
2894
|
-
),
|
|
2895
|
-
style: g.contentStyle,
|
|
2896
|
-
children: o
|
|
2897
|
-
}
|
|
2898
|
-
)
|
|
2899
|
-
] }),
|
|
2900
|
-
/* @__PURE__ */ i(qe, { open: p, onOpenChange: m, children: [
|
|
2901
|
-
/* @__PURE__ */ t(He, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2902
|
-
U,
|
|
2903
|
-
{
|
|
2904
|
-
variant: "ghost",
|
|
2905
|
-
size: "xs",
|
|
2906
|
-
className: Z(
|
|
2907
|
-
"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",
|
|
2908
|
-
c
|
|
2909
|
-
),
|
|
2910
|
-
"aria-label": "Filter and control actions",
|
|
2911
|
-
children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
|
|
2912
|
-
}
|
|
2913
|
-
) }),
|
|
2914
|
-
/* @__PURE__ */ t(
|
|
2915
|
-
Ge,
|
|
2916
|
-
{
|
|
2917
|
-
align: "end",
|
|
2918
|
-
sideOffset: 6,
|
|
2919
|
-
className: Z(
|
|
2920
|
-
"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)]",
|
|
2921
|
-
u
|
|
2922
|
-
),
|
|
2923
|
-
style: g.contentStyle,
|
|
2924
|
-
children: a(() => m(!1))
|
|
2925
|
-
}
|
|
2926
|
-
)
|
|
2927
|
-
] })
|
|
2928
|
-
]
|
|
2929
|
-
}
|
|
2930
|
-
);
|
|
2931
|
-
}
|
|
2932
|
-
function Gn() {
|
|
2933
|
-
Ma();
|
|
2934
|
-
const e = T((l) => l.selectedSheetId), r = T((l) => l.selectedFrameId), o = T((l) => l.dashboard), a = T((l) => l.actions.getSelectedFrame), { setSelectedFrameId: n } = pe(), { setCard: s } = tt(), d = ee((l) => l.card.dataSource);
|
|
2935
|
-
return J(() => {
|
|
2936
|
-
var u, h;
|
|
2937
|
-
let l = a();
|
|
2938
|
-
if (!l) {
|
|
2939
|
-
const p = (u = o == null ? void 0 : o.sheets) == null ? void 0 : u.find((g) => g.id === e), m = (h = p == null ? void 0 : p.frames) == null ? void 0 : h[0];
|
|
2940
|
-
m && (n(m.id), l = m);
|
|
2941
|
-
}
|
|
2942
|
-
if (l) {
|
|
2943
|
-
const p = l.cards.find((m) => m.id === l.activeCardId);
|
|
2944
|
-
p && s(p);
|
|
2945
|
-
}
|
|
2946
|
-
}, [a, e, r, o, n, s]), {
|
|
2947
|
-
hasEntities: !!(d != null && d.selectedEntities && d.selectedEntities.length > 0)
|
|
2948
|
-
};
|
|
2949
|
-
}
|
|
2950
|
-
function Qn() {
|
|
2951
|
-
const e = T((l) => l.dashboard), r = T(
|
|
2952
|
-
(l) => l.semanticExecutionPayload
|
|
2953
|
-
), o = T((l) => l.actions.addFilter), { hasEntities: a } = Gn(), { isLoading: n } = Xr(), s = oe(
|
|
2954
|
-
() => Fa(e, r),
|
|
2955
|
-
[e, r]
|
|
2956
|
-
), c = !Pa(e.filters) && s.hasEligibleCards && !n;
|
|
2957
|
-
return /* @__PURE__ */ i("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
|
|
2958
|
-
c && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ i(
|
|
2959
|
-
"button",
|
|
2960
|
-
{
|
|
2961
|
-
type: "button",
|
|
2962
|
-
onClick: () => o(Ta()),
|
|
2963
|
-
title: `Applies to ${s.eligibleCardCount} of ${s.totalCardCount} date-aware cards`,
|
|
2964
|
-
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",
|
|
2965
|
-
children: [
|
|
2966
|
-
/* @__PURE__ */ t(ja, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2967
|
-
/* @__PURE__ */ i("span", { className: "flex min-w-0 flex-col", children: [
|
|
2968
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
|
|
2969
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
|
|
2970
|
-
] })
|
|
2971
|
-
]
|
|
2972
|
-
}
|
|
2973
|
-
) }),
|
|
2974
|
-
!a && /* @__PURE__ */ i("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
|
|
2975
|
-
/* @__PURE__ */ t(Zr, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
|
|
2976
|
-
/* @__PURE__ */ t("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
|
|
2977
|
-
/* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
|
|
2978
|
-
] }),
|
|
2979
|
-
a && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(Yr, { context: "filter" }) })
|
|
2980
|
-
] });
|
|
2981
|
-
}
|
|
2982
|
-
const Mt = !1;
|
|
2983
|
-
function Kn({
|
|
2984
|
-
onAddFilter: e,
|
|
2985
|
-
onAddControl: r,
|
|
2986
|
-
onManageControls: o,
|
|
2987
|
-
onDismiss: a
|
|
2988
|
-
}) {
|
|
2989
|
-
const n = T(
|
|
2990
|
-
(c) => c.dashboard.filterLayout
|
|
2991
|
-
), { setFilterLayout: s } = pe();
|
|
2992
|
-
n != null && n.displayMode;
|
|
2993
|
-
const d = (n == null ? void 0 : n.toolbarWrap) ?? !1;
|
|
2994
|
-
return n == null || n.showDownloadButton, /* @__PURE__ */ i("div", { className: "w-[300px]", children: [
|
|
2995
|
-
/* @__PURE__ */ i("div", { className: "p-1", children: [
|
|
2996
|
-
/* @__PURE__ */ t(
|
|
2997
|
-
ct,
|
|
2998
|
-
{
|
|
2999
|
-
icon: Kt,
|
|
3000
|
-
label: "Add filter",
|
|
3001
|
-
onClick: () => {
|
|
3002
|
-
e(), a();
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
),
|
|
3006
|
-
/* @__PURE__ */ t(
|
|
3007
|
-
ct,
|
|
3008
|
-
{
|
|
3009
|
-
icon: $t,
|
|
3010
|
-
label: "Add control",
|
|
3011
|
-
onClick: () => {
|
|
3012
|
-
r(), a();
|
|
3013
|
-
}
|
|
3014
|
-
}
|
|
3015
|
-
),
|
|
3016
|
-
/* @__PURE__ */ t(
|
|
3017
|
-
ct,
|
|
3018
|
-
{
|
|
3019
|
-
icon: Xt,
|
|
3020
|
-
label: "Manage controls",
|
|
3021
|
-
onClick: () => {
|
|
3022
|
-
o(), a();
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
)
|
|
3026
|
-
] }),
|
|
3027
|
-
/* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
|
|
3028
|
-
/* @__PURE__ */ i("div", { className: "space-y-1 p-2", children: [
|
|
3029
|
-
/* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
|
|
3030
|
-
Mt,
|
|
3031
|
-
/* @__PURE__ */ t(
|
|
3032
|
-
Xn,
|
|
3033
|
-
{
|
|
3034
|
-
id: "filter-display-wrap",
|
|
3035
|
-
label: "Wrap to multiple lines",
|
|
3036
|
-
checked: d,
|
|
3037
|
-
onCheckedChange: (c) => s({ toolbarWrap: c === !0 })
|
|
3038
|
-
}
|
|
3039
|
-
),
|
|
3040
|
-
Mt
|
|
3041
|
-
] })
|
|
3042
|
-
] });
|
|
3043
|
-
}
|
|
3044
|
-
function ct({
|
|
3045
|
-
icon: e,
|
|
3046
|
-
label: r,
|
|
3047
|
-
onClick: o
|
|
3048
|
-
}) {
|
|
3049
|
-
return /* @__PURE__ */ i(
|
|
3050
|
-
"button",
|
|
3051
|
-
{
|
|
3052
|
-
type: "button",
|
|
3053
|
-
onClick: o,
|
|
3054
|
-
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",
|
|
3055
|
-
children: [
|
|
3056
|
-
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3057
|
-
r
|
|
3058
|
-
]
|
|
3059
|
-
}
|
|
3060
|
-
);
|
|
3061
|
-
}
|
|
3062
|
-
function Xn({
|
|
3063
|
-
id: e,
|
|
3064
|
-
label: r,
|
|
3065
|
-
checked: o,
|
|
3066
|
-
onCheckedChange: a
|
|
3067
|
-
}) {
|
|
3068
|
-
return /* @__PURE__ */ i("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: [
|
|
3069
|
-
/* @__PURE__ */ t(Ct, { id: e, checked: o, onCheckedChange: a }),
|
|
3070
|
-
/* @__PURE__ */ t(
|
|
3071
|
-
Le,
|
|
3072
|
-
{
|
|
3073
|
-
htmlFor: e,
|
|
3074
|
-
className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
|
|
3075
|
-
children: r
|
|
3076
|
-
}
|
|
3077
|
-
)
|
|
3078
|
-
] });
|
|
3079
|
-
}
|
|
3080
|
-
function to({
|
|
3081
|
-
size: e,
|
|
3082
|
-
className: r,
|
|
3083
|
-
primaryButtonClassName: o,
|
|
3084
|
-
secondaryButtonClassName: a,
|
|
3085
|
-
pickerContentClassName: n,
|
|
3086
|
-
settingsContentClassName: s
|
|
3087
|
-
}) {
|
|
3088
|
-
var y;
|
|
3089
|
-
const [d, c] = F(null), l = T((w) => w.dashboard), u = T((w) => w.selectedSheetId), h = T((w) => w.showFilters), p = T((w) => w.actions), { setDocumentPanelTarget: m, setShowFilters: g } = p, f = (y = l.sheets) == null ? void 0 : y.find(
|
|
3090
|
-
(w) => w.id === u
|
|
3091
|
-
), b = _a(f), k = j((w) => {
|
|
3092
|
-
window.setTimeout(() => {
|
|
3093
|
-
c(w);
|
|
3094
|
-
}, 0);
|
|
3095
|
-
}, []), v = j(
|
|
3096
|
-
(w) => {
|
|
3097
|
-
if (b && u) {
|
|
3098
|
-
w && m(u, {
|
|
3099
|
-
kind: "document",
|
|
3100
|
-
group: "inputs"
|
|
3101
|
-
});
|
|
3102
|
-
return;
|
|
3103
|
-
}
|
|
3104
|
-
g(w);
|
|
3105
|
-
},
|
|
3106
|
-
[
|
|
3107
|
-
b,
|
|
3108
|
-
u,
|
|
3109
|
-
m,
|
|
3110
|
-
g
|
|
3111
|
-
]
|
|
3112
|
-
), D = j(() => {
|
|
3113
|
-
v(!0);
|
|
3114
|
-
}, [v]), E = j(() => {
|
|
3115
|
-
k("create");
|
|
3116
|
-
}, [k]), N = j(() => {
|
|
3117
|
-
k("manage");
|
|
3118
|
-
}, [k]);
|
|
3119
|
-
return /* @__PURE__ */ i($, { children: [
|
|
3120
|
-
/* @__PURE__ */ t(
|
|
3121
|
-
Hn,
|
|
3122
|
-
{
|
|
3123
|
-
showFilters: b ? !1 : h,
|
|
3124
|
-
onShowFiltersChange: v,
|
|
3125
|
-
pickerContent: /* @__PURE__ */ t(Qn, {}),
|
|
3126
|
-
settingsContent: (w) => /* @__PURE__ */ t(
|
|
3127
|
-
Kn,
|
|
3128
|
-
{
|
|
3129
|
-
onAddFilter: D,
|
|
3130
|
-
onAddControl: E,
|
|
3131
|
-
onManageControls: N,
|
|
3132
|
-
onDismiss: w
|
|
3133
|
-
}
|
|
3134
|
-
),
|
|
3135
|
-
size: e,
|
|
3136
|
-
className: r,
|
|
3137
|
-
primaryButtonClassName: o,
|
|
3138
|
-
secondaryButtonClassName: a,
|
|
3139
|
-
pickerContentClassName: n,
|
|
3140
|
-
settingsContentClassName: s
|
|
3141
|
-
}
|
|
3142
|
-
),
|
|
3143
|
-
d ? b ? /* @__PURE__ */ t(
|
|
3144
|
-
$n,
|
|
3145
|
-
{
|
|
3146
|
-
open: !0,
|
|
3147
|
-
onOpenChange: (w) => {
|
|
3148
|
-
w || c(null);
|
|
3149
|
-
},
|
|
3150
|
-
initialMode: d
|
|
3151
|
-
}
|
|
3152
|
-
) : /* @__PURE__ */ t(
|
|
3153
|
-
_n,
|
|
3154
|
-
{
|
|
3155
|
-
open: !0,
|
|
3156
|
-
onOpenChange: (w) => {
|
|
3157
|
-
w || c(null);
|
|
3158
|
-
},
|
|
3159
|
-
showTrigger: !1,
|
|
3160
|
-
initialMode: d
|
|
3161
|
-
}
|
|
3162
|
-
) : null
|
|
3163
|
-
] });
|
|
3164
|
-
}
|
|
3165
|
-
function Zn({
|
|
3166
|
-
disabled: e,
|
|
3167
|
-
briefingCount: r,
|
|
3168
|
-
className: o,
|
|
3169
|
-
onClick: a
|
|
3170
|
-
}) {
|
|
3171
|
-
const n = typeof r == "number" && r > 0;
|
|
3172
|
-
return /* @__PURE__ */ i(
|
|
3173
|
-
U,
|
|
3174
|
-
{
|
|
3175
|
-
type: "button",
|
|
3176
|
-
size: "xs",
|
|
3177
|
-
variant: "outline",
|
|
3178
|
-
disabled: e,
|
|
3179
|
-
className: Z("gap-1.5", o),
|
|
3180
|
-
onClick: a,
|
|
3181
|
-
"aria-label": "Reports & briefings",
|
|
3182
|
-
children: [
|
|
3183
|
-
/* @__PURE__ */ t(Ga, { className: "h-3.5 w-3.5" }),
|
|
3184
|
-
"Reports & briefings",
|
|
3185
|
-
n ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: r }) : null
|
|
3186
|
-
]
|
|
3187
|
-
}
|
|
3188
|
-
);
|
|
3189
|
-
}
|
|
3190
|
-
const Yn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", ur = "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", We = "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";
|
|
3191
|
-
function Jn(e) {
|
|
3192
|
-
return e === "dashboard" ? "This dashboard" : "Project";
|
|
3193
|
-
}
|
|
3194
|
-
function es(e) {
|
|
3195
|
-
if (!e) return "Never";
|
|
3196
|
-
const r = new Date(e);
|
|
3197
|
-
if (Number.isNaN(r.getTime())) return "Unknown";
|
|
3198
|
-
const o = Date.now() - r.getTime(), a = Math.round(o / 6e4);
|
|
3199
|
-
if (a < 1) return "now";
|
|
3200
|
-
if (a < 60) return `${a}m ago`;
|
|
3201
|
-
const n = Math.round(a / 60);
|
|
3202
|
-
if (n < 24) return `${n}h ago`;
|
|
3203
|
-
const s = Math.round(n / 24);
|
|
3204
|
-
if (s < 7) return `${s}d ago`;
|
|
3205
|
-
const d = Math.round(s / 7);
|
|
3206
|
-
return d < 5 ? `${d}w ago` : `${Math.round(s / 30)}mo ago`;
|
|
3207
|
-
}
|
|
3208
|
-
function ts(e) {
|
|
3209
|
-
return e.scheduleExpr ? Oa(
|
|
3210
|
-
e.scheduleExpr,
|
|
3211
|
-
e.timezone || "UTC"
|
|
3212
|
-
) ?? "Invalid schedule" : "On demand";
|
|
3213
|
-
}
|
|
3214
|
-
function rs(e) {
|
|
3215
|
-
if (e.lastRunStatus) {
|
|
3216
|
-
const r = e.lastRunStatus.toString().toUpperCase();
|
|
3217
|
-
return r === "SUCCESS" ? "Last run completed." : r === "FAILED" ? "Last run failed." : `Last run ${e.lastRunStatus.toString().toLowerCase()}`;
|
|
3218
|
-
}
|
|
3219
|
-
return null;
|
|
3220
|
-
}
|
|
3221
|
-
function hr(e) {
|
|
3222
|
-
return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
|
|
3223
|
-
}
|
|
3224
|
-
function as(e) {
|
|
3225
|
-
return e.source.type === "dashboard" ? "This dashboard" : "Project";
|
|
3226
|
-
}
|
|
3227
|
-
function ns({
|
|
3228
|
-
activeView: e,
|
|
3229
|
-
onChange: r
|
|
3230
|
-
}) {
|
|
3231
|
-
return /* @__PURE__ */ t(
|
|
3232
|
-
"div",
|
|
3233
|
-
{
|
|
3234
|
-
className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
|
|
3235
|
-
role: "tablist",
|
|
3236
|
-
"aria-label": "Briefing source view",
|
|
3237
|
-
children: ["dashboard", "project"].map((o) => {
|
|
3238
|
-
const a = e === o;
|
|
3239
|
-
return /* @__PURE__ */ t(
|
|
3240
|
-
"button",
|
|
3241
|
-
{
|
|
3242
|
-
type: "button",
|
|
3243
|
-
role: "tab",
|
|
3244
|
-
"aria-selected": a,
|
|
3245
|
-
onClick: () => r(o),
|
|
3246
|
-
className: Z(
|
|
3247
|
-
"h-6 rounded-[3px] px-2 text-[11px] transition-colors",
|
|
3248
|
-
a ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
3249
|
-
),
|
|
3250
|
-
children: Jn(o)
|
|
3251
|
-
},
|
|
3252
|
-
o
|
|
3253
|
-
);
|
|
3254
|
-
})
|
|
3255
|
-
}
|
|
3256
|
-
);
|
|
3257
|
-
}
|
|
3258
|
-
function ss({
|
|
3259
|
-
briefings: e,
|
|
3260
|
-
dashboardLabel: r,
|
|
3261
|
-
sourceView: o,
|
|
3262
|
-
error: a,
|
|
3263
|
-
loading: n,
|
|
3264
|
-
onSourceViewChange: s,
|
|
3265
|
-
onClose: d,
|
|
3266
|
-
onEdit: c,
|
|
3267
|
-
onNew: l,
|
|
3268
|
-
canCreate: u,
|
|
3269
|
-
canCreateScheduledReport: h,
|
|
3270
|
-
analyticalBriefingsEnabled: p,
|
|
3271
|
-
onRunNow: m,
|
|
3272
|
-
onTogglePause: g,
|
|
3273
|
-
onDelete: f,
|
|
3274
|
-
selectingId: b,
|
|
3275
|
-
busyId: k,
|
|
3276
|
-
manageBriefingsHref: v,
|
|
3277
|
-
contentKind: D,
|
|
3278
|
-
hideHeader: E = !1
|
|
3279
|
-
}) {
|
|
3280
|
-
const N = e.length, y = e.filter((I) => I.status === "ACTIVE").length, w = D === "reports" ? N === 1 ? "report" : "reports" : D === "briefings" ? N === 1 ? "briefing" : "briefings" : N === 1 ? "item" : "items", S = e.find((I) => I.hasActiveRun) ?? null, x = D ?? "reports & briefings", B = o === "dashboard" ? r : `Project ${x}`;
|
|
3281
|
-
return /* @__PURE__ */ i(
|
|
3282
|
-
"section",
|
|
3283
|
-
{
|
|
3284
|
-
"aria-label": `Dashboard ${x.replace("&", "and")}`,
|
|
3285
|
-
className: "flex h-full min-h-0 flex-col bg-background text-foreground",
|
|
3286
|
-
children: [
|
|
3287
|
-
E ? null : /* @__PURE__ */ i("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
3288
|
-
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
3289
|
-
/* @__PURE__ */ t("div", { className: Yn, children: x }),
|
|
3290
|
-
/* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: B })
|
|
3291
|
-
] }),
|
|
3292
|
-
/* @__PURE__ */ t(
|
|
3293
|
-
"button",
|
|
3294
|
-
{
|
|
3295
|
-
type: "button",
|
|
3296
|
-
onClick: d,
|
|
3297
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3298
|
-
"aria-label": `Close ${x.replace("&", "and")} panel`,
|
|
3299
|
-
children: /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" })
|
|
3300
|
-
}
|
|
3301
|
-
)
|
|
3302
|
-
] }),
|
|
3303
|
-
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
|
|
3304
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3305
|
-
/* @__PURE__ */ t(
|
|
3306
|
-
ns,
|
|
3307
|
-
{
|
|
3308
|
-
activeView: o,
|
|
3309
|
-
onChange: s
|
|
3310
|
-
}
|
|
3311
|
-
),
|
|
3312
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: n && N === 0 ? /* @__PURE__ */ i("span", { children: [
|
|
3313
|
-
"Loading ",
|
|
3314
|
-
x,
|
|
3315
|
-
"…"
|
|
3316
|
-
] }) : N === 0 ? /* @__PURE__ */ i("span", { children: [
|
|
3317
|
-
"No ",
|
|
3318
|
-
x,
|
|
3319
|
-
" yet"
|
|
3320
|
-
] }) : /* @__PURE__ */ i($, { children: [
|
|
3321
|
-
/* @__PURE__ */ i("span", { className: "font-medium text-foreground/80", children: [
|
|
3322
|
-
N,
|
|
3323
|
-
" ",
|
|
3324
|
-
w
|
|
3325
|
-
] }),
|
|
3326
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3327
|
-
/* @__PURE__ */ i("span", { children: [
|
|
3328
|
-
y,
|
|
3329
|
-
" active"
|
|
3330
|
-
] })
|
|
3331
|
-
] }) })
|
|
3332
|
-
] }),
|
|
3333
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
3334
|
-
n ? (
|
|
3335
|
-
// Auto-refresh on open; surface a quiet spinner near the count
|
|
3336
|
-
// when a manual reload is in flight, but don't show a separate
|
|
3337
|
-
// refresh button — close+reopen handles the rare "stale list"
|
|
3338
|
-
// case without crowding the toolbar.
|
|
3339
|
-
/* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
|
|
3340
|
-
) : null,
|
|
3341
|
-
N > 0 && u ? p && h ? /* @__PURE__ */ i(rt, { children: [
|
|
3342
|
-
/* @__PURE__ */ t(at, { asChild: !0, children: /* @__PURE__ */ i("button", { className: We, children: [
|
|
3343
|
-
/* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
|
|
3344
|
-
" New"
|
|
3345
|
-
] }) }),
|
|
3346
|
-
/* @__PURE__ */ i(nt, { align: "end", children: [
|
|
3347
|
-
/* @__PURE__ */ t(X, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
|
|
3348
|
-
/* @__PURE__ */ t(
|
|
3349
|
-
X,
|
|
3350
|
-
{
|
|
3351
|
-
onClick: () => l("analytical_briefing"),
|
|
3352
|
-
children: "Create analytical briefing"
|
|
3353
|
-
}
|
|
3354
|
-
)
|
|
3355
|
-
] })
|
|
3356
|
-
] }) : h ? /* @__PURE__ */ i(
|
|
3357
|
-
"button",
|
|
3358
|
-
{
|
|
3359
|
-
onClick: () => l("scheduled_report"),
|
|
3360
|
-
className: We,
|
|
3361
|
-
children: [
|
|
3362
|
-
/* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
|
|
3363
|
-
" Schedule report"
|
|
3364
|
-
]
|
|
3365
|
-
}
|
|
3366
|
-
) : p ? /* @__PURE__ */ i(
|
|
3367
|
-
"button",
|
|
3368
|
-
{
|
|
3369
|
-
onClick: () => l("analytical_briefing"),
|
|
3370
|
-
className: We,
|
|
3371
|
-
children: [
|
|
3372
|
-
/* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
|
|
3373
|
-
" New briefing"
|
|
3374
|
-
]
|
|
3375
|
-
}
|
|
3376
|
-
) : null : null
|
|
3377
|
-
] })
|
|
3378
|
-
] }),
|
|
3379
|
-
S ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
|
|
3380
|
-
/* @__PURE__ */ t(ie, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
|
|
3381
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: S.name }),
|
|
3382
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3383
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: hr(S) })
|
|
3384
|
-
] }) : null,
|
|
3385
|
-
/* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto", children: [
|
|
3386
|
-
a ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: a }) : null,
|
|
3387
|
-
!n && e.length === 0 && !a ? /* @__PURE__ */ t(
|
|
3388
|
-
os,
|
|
3389
|
-
{
|
|
3390
|
-
onNew: l,
|
|
3391
|
-
canCreate: u,
|
|
3392
|
-
canCreateScheduledReport: h,
|
|
3393
|
-
analyticalBriefingsEnabled: p,
|
|
3394
|
-
contentKind: D
|
|
3395
|
-
}
|
|
3396
|
-
) : null,
|
|
3397
|
-
e.map((I) => /* @__PURE__ */ t(
|
|
3398
|
-
ls,
|
|
3399
|
-
{
|
|
3400
|
-
briefing: I,
|
|
3401
|
-
isOpening: b === I.id,
|
|
3402
|
-
isBusy: k === I.id,
|
|
3403
|
-
onOpen: () => c(I.id),
|
|
3404
|
-
onRunNow: () => m(I),
|
|
3405
|
-
onTogglePause: () => g(I),
|
|
3406
|
-
onDelete: () => f(I)
|
|
3407
|
-
},
|
|
3408
|
-
I.id
|
|
3409
|
-
))
|
|
3410
|
-
] }),
|
|
3411
|
-
v ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ i(
|
|
3412
|
-
"a",
|
|
3413
|
-
{
|
|
3414
|
-
href: v,
|
|
3415
|
-
className: Z(ur, "h-6 px-1 text-[11px]"),
|
|
3416
|
-
children: [
|
|
3417
|
-
"Manage all reports & briefings",
|
|
3418
|
-
/* @__PURE__ */ t(za, { className: "h-3 w-3" })
|
|
3419
|
-
]
|
|
3420
|
-
}
|
|
3421
|
-
) }) : null
|
|
3422
|
-
]
|
|
3423
|
-
}
|
|
3424
|
-
);
|
|
3425
|
-
}
|
|
3426
|
-
function os({
|
|
3427
|
-
onNew: e,
|
|
3428
|
-
canCreate: r,
|
|
3429
|
-
canCreateScheduledReport: o,
|
|
3430
|
-
analyticalBriefingsEnabled: a,
|
|
3431
|
-
contentKind: n
|
|
3432
|
-
}) {
|
|
3433
|
-
const s = n === "reports" ? {
|
|
3434
|
-
title: "No reports yet",
|
|
3435
|
-
description: "Schedule an emailed dashboard or visual report to see it here."
|
|
3436
|
-
} : n === "briefings" ? {
|
|
3437
|
-
title: "No briefings yet",
|
|
3438
|
-
description: "Create an analytical briefing to monitor this dashboard and brief your team."
|
|
3439
|
-
} : null;
|
|
3440
|
-
return /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
|
|
3441
|
-
/* @__PURE__ */ t(is, { className: "mb-5 h-[88px] w-[112px] text-border" }),
|
|
3442
|
-
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: (s == null ? void 0 : s.title) ?? "Have an analyst brief your team" }),
|
|
3443
|
-
/* @__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." }),
|
|
3444
|
-
r ? /* @__PURE__ */ i("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
3445
|
-
o ? /* @__PURE__ */ i(
|
|
3446
|
-
"button",
|
|
3447
|
-
{
|
|
3448
|
-
onClick: () => e("scheduled_report"),
|
|
3449
|
-
className: We,
|
|
3450
|
-
children: [
|
|
3451
|
-
/* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
|
|
3452
|
-
" Schedule a report"
|
|
3453
|
-
]
|
|
3454
|
-
}
|
|
3455
|
-
) : null,
|
|
3456
|
-
a ? /* @__PURE__ */ t(
|
|
3457
|
-
"button",
|
|
3458
|
-
{
|
|
3459
|
-
onClick: () => e("analytical_briefing"),
|
|
3460
|
-
className: ur,
|
|
3461
|
-
children: "Create analytical briefing"
|
|
3462
|
-
}
|
|
3463
|
-
) : null
|
|
3464
|
-
] }) : null
|
|
3465
|
-
] });
|
|
3466
|
-
}
|
|
3467
|
-
function is({ className: e }) {
|
|
3468
|
-
return /* @__PURE__ */ i(
|
|
3469
|
-
"svg",
|
|
3470
|
-
{
|
|
3471
|
-
viewBox: "0 0 112 88",
|
|
3472
|
-
fill: "none",
|
|
3473
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3474
|
-
role: "presentation",
|
|
3475
|
-
"aria-hidden": "true",
|
|
3476
|
-
className: e,
|
|
3477
|
-
children: [
|
|
3478
|
-
/* @__PURE__ */ t(
|
|
3479
|
-
"rect",
|
|
3480
|
-
{
|
|
3481
|
-
x: "22",
|
|
3482
|
-
y: "6",
|
|
3483
|
-
width: "60",
|
|
3484
|
-
height: "72",
|
|
3485
|
-
rx: "3",
|
|
3486
|
-
stroke: "currentColor",
|
|
3487
|
-
strokeWidth: "1.25"
|
|
3488
|
-
}
|
|
3489
|
-
),
|
|
3490
|
-
/* @__PURE__ */ t(
|
|
3491
|
-
"line",
|
|
3492
|
-
{
|
|
3493
|
-
x1: "30",
|
|
3494
|
-
y1: "16",
|
|
3495
|
-
x2: "64",
|
|
3496
|
-
y2: "16",
|
|
3497
|
-
stroke: "currentColor",
|
|
3498
|
-
strokeWidth: "1.5",
|
|
3499
|
-
strokeLinecap: "round"
|
|
3500
|
-
}
|
|
3501
|
-
),
|
|
3502
|
-
/* @__PURE__ */ t(
|
|
3503
|
-
"line",
|
|
3504
|
-
{
|
|
3505
|
-
x1: "30",
|
|
3506
|
-
y1: "21",
|
|
3507
|
-
x2: "52",
|
|
3508
|
-
y2: "21",
|
|
3509
|
-
stroke: "currentColor",
|
|
3510
|
-
strokeWidth: "1",
|
|
3511
|
-
strokeLinecap: "round",
|
|
3512
|
-
opacity: "0.5"
|
|
3513
|
-
}
|
|
3514
|
-
),
|
|
3515
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "32", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3516
|
-
/* @__PURE__ */ t(
|
|
3517
|
-
"line",
|
|
3518
|
-
{
|
|
3519
|
-
x1: "35",
|
|
3520
|
-
y1: "32",
|
|
3521
|
-
x2: "72",
|
|
3522
|
-
y2: "32",
|
|
3523
|
-
stroke: "currentColor",
|
|
3524
|
-
strokeWidth: "1",
|
|
3525
|
-
opacity: "0.4",
|
|
3526
|
-
strokeLinecap: "round"
|
|
3527
|
-
}
|
|
3528
|
-
),
|
|
3529
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "38", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3530
|
-
/* @__PURE__ */ t(
|
|
3531
|
-
"line",
|
|
3532
|
-
{
|
|
3533
|
-
x1: "35",
|
|
3534
|
-
y1: "38",
|
|
3535
|
-
x2: "68",
|
|
3536
|
-
y2: "38",
|
|
3537
|
-
stroke: "currentColor",
|
|
3538
|
-
strokeWidth: "1",
|
|
3539
|
-
opacity: "0.4",
|
|
3540
|
-
strokeLinecap: "round"
|
|
3541
|
-
}
|
|
3542
|
-
),
|
|
3543
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "44", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3544
|
-
/* @__PURE__ */ t(
|
|
3545
|
-
"line",
|
|
3546
|
-
{
|
|
3547
|
-
x1: "35",
|
|
3548
|
-
y1: "44",
|
|
3549
|
-
x2: "74",
|
|
3550
|
-
y2: "44",
|
|
3551
|
-
stroke: "currentColor",
|
|
3552
|
-
strokeWidth: "1",
|
|
3553
|
-
opacity: "0.4",
|
|
3554
|
-
strokeLinecap: "round"
|
|
3555
|
-
}
|
|
3556
|
-
),
|
|
3557
|
-
/* @__PURE__ */ t(
|
|
3558
|
-
"rect",
|
|
3559
|
-
{
|
|
3560
|
-
x: "30",
|
|
3561
|
-
y: "64",
|
|
3562
|
-
width: "5",
|
|
3563
|
-
height: "8",
|
|
3564
|
-
rx: "0.5",
|
|
3565
|
-
fill: "currentColor",
|
|
3566
|
-
opacity: "0.55"
|
|
3567
|
-
}
|
|
3568
|
-
),
|
|
3569
|
-
/* @__PURE__ */ t(
|
|
3570
|
-
"rect",
|
|
3571
|
-
{
|
|
3572
|
-
x: "38",
|
|
3573
|
-
y: "60",
|
|
3574
|
-
width: "5",
|
|
3575
|
-
height: "12",
|
|
3576
|
-
rx: "0.5",
|
|
3577
|
-
fill: "currentColor",
|
|
3578
|
-
opacity: "0.7"
|
|
3579
|
-
}
|
|
3580
|
-
),
|
|
3581
|
-
/* @__PURE__ */ t(
|
|
3582
|
-
"rect",
|
|
3583
|
-
{
|
|
3584
|
-
x: "46",
|
|
3585
|
-
y: "56",
|
|
3586
|
-
width: "5",
|
|
3587
|
-
height: "16",
|
|
3588
|
-
rx: "0.5",
|
|
3589
|
-
fill: "currentColor",
|
|
3590
|
-
opacity: "0.85"
|
|
3591
|
-
}
|
|
3592
|
-
),
|
|
3593
|
-
/* @__PURE__ */ t(
|
|
3594
|
-
"rect",
|
|
3595
|
-
{
|
|
3596
|
-
x: "54",
|
|
3597
|
-
y: "62",
|
|
3598
|
-
width: "5",
|
|
3599
|
-
height: "10",
|
|
3600
|
-
rx: "0.5",
|
|
3601
|
-
fill: "currentColor",
|
|
3602
|
-
opacity: "0.6"
|
|
3603
|
-
}
|
|
3604
|
-
),
|
|
3605
|
-
/* @__PURE__ */ t(
|
|
3606
|
-
"rect",
|
|
3607
|
-
{
|
|
3608
|
-
x: "62",
|
|
3609
|
-
y: "58",
|
|
3610
|
-
width: "5",
|
|
3611
|
-
height: "14",
|
|
3612
|
-
rx: "0.5",
|
|
3613
|
-
fill: "currentColor",
|
|
3614
|
-
opacity: "0.75"
|
|
3615
|
-
}
|
|
3616
|
-
),
|
|
3617
|
-
/* @__PURE__ */ t(
|
|
3618
|
-
"circle",
|
|
3619
|
-
{
|
|
3620
|
-
cx: "86",
|
|
3621
|
-
cy: "62",
|
|
3622
|
-
r: "10",
|
|
3623
|
-
fill: "var(--background, white)",
|
|
3624
|
-
stroke: "currentColor",
|
|
3625
|
-
strokeWidth: "1.25"
|
|
3626
|
-
}
|
|
3627
|
-
),
|
|
3628
|
-
/* @__PURE__ */ t(
|
|
3629
|
-
"line",
|
|
3630
|
-
{
|
|
3631
|
-
x1: "93.5",
|
|
3632
|
-
y1: "69.5",
|
|
3633
|
-
x2: "100",
|
|
3634
|
-
y2: "76",
|
|
3635
|
-
stroke: "currentColor",
|
|
3636
|
-
strokeWidth: "1.5",
|
|
3637
|
-
strokeLinecap: "round"
|
|
3638
|
-
}
|
|
3639
|
-
)
|
|
3640
|
-
]
|
|
3641
|
-
}
|
|
3642
|
-
);
|
|
3643
|
-
}
|
|
3644
|
-
function ls({
|
|
3645
|
-
briefing: e,
|
|
3646
|
-
isOpening: r,
|
|
3647
|
-
isBusy: o,
|
|
3648
|
-
onOpen: a,
|
|
3649
|
-
onRunNow: n,
|
|
3650
|
-
onTogglePause: s,
|
|
3651
|
-
onDelete: d
|
|
3652
|
-
}) {
|
|
3653
|
-
const c = e.status === "PAUSED", l = e.hasActiveRun, u = rs(e), h = es(e.lastRunAt), p = e.lastRunStatus, m = me(e), g = p === "SUCCESS" ? ze.success.dot : p === "FAILED" ? ze.danger.dot : p ? ze.warning.dot : ze.neutral.dot;
|
|
3654
|
-
return /* @__PURE__ */ i(
|
|
3655
|
-
"div",
|
|
3656
|
-
{
|
|
3657
|
-
className: Z(
|
|
3658
|
-
"group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
|
|
3659
|
-
c && "opacity-70"
|
|
3660
|
-
),
|
|
3661
|
-
children: [
|
|
3662
|
-
/* @__PURE__ */ i(
|
|
3663
|
-
"div",
|
|
3664
|
-
{
|
|
3665
|
-
role: "button",
|
|
3666
|
-
tabIndex: 0,
|
|
3667
|
-
onClick: a,
|
|
3668
|
-
onKeyDown: (f) => {
|
|
3669
|
-
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), a());
|
|
3670
|
-
},
|
|
3671
|
-
className: "cursor-pointer pr-8",
|
|
3672
|
-
children: [
|
|
3673
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3674
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
|
|
3675
|
-
c ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
|
|
3676
|
-
] }),
|
|
3677
|
-
/* @__PURE__ */ i("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
|
|
3678
|
-
/* @__PURE__ */ t("span", { children: m.typeLabel }),
|
|
3679
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3680
|
-
/* @__PURE__ */ t("span", { children: as(e) }),
|
|
3681
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3682
|
-
/* @__PURE__ */ t(Jr, { className: "h-3 w-3" }),
|
|
3683
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: ts(e) }),
|
|
3684
|
-
e.lastRunAt ? /* @__PURE__ */ i($, { children: [
|
|
3685
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3686
|
-
/* @__PURE__ */ i("span", { children: [
|
|
3687
|
-
"Last run ",
|
|
3688
|
-
h
|
|
3689
|
-
] })
|
|
3690
|
-
] }) : null
|
|
3691
|
-
] }),
|
|
3692
|
-
u || l ? /* @__PURE__ */ i("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
|
|
3693
|
-
l ? /* @__PURE__ */ t(ie, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
|
|
3694
|
-
"span",
|
|
3695
|
-
{
|
|
3696
|
-
className: Z(
|
|
3697
|
-
"inline-block h-1.5 w-1.5 shrink-0 rounded-full",
|
|
3698
|
-
g
|
|
3699
|
-
)
|
|
3700
|
-
}
|
|
3701
|
-
),
|
|
3702
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: l ? hr(e) : u })
|
|
3703
|
-
] }) : null
|
|
3704
|
-
]
|
|
3705
|
-
}
|
|
3706
|
-
),
|
|
3707
|
-
/* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : r ? /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ i(rt, { children: [
|
|
3708
|
-
/* @__PURE__ */ t(at, { asChild: !0, children: /* @__PURE__ */ t(
|
|
3709
|
-
"button",
|
|
3710
|
-
{
|
|
3711
|
-
type: "button",
|
|
3712
|
-
onClick: (f) => f.stopPropagation(),
|
|
3713
|
-
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",
|
|
3714
|
-
"aria-label": `${m.noun === "report" ? "Report" : "Briefing"} actions`,
|
|
3715
|
-
children: /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" })
|
|
3716
|
-
}
|
|
3717
|
-
) }),
|
|
3718
|
-
/* @__PURE__ */ i(nt, { align: "end", className: "w-44", children: [
|
|
3719
|
-
/* @__PURE__ */ i(X, { onClick: a, children: [
|
|
3720
|
-
/* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
|
|
3721
|
-
"Edit ",
|
|
3722
|
-
m.noun
|
|
3723
|
-
] }),
|
|
3724
|
-
/* @__PURE__ */ i(
|
|
3725
|
-
X,
|
|
3726
|
-
{
|
|
3727
|
-
onClick: (f) => {
|
|
3728
|
-
f.preventDefault(), n();
|
|
3729
|
-
},
|
|
3730
|
-
children: [
|
|
3731
|
-
/* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
|
|
3732
|
-
"Run now"
|
|
3733
|
-
]
|
|
3734
|
-
}
|
|
3735
|
-
),
|
|
3736
|
-
e.scheduleExpr ? /* @__PURE__ */ t(
|
|
3737
|
-
X,
|
|
3738
|
-
{
|
|
3739
|
-
onClick: (f) => {
|
|
3740
|
-
f.preventDefault(), s();
|
|
3741
|
-
},
|
|
3742
|
-
children: c ? /* @__PURE__ */ i($, { children: [
|
|
3743
|
-
/* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5" }),
|
|
3744
|
-
"Resume"
|
|
3745
|
-
] }) : /* @__PURE__ */ i($, { children: [
|
|
3746
|
-
/* @__PURE__ */ t(ra, { className: "h-3.5 w-3.5" }),
|
|
3747
|
-
"Pause"
|
|
3748
|
-
] })
|
|
3749
|
-
}
|
|
3750
|
-
) : null,
|
|
3751
|
-
/* @__PURE__ */ t(Ke, {}),
|
|
3752
|
-
/* @__PURE__ */ i(
|
|
3753
|
-
X,
|
|
3754
|
-
{
|
|
3755
|
-
onClick: (f) => {
|
|
3756
|
-
f.preventDefault(), d();
|
|
3757
|
-
},
|
|
3758
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
3759
|
-
children: [
|
|
3760
|
-
/* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
|
|
3761
|
-
"Delete ",
|
|
3762
|
-
m.noun
|
|
3763
|
-
]
|
|
3764
|
-
}
|
|
3765
|
-
)
|
|
3766
|
-
] })
|
|
3767
|
-
] }) })
|
|
3768
|
-
]
|
|
3769
|
-
}
|
|
3770
|
-
);
|
|
3771
|
-
}
|
|
3772
|
-
const cs = 2e3, ds = 20 * 6e4;
|
|
3773
|
-
function us(e) {
|
|
3774
|
-
return (e == null ? void 0 : e.trim()) || "This dashboard";
|
|
3775
|
-
}
|
|
3776
|
-
function hs(e) {
|
|
3777
|
-
return e === "This dashboard" ? "Watch this dashboard" : `Watch ${e}`;
|
|
3778
|
-
}
|
|
3779
|
-
function ms(e, r, o) {
|
|
3780
|
-
return r !== "dashboard" ? e : e.filter(
|
|
3781
|
-
(a) => a.source.type === "dashboard" && a.source.dashboardId === o
|
|
3782
|
-
);
|
|
3783
|
-
}
|
|
3784
|
-
async function ps(e) {
|
|
3785
|
-
const o = [];
|
|
3786
|
-
let a = 1, n = 0, s = Number.POSITIVE_INFINITY;
|
|
3787
|
-
for (; n < s; ) {
|
|
3788
|
-
const d = await e.apiClient.listBriefings(
|
|
3789
|
-
e.apiServiceUrl,
|
|
3790
|
-
e.token,
|
|
3791
|
-
{ scope: "organization", page: a, pageSize: 100 }
|
|
3792
|
-
);
|
|
3793
|
-
if (o.push(...d.briefings), n += d.briefings.length, s = d.total, d.briefings.length === 0 || n >= s) break;
|
|
3794
|
-
a += 1;
|
|
3795
|
-
}
|
|
3796
|
-
return o;
|
|
3797
|
-
}
|
|
3798
|
-
const fs = {
|
|
3799
|
-
listBriefings: da,
|
|
3800
|
-
getBriefing: ca,
|
|
3801
|
-
pauseBriefing: la,
|
|
3802
|
-
resumeBriefing: ia,
|
|
3803
|
-
deleteBriefing: oa,
|
|
3804
|
-
runBriefingNow: sa
|
|
3805
|
-
};
|
|
3806
|
-
function gs({
|
|
3807
|
-
briefingId: e,
|
|
3808
|
-
initialRun: r,
|
|
3809
|
-
apiServiceUrl: o,
|
|
3810
|
-
token: a,
|
|
3811
|
-
onTerminal: n,
|
|
3812
|
-
onTimeout: s,
|
|
3813
|
-
onExpand: d
|
|
3814
|
-
}) {
|
|
3815
|
-
const [c, l] = F(r), { startRun: u } = va({
|
|
3816
|
-
apiServiceUrl: o,
|
|
3817
|
-
token: a,
|
|
3818
|
-
intervalMs: cs,
|
|
3819
|
-
timeoutMs: ds,
|
|
3820
|
-
fetchRun: ({
|
|
3821
|
-
apiServiceUrl: p,
|
|
3822
|
-
token: m,
|
|
3823
|
-
runId: g
|
|
3824
|
-
}) => xa(p, m, e, g),
|
|
3825
|
-
onRun: (p) => {
|
|
3826
|
-
l(p);
|
|
3827
|
-
},
|
|
3828
|
-
onTerminalRun: (p) => {
|
|
3829
|
-
n(p);
|
|
3830
|
-
},
|
|
3831
|
-
onTimeout: () => {
|
|
3832
|
-
s();
|
|
3833
|
-
}
|
|
3834
|
-
}), h = ge(!1);
|
|
3835
|
-
return J(() => {
|
|
3836
|
-
h.current || (h.current = !0, ya(r.status) ? u(r) : Ca(r.status) && n(r));
|
|
3837
|
-
}, [r, n, u]), /* @__PURE__ */ t(wa, { run: c, onExpand: d });
|
|
3838
|
-
}
|
|
3839
|
-
function ro(e) {
|
|
3840
|
-
return /* @__PURE__ */ t(aa, { children: /* @__PURE__ */ t(bs, { ...e }) });
|
|
3841
|
-
}
|
|
3842
|
-
function bs({
|
|
3843
|
-
dashboardId: e,
|
|
3844
|
-
dashboardTitle: r,
|
|
3845
|
-
apiServiceUrl: o,
|
|
3846
|
-
token: a,
|
|
3847
|
-
disabled: n,
|
|
3848
|
-
className: s,
|
|
3849
|
-
manageBriefingsHref: d,
|
|
3850
|
-
open: c,
|
|
3851
|
-
onOpenChange: l,
|
|
3852
|
-
hideTrigger: u = !1,
|
|
3853
|
-
workflowIntent: h,
|
|
3854
|
-
client: p
|
|
3855
|
-
}) {
|
|
3856
|
-
const { authToken: m, tokenProps: g } = Be(), f = na(), b = !h || f.canCreate && (h === "scheduled_report" || f.analyticalBriefingsEnabled), [k, v] = F(!1), D = c ?? k, E = (A) => {
|
|
3857
|
-
c === void 0 && v(A), l == null || l(A);
|
|
3858
|
-
}, [N, y] = F(
|
|
3859
|
-
h ? "author" : "list"
|
|
3860
|
-
), [w, S] = F(
|
|
3861
|
-
h ?? "analytical_briefing"
|
|
3862
|
-
), [x, B] = F("dashboard"), [I, W] = F(
|
|
3863
|
-
[]
|
|
3864
|
-
), [P, M] = F(null), Y = h && !b && !P ? "list" : N, [K, Ce] = F(!1), [ce, O] = F(null), [te, re] = F(null), [L, ae] = F(
|
|
3865
|
-
null
|
|
3866
|
-
), [le, Q] = F(null), be = ge(null), ke = ge(D);
|
|
3867
|
-
J(() => {
|
|
3868
|
-
const A = D && !ke.current;
|
|
3869
|
-
ke.current = D, !(!A || !h) && (M(null), B("dashboard"), S(h), y("author"), Q(null));
|
|
3870
|
-
}, [D, h]);
|
|
3871
|
-
const [ve, we] = F(
|
|
3872
|
-
null
|
|
3873
|
-
), [se, Ae] = F(null), q = o ?? (g == null ? void 0 : g.apiServiceUrl), H = a ?? (m == null ? void 0 : m.accessToken), he = oe(() => ({ ...fs, ...p }), [p]), Ne = us(r), _e = oe(() => {
|
|
3874
|
-
const A = ms(
|
|
3875
|
-
I,
|
|
3876
|
-
x,
|
|
3877
|
-
e
|
|
3878
|
-
);
|
|
3879
|
-
if (!h)
|
|
3880
|
-
return A;
|
|
3881
|
-
const _ = h === "scheduled_report" ? "report" : "briefing";
|
|
3882
|
-
return A.filter(
|
|
3883
|
-
(Oe) => me(Oe).noun === _
|
|
3884
|
-
);
|
|
3885
|
-
}, [e, I, x, h]), st = oe(() => x === "dashboard" ? {
|
|
3886
|
-
source: { type: "dashboard", dashboardId: e },
|
|
3887
|
-
label: Ne,
|
|
3888
|
-
detail: hs(Ne)
|
|
3889
|
-
} : {
|
|
3890
|
-
source: { type: "project" },
|
|
3891
|
-
label: "This project",
|
|
3892
|
-
detail: "Use any data in this project."
|
|
3893
|
-
}, [e, Ne, x]), Ie = !!(q && H), Fe = $a({
|
|
3894
|
-
canCreate: f.canCreate,
|
|
3895
|
-
analyticalBriefingsEnabled: f.analyticalBriefingsEnabled,
|
|
3896
|
-
scheduledReportAvailable: x === "dashboard"
|
|
3897
|
-
}), ne = j(async () => {
|
|
3898
|
-
if (!(!q || !H)) {
|
|
3899
|
-
Ce(!0), Q(null);
|
|
3900
|
-
try {
|
|
3901
|
-
W(
|
|
3902
|
-
await ps({
|
|
3903
|
-
apiClient: he,
|
|
3904
|
-
apiServiceUrl: q,
|
|
3905
|
-
token: H
|
|
3906
|
-
})
|
|
3907
|
-
);
|
|
3908
|
-
} catch (A) {
|
|
3909
|
-
Q(
|
|
3910
|
-
A instanceof Error ? A.message : "Could not load briefings."
|
|
3911
|
-
);
|
|
3912
|
-
} finally {
|
|
3913
|
-
Ce(!1);
|
|
3914
|
-
}
|
|
3915
|
-
}
|
|
3916
|
-
}, [he, q, H]);
|
|
3917
|
-
J(() => {
|
|
3918
|
-
!D || Y !== "list" || !Ie || ne();
|
|
3919
|
-
}, [Ie, Y, ne, D]);
|
|
3920
|
-
const Pe = () => {
|
|
3921
|
-
M(null), B("dashboard"), y("list"), E(!0);
|
|
3922
|
-
}, C = (A) => {
|
|
3923
|
-
M(null), S(A), y("author");
|
|
3924
|
-
}, R = async (A) => {
|
|
3925
|
-
if (!(!q || !H)) {
|
|
3926
|
-
O(A), Q(null);
|
|
3927
|
-
try {
|
|
3928
|
-
const _ = await he.getBriefing(
|
|
3929
|
-
q,
|
|
3930
|
-
H,
|
|
3931
|
-
A
|
|
3932
|
-
);
|
|
3933
|
-
M(_.briefing), y("author");
|
|
3934
|
-
} catch (_) {
|
|
3935
|
-
Q(
|
|
3936
|
-
_ instanceof Error ? _.message : "Could not open briefing."
|
|
3937
|
-
);
|
|
3938
|
-
} finally {
|
|
3939
|
-
O(null);
|
|
3940
|
-
}
|
|
3941
|
-
}
|
|
3942
|
-
}, z = async (A) => {
|
|
3943
|
-
if (!(!q || !H)) {
|
|
3944
|
-
re(A.id);
|
|
3945
|
-
try {
|
|
3946
|
-
await he.runBriefingNow(
|
|
3947
|
-
q,
|
|
3948
|
-
H,
|
|
3949
|
-
A.id,
|
|
3950
|
-
{ requestId: vs() }
|
|
3951
|
-
), ne();
|
|
3952
|
-
} catch (_) {
|
|
3953
|
-
V.error(
|
|
3954
|
-
_ instanceof Error ? _.message : "Could not start the run."
|
|
3955
|
-
);
|
|
3956
|
-
} finally {
|
|
3957
|
-
re(null);
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
}, de = async (A) => {
|
|
3961
|
-
if (!q || !H) return;
|
|
3962
|
-
const { noun: _ } = me(A), Oe = _ === "report" ? "Report" : "Briefing";
|
|
3963
|
-
re(A.id);
|
|
3964
|
-
try {
|
|
3965
|
-
const $e = A.status === "PAUSED" ? await he.resumeBriefing(
|
|
3966
|
-
q,
|
|
3967
|
-
H,
|
|
3968
|
-
A.id
|
|
3969
|
-
) : await he.pauseBriefing(
|
|
3970
|
-
q,
|
|
3971
|
-
H,
|
|
3972
|
-
A.id
|
|
3973
|
-
);
|
|
3974
|
-
V.success(
|
|
3975
|
-
$e.briefing.status === "PAUSED" ? `${Oe} paused` : `${Oe} resumed`
|
|
3976
|
-
), ne();
|
|
3977
|
-
} catch ($e) {
|
|
3978
|
-
V.error(
|
|
3979
|
-
$e instanceof Error ? $e.message : `Could not update the ${_} status.`
|
|
3980
|
-
);
|
|
3981
|
-
} finally {
|
|
3982
|
-
re(null);
|
|
3983
|
-
}
|
|
3984
|
-
}, fe = async () => {
|
|
3985
|
-
if (!L || !q || !H) return;
|
|
3986
|
-
const A = L;
|
|
3987
|
-
re(A.id);
|
|
3988
|
-
try {
|
|
3989
|
-
await he.deleteBriefing(
|
|
3990
|
-
q,
|
|
3991
|
-
H,
|
|
3992
|
-
A.id
|
|
3993
|
-
);
|
|
3994
|
-
const { noun: _ } = me(A);
|
|
3995
|
-
V.success(`${_ === "report" ? "Report" : "Briefing"} deleted`), ae(null), ne();
|
|
3996
|
-
} catch (_) {
|
|
3997
|
-
V.error(
|
|
3998
|
-
_ instanceof Error ? _.message : "Could not delete the briefing."
|
|
3999
|
-
);
|
|
4000
|
-
} finally {
|
|
4001
|
-
re(null);
|
|
4002
|
-
}
|
|
4003
|
-
}, mr = _e.length;
|
|
4004
|
-
return f.surfaceVisible ? /* @__PURE__ */ i(ua, { open: D, onOpenChange: E, children: [
|
|
4005
|
-
u ? null : /* @__PURE__ */ t(
|
|
4006
|
-
Zn,
|
|
4007
|
-
{
|
|
4008
|
-
disabled: n || !Ie,
|
|
4009
|
-
briefingCount: mr,
|
|
4010
|
-
className: s,
|
|
4011
|
-
onClick: Pe
|
|
4012
|
-
}
|
|
4013
|
-
),
|
|
4014
|
-
/* @__PURE__ */ i(
|
|
4015
|
-
ha,
|
|
4016
|
-
{
|
|
4017
|
-
ref: be,
|
|
4018
|
-
side: "right",
|
|
4019
|
-
hideClose: !0,
|
|
4020
|
-
className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
|
|
4021
|
-
onOpenAutoFocus: (A) => {
|
|
4022
|
-
var _;
|
|
4023
|
-
A.preventDefault(), (_ = be.current) == null || _.focus({ preventScroll: !0 });
|
|
4024
|
-
},
|
|
4025
|
-
children: [
|
|
4026
|
-
/* @__PURE__ */ i(ma, { className: "sr-only", children: [
|
|
4027
|
-
/* @__PURE__ */ t(pa, { children: "Reports & briefings" }),
|
|
4028
|
-
/* @__PURE__ */ t(fa, { children: "Manage reports and briefings for this dashboard." })
|
|
4029
|
-
] }),
|
|
4030
|
-
h ? /* @__PURE__ */ i("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
|
|
4031
|
-
/* @__PURE__ */ i(
|
|
4032
|
-
"div",
|
|
4033
|
-
{
|
|
4034
|
-
className: "flex items-center gap-5",
|
|
4035
|
-
role: "tablist",
|
|
4036
|
-
"aria-label": h === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
|
|
4037
|
-
children: [
|
|
4038
|
-
/* @__PURE__ */ t(
|
|
4039
|
-
"button",
|
|
4040
|
-
{
|
|
4041
|
-
type: "button",
|
|
4042
|
-
role: "tab",
|
|
4043
|
-
"aria-selected": Y === "author",
|
|
4044
|
-
disabled: !b,
|
|
4045
|
-
className: Z(
|
|
4046
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
4047
|
-
Y === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
|
|
4048
|
-
!b && "cursor-not-allowed opacity-50"
|
|
4049
|
-
),
|
|
4050
|
-
onClick: () => {
|
|
4051
|
-
b && (M(null), S(h), B("dashboard"), y("author"));
|
|
4052
|
-
},
|
|
4053
|
-
children: P ? `Edit ${me(P).noun}` : h === "scheduled_report" ? "Schedule report" : "Create briefing"
|
|
4054
|
-
}
|
|
4055
|
-
),
|
|
4056
|
-
/* @__PURE__ */ t(
|
|
4057
|
-
"button",
|
|
4058
|
-
{
|
|
4059
|
-
type: "button",
|
|
4060
|
-
role: "tab",
|
|
4061
|
-
"aria-selected": Y === "list",
|
|
4062
|
-
className: Z(
|
|
4063
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
4064
|
-
Y === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
4065
|
-
),
|
|
4066
|
-
onClick: () => y("list"),
|
|
4067
|
-
children: h === "scheduled_report" ? "Manage reports" : "Manage briefings"
|
|
4068
|
-
}
|
|
4069
|
-
)
|
|
4070
|
-
]
|
|
4071
|
-
}
|
|
4072
|
-
),
|
|
4073
|
-
/* @__PURE__ */ t(
|
|
4074
|
-
"button",
|
|
4075
|
-
{
|
|
4076
|
-
type: "button",
|
|
4077
|
-
onClick: () => E(!1),
|
|
4078
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
4079
|
-
"aria-label": h === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
|
|
4080
|
-
children: /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" })
|
|
4081
|
-
}
|
|
4082
|
-
)
|
|
4083
|
-
] }) : null,
|
|
4084
|
-
Y === "list" ? /* @__PURE__ */ t(
|
|
4085
|
-
ss,
|
|
4086
|
-
{
|
|
4087
|
-
briefings: _e,
|
|
4088
|
-
dashboardLabel: Ne,
|
|
4089
|
-
sourceView: x,
|
|
4090
|
-
error: le,
|
|
4091
|
-
loading: K,
|
|
4092
|
-
onSourceViewChange: B,
|
|
4093
|
-
onClose: () => E(!1),
|
|
4094
|
-
onEdit: (A) => {
|
|
4095
|
-
R(A);
|
|
4096
|
-
},
|
|
4097
|
-
onNew: C,
|
|
4098
|
-
canCreate: !h && Fe.length > 0,
|
|
4099
|
-
canCreateScheduledReport: Fe.includes(
|
|
4100
|
-
"scheduled_report"
|
|
4101
|
-
),
|
|
4102
|
-
analyticalBriefingsEnabled: Fe.includes(
|
|
4103
|
-
"analytical_briefing"
|
|
4104
|
-
),
|
|
4105
|
-
onRunNow: (A) => {
|
|
4106
|
-
z(A);
|
|
4107
|
-
},
|
|
4108
|
-
onTogglePause: (A) => {
|
|
4109
|
-
de(A);
|
|
4110
|
-
},
|
|
4111
|
-
onDelete: (A) => ae(A),
|
|
4112
|
-
selectingId: ce,
|
|
4113
|
-
busyId: te,
|
|
4114
|
-
manageBriefingsHref: d,
|
|
4115
|
-
contentKind: h === "scheduled_report" ? "reports" : h === "analytical_briefing" ? "briefings" : void 0,
|
|
4116
|
-
hideHeader: !!h
|
|
4117
|
-
}
|
|
4118
|
-
) : /* @__PURE__ */ t(
|
|
4119
|
-
ga,
|
|
4120
|
-
{
|
|
4121
|
-
apiServiceUrl: q,
|
|
4122
|
-
token: H,
|
|
4123
|
-
briefing: P,
|
|
4124
|
-
intent: w,
|
|
4125
|
-
sourceContext: P ? void 0 : st,
|
|
4126
|
-
title: P ? `Edit ${me(P).noun}` : w === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
|
|
4127
|
-
hideHeader: !!h,
|
|
4128
|
-
className: "h-full min-h-0 max-w-none border-0 shadow-none",
|
|
4129
|
-
onBack: h ? void 0 : () => y("list"),
|
|
4130
|
-
onCancel: () => E(!1),
|
|
4131
|
-
onDeleted: () => {
|
|
4132
|
-
const A = P ? me(P).noun : "briefing";
|
|
4133
|
-
V.success(`${A === "report" ? "Report" : "Briefing"} deleted`), M(null), y("list"), ne();
|
|
4134
|
-
},
|
|
4135
|
-
onRunStarted: () => {
|
|
4136
|
-
},
|
|
4137
|
-
onSaved: (A) => {
|
|
4138
|
-
M(A), ne();
|
|
4139
|
-
},
|
|
4140
|
-
onMinimizeRun: ({ briefing: A, run: _ }) => {
|
|
4141
|
-
we({ briefing: A, run: _ }), E(!1);
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
)
|
|
4145
|
-
]
|
|
4146
|
-
}
|
|
4147
|
-
),
|
|
4148
|
-
ve && q && H ? /* @__PURE__ */ t(
|
|
4149
|
-
gs,
|
|
4150
|
-
{
|
|
4151
|
-
briefingId: ve.briefing.id,
|
|
4152
|
-
initialRun: ve.run,
|
|
4153
|
-
apiServiceUrl: q,
|
|
4154
|
-
token: H,
|
|
4155
|
-
onTerminal: (A) => {
|
|
4156
|
-
Ae({
|
|
4157
|
-
briefing: ve.briefing,
|
|
4158
|
-
run: A
|
|
4159
|
-
}), we(null), ne();
|
|
4160
|
-
},
|
|
4161
|
-
onTimeout: () => {
|
|
4162
|
-
we(null), ne();
|
|
4163
|
-
},
|
|
4164
|
-
onExpand: () => {
|
|
4165
|
-
M(ve.briefing), y("author"), we(null), E(!0);
|
|
4166
|
-
}
|
|
4167
|
-
}
|
|
4168
|
-
) : null,
|
|
4169
|
-
se ? /* @__PURE__ */ t("div", { className: "fixed bottom-4 right-4 z-50 w-[360px]", children: /* @__PURE__ */ t(
|
|
4170
|
-
ba,
|
|
4171
|
-
{
|
|
4172
|
-
title: se.run.status === "SUCCESS" ? `${se.briefing.name} is ready` : `${se.briefing.name} run failed`,
|
|
4173
|
-
durationSeconds: se.run.startedAt && se.run.completedAt ? Math.max(
|
|
4174
|
-
0,
|
|
4175
|
-
Math.floor(
|
|
4176
|
-
(new Date(se.run.completedAt).getTime() - new Date(se.run.startedAt).getTime()) / 1e3
|
|
4177
|
-
)
|
|
4178
|
-
) : null,
|
|
4179
|
-
status: se.run.status === "SUCCESS" ? "success" : "failed",
|
|
4180
|
-
onView: () => {
|
|
4181
|
-
M(se.briefing), y("author"), Ae(null), E(!0);
|
|
4182
|
-
},
|
|
4183
|
-
onDismiss: () => Ae(null)
|
|
4184
|
-
}
|
|
4185
|
-
) }) : null,
|
|
4186
|
-
/* @__PURE__ */ t(
|
|
4187
|
-
pt,
|
|
4188
|
-
{
|
|
4189
|
-
open: !!L,
|
|
4190
|
-
onOpenChange: (A) => {
|
|
4191
|
-
A || ae(null);
|
|
4192
|
-
},
|
|
4193
|
-
children: /* @__PURE__ */ i(ft, { children: [
|
|
4194
|
-
/* @__PURE__ */ i(gt, { children: [
|
|
4195
|
-
/* @__PURE__ */ i(bt, { children: [
|
|
4196
|
-
"Delete",
|
|
4197
|
-
" ",
|
|
4198
|
-
L ? me(L).noun : "briefing",
|
|
4199
|
-
"?"
|
|
4200
|
-
] }),
|
|
4201
|
-
/* @__PURE__ */ i(vt, { children: [
|
|
4202
|
-
"This permanently deletes ",
|
|
4203
|
-
/* @__PURE__ */ t("strong", { children: L == null ? void 0 : L.name }),
|
|
4204
|
-
". Recipients will stop receiving it."
|
|
4205
|
-
] })
|
|
4206
|
-
] }),
|
|
4207
|
-
/* @__PURE__ */ i(xt, { children: [
|
|
4208
|
-
/* @__PURE__ */ t(yt, { children: "Cancel" }),
|
|
4209
|
-
/* @__PURE__ */ i(
|
|
4210
|
-
jt,
|
|
4211
|
-
{
|
|
4212
|
-
className: "bg-destructive/90 hover:bg-destructive",
|
|
4213
|
-
onClick: fe,
|
|
4214
|
-
children: [
|
|
4215
|
-
"Delete",
|
|
4216
|
-
" ",
|
|
4217
|
-
L ? me(L).noun : "briefing"
|
|
4218
|
-
]
|
|
4219
|
-
}
|
|
4220
|
-
)
|
|
4221
|
-
] })
|
|
4222
|
-
] })
|
|
4223
|
-
}
|
|
4224
|
-
)
|
|
4225
|
-
] }) : null;
|
|
4226
|
-
}
|
|
4227
|
-
function vs() {
|
|
4228
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
4229
|
-
}
|
|
4230
|
-
export {
|
|
4231
|
-
Ks as A,
|
|
4232
|
-
_n as D,
|
|
4233
|
-
Bn as E,
|
|
4234
|
-
eo as N,
|
|
4235
|
-
Xs as U,
|
|
4236
|
-
Hs as V,
|
|
4237
|
-
Zn as W,
|
|
4238
|
-
Qs as a,
|
|
4239
|
-
Rn as b,
|
|
4240
|
-
Ys as c,
|
|
4241
|
-
Js as d,
|
|
4242
|
-
$n as e,
|
|
4243
|
-
Hn as f,
|
|
4244
|
-
to as g,
|
|
4245
|
-
ro as h,
|
|
4246
|
-
Zs as i,
|
|
4247
|
-
Gs as u
|
|
4248
|
-
};
|