react-semaphor 0.1.311 → 0.1.313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/chunks/{braces-DwaAt32i.js → braces-NfG5hX2c.js} +1 -1
- package/dist/chunks/{braces-CSECDaJQ.js → braces-raPCNcS4.js} +1 -1
- package/dist/chunks/{chevrons-up-down-DJhB8JNW.js → chevrons-up-down-BYzO4q5w.js} +1 -1
- package/dist/chunks/{chevrons-up-down-3vBEM7eI.js → chevrons-up-down-DiWloubI.js} +1 -1
- package/dist/chunks/dashboard-controls-DMsmUQkB.js +2043 -0
- package/dist/chunks/dashboard-controls-wPVXTTiH.js +57 -0
- package/dist/chunks/dashboard-filter-controls-launcher-CqXgWEa1.js +1540 -0
- package/dist/chunks/dashboard-filter-controls-launcher-DBmNn4EY.js +11 -0
- package/dist/chunks/{dashboard-json-GL_IXTCk.js → dashboard-json-CHoCrAp0.js} +2 -2
- package/dist/chunks/{dashboard-json-B_rQbUUz.js → dashboard-json-DMFZLkws.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CcszMc1A.js → dashboard-summary-settings-dialog-CZkn4rtm.js} +3 -3
- package/dist/chunks/{dashboard-summary-settings-dialog-DgqFlYl9.js → dashboard-summary-settings-dialog-DoxcpXjk.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-nGSsSTYx.js → edit-dashboard-visual-B0Ae_O25.js} +4534 -4470
- package/dist/chunks/edit-dashboard-visual-CIP9G-Bu.js +183 -0
- package/dist/chunks/{index-9v7DehZd.js → index-D7e2Eyp_.js} +34869 -34317
- package/dist/chunks/{index-CGCrm-dj.js → index-DjZqoaV5.js} +228 -228
- package/dist/chunks/{palette-CI2J34i6.js → palette-7yJYVEvk.js} +1 -1
- package/dist/chunks/{palette-C5o9bLo6.js → palette-CJTdBzJB.js} +1 -1
- package/dist/chunks/{resource-management-panel-CNmVHnCz.js → resource-management-panel-B1mhnY97.js} +1 -1
- package/dist/chunks/{resource-management-panel-DTg9_DI9.js → resource-management-panel-CSkNW3es.js} +3 -3
- package/dist/chunks/{save-CMv91_Hz.js → save-B8x5Vi0W.js} +1 -1
- package/dist/chunks/{save-Cpz6BWx9.js → save-DDX_vrED.js} +1 -1
- package/dist/chunks/{switch-Dhoqe3OE.js → switch-DEPWsRhf.js} +114 -113
- package/dist/chunks/{switch-otrSiyjH.js → switch-DPaKnsb8.js} +14 -14
- package/dist/chunks/use-create-flow-overlay-state-7LiC_vaL.js +16 -0
- package/dist/chunks/{use-create-flow-overlay-state-C8WGfC8T.js → use-create-flow-overlay-state-BHQjJwik.js} +511 -483
- package/dist/chunks/{use-visual-utils-BeJ73yvV.js → use-visual-utils-Bz7kjSrk.js} +1 -1
- package/dist/chunks/{use-visual-utils-RkPa2gqQ.js → use-visual-utils-Dw-uLgop.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +76 -74
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +1 -1
- package/dist/types/main.d.ts +76 -23
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/surfboard.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CeKjYa7s.js +0 -2274
- package/dist/chunks/dashboard-controls-Ds8Hmo3Q.js +0 -57
- package/dist/chunks/dashboard-filter-controls-button-CWL2jJcu.js +0 -11
- package/dist/chunks/dashboard-filter-controls-button-Tk5lhwVV.js +0 -1116
- package/dist/chunks/edit-dashboard-visual-Bu2rxJjm.js +0 -183
- package/dist/chunks/use-create-flow-overlay-state-DiH6M1Cd.js +0 -16
|
@@ -1,2274 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as c, Fragment as T } from "react/jsx-runtime";
|
|
2
|
-
import { c as j, u as N, B as L, aC as wt, m as Nt, L as dt, I as ue, a as Y, aD as Re, aE as da, aF as ua, E as ls, f as X, aG as ds, aH as us, aI as ut, T as ma, q as ha, r as _e, t as Ue, s as mt, aJ as pa, aK as ms, n as ta, z as hs, A as ps, D as fs, F as gs, K as vs, aL as bs } from "./switch-Dhoqe3OE.js";
|
|
3
|
-
import { c4 as ys, u as K, b as Ge, c5 as xs, bk as ht, c as $e, d as Ve, e as qe, f as St, n as ws, c6 as de, bx as Te, c7 as Ns, c8 as aa, c9 as fa, ca as ga, cb as Ss, bN as Dt, cc as Ds, cd as Cs, ce as Es, cf as Is, cg as Ms, ch as Ls, q as ze, M as He, o as M, bU as As, ci as ks, cj as Os, bR as pt, ck as ft, bw as Ct, bb as va, b9 as ba, cl as Ps, bE as ya, bF as xa, bG as wa, bH as Na, bI as Sa, bJ as Da, bK as Ca, bL as gt, cm as Ts, cn as _s, co as Us, bo as Fs, cp as Rs, cq as Gs, W as $s, V as Oe, cr as Vs, a0 as qs, X as nt, cs as zs, ct as Hs, cu as Bs, ac as js, cv as Ks, I as rt, cw as Qs, cx as Ws, cy as Js, c3 as Ys, bp as Xs, bq as Zs, br as en, bs as tn, bt as $, bY as an, K as sn, bz as nn, cz as rn, bu as sa, cA as on, cB as cn, cC as ln, $ as dn, L as un, cD as mn, H as vt } from "./index-9v7DehZd.js";
|
|
4
|
-
import * as A from "react";
|
|
5
|
-
import Ea, { useState as w, useMemo as F, useCallback as Fe, useEffect as ot } from "react";
|
|
6
|
-
import "./index-CJdxSyQq.js";
|
|
7
|
-
import "react-dom";
|
|
8
|
-
import { b as hn, u as pn, A as fn, V as gn, c as vn, D as bn, N as yn, U as xn } from "./dashboard-filter-controls-button-Tk5lhwVV.js";
|
|
9
|
-
import { d as wn } from "./index-DFOb_6HB.js";
|
|
10
|
-
import { C as Nn, D as Sn } from "./dashboard-summary-settings-dialog-CcszMc1A.js";
|
|
11
|
-
import { u as Dn } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
12
|
-
import { s as it } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
13
|
-
import { u as Cn, e as En } from "./use-create-flow-overlay-state-C8WGfC8T.js";
|
|
14
|
-
import { S as na } from "./save-Cpz6BWx9.js";
|
|
15
|
-
import { P as In } from "./palette-CI2J34i6.js";
|
|
16
|
-
import { B as Mn } from "./braces-CSECDaJQ.js";
|
|
17
|
-
/**
|
|
18
|
-
* @license lucide-react v0.453.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/
|
|
23
|
-
const Ln = j("Glasses", [
|
|
24
|
-
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
25
|
-
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
26
|
-
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
27
|
-
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
28
|
-
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
29
|
-
]);
|
|
30
|
-
/**
|
|
31
|
-
* @license lucide-react v0.453.0 - ISC
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the ISC license.
|
|
34
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/
|
|
36
|
-
const An = j("Menu", [
|
|
37
|
-
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
38
|
-
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
39
|
-
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* @license lucide-react v0.453.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/
|
|
47
|
-
const kn = j("Monitor", [
|
|
48
|
-
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
49
|
-
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
50
|
-
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
51
|
-
]);
|
|
52
|
-
/**
|
|
53
|
-
* @license lucide-react v0.453.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/
|
|
58
|
-
const On = j("Moon", [
|
|
59
|
-
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
60
|
-
]);
|
|
61
|
-
/**
|
|
62
|
-
* @license lucide-react v0.453.0 - ISC
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the ISC license.
|
|
65
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/
|
|
67
|
-
const Pn = j("ShieldX", [
|
|
68
|
-
[
|
|
69
|
-
"path",
|
|
70
|
-
{
|
|
71
|
-
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
72
|
-
key: "oel41y"
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
|
|
76
|
-
["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
|
|
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 Tn = j("Sun", [
|
|
85
|
-
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
86
|
-
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
87
|
-
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
88
|
-
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
89
|
-
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
90
|
-
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
91
|
-
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
92
|
-
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
93
|
-
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
94
|
-
]);
|
|
95
|
-
/**
|
|
96
|
-
* @license lucide-react v0.453.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/
|
|
101
|
-
const _n = j("Undo2", [
|
|
102
|
-
["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
|
|
103
|
-
["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
|
|
104
|
-
]);
|
|
105
|
-
/**
|
|
106
|
-
* @license lucide-react v0.453.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/
|
|
111
|
-
const bt = j("UserPlus", [
|
|
112
|
-
["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
|
|
113
|
-
["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
|
|
114
|
-
["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
|
|
115
|
-
["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
|
|
116
|
-
]);
|
|
117
|
-
var yt = { exports: {} }, ct = {};
|
|
118
|
-
/**
|
|
119
|
-
* @license React
|
|
120
|
-
* use-sync-external-store-shim.production.js
|
|
121
|
-
*
|
|
122
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the MIT license found in the
|
|
125
|
-
* LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/
|
|
127
|
-
var ra;
|
|
128
|
-
function Un() {
|
|
129
|
-
if (ra) return ct;
|
|
130
|
-
ra = 1;
|
|
131
|
-
var t = Ea;
|
|
132
|
-
function a(f, h) {
|
|
133
|
-
return f === h && (f !== 0 || 1 / f === 1 / h) || f !== f && h !== h;
|
|
134
|
-
}
|
|
135
|
-
var n = typeof Object.is == "function" ? Object.is : a, s = t.useState, i = t.useEffect, u = t.useLayoutEffect, l = t.useDebugValue;
|
|
136
|
-
function p(f, h) {
|
|
137
|
-
var d = h(), r = s({ inst: { value: d, getSnapshot: h } }), b = r[0].inst, D = r[1];
|
|
138
|
-
return u(
|
|
139
|
-
function() {
|
|
140
|
-
b.value = d, b.getSnapshot = h, g(b) && D({ inst: b });
|
|
141
|
-
},
|
|
142
|
-
[f, d, h]
|
|
143
|
-
), i(
|
|
144
|
-
function() {
|
|
145
|
-
return g(b) && D({ inst: b }), f(function() {
|
|
146
|
-
g(b) && D({ inst: b });
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
[f]
|
|
150
|
-
), l(d), d;
|
|
151
|
-
}
|
|
152
|
-
function g(f) {
|
|
153
|
-
var h = f.getSnapshot;
|
|
154
|
-
f = f.value;
|
|
155
|
-
try {
|
|
156
|
-
var d = h();
|
|
157
|
-
return !n(f, d);
|
|
158
|
-
} catch {
|
|
159
|
-
return !0;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function v(f, h) {
|
|
163
|
-
return h();
|
|
164
|
-
}
|
|
165
|
-
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : p;
|
|
166
|
-
return ct.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : m, ct;
|
|
167
|
-
}
|
|
168
|
-
var lt = {};
|
|
169
|
-
/**
|
|
170
|
-
* @license React
|
|
171
|
-
* use-sync-external-store-shim.development.js
|
|
172
|
-
*
|
|
173
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
174
|
-
*
|
|
175
|
-
* This source code is licensed under the MIT license found in the
|
|
176
|
-
* LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/
|
|
178
|
-
var oa;
|
|
179
|
-
function Fn() {
|
|
180
|
-
return oa || (oa = 1, process.env.NODE_ENV !== "production" && function() {
|
|
181
|
-
function t(d, r) {
|
|
182
|
-
return d === r && (d !== 0 || 1 / d === 1 / r) || d !== d && r !== r;
|
|
183
|
-
}
|
|
184
|
-
function a(d, r) {
|
|
185
|
-
m || i.startTransition === void 0 || (m = !0, console.error(
|
|
186
|
-
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
187
|
-
));
|
|
188
|
-
var b = r();
|
|
189
|
-
if (!f) {
|
|
190
|
-
var D = r();
|
|
191
|
-
u(b, D) || (console.error(
|
|
192
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
193
|
-
), f = !0);
|
|
194
|
-
}
|
|
195
|
-
D = l({
|
|
196
|
-
inst: { value: b, getSnapshot: r }
|
|
197
|
-
});
|
|
198
|
-
var S = D[0].inst, C = D[1];
|
|
199
|
-
return g(
|
|
200
|
-
function() {
|
|
201
|
-
S.value = b, S.getSnapshot = r, n(S) && C({ inst: S });
|
|
202
|
-
},
|
|
203
|
-
[d, b, r]
|
|
204
|
-
), p(
|
|
205
|
-
function() {
|
|
206
|
-
return n(S) && C({ inst: S }), d(function() {
|
|
207
|
-
n(S) && C({ inst: S });
|
|
208
|
-
});
|
|
209
|
-
},
|
|
210
|
-
[d]
|
|
211
|
-
), v(b), b;
|
|
212
|
-
}
|
|
213
|
-
function n(d) {
|
|
214
|
-
var r = d.getSnapshot;
|
|
215
|
-
d = d.value;
|
|
216
|
-
try {
|
|
217
|
-
var b = r();
|
|
218
|
-
return !u(d, b);
|
|
219
|
-
} catch {
|
|
220
|
-
return !0;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function s(d, r) {
|
|
224
|
-
return r();
|
|
225
|
-
}
|
|
226
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
227
|
-
var i = Ea, u = typeof Object.is == "function" ? Object.is : t, l = i.useState, p = i.useEffect, g = i.useLayoutEffect, v = i.useDebugValue, m = !1, f = !1, h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : a;
|
|
228
|
-
lt.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : h, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
229
|
-
}()), lt;
|
|
230
|
-
}
|
|
231
|
-
process.env.NODE_ENV === "production" ? yt.exports = Un() : yt.exports = Fn();
|
|
232
|
-
var Rn = yt.exports;
|
|
233
|
-
const Pe = ["light", "dark", "system"];
|
|
234
|
-
function Gn() {
|
|
235
|
-
const { theme: t, setTheme: a } = ys(), n = N(
|
|
236
|
-
(l) => l.actions.setDashboardTheme
|
|
237
|
-
);
|
|
238
|
-
function s() {
|
|
239
|
-
const l = Pe.includes(t) ? t : "system", p = Pe[(Pe.indexOf(l) + 1) % Pe.length];
|
|
240
|
-
a(p), n(p);
|
|
241
|
-
}
|
|
242
|
-
const i = t === "light" ? Tn : t === "dark" ? On : kn, u = t === "light" ? "Theme: light (click for dark)" : t === "dark" ? "Theme: dark (click for system)" : "Theme: system (click for light)";
|
|
243
|
-
return /* @__PURE__ */ e(
|
|
244
|
-
L,
|
|
245
|
-
{
|
|
246
|
-
type: "button",
|
|
247
|
-
variant: "ghost",
|
|
248
|
-
size: "xs",
|
|
249
|
-
className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
|
|
250
|
-
onClick: s,
|
|
251
|
-
"aria-label": u,
|
|
252
|
-
title: u,
|
|
253
|
-
children: /* @__PURE__ */ e(i, { className: "h-3.5 w-3.5", strokeWidth: 1.5 })
|
|
254
|
-
}
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
async function $n(t, a, n, s, i) {
|
|
258
|
-
if (!i)
|
|
259
|
-
return null;
|
|
260
|
-
const u = JSON.stringify(n), l = `${t}/v1/lens`;
|
|
261
|
-
return await wt(l, i, {
|
|
262
|
-
name: a,
|
|
263
|
-
template: u,
|
|
264
|
-
filterValues: s,
|
|
265
|
-
operation: "create"
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
async function xt(t, a, n) {
|
|
269
|
-
if (!n)
|
|
270
|
-
return null;
|
|
271
|
-
const { id: s, template: i, filterValues: u, isDefault: l, shared: p } = a, g = `${t}/v1/lens`;
|
|
272
|
-
return await wt(g, n, {
|
|
273
|
-
lensId: s,
|
|
274
|
-
template: i,
|
|
275
|
-
filterValues: u,
|
|
276
|
-
isDefault: l,
|
|
277
|
-
shared: p,
|
|
278
|
-
operation: "update"
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
async function Vn(t, a, n) {
|
|
282
|
-
if (!n)
|
|
283
|
-
return null;
|
|
284
|
-
const s = `${t}/v1/lens`;
|
|
285
|
-
return await wt(s, n, {
|
|
286
|
-
operation: "delete",
|
|
287
|
-
lensId: a
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
const qn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
291
|
-
function zn({
|
|
292
|
-
open: t,
|
|
293
|
-
onOpenChange: a
|
|
294
|
-
} = {}) {
|
|
295
|
-
const [n, s] = w(""), [i, u] = w(!1), l = N((I) => I.lenses), { setLenses: p, setSelectedLensId: g } = Nt(), [v, m] = w(!1), [f, h] = w(!1), d = t !== void 0, r = d ? t : f, b = (I) => {
|
|
296
|
-
d || h(I), a == null || a(I);
|
|
297
|
-
}, D = N((I) => I.dashboard), S = N((I) => I.filterValues), { authToken: C, tokenProps: E } = K();
|
|
298
|
-
async function k() {
|
|
299
|
-
m(!0);
|
|
300
|
-
const I = await $n(
|
|
301
|
-
E.apiServiceUrl,
|
|
302
|
-
n,
|
|
303
|
-
D,
|
|
304
|
-
S,
|
|
305
|
-
C == null ? void 0 : C.accessToken
|
|
306
|
-
);
|
|
307
|
-
I && (p([...l || [], I]), g(I.id), b(!1)), m(!1);
|
|
308
|
-
}
|
|
309
|
-
return /* @__PURE__ */ c(Ge, { open: r, onOpenChange: b, children: [
|
|
310
|
-
d ? null : /* @__PURE__ */ e(xs, { asChild: !0, children: /* @__PURE__ */ c(L, { variant: "secondary", size: "xs", children: [
|
|
311
|
-
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
312
|
-
"Lens"
|
|
313
|
-
] }) }),
|
|
314
|
-
/* @__PURE__ */ c($e, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
|
|
315
|
-
/* @__PURE__ */ c(Ve, { children: [
|
|
316
|
-
/* @__PURE__ */ e(qe, { className: "text-[15px]", children: "Create lens" }),
|
|
317
|
-
/* @__PURE__ */ e(St, { className: "text-[13px] leading-5", children: "Lenses are private by default and are only visible to you." })
|
|
318
|
-
] }),
|
|
319
|
-
/* @__PURE__ */ c("div", { className: "space-y-1.5 py-1", children: [
|
|
320
|
-
/* @__PURE__ */ e(dt, { htmlFor: "lens-name", className: qn, children: "Name" }),
|
|
321
|
-
/* @__PURE__ */ e(
|
|
322
|
-
ue,
|
|
323
|
-
{
|
|
324
|
-
id: "lens-name",
|
|
325
|
-
size: "xs",
|
|
326
|
-
value: n,
|
|
327
|
-
placeholder: "Monthly review, West region, …",
|
|
328
|
-
onChange: (I) => s(I.target.value)
|
|
329
|
-
}
|
|
330
|
-
),
|
|
331
|
-
i && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: "A lens with this name already exists. Pick a different one." })
|
|
332
|
-
] }),
|
|
333
|
-
/* @__PURE__ */ c(ws, { children: [
|
|
334
|
-
/* @__PURE__ */ e(L, { variant: "outline", size: "xs", onClick: () => b(!1), children: "Cancel" }),
|
|
335
|
-
/* @__PURE__ */ e(
|
|
336
|
-
L,
|
|
337
|
-
{
|
|
338
|
-
size: "xs",
|
|
339
|
-
type: "submit",
|
|
340
|
-
onClick: k,
|
|
341
|
-
disabled: v || !n.trim(),
|
|
342
|
-
children: v ? "Creating…" : "Create"
|
|
343
|
-
}
|
|
344
|
-
)
|
|
345
|
-
] })
|
|
346
|
-
] })
|
|
347
|
-
] });
|
|
348
|
-
}
|
|
349
|
-
function Hn({ includeLabel: t = !1 } = {}) {
|
|
350
|
-
const a = N((m) => m.lenses), n = N((m) => m.selectedLensId), { setLenses: s, setSelectedLensId: i } = Nt(), { authToken: u, tokenProps: l } = K();
|
|
351
|
-
async function p(m) {
|
|
352
|
-
i(m);
|
|
353
|
-
}
|
|
354
|
-
async function g(m) {
|
|
355
|
-
if (await Vn(l.apiServiceUrl, m, u == null ? void 0 : u.accessToken)) {
|
|
356
|
-
const h = a == null ? void 0 : a.filter((d) => d.id !== m);
|
|
357
|
-
s(h || []), i("original");
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
async function v(m) {
|
|
361
|
-
const f = a == null ? void 0 : a.map((r) => r.id === m.id ? {
|
|
362
|
-
...r,
|
|
363
|
-
isDefault: !m.isDefault
|
|
364
|
-
} : {
|
|
365
|
-
...r,
|
|
366
|
-
isDefault: !1
|
|
367
|
-
});
|
|
368
|
-
s(f || []);
|
|
369
|
-
const h = {
|
|
370
|
-
...m,
|
|
371
|
-
isDefault: !m.isDefault
|
|
372
|
-
};
|
|
373
|
-
await xt(l.apiServiceUrl, h, u == null ? void 0 : u.accessToken);
|
|
374
|
-
const d = a == null ? void 0 : a.find((r) => r.isDefault);
|
|
375
|
-
if (d && d.id !== m.id) {
|
|
376
|
-
const r = {
|
|
377
|
-
...d,
|
|
378
|
-
isDefault: !1
|
|
379
|
-
};
|
|
380
|
-
await xt(l.apiServiceUrl, r, u == null ? void 0 : u.accessToken);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return /* @__PURE__ */ c(T, { children: [
|
|
384
|
-
t ? /* @__PURE__ */ c(T, { children: [
|
|
385
|
-
/* @__PURE__ */ e(de, { className: "px-3", children: "Lenses" }),
|
|
386
|
-
/* @__PURE__ */ e(Te, {})
|
|
387
|
-
] }) : null,
|
|
388
|
-
/* @__PURE__ */ c(
|
|
389
|
-
Ns,
|
|
390
|
-
{
|
|
391
|
-
value: n,
|
|
392
|
-
onValueChange: p,
|
|
393
|
-
children: [
|
|
394
|
-
/* @__PURE__ */ e(aa, { value: "original", children: "Original" }),
|
|
395
|
-
a == null ? void 0 : a.map((m) => /* @__PURE__ */ c(
|
|
396
|
-
aa,
|
|
397
|
-
{
|
|
398
|
-
className: "group flex justify-between gap-2",
|
|
399
|
-
value: m.id,
|
|
400
|
-
children: [
|
|
401
|
-
/* @__PURE__ */ e("p", { children: m.name }),
|
|
402
|
-
/* @__PURE__ */ c("span", { className: "flex items-center gap-3", children: [
|
|
403
|
-
/* @__PURE__ */ e(
|
|
404
|
-
fa,
|
|
405
|
-
{
|
|
406
|
-
onClick: (f) => {
|
|
407
|
-
f.preventDefault(), v(m);
|
|
408
|
-
},
|
|
409
|
-
className: Y(
|
|
410
|
-
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
411
|
-
{
|
|
412
|
-
invisible: !m.isDefault,
|
|
413
|
-
"text-green-500": m.isDefault
|
|
414
|
-
}
|
|
415
|
-
),
|
|
416
|
-
strokeWidth: 1.5
|
|
417
|
-
}
|
|
418
|
-
),
|
|
419
|
-
/* @__PURE__ */ e(
|
|
420
|
-
ga,
|
|
421
|
-
{
|
|
422
|
-
onClick: (f) => {
|
|
423
|
-
f.preventDefault(), g(m.id);
|
|
424
|
-
},
|
|
425
|
-
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
426
|
-
strokeWidth: 1.5
|
|
427
|
-
}
|
|
428
|
-
)
|
|
429
|
-
] })
|
|
430
|
-
]
|
|
431
|
-
},
|
|
432
|
-
m.id
|
|
433
|
-
))
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
] });
|
|
438
|
-
}
|
|
439
|
-
function Bn() {
|
|
440
|
-
const { displayPreferences: t, shouldShowElement: a } = Ss(), { currentUser: n, userContext: s } = Dt(), i = F(
|
|
441
|
-
() => Ds(n),
|
|
442
|
-
[n]
|
|
443
|
-
), u = F(() => (p) => i && i[p] !== void 0 && i[p] === !1 ? !1 : a(p), [i, a, t]), l = F(
|
|
444
|
-
() => {
|
|
445
|
-
var p, g, v, m, f;
|
|
446
|
-
return {
|
|
447
|
-
canEdit: ((p = s == null ? void 0 : s.permissions) == null ? void 0 : p.canEdit) ?? Ls(n),
|
|
448
|
-
canUseFilters: ((g = s == null ? void 0 : s.permissions) == null ? void 0 : g.canEdit) ?? Ms(n),
|
|
449
|
-
canManageDashboards: ((v = s == null ? void 0 : s.permissions) == null ? void 0 : v.canCreateDashboard) ?? Is(n),
|
|
450
|
-
canCreateDashboards: ((m = s == null ? void 0 : s.permissions) == null ? void 0 : m.canCreateDashboard) ?? Es(n),
|
|
451
|
-
canAccessVisuals: ((f = s == null ? void 0 : s.permissions) == null ? void 0 : f.canEdit) ?? Cs(n)
|
|
452
|
-
};
|
|
453
|
-
},
|
|
454
|
-
[n, s]
|
|
455
|
-
);
|
|
456
|
-
return {
|
|
457
|
-
displayPreferences: t,
|
|
458
|
-
shouldShowElement: u,
|
|
459
|
-
permissions: l,
|
|
460
|
-
currentUser: n
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
const jn = async (t, a, n) => {
|
|
464
|
-
const s = `${t}/management/v1/groups`;
|
|
465
|
-
return await ua(s, a, n);
|
|
466
|
-
}, Kn = async (t, a, n) => {
|
|
467
|
-
const s = `${t}/management/v1/groups/${n}`;
|
|
468
|
-
await da(s, a, "DELETE");
|
|
469
|
-
}, Qn = async (t, a, n, s) => {
|
|
470
|
-
const i = `${t}/management/v1/groups/${n}/members`;
|
|
471
|
-
return await ua(i, a, s);
|
|
472
|
-
}, Wn = async (t, a, n, s) => {
|
|
473
|
-
const i = `${t}/management/v1/groups/${n}/members`;
|
|
474
|
-
await da(i, a, "DELETE", s);
|
|
475
|
-
};
|
|
476
|
-
function Jn() {
|
|
477
|
-
const { authToken: t, tokenProps: a } = K(), n = ze();
|
|
478
|
-
return He({
|
|
479
|
-
mutationFn: (s) => jn(a.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", s),
|
|
480
|
-
onSuccess: () => {
|
|
481
|
-
n.invalidateQueries({ queryKey: ["groups"] }), M.success("Group created successfully");
|
|
482
|
-
},
|
|
483
|
-
onError: (s) => {
|
|
484
|
-
console.error("Failed to create group:", s), M.error("Failed to create group", {
|
|
485
|
-
description: Re(s, "Failed to create group")
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
function Yn() {
|
|
491
|
-
const { authToken: t, tokenProps: a } = K(), n = ze();
|
|
492
|
-
return He({
|
|
493
|
-
mutationFn: (s) => Kn(a.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", s),
|
|
494
|
-
onSuccess: (s, i) => {
|
|
495
|
-
n.invalidateQueries({ queryKey: ["groups"] }), n.removeQueries({ queryKey: ["group", i] }), M.success("Group deleted successfully");
|
|
496
|
-
},
|
|
497
|
-
onError: (s) => {
|
|
498
|
-
console.error("Failed to delete group:", s), M.error("Failed to delete group", {
|
|
499
|
-
description: Re(s, "Failed to delete group")
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
function Xn() {
|
|
505
|
-
const { authToken: t, tokenProps: a } = K(), n = ze();
|
|
506
|
-
return He({
|
|
507
|
-
mutationFn: ({
|
|
508
|
-
groupId: s,
|
|
509
|
-
data: i
|
|
510
|
-
}) => Qn(a.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", s, i),
|
|
511
|
-
onSuccess: (s, i) => {
|
|
512
|
-
n.invalidateQueries({ queryKey: ["group", i.groupId] }), n.invalidateQueries({
|
|
513
|
-
queryKey: ["group-members", i.groupId]
|
|
514
|
-
}), n.invalidateQueries({ queryKey: ["groups"] }), M.success("Members added successfully");
|
|
515
|
-
},
|
|
516
|
-
onError: (s) => {
|
|
517
|
-
console.error("Failed to add group members:", s), M.error("Failed to add members", {
|
|
518
|
-
description: Re(s, "Failed to add members")
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
function Zn() {
|
|
524
|
-
const { authToken: t, tokenProps: a } = K(), n = ze();
|
|
525
|
-
return He({
|
|
526
|
-
mutationFn: ({
|
|
527
|
-
groupId: s,
|
|
528
|
-
data: i
|
|
529
|
-
}) => Wn(a.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", s, i),
|
|
530
|
-
onSuccess: (s, i) => {
|
|
531
|
-
n.invalidateQueries({ queryKey: ["group", i.groupId] }), n.invalidateQueries({
|
|
532
|
-
queryKey: ["group-members", i.groupId]
|
|
533
|
-
}), n.invalidateQueries({ queryKey: ["groups"] }), M.success("Members removed successfully");
|
|
534
|
-
},
|
|
535
|
-
onError: (s) => {
|
|
536
|
-
console.error("Failed to remove group members:", s), M.error("Failed to remove members", {
|
|
537
|
-
description: Re(s, "Failed to remove members")
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
const ia = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
543
|
-
function er({
|
|
544
|
-
onSuccess: t,
|
|
545
|
-
tenantId: a,
|
|
546
|
-
isTenantUser: n
|
|
547
|
-
}) {
|
|
548
|
-
const [s, i] = w(""), [u, l] = w(""), [p, g] = w({}), v = Jn(), m = () => {
|
|
549
|
-
const h = {};
|
|
550
|
-
return s.trim() ? s.length < 3 ? h.name = "Group name must be at least 3 characters" : s.length > 50 && (h.name = "Group name must be less than 50 characters") : h.name = "Group name is required", u && u.length > 200 && (h.description = "Description must be less than 200 characters"), g(h), Object.keys(h).length === 0;
|
|
551
|
-
};
|
|
552
|
-
return /* @__PURE__ */ c("form", { onSubmit: async (h) => {
|
|
553
|
-
if (h.preventDefault(), !m()) return;
|
|
554
|
-
const d = {
|
|
555
|
-
name: s.trim(),
|
|
556
|
-
description: u.trim() || void 0,
|
|
557
|
-
type: n ? "TENANT_GROUP" : "ORG_GROUP",
|
|
558
|
-
...n && a ? { tenantId: a } : {}
|
|
559
|
-
};
|
|
560
|
-
try {
|
|
561
|
-
await v.mutateAsync(d), i(""), l(""), g({}), t();
|
|
562
|
-
} catch (r) {
|
|
563
|
-
console.error("Failed to create group:", r);
|
|
564
|
-
}
|
|
565
|
-
}, className: "space-y-4", children: [
|
|
566
|
-
/* @__PURE__ */ c("div", { className: "space-y-1.5", children: [
|
|
567
|
-
/* @__PURE__ */ c(dt, { htmlFor: "group-name", className: ia, children: [
|
|
568
|
-
"Group name ",
|
|
569
|
-
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
570
|
-
] }),
|
|
571
|
-
/* @__PURE__ */ e(
|
|
572
|
-
ue,
|
|
573
|
-
{
|
|
574
|
-
id: "group-name",
|
|
575
|
-
size: "xs",
|
|
576
|
-
placeholder: "e.g., Marketing Team, Engineering Squad",
|
|
577
|
-
value: s,
|
|
578
|
-
onChange: (h) => {
|
|
579
|
-
i(h.target.value), p.name && g((d) => ({ ...d, name: "" }));
|
|
580
|
-
},
|
|
581
|
-
className: p.name ? "border-destructive" : "",
|
|
582
|
-
disabled: v.isPending
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
p.name && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: p.name })
|
|
586
|
-
] }),
|
|
587
|
-
/* @__PURE__ */ c("div", { className: "space-y-1.5", children: [
|
|
588
|
-
/* @__PURE__ */ e(dt, { htmlFor: "group-description", className: ia, children: "Description (optional)" }),
|
|
589
|
-
/* @__PURE__ */ e(
|
|
590
|
-
As,
|
|
591
|
-
{
|
|
592
|
-
id: "group-description",
|
|
593
|
-
placeholder: "Describe the purpose of this group…",
|
|
594
|
-
value: u,
|
|
595
|
-
onChange: (h) => {
|
|
596
|
-
l(h.target.value), p.description && g((d) => ({ ...d, description: "" }));
|
|
597
|
-
},
|
|
598
|
-
className: `text-[13px] ${p.description ? "border-destructive" : ""}`,
|
|
599
|
-
disabled: v.isPending,
|
|
600
|
-
rows: 3
|
|
601
|
-
}
|
|
602
|
-
),
|
|
603
|
-
p.description ? /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: p.description }) : /* @__PURE__ */ c("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
604
|
-
u.length,
|
|
605
|
-
"/200"
|
|
606
|
-
] })
|
|
607
|
-
] }),
|
|
608
|
-
/* @__PURE__ */ c("div", { className: "flex gap-2 text-[12px] text-muted-foreground", children: [
|
|
609
|
-
/* @__PURE__ */ e(ls, { className: "h-3.5 w-3.5 shrink-0 mt-0.5" }),
|
|
610
|
-
/* @__PURE__ */ e("p", { children: "This group will be accessible to users in your workspace. You can add members after creating it." })
|
|
611
|
-
] }),
|
|
612
|
-
/* @__PURE__ */ c("div", { className: "flex justify-end gap-1.5 pt-1", children: [
|
|
613
|
-
/* @__PURE__ */ e(
|
|
614
|
-
L,
|
|
615
|
-
{
|
|
616
|
-
type: "button",
|
|
617
|
-
variant: "outline",
|
|
618
|
-
size: "xs",
|
|
619
|
-
onClick: () => {
|
|
620
|
-
i(""), l(""), g({});
|
|
621
|
-
},
|
|
622
|
-
disabled: v.isPending,
|
|
623
|
-
children: "Clear"
|
|
624
|
-
}
|
|
625
|
-
),
|
|
626
|
-
/* @__PURE__ */ e(
|
|
627
|
-
L,
|
|
628
|
-
{
|
|
629
|
-
type: "submit",
|
|
630
|
-
size: "xs",
|
|
631
|
-
disabled: v.isPending || !s.trim(),
|
|
632
|
-
children: v.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
633
|
-
/* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
634
|
-
"Creating…"
|
|
635
|
-
] }) : "Create group"
|
|
636
|
-
}
|
|
637
|
-
)
|
|
638
|
-
] })
|
|
639
|
-
] });
|
|
640
|
-
}
|
|
641
|
-
function tr(t, a = []) {
|
|
642
|
-
let n = [];
|
|
643
|
-
function s(u, l) {
|
|
644
|
-
const p = A.createContext(l);
|
|
645
|
-
p.displayName = u + "Context";
|
|
646
|
-
const g = n.length;
|
|
647
|
-
n = [...n, l];
|
|
648
|
-
const v = (f) => {
|
|
649
|
-
var S;
|
|
650
|
-
const { scope: h, children: d, ...r } = f, b = ((S = h == null ? void 0 : h[t]) == null ? void 0 : S[g]) || p, D = A.useMemo(() => r, Object.values(r));
|
|
651
|
-
return /* @__PURE__ */ e(b.Provider, { value: D, children: d });
|
|
652
|
-
};
|
|
653
|
-
v.displayName = u + "Provider";
|
|
654
|
-
function m(f, h) {
|
|
655
|
-
var b;
|
|
656
|
-
const d = ((b = h == null ? void 0 : h[t]) == null ? void 0 : b[g]) || p, r = A.useContext(d);
|
|
657
|
-
if (r) return r;
|
|
658
|
-
if (l !== void 0) return l;
|
|
659
|
-
throw new Error(`\`${f}\` must be used within \`${u}\``);
|
|
660
|
-
}
|
|
661
|
-
return [v, m];
|
|
662
|
-
}
|
|
663
|
-
const i = () => {
|
|
664
|
-
const u = n.map((l) => A.createContext(l));
|
|
665
|
-
return function(p) {
|
|
666
|
-
const g = (p == null ? void 0 : p[t]) || u;
|
|
667
|
-
return A.useMemo(
|
|
668
|
-
() => ({ [`__scope${t}`]: { ...p, [t]: g } }),
|
|
669
|
-
[p, g]
|
|
670
|
-
);
|
|
671
|
-
};
|
|
672
|
-
};
|
|
673
|
-
return i.scopeName = t, [s, ar(i, ...a)];
|
|
674
|
-
}
|
|
675
|
-
function ar(...t) {
|
|
676
|
-
const a = t[0];
|
|
677
|
-
if (t.length === 1) return a;
|
|
678
|
-
const n = () => {
|
|
679
|
-
const s = t.map((i) => ({
|
|
680
|
-
useScope: i(),
|
|
681
|
-
scopeName: i.scopeName
|
|
682
|
-
}));
|
|
683
|
-
return function(u) {
|
|
684
|
-
const l = s.reduce((p, { useScope: g, scopeName: v }) => {
|
|
685
|
-
const f = g(u)[`__scope${v}`];
|
|
686
|
-
return { ...p, ...f };
|
|
687
|
-
}, {});
|
|
688
|
-
return A.useMemo(() => ({ [`__scope${a.scopeName}`]: l }), [l]);
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
return n.scopeName = a.scopeName, n;
|
|
692
|
-
}
|
|
693
|
-
var sr = [
|
|
694
|
-
"a",
|
|
695
|
-
"button",
|
|
696
|
-
"div",
|
|
697
|
-
"form",
|
|
698
|
-
"h2",
|
|
699
|
-
"h3",
|
|
700
|
-
"img",
|
|
701
|
-
"input",
|
|
702
|
-
"label",
|
|
703
|
-
"li",
|
|
704
|
-
"nav",
|
|
705
|
-
"ol",
|
|
706
|
-
"p",
|
|
707
|
-
"select",
|
|
708
|
-
"span",
|
|
709
|
-
"svg",
|
|
710
|
-
"ul"
|
|
711
|
-
], Et = sr.reduce((t, a) => {
|
|
712
|
-
const n = ds(`Primitive.${a}`), s = A.forwardRef((i, u) => {
|
|
713
|
-
const { asChild: l, ...p } = i, g = l ? n : a;
|
|
714
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(g, { ...p, ref: u });
|
|
715
|
-
});
|
|
716
|
-
return s.displayName = `Primitive.${a}`, { ...t, [a]: s };
|
|
717
|
-
}, {});
|
|
718
|
-
function nr() {
|
|
719
|
-
return Rn.useSyncExternalStore(
|
|
720
|
-
rr,
|
|
721
|
-
() => !0,
|
|
722
|
-
() => !1
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
function rr() {
|
|
726
|
-
return () => {
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
var It = "Avatar", [or] = tr(It), [ir, Ia] = or(It), Ma = A.forwardRef(
|
|
730
|
-
(t, a) => {
|
|
731
|
-
const { __scopeAvatar: n, ...s } = t, [i, u] = A.useState("idle");
|
|
732
|
-
return /* @__PURE__ */ e(
|
|
733
|
-
ir,
|
|
734
|
-
{
|
|
735
|
-
scope: n,
|
|
736
|
-
imageLoadingStatus: i,
|
|
737
|
-
onImageLoadingStatusChange: u,
|
|
738
|
-
children: /* @__PURE__ */ e(Et.span, { ...s, ref: a })
|
|
739
|
-
}
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
);
|
|
743
|
-
Ma.displayName = It;
|
|
744
|
-
var La = "AvatarImage", Aa = A.forwardRef(
|
|
745
|
-
(t, a) => {
|
|
746
|
-
const { __scopeAvatar: n, src: s, onLoadingStatusChange: i = () => {
|
|
747
|
-
}, ...u } = t, l = Ia(La, n), p = cr(s, u), g = us((v) => {
|
|
748
|
-
i(v), l.onImageLoadingStatusChange(v);
|
|
749
|
-
});
|
|
750
|
-
return ut(() => {
|
|
751
|
-
p !== "idle" && g(p);
|
|
752
|
-
}, [p, g]), p === "loaded" ? /* @__PURE__ */ e(Et.img, { ...u, ref: a, src: s }) : null;
|
|
753
|
-
}
|
|
754
|
-
);
|
|
755
|
-
Aa.displayName = La;
|
|
756
|
-
var ka = "AvatarFallback", Oa = A.forwardRef(
|
|
757
|
-
(t, a) => {
|
|
758
|
-
const { __scopeAvatar: n, delayMs: s, ...i } = t, u = Ia(ka, n), [l, p] = A.useState(s === void 0);
|
|
759
|
-
return A.useEffect(() => {
|
|
760
|
-
if (s !== void 0) {
|
|
761
|
-
const g = window.setTimeout(() => p(!0), s);
|
|
762
|
-
return () => window.clearTimeout(g);
|
|
763
|
-
}
|
|
764
|
-
}, [s]), l && u.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(Et.span, { ...i, ref: a }) : null;
|
|
765
|
-
}
|
|
766
|
-
);
|
|
767
|
-
Oa.displayName = ka;
|
|
768
|
-
function ca(t, a) {
|
|
769
|
-
return t ? a ? (t.src !== a && (t.src = a), t.complete && t.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
770
|
-
}
|
|
771
|
-
function cr(t, { referrerPolicy: a, crossOrigin: n }) {
|
|
772
|
-
const s = nr(), i = A.useRef(null), u = s ? (i.current || (i.current = new window.Image()), i.current) : null, [l, p] = A.useState(
|
|
773
|
-
() => ca(u, t)
|
|
774
|
-
);
|
|
775
|
-
return ut(() => {
|
|
776
|
-
p(ca(u, t));
|
|
777
|
-
}, [u, t]), ut(() => {
|
|
778
|
-
const g = (f) => () => {
|
|
779
|
-
p(f);
|
|
780
|
-
};
|
|
781
|
-
if (!u) return;
|
|
782
|
-
const v = g("loaded"), m = g("error");
|
|
783
|
-
return u.addEventListener("load", v), u.addEventListener("error", m), a && (u.referrerPolicy = a), typeof n == "string" && (u.crossOrigin = n), () => {
|
|
784
|
-
u.removeEventListener("load", v), u.removeEventListener("error", m);
|
|
785
|
-
};
|
|
786
|
-
}, [u, n, a]), l;
|
|
787
|
-
}
|
|
788
|
-
var Pa = Ma, Ta = Aa, _a = Oa;
|
|
789
|
-
const Mt = A.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e(
|
|
790
|
-
Pa,
|
|
791
|
-
{
|
|
792
|
-
ref: n,
|
|
793
|
-
className: Y(
|
|
794
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
795
|
-
t
|
|
796
|
-
),
|
|
797
|
-
...a
|
|
798
|
-
}
|
|
799
|
-
));
|
|
800
|
-
Mt.displayName = Pa.displayName;
|
|
801
|
-
const lr = A.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e(
|
|
802
|
-
Ta,
|
|
803
|
-
{
|
|
804
|
-
ref: n,
|
|
805
|
-
className: Y("aspect-square h-full w-full", t),
|
|
806
|
-
...a
|
|
807
|
-
}
|
|
808
|
-
));
|
|
809
|
-
lr.displayName = Ta.displayName;
|
|
810
|
-
const Lt = A.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e(
|
|
811
|
-
_a,
|
|
812
|
-
{
|
|
813
|
-
ref: n,
|
|
814
|
-
className: Y(
|
|
815
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
816
|
-
t
|
|
817
|
-
),
|
|
818
|
-
...a
|
|
819
|
-
}
|
|
820
|
-
));
|
|
821
|
-
Lt.displayName = _a.displayName;
|
|
822
|
-
function dr({
|
|
823
|
-
open: t,
|
|
824
|
-
onOpenChange: a,
|
|
825
|
-
group: n,
|
|
826
|
-
onUpdate: s
|
|
827
|
-
}) {
|
|
828
|
-
const [i, u] = w("members"), [l, p] = w(""), [g, v] = w([]), [m, f] = w([]), { data: h, isLoading: d, refetch: r } = ks(n.id), b = n.type === "TENANT_GROUP" ? "tenant" : "organization", { users: D, isLoading: S } = Os({
|
|
829
|
-
type: b,
|
|
830
|
-
tenantId: n.tenantId || void 0,
|
|
831
|
-
active: !0,
|
|
832
|
-
limit: 100
|
|
833
|
-
}), C = Xn(), E = Zn(), k = (h == null ? void 0 : h.members) || [], I = F(() => new Set(k.map((y) => y.userId)), [k]), V = F(() => D.filter((y) => !I.has(y.id)), [D, I]), q = F(() => {
|
|
834
|
-
if (!l) return V;
|
|
835
|
-
const y = l.toLowerCase();
|
|
836
|
-
return V.filter(
|
|
837
|
-
(O) => {
|
|
838
|
-
var G, B;
|
|
839
|
-
return ((G = O.name) == null ? void 0 : G.toLowerCase().includes(y)) || ((B = O.email) == null ? void 0 : B.toLowerCase().includes(y));
|
|
840
|
-
}
|
|
841
|
-
);
|
|
842
|
-
}, [V, l]), x = F(() => {
|
|
843
|
-
if (!l) return k;
|
|
844
|
-
const y = l.toLowerCase();
|
|
845
|
-
return k.filter(
|
|
846
|
-
(O) => {
|
|
847
|
-
var G, B, me, te;
|
|
848
|
-
return ((B = (G = O.user) == null ? void 0 : G.name) == null ? void 0 : B.toLowerCase().includes(y)) || ((te = (me = O.user) == null ? void 0 : me.email) == null ? void 0 : te.toLowerCase().includes(y));
|
|
849
|
-
}
|
|
850
|
-
);
|
|
851
|
-
}, [k, l]), H = async () => {
|
|
852
|
-
if (g.length !== 0)
|
|
853
|
-
try {
|
|
854
|
-
await C.mutateAsync({
|
|
855
|
-
groupId: n.id,
|
|
856
|
-
data: {
|
|
857
|
-
userIds: g,
|
|
858
|
-
userType: b === "tenant" ? "tenant" : "org"
|
|
859
|
-
}
|
|
860
|
-
}), v([]), u("members"), r(), s == null || s();
|
|
861
|
-
} catch (y) {
|
|
862
|
-
console.error("Failed to add members:", y);
|
|
863
|
-
}
|
|
864
|
-
}, W = async () => {
|
|
865
|
-
if (m.length !== 0)
|
|
866
|
-
try {
|
|
867
|
-
await E.mutateAsync({
|
|
868
|
-
groupId: n.id,
|
|
869
|
-
data: {
|
|
870
|
-
userIds: m
|
|
871
|
-
}
|
|
872
|
-
}), f([]), r(), s == null || s();
|
|
873
|
-
} catch (y) {
|
|
874
|
-
console.error("Failed to remove members:", y);
|
|
875
|
-
}
|
|
876
|
-
}, Z = (y) => {
|
|
877
|
-
v(
|
|
878
|
-
(O) => O.includes(y) ? O.filter((G) => G !== y) : [...O, y]
|
|
879
|
-
);
|
|
880
|
-
}, ee = (y) => {
|
|
881
|
-
f(
|
|
882
|
-
(O) => O.includes(y) ? O.filter((G) => G !== y) : [...O, y]
|
|
883
|
-
);
|
|
884
|
-
};
|
|
885
|
-
return /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(Ge, { open: t, onOpenChange: a, children: /* @__PURE__ */ c($e, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
886
|
-
/* @__PURE__ */ c(Ve, { children: [
|
|
887
|
-
/* @__PURE__ */ e(qe, { children: n.name }),
|
|
888
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ c("p", { className: "text-sm text-muted-foreground", children: [
|
|
889
|
-
k.length,
|
|
890
|
-
" ",
|
|
891
|
-
k.length === 1 ? "member" : "members"
|
|
892
|
-
] }) }),
|
|
893
|
-
/* @__PURE__ */ c("p", { id: "group-members-description", className: "sr-only", children: [
|
|
894
|
-
"Add or remove members from the ",
|
|
895
|
-
n.name,
|
|
896
|
-
" group"
|
|
897
|
-
] })
|
|
898
|
-
] }),
|
|
899
|
-
/* @__PURE__ */ c(ma, { value: i, onValueChange: (y) => {
|
|
900
|
-
u(y), p(""), f([]);
|
|
901
|
-
}, className: "mt-4", children: [
|
|
902
|
-
/* @__PURE__ */ c(ha, { className: "grid w-full grid-cols-2", children: [
|
|
903
|
-
/* @__PURE__ */ e(_e, { value: "members", children: "Current Members" }),
|
|
904
|
-
/* @__PURE__ */ e(_e, { value: "add", children: "Add Members" })
|
|
905
|
-
] }),
|
|
906
|
-
/* @__PURE__ */ c(Ue, { value: "members", className: "mt-4 space-y-4", children: [
|
|
907
|
-
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
908
|
-
/* @__PURE__ */ e(pt, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
909
|
-
/* @__PURE__ */ e(
|
|
910
|
-
ue,
|
|
911
|
-
{
|
|
912
|
-
placeholder: "Search members...",
|
|
913
|
-
value: l,
|
|
914
|
-
onChange: (y) => p(y.target.value),
|
|
915
|
-
className: "pl-10"
|
|
916
|
-
}
|
|
917
|
-
)
|
|
918
|
-
] }),
|
|
919
|
-
/* @__PURE__ */ e(mt, { className: m.length > 0 ? "h-[300px]" : "h-[350px]", children: d ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((y) => /* @__PURE__ */ e(ft, { className: "h-16 w-full" }, y)) }) : x.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
920
|
-
/* @__PURE__ */ e(Ct, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
921
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: l ? "No members found" : "No members yet" }),
|
|
922
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
|
|
923
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: x.map((y) => /* @__PURE__ */ e(
|
|
924
|
-
ur,
|
|
925
|
-
{
|
|
926
|
-
member: y,
|
|
927
|
-
selected: m.includes(y.userId),
|
|
928
|
-
onToggle: () => ee(y.userId)
|
|
929
|
-
},
|
|
930
|
-
y.id
|
|
931
|
-
)) }) }),
|
|
932
|
-
m.length > 0 && /* @__PURE__ */ c("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
933
|
-
/* @__PURE__ */ c("span", { className: "text-sm text-muted-foreground", children: [
|
|
934
|
-
m.length,
|
|
935
|
-
" member",
|
|
936
|
-
m.length !== 1 ? "s" : "",
|
|
937
|
-
" selected"
|
|
938
|
-
] }),
|
|
939
|
-
/* @__PURE__ */ e(
|
|
940
|
-
L,
|
|
941
|
-
{
|
|
942
|
-
variant: "destructive",
|
|
943
|
-
size: "sm",
|
|
944
|
-
onClick: W,
|
|
945
|
-
disabled: E.isPending,
|
|
946
|
-
children: E.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
947
|
-
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
948
|
-
"Removing..."
|
|
949
|
-
] }) : /* @__PURE__ */ c(T, { children: [
|
|
950
|
-
/* @__PURE__ */ e(va, { className: "mr-2 h-4 w-4" }),
|
|
951
|
-
"Remove Selected"
|
|
952
|
-
] })
|
|
953
|
-
}
|
|
954
|
-
)
|
|
955
|
-
] })
|
|
956
|
-
] }),
|
|
957
|
-
/* @__PURE__ */ c(Ue, { value: "add", className: "mt-4 space-y-4", children: [
|
|
958
|
-
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
959
|
-
/* @__PURE__ */ e(pt, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
960
|
-
/* @__PURE__ */ e(
|
|
961
|
-
ue,
|
|
962
|
-
{
|
|
963
|
-
placeholder: "Search users to add...",
|
|
964
|
-
value: l,
|
|
965
|
-
onChange: (y) => p(y.target.value),
|
|
966
|
-
className: "pl-10"
|
|
967
|
-
}
|
|
968
|
-
)
|
|
969
|
-
] }),
|
|
970
|
-
/* @__PURE__ */ e(mt, { className: "h-[300px]", children: S ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((y) => /* @__PURE__ */ e(ft, { className: "h-16 w-full" }, y)) }) : q.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
971
|
-
/* @__PURE__ */ e(bt, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
972
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
|
|
973
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : "All eligible users are already members" })
|
|
974
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: q.map((y) => /* @__PURE__ */ e(
|
|
975
|
-
mr,
|
|
976
|
-
{
|
|
977
|
-
user: y,
|
|
978
|
-
selected: g.includes(y.id),
|
|
979
|
-
onToggle: () => Z(y.id)
|
|
980
|
-
},
|
|
981
|
-
y.id
|
|
982
|
-
)) }) }),
|
|
983
|
-
g.length > 0 && /* @__PURE__ */ c("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
984
|
-
/* @__PURE__ */ c("span", { className: "text-sm text-muted-foreground", children: [
|
|
985
|
-
g.length,
|
|
986
|
-
" user",
|
|
987
|
-
g.length !== 1 ? "s" : "",
|
|
988
|
-
" selected"
|
|
989
|
-
] }),
|
|
990
|
-
/* @__PURE__ */ e(
|
|
991
|
-
L,
|
|
992
|
-
{
|
|
993
|
-
onClick: H,
|
|
994
|
-
disabled: C.isPending,
|
|
995
|
-
children: C.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
996
|
-
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
997
|
-
"Adding..."
|
|
998
|
-
] }) : /* @__PURE__ */ c(T, { children: [
|
|
999
|
-
/* @__PURE__ */ e(bt, { className: "mr-2 h-4 w-4" }),
|
|
1000
|
-
"Add Members"
|
|
1001
|
-
] })
|
|
1002
|
-
}
|
|
1003
|
-
)
|
|
1004
|
-
] })
|
|
1005
|
-
] })
|
|
1006
|
-
] })
|
|
1007
|
-
] }) }) });
|
|
1008
|
-
}
|
|
1009
|
-
function ur({
|
|
1010
|
-
member: t,
|
|
1011
|
-
selected: a,
|
|
1012
|
-
onToggle: n
|
|
1013
|
-
}) {
|
|
1014
|
-
var i, u, l, p;
|
|
1015
|
-
const s = ((u = (i = t.user) == null ? void 0 : i.name) == null ? void 0 : u.split(" ").map((g) => g[0]).join("").toUpperCase()) || "?";
|
|
1016
|
-
return /* @__PURE__ */ c(
|
|
1017
|
-
"div",
|
|
1018
|
-
{
|
|
1019
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1020
|
-
onClick: n,
|
|
1021
|
-
children: [
|
|
1022
|
-
/* @__PURE__ */ e(ba, { checked: a }),
|
|
1023
|
-
/* @__PURE__ */ e(Mt, { className: "h-8 w-8", children: /* @__PURE__ */ e(Lt, { className: "text-xs", children: s }) }),
|
|
1024
|
-
/* @__PURE__ */ c("div", { className: "flex-1", children: [
|
|
1025
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((l = t.user) == null ? void 0 : l.name) || "Unknown User" }),
|
|
1026
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (p = t.user) == null ? void 0 : p.email })
|
|
1027
|
-
] })
|
|
1028
|
-
]
|
|
1029
|
-
}
|
|
1030
|
-
);
|
|
1031
|
-
}
|
|
1032
|
-
function mr({
|
|
1033
|
-
user: t,
|
|
1034
|
-
selected: a,
|
|
1035
|
-
onToggle: n
|
|
1036
|
-
}) {
|
|
1037
|
-
var i;
|
|
1038
|
-
const s = ((i = t.name) == null ? void 0 : i.split(" ").map((u) => u[0]).join("").toUpperCase()) || "?";
|
|
1039
|
-
return /* @__PURE__ */ c(
|
|
1040
|
-
"div",
|
|
1041
|
-
{
|
|
1042
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1043
|
-
onClick: n,
|
|
1044
|
-
children: [
|
|
1045
|
-
/* @__PURE__ */ e(ba, { checked: a }),
|
|
1046
|
-
/* @__PURE__ */ e(Mt, { className: "h-8 w-8", children: /* @__PURE__ */ e(Lt, { className: "text-xs", children: s }) }),
|
|
1047
|
-
/* @__PURE__ */ c("div", { className: "flex-1", children: [
|
|
1048
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: t.name }),
|
|
1049
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t.email })
|
|
1050
|
-
] })
|
|
1051
|
-
]
|
|
1052
|
-
}
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
function hr({
|
|
1056
|
-
open: t,
|
|
1057
|
-
onOpenChange: a
|
|
1058
|
-
}) {
|
|
1059
|
-
const [n, s] = w("groups"), [i, u] = w(""), [l, p] = w(null), [g, v] = w(!1), [m, f] = w(null), { tokenProps: h } = K(), { currentUser: d } = Dt(), r = Yn(), b = (d == null ? void 0 : d.type) === "tenant", D = h == null ? void 0 : h.tenantId, { groups: S, isLoading: C, refetch: E } = Ps({
|
|
1060
|
-
type: b ? "TENANT_GROUP" : "all",
|
|
1061
|
-
tenantId: b ? D : void 0,
|
|
1062
|
-
includeMembers: !1
|
|
1063
|
-
}), k = S.filter(
|
|
1064
|
-
(x) => {
|
|
1065
|
-
var H;
|
|
1066
|
-
return x.name.toLowerCase().includes(i.toLowerCase()) || ((H = x.description) == null ? void 0 : H.toLowerCase().includes(i.toLowerCase()));
|
|
1067
|
-
}
|
|
1068
|
-
), I = async () => {
|
|
1069
|
-
if (m)
|
|
1070
|
-
try {
|
|
1071
|
-
await r.mutateAsync(m.id), f(null), E();
|
|
1072
|
-
} catch (x) {
|
|
1073
|
-
console.error("Failed to delete group:", x);
|
|
1074
|
-
}
|
|
1075
|
-
}, V = (x) => {
|
|
1076
|
-
p(x), v(!0);
|
|
1077
|
-
}, q = () => {
|
|
1078
|
-
s("groups"), E();
|
|
1079
|
-
};
|
|
1080
|
-
return /* @__PURE__ */ c(T, { children: [
|
|
1081
|
-
/* @__PURE__ */ e(Ge, { open: t, onOpenChange: a, children: /* @__PURE__ */ c($e, { className: "max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]", children: [
|
|
1082
|
-
/* @__PURE__ */ c(Ve, { children: [
|
|
1083
|
-
/* @__PURE__ */ e(qe, { className: "text-[15px]", children: "Group management" }),
|
|
1084
|
-
/* @__PURE__ */ e(St, { className: "text-[13px] leading-5", children: "Manage groups, create new ones, and control membership." })
|
|
1085
|
-
] }),
|
|
1086
|
-
/* @__PURE__ */ c(
|
|
1087
|
-
ma,
|
|
1088
|
-
{
|
|
1089
|
-
value: n,
|
|
1090
|
-
onValueChange: s,
|
|
1091
|
-
className: "mt-2",
|
|
1092
|
-
children: [
|
|
1093
|
-
/* @__PURE__ */ c(ha, { className: "h-8 w-full justify-start gap-1 bg-transparent p-0 border-b border-border/60 rounded-none", children: [
|
|
1094
|
-
/* @__PURE__ */ e(
|
|
1095
|
-
_e,
|
|
1096
|
-
{
|
|
1097
|
-
value: "groups",
|
|
1098
|
-
className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
1099
|
-
children: "Groups"
|
|
1100
|
-
}
|
|
1101
|
-
),
|
|
1102
|
-
/* @__PURE__ */ e(
|
|
1103
|
-
_e,
|
|
1104
|
-
{
|
|
1105
|
-
value: "create",
|
|
1106
|
-
className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
1107
|
-
children: "Create group"
|
|
1108
|
-
}
|
|
1109
|
-
)
|
|
1110
|
-
] }),
|
|
1111
|
-
/* @__PURE__ */ e(Ue, { value: "groups", className: "mt-4", children: /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
1112
|
-
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
1113
|
-
/* @__PURE__ */ e(pt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1114
|
-
/* @__PURE__ */ e(
|
|
1115
|
-
ue,
|
|
1116
|
-
{
|
|
1117
|
-
size: "xs",
|
|
1118
|
-
placeholder: "Search groups…",
|
|
1119
|
-
value: i,
|
|
1120
|
-
onChange: (x) => u(x.target.value),
|
|
1121
|
-
className: "pl-7"
|
|
1122
|
-
}
|
|
1123
|
-
)
|
|
1124
|
-
] }),
|
|
1125
|
-
/* @__PURE__ */ e(mt, { className: "h-[400px]", children: C ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(
|
|
1126
|
-
ft,
|
|
1127
|
-
{
|
|
1128
|
-
className: "h-16 w-full rounded-[6px]"
|
|
1129
|
-
},
|
|
1130
|
-
x
|
|
1131
|
-
)) }) : k.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
1132
|
-
/* @__PURE__ */ e("p", { className: "text-[13px]", children: "No groups found." }),
|
|
1133
|
-
/* @__PURE__ */ e("p", { className: "mt-1 text-[12px]", children: i ? "Try a different search." : "Create your first group to get started." })
|
|
1134
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2 pr-2", children: k.map((x) => /* @__PURE__ */ e(
|
|
1135
|
-
pr,
|
|
1136
|
-
{
|
|
1137
|
-
group: x,
|
|
1138
|
-
onManageMembers: () => V(x),
|
|
1139
|
-
onDelete: () => f(x),
|
|
1140
|
-
currentUserId: d == null ? void 0 : d.id
|
|
1141
|
-
},
|
|
1142
|
-
x.id
|
|
1143
|
-
)) }) })
|
|
1144
|
-
] }) }),
|
|
1145
|
-
/* @__PURE__ */ e(Ue, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
|
|
1146
|
-
er,
|
|
1147
|
-
{
|
|
1148
|
-
onSuccess: q,
|
|
1149
|
-
tenantId: D,
|
|
1150
|
-
isTenantUser: b
|
|
1151
|
-
}
|
|
1152
|
-
) })
|
|
1153
|
-
]
|
|
1154
|
-
}
|
|
1155
|
-
)
|
|
1156
|
-
] }) }),
|
|
1157
|
-
l && /* @__PURE__ */ e(
|
|
1158
|
-
dr,
|
|
1159
|
-
{
|
|
1160
|
-
open: g,
|
|
1161
|
-
onOpenChange: v,
|
|
1162
|
-
group: l,
|
|
1163
|
-
onUpdate: () => E()
|
|
1164
|
-
}
|
|
1165
|
-
),
|
|
1166
|
-
/* @__PURE__ */ e(
|
|
1167
|
-
ya,
|
|
1168
|
-
{
|
|
1169
|
-
open: !!m,
|
|
1170
|
-
onOpenChange: () => f(null),
|
|
1171
|
-
children: /* @__PURE__ */ c(xa, { children: [
|
|
1172
|
-
/* @__PURE__ */ c(wa, { children: [
|
|
1173
|
-
/* @__PURE__ */ e(Na, { children: "Delete group" }),
|
|
1174
|
-
/* @__PURE__ */ c(Sa, { children: [
|
|
1175
|
-
'Delete "',
|
|
1176
|
-
m == null ? void 0 : m.name,
|
|
1177
|
-
`"? This removes all members and can't be undone.`
|
|
1178
|
-
] })
|
|
1179
|
-
] }),
|
|
1180
|
-
/* @__PURE__ */ c(Da, { children: [
|
|
1181
|
-
/* @__PURE__ */ e(Ca, { children: "Cancel" }),
|
|
1182
|
-
/* @__PURE__ */ e(
|
|
1183
|
-
gt,
|
|
1184
|
-
{
|
|
1185
|
-
onClick: I,
|
|
1186
|
-
disabled: r.isPending,
|
|
1187
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1188
|
-
children: r.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
1189
|
-
/* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1190
|
-
"Deleting…"
|
|
1191
|
-
] }) : "Delete group"
|
|
1192
|
-
}
|
|
1193
|
-
)
|
|
1194
|
-
] })
|
|
1195
|
-
] })
|
|
1196
|
-
}
|
|
1197
|
-
)
|
|
1198
|
-
] });
|
|
1199
|
-
}
|
|
1200
|
-
function pr({
|
|
1201
|
-
group: t,
|
|
1202
|
-
onManageMembers: a,
|
|
1203
|
-
onDelete: n,
|
|
1204
|
-
currentUserId: s
|
|
1205
|
-
}) {
|
|
1206
|
-
const i = t.createdBy === s;
|
|
1207
|
-
return /* @__PURE__ */ e("div", { className: "rounded-[6px] border border-border/60 bg-card px-3 py-2.5 transition-colors hover:bg-muted/30", children: /* @__PURE__ */ c("div", { className: "flex items-start justify-between gap-2", children: [
|
|
1208
|
-
/* @__PURE__ */ c("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
1209
|
-
/* @__PURE__ */ e("h4", { className: "text-[13px] font-medium text-foreground", children: t.name }),
|
|
1210
|
-
t.description && /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: t.description }),
|
|
1211
|
-
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground", children: [
|
|
1212
|
-
/* @__PURE__ */ c("span", { className: "inline-flex items-center gap-1", children: [
|
|
1213
|
-
/* @__PURE__ */ e(Ct, { className: "h-3 w-3" }),
|
|
1214
|
-
t.memberCount,
|
|
1215
|
-
" ",
|
|
1216
|
-
t.memberCount === 1 ? "member" : "members"
|
|
1217
|
-
] }),
|
|
1218
|
-
/* @__PURE__ */ c("span", { children: [
|
|
1219
|
-
"Created ",
|
|
1220
|
-
wn(new Date(t.createdAt), "MMM d, yyyy")
|
|
1221
|
-
] })
|
|
1222
|
-
] })
|
|
1223
|
-
] }),
|
|
1224
|
-
/* @__PURE__ */ c("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
1225
|
-
/* @__PURE__ */ e(
|
|
1226
|
-
L,
|
|
1227
|
-
{
|
|
1228
|
-
variant: "ghost",
|
|
1229
|
-
size: "xs",
|
|
1230
|
-
className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
|
|
1231
|
-
onClick: a,
|
|
1232
|
-
title: "Manage members",
|
|
1233
|
-
"aria-label": "Manage members",
|
|
1234
|
-
children: /* @__PURE__ */ e(bt, { className: "h-3.5 w-3.5" })
|
|
1235
|
-
}
|
|
1236
|
-
),
|
|
1237
|
-
i && /* @__PURE__ */ e(
|
|
1238
|
-
L,
|
|
1239
|
-
{
|
|
1240
|
-
variant: "ghost",
|
|
1241
|
-
size: "xs",
|
|
1242
|
-
className: "h-7 w-7 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
|
|
1243
|
-
onClick: n,
|
|
1244
|
-
title: "Delete group",
|
|
1245
|
-
"aria-label": "Delete group",
|
|
1246
|
-
children: /* @__PURE__ */ e(va, { className: "h-3.5 w-3.5" })
|
|
1247
|
-
}
|
|
1248
|
-
)
|
|
1249
|
-
] })
|
|
1250
|
-
] }) });
|
|
1251
|
-
}
|
|
1252
|
-
function ce(t, a, n) {
|
|
1253
|
-
var u, l;
|
|
1254
|
-
const s = (t.controls || []).find(
|
|
1255
|
-
(p) => p.id === n
|
|
1256
|
-
);
|
|
1257
|
-
if (s)
|
|
1258
|
-
return s.label;
|
|
1259
|
-
const i = (l = (u = pa(t, a)) == null ? void 0 : u.controls) == null ? void 0 : l.find(
|
|
1260
|
-
(p) => p.id === n
|
|
1261
|
-
);
|
|
1262
|
-
return (i == null ? void 0 : i.label) || n;
|
|
1263
|
-
}
|
|
1264
|
-
function le(t, a) {
|
|
1265
|
-
var n;
|
|
1266
|
-
return ((n = pa(t, a)) == null ? void 0 : n.title) || a;
|
|
1267
|
-
}
|
|
1268
|
-
function fr(t) {
|
|
1269
|
-
const { errors: a, dashboard: n } = t;
|
|
1270
|
-
if (!n)
|
|
1271
|
-
return a;
|
|
1272
|
-
const s = /* @__PURE__ */ new Map();
|
|
1273
|
-
for (const i of a) {
|
|
1274
|
-
const u = i.match(
|
|
1275
|
-
/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/
|
|
1276
|
-
);
|
|
1277
|
-
if (u) {
|
|
1278
|
-
const [, m, f] = u, h = `${m}:${f}:missing-metric`;
|
|
1279
|
-
s.has(h) || s.set(
|
|
1280
|
-
h,
|
|
1281
|
-
`"${le(n, m)}" has an outdated "${ce(
|
|
1282
|
-
n,
|
|
1283
|
-
m,
|
|
1284
|
-
f
|
|
1285
|
-
)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`
|
|
1286
|
-
);
|
|
1287
|
-
continue;
|
|
1288
|
-
}
|
|
1289
|
-
const l = i.match(
|
|
1290
|
-
/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/
|
|
1291
|
-
);
|
|
1292
|
-
if (l) {
|
|
1293
|
-
const [, m, f] = l, h = `${m}:${f}:missing-group-by`;
|
|
1294
|
-
s.has(h) || s.set(
|
|
1295
|
-
h,
|
|
1296
|
-
`"${le(n, m)}" has an outdated "${ce(
|
|
1297
|
-
n,
|
|
1298
|
-
m,
|
|
1299
|
-
f
|
|
1300
|
-
)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`
|
|
1301
|
-
);
|
|
1302
|
-
continue;
|
|
1303
|
-
}
|
|
1304
|
-
const p = i.match(
|
|
1305
|
-
/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/
|
|
1306
|
-
);
|
|
1307
|
-
if (p) {
|
|
1308
|
-
const [, m, f] = p, h = `${m}:${f}:invalid-metric`;
|
|
1309
|
-
s.has(h) || s.set(
|
|
1310
|
-
h,
|
|
1311
|
-
`"${le(n, m)}" has an invalid "${ce(
|
|
1312
|
-
n,
|
|
1313
|
-
m,
|
|
1314
|
-
f
|
|
1315
|
-
)}" metric mapping. Open the card controls and choose a valid metric for each option.`
|
|
1316
|
-
);
|
|
1317
|
-
continue;
|
|
1318
|
-
}
|
|
1319
|
-
const g = i.match(
|
|
1320
|
-
/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/
|
|
1321
|
-
);
|
|
1322
|
-
if (g) {
|
|
1323
|
-
const [, m, f] = g, h = `${m}:${f}:invalid-group-by`;
|
|
1324
|
-
s.has(h) || s.set(
|
|
1325
|
-
h,
|
|
1326
|
-
`"${le(n, m)}" has an invalid "${ce(
|
|
1327
|
-
n,
|
|
1328
|
-
m,
|
|
1329
|
-
f
|
|
1330
|
-
)}" field mapping. Open the card controls and choose a valid field for each option.`
|
|
1331
|
-
);
|
|
1332
|
-
continue;
|
|
1333
|
-
}
|
|
1334
|
-
const v = i.match(
|
|
1335
|
-
/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/
|
|
1336
|
-
);
|
|
1337
|
-
if (v) {
|
|
1338
|
-
const [, m, f] = v, h = `${m}:${f}:missing-temporal-group-by`;
|
|
1339
|
-
s.has(h) || s.set(
|
|
1340
|
-
h,
|
|
1341
|
-
`"${le(n, m)}" can no longer use "${ce(
|
|
1342
|
-
n,
|
|
1343
|
-
m,
|
|
1344
|
-
f
|
|
1345
|
-
)}" for time grain because the card does not currently group by a date field.`
|
|
1346
|
-
);
|
|
1347
|
-
continue;
|
|
1348
|
-
}
|
|
1349
|
-
s.set(i, i);
|
|
1350
|
-
}
|
|
1351
|
-
return Array.from(s.values());
|
|
1352
|
-
}
|
|
1353
|
-
const gr = [
|
|
1354
|
-
"enum",
|
|
1355
|
-
"multi_enum",
|
|
1356
|
-
"text",
|
|
1357
|
-
"number",
|
|
1358
|
-
"boolean",
|
|
1359
|
-
"date"
|
|
1360
|
-
];
|
|
1361
|
-
function vr({
|
|
1362
|
-
open: t,
|
|
1363
|
-
onOpenChange: a,
|
|
1364
|
-
initialMode: n = "manage"
|
|
1365
|
-
}) {
|
|
1366
|
-
var q;
|
|
1367
|
-
const s = n === "create", {
|
|
1368
|
-
forceClose: i,
|
|
1369
|
-
handleOpenChange: u,
|
|
1370
|
-
isCreateFlowActive: l,
|
|
1371
|
-
preventPassiveDismissDuringCreate: p,
|
|
1372
|
-
resolvedOpen: g,
|
|
1373
|
-
setIsCreateFlowActive: v
|
|
1374
|
-
} = Cn({
|
|
1375
|
-
open: t,
|
|
1376
|
-
onOpenChange: a,
|
|
1377
|
-
initialCreateFlowActive: n === "create",
|
|
1378
|
-
dismissMode: "explicit-only"
|
|
1379
|
-
}), m = N((x) => x.dashboard), f = N((x) => x.selectedSheetId), { setDashboardInputs: h } = Nt(), d = (q = m.sheets) == null ? void 0 : q.find(
|
|
1380
|
-
(x) => x.id === f
|
|
1381
|
-
), r = (d == null ? void 0 : d.kind) === "document" && !!d.document, b = F(
|
|
1382
|
-
() => r && (d != null && d.document) ? Ts(m, d.id) : [],
|
|
1383
|
-
[m, r, d == null ? void 0 : d.document, d == null ? void 0 : d.id]
|
|
1384
|
-
), D = F(
|
|
1385
|
-
() => b.filter(
|
|
1386
|
-
(x) => x.kind === "control"
|
|
1387
|
-
),
|
|
1388
|
-
[b]
|
|
1389
|
-
), S = F(
|
|
1390
|
-
() => D.map((x) => x.control),
|
|
1391
|
-
[D]
|
|
1392
|
-
), C = F(
|
|
1393
|
-
() => yr(S),
|
|
1394
|
-
[S]
|
|
1395
|
-
), E = F(
|
|
1396
|
-
() => br(m),
|
|
1397
|
-
[m]
|
|
1398
|
-
), k = Fe(() => {
|
|
1399
|
-
if (s) {
|
|
1400
|
-
i();
|
|
1401
|
-
return;
|
|
1402
|
-
}
|
|
1403
|
-
v(!1);
|
|
1404
|
-
}, [s, i, v]), I = Fe(
|
|
1405
|
-
(x, H, W) => {
|
|
1406
|
-
!r || !(d != null && d.document) || h(
|
|
1407
|
-
wr({
|
|
1408
|
-
allInputs: m.inputs || [],
|
|
1409
|
-
documentSheetId: d.id,
|
|
1410
|
-
currentDocumentInputs: b,
|
|
1411
|
-
nextControls: x,
|
|
1412
|
-
nextDefaultValues: H,
|
|
1413
|
-
change: W
|
|
1414
|
-
})
|
|
1415
|
-
);
|
|
1416
|
-
},
|
|
1417
|
-
[
|
|
1418
|
-
m.inputs,
|
|
1419
|
-
b,
|
|
1420
|
-
r,
|
|
1421
|
-
d,
|
|
1422
|
-
h
|
|
1423
|
-
]
|
|
1424
|
-
);
|
|
1425
|
-
return !r || !(d != null && d.document) ? null : /* @__PURE__ */ e(Ge, { open: g, onOpenChange: u, children: /* @__PURE__ */ c(
|
|
1426
|
-
$e,
|
|
1427
|
-
{
|
|
1428
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
1429
|
-
onEscapeKeyDown: p,
|
|
1430
|
-
onPointerDownOutside: p,
|
|
1431
|
-
children: [
|
|
1432
|
-
/* @__PURE__ */ c(Ve, { className: l ? "space-y-0" : void 0, children: [
|
|
1433
|
-
/* @__PURE__ */ e(qe, { className: "text-[15px]", children: l ? "Add document control" : "Document Controls" }),
|
|
1434
|
-
/* @__PURE__ */ e(
|
|
1435
|
-
St,
|
|
1436
|
-
{
|
|
1437
|
-
className: l ? "sr-only" : "text-[13px]",
|
|
1438
|
-
children: l ? "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."
|
|
1439
|
-
}
|
|
1440
|
-
)
|
|
1441
|
-
] }),
|
|
1442
|
-
/* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ e(
|
|
1443
|
-
En,
|
|
1444
|
-
{
|
|
1445
|
-
scope: "dashboard",
|
|
1446
|
-
controls: S,
|
|
1447
|
-
reservedControlIds: E,
|
|
1448
|
-
defaultValues: C,
|
|
1449
|
-
usageByControlId: {},
|
|
1450
|
-
availableFieldChoices: [],
|
|
1451
|
-
availableMetricChoices: [],
|
|
1452
|
-
structuralParticipants: [],
|
|
1453
|
-
structuralParticipantIdsByControlId: {},
|
|
1454
|
-
allowedControlTypes: gr,
|
|
1455
|
-
initialCreateFlow: n === "create",
|
|
1456
|
-
onCreateFlowActiveChange: v,
|
|
1457
|
-
onCreateFlowComplete: k,
|
|
1458
|
-
onChange: I,
|
|
1459
|
-
emptyMessage: "No document controls yet."
|
|
1460
|
-
}
|
|
1461
|
-
) })
|
|
1462
|
-
]
|
|
1463
|
-
}
|
|
1464
|
-
) });
|
|
1465
|
-
}
|
|
1466
|
-
function br(t) {
|
|
1467
|
-
return (t.controls || []).map((a) => a.id);
|
|
1468
|
-
}
|
|
1469
|
-
function yr(t) {
|
|
1470
|
-
const a = {};
|
|
1471
|
-
for (const n of t)
|
|
1472
|
-
n.defaultValue !== void 0 && (a[n.id] = n.defaultValue);
|
|
1473
|
-
return a;
|
|
1474
|
-
}
|
|
1475
|
-
function xr(t, a) {
|
|
1476
|
-
return a ? Object.prototype.hasOwnProperty.call(a, t.id) ? {
|
|
1477
|
-
...t,
|
|
1478
|
-
defaultValue: a[t.id]
|
|
1479
|
-
} : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 } : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 };
|
|
1480
|
-
}
|
|
1481
|
-
function wr({
|
|
1482
|
-
allInputs: t,
|
|
1483
|
-
documentSheetId: a,
|
|
1484
|
-
currentDocumentInputs: n,
|
|
1485
|
-
nextControls: s,
|
|
1486
|
-
nextDefaultValues: i,
|
|
1487
|
-
change: u
|
|
1488
|
-
}) {
|
|
1489
|
-
const l = new Map(
|
|
1490
|
-
s.map((h) => [
|
|
1491
|
-
h.id,
|
|
1492
|
-
xr(h, i)
|
|
1493
|
-
])
|
|
1494
|
-
), p = (u == null ? void 0 : u.type) === "rename" ? { oldId: u.oldId, newId: u.newId } : null, g = /* @__PURE__ */ new Set(), v = [];
|
|
1495
|
-
for (const h of n) {
|
|
1496
|
-
if (h.kind !== "control") {
|
|
1497
|
-
v.push(h);
|
|
1498
|
-
continue;
|
|
1499
|
-
}
|
|
1500
|
-
const d = l.get(h.control.id) || ((p == null ? void 0 : p.oldId) === h.control.id ? l.get(p.newId) : void 0);
|
|
1501
|
-
if (!d)
|
|
1502
|
-
continue;
|
|
1503
|
-
g.add(d.id);
|
|
1504
|
-
const r = _s(
|
|
1505
|
-
d.id,
|
|
1506
|
-
[...t, ...v].filter(
|
|
1507
|
-
(D) => D.id !== h.id
|
|
1508
|
-
)
|
|
1509
|
-
), b = d.id === r ? d : { ...d, id: r };
|
|
1510
|
-
v.push({
|
|
1511
|
-
...h,
|
|
1512
|
-
label: b.label,
|
|
1513
|
-
variableName: r,
|
|
1514
|
-
requiredAtExecution: b.requiredAtExecution,
|
|
1515
|
-
control: b
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
for (const h of l.values())
|
|
1519
|
-
g.has(h.id) || v.push(
|
|
1520
|
-
Us({
|
|
1521
|
-
control: h,
|
|
1522
|
-
existingInputs: [...t, ...v],
|
|
1523
|
-
sheetId: a
|
|
1524
|
-
})
|
|
1525
|
-
);
|
|
1526
|
-
const m = new Set(
|
|
1527
|
-
n.map((h) => h.id)
|
|
1528
|
-
);
|
|
1529
|
-
return [...t.filter(
|
|
1530
|
-
(h) => !m.has(h.id)
|
|
1531
|
-
), ...v];
|
|
1532
|
-
}
|
|
1533
|
-
function la(t, a) {
|
|
1534
|
-
return {
|
|
1535
|
-
dashboard: vt(t),
|
|
1536
|
-
semanticExecutionPayload: vt(a)
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
function Rr() {
|
|
1540
|
-
var Qt, Wt, Jt, Yt, Xt, Zt;
|
|
1541
|
-
hn(), pn();
|
|
1542
|
-
const {
|
|
1543
|
-
authToken: t,
|
|
1544
|
-
tokenProps: a,
|
|
1545
|
-
id: n
|
|
1546
|
-
} = K(), { isLocalDev: s } = Fs(), { openBrandStudioPreview: i } = Rs(), { permissions: u } = Bn(), l = Gs(), { isLoading: p } = $s(), g = N((o) => o.theme), v = N((o) => o.isDownloadingPdf), m = N(
|
|
1547
|
-
(o) => o.dashboardAssistantDraftScopeKey
|
|
1548
|
-
), f = N((o) => o.lenses), h = N((o) => o.selectedLensId), d = f == null ? void 0 : f.find((o) => o.id === h), r = N((o) => o.dashboard), b = N((o) => o.selectedSheetId), D = (Qt = r == null ? void 0 : r.sheets) == null ? void 0 : Qt.find(
|
|
1549
|
-
(o) => o.id === b
|
|
1550
|
-
), S = ms(D), C = S ? (Wt = D == null ? void 0 : D.document) == null ? void 0 : Wt.page : void 0, E = N(
|
|
1551
|
-
(o) => o.isDashboardEditing
|
|
1552
|
-
), { setDashboardTitle: k } = N((o) => o.actions), [I, V] = w(!1), [q, x] = w(!1), [H, W] = w(!1), [Z, ee] = w(!1), [y, O] = w(!1), [G, B] = w(!1), [me, te] = w(!1), [Ua, At] = w(!1), [Be, he] = w(null), [Fa, pe] = w(!1), [fe, ge] = w(null), [kt, ve] = w([]), [Ot, be] = w(!1), Ra = N((o) => o.isDashboardPanelOpen), Ga = N(
|
|
1553
|
-
(o) => o.actions.setIsDashboardPanelOpen
|
|
1554
|
-
), $a = N((o) => o.filterValues), _ = N((o) => o.isVisualEditing);
|
|
1555
|
-
ta((o) => o.card);
|
|
1556
|
-
const ae = Oe(
|
|
1557
|
-
(o) => o.selectedDashboard
|
|
1558
|
-
), ye = Oe(
|
|
1559
|
-
(o) => o.initialDashboard
|
|
1560
|
-
);
|
|
1561
|
-
Oe((o) => o.selectedVisual), N((o) => o.selectedFrameId), ta((o) => o.frame);
|
|
1562
|
-
const xe = ae ? (Yt = ae == null ? void 0 : ae.permissions) == null ? void 0 : Yt.canEdit : (Jt = ye == null ? void 0 : ye.permissions) == null ? void 0 : Jt.canEdit, we = N((o) => o.showFilters), Pt = Vs((o) => o.setPanelOpen), Tt = N(
|
|
1563
|
-
(o) => o.showDashboardJSON
|
|
1564
|
-
), je = N((o) => o.onSaveFunction), _t = N(
|
|
1565
|
-
(o) => o.actions.setShowFilters
|
|
1566
|
-
), {
|
|
1567
|
-
setDocumentInspectorTab: Ut,
|
|
1568
|
-
setIsDashboardEditing: Ft,
|
|
1569
|
-
setShowDashboardJSON: Rt
|
|
1570
|
-
} = N((o) => o.actions), { setInitialDashboard: Gt, clearSelectedDashboard: Ke } = Oe(
|
|
1571
|
-
(o) => o.actions
|
|
1572
|
-
), { resources: Ne } = qs(nt.DASHBOARD), { data: Qe } = zs(), Va = ((Xt = Qe == null ? void 0 : Qe.preference) == null ? void 0 : Xt.defaultDashboardId) || null, { mutate: qa, isPending: za } = Hs(), { currentUser: Ha } = Dt(), Ba = Bs(Ha), J = ae || ye, $t = J ? {
|
|
1573
|
-
id: J.id,
|
|
1574
|
-
title: (r == null ? void 0 : r.title) || J.title || "Dashboard"
|
|
1575
|
-
} : null, { handleAddNewFrame: ja } = js(), [We, Je] = w(!1), [Ka, se] = w(!1), [Ye, Se] = w("close"), ne = Ks(nt.DASHBOARD), [R, De] = w(null), Vt = Fe((o) => {
|
|
1576
|
-
window.setTimeout(() => {
|
|
1577
|
-
he(o);
|
|
1578
|
-
}, 0);
|
|
1579
|
-
}, []), Qa = async (o, P) => {
|
|
1580
|
-
if (!(r != null && r.id)) {
|
|
1581
|
-
console.log("No dashboard ID found");
|
|
1582
|
-
return;
|
|
1583
|
-
}
|
|
1584
|
-
console.log("Updating dashboard title:", {
|
|
1585
|
-
dashboardId: r.id,
|
|
1586
|
-
newTitle: o,
|
|
1587
|
-
previousTitle: P
|
|
1588
|
-
}), ne.mutate(
|
|
1589
|
-
{
|
|
1590
|
-
resourceId: r.id,
|
|
1591
|
-
data: { title: o }
|
|
1592
|
-
},
|
|
1593
|
-
{
|
|
1594
|
-
onSuccess: () => {
|
|
1595
|
-
console.log("Dashboard title updated successfully"), M.success("Dashboard title updated");
|
|
1596
|
-
},
|
|
1597
|
-
onError: (z) => {
|
|
1598
|
-
console.error("Failed to update dashboard title:", z), M.error("Failed to update dashboard title"), k(P);
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
);
|
|
1602
|
-
};
|
|
1603
|
-
ot(() => {
|
|
1604
|
-
if (Ne && Ne.length > 0) {
|
|
1605
|
-
const o = r == null ? void 0 : r.id;
|
|
1606
|
-
if (o) {
|
|
1607
|
-
const P = Ne.find(
|
|
1608
|
-
(z) => z.id === o
|
|
1609
|
-
);
|
|
1610
|
-
P && Gt(P);
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
}, [Ne, r == null ? void 0 : r.id, Gt]);
|
|
1614
|
-
const re = a.orgUserId || a.tenantId, Xe = F(
|
|
1615
|
-
() => Nr({
|
|
1616
|
-
accessToken: t == null ? void 0 : t.accessToken,
|
|
1617
|
-
dashboardId: (r == null ? void 0 : r.id) || n || a.dashboard_id,
|
|
1618
|
-
selectedSheetId: S ? b : void 0,
|
|
1619
|
-
pageSize: C == null ? void 0 : C.size,
|
|
1620
|
-
orientation: C == null ? void 0 : C.orientation,
|
|
1621
|
-
theme: g
|
|
1622
|
-
}),
|
|
1623
|
-
[
|
|
1624
|
-
t == null ? void 0 : t.accessToken,
|
|
1625
|
-
n,
|
|
1626
|
-
r == null ? void 0 : r.id,
|
|
1627
|
-
S,
|
|
1628
|
-
C == null ? void 0 : C.orientation,
|
|
1629
|
-
C == null ? void 0 : C.size,
|
|
1630
|
-
b,
|
|
1631
|
-
g,
|
|
1632
|
-
a.dashboard_id
|
|
1633
|
-
]
|
|
1634
|
-
), qt = E && !_ && re && xe, { setDashboard: Ze } = N((o) => o.actions), et = N(
|
|
1635
|
-
(o) => o.semanticExecutionPayload
|
|
1636
|
-
), Wa = () => {
|
|
1637
|
-
Ft(!0);
|
|
1638
|
-
}, tt = () => {
|
|
1639
|
-
Ft(!1), Rt(!1), De(null), he(null);
|
|
1640
|
-
};
|
|
1641
|
-
ot(() => {
|
|
1642
|
-
if (!E) {
|
|
1643
|
-
R && De(null);
|
|
1644
|
-
return;
|
|
1645
|
-
}
|
|
1646
|
-
R || !r || p || De(
|
|
1647
|
-
la(
|
|
1648
|
-
r,
|
|
1649
|
-
et
|
|
1650
|
-
)
|
|
1651
|
-
);
|
|
1652
|
-
}, [
|
|
1653
|
-
r,
|
|
1654
|
-
R,
|
|
1655
|
-
E,
|
|
1656
|
-
p,
|
|
1657
|
-
et
|
|
1658
|
-
]);
|
|
1659
|
-
const Ce = (R == null ? void 0 : R.dashboard) ?? null, { isDirty: zt, isDirtyPending: Ja, resetDirty: Ee } = Dn(
|
|
1660
|
-
r,
|
|
1661
|
-
Ce,
|
|
1662
|
-
300,
|
|
1663
|
-
1e3,
|
|
1664
|
-
it
|
|
1665
|
-
), Ht = Fe(() => Ce ? it(r) !== it(Ce) : !1, [r, Ce]), Bt = zt || Ja, Ie = We || ne.isPending, Ya = () => {
|
|
1666
|
-
Ht() ? (Se("close"), se(!0)) : (tt(), Ee());
|
|
1667
|
-
}, Xa = async () => {
|
|
1668
|
-
await at({
|
|
1669
|
-
closeAfterSave: !0,
|
|
1670
|
-
navigateHomeAfterSave: Ye === "home"
|
|
1671
|
-
});
|
|
1672
|
-
}, Za = () => {
|
|
1673
|
-
R && Ze(R.dashboard, {
|
|
1674
|
-
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1675
|
-
}), tt(), Ye === "home" && Ke(), Se("close"), se(!1), Ee();
|
|
1676
|
-
}, es = () => {
|
|
1677
|
-
R && (Ze(R.dashboard, {
|
|
1678
|
-
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1679
|
-
}), Ee());
|
|
1680
|
-
}, ts = () => {
|
|
1681
|
-
if (E && Ht()) {
|
|
1682
|
-
Se("home"), se(!0);
|
|
1683
|
-
return;
|
|
1684
|
-
}
|
|
1685
|
-
Ke();
|
|
1686
|
-
};
|
|
1687
|
-
async function at(o) {
|
|
1688
|
-
const P = N.getState().dashboard;
|
|
1689
|
-
if (!P)
|
|
1690
|
-
return;
|
|
1691
|
-
const z = (o == null ? void 0 : o.closeAfterSave) ?? Ot, os = (o == null ? void 0 : o.navigateHomeAfterSave) ?? !1;
|
|
1692
|
-
be(z), z && se(!1);
|
|
1693
|
-
const is = vt(P);
|
|
1694
|
-
pe(!0), ge(null), ve([]), Je(!0);
|
|
1695
|
-
const cs = {
|
|
1696
|
-
template: P
|
|
1697
|
-
};
|
|
1698
|
-
ne.mutate(
|
|
1699
|
-
{
|
|
1700
|
-
resourceId: P.id,
|
|
1701
|
-
data: cs
|
|
1702
|
-
},
|
|
1703
|
-
{
|
|
1704
|
-
onSuccess: (U) => {
|
|
1705
|
-
var Le, Ae, ea;
|
|
1706
|
-
const Q = (U == null ? void 0 : U.id) || ((Le = U == null ? void 0 : U.dashboard) == null ? void 0 : Le.id) || ((Ae = U == null ? void 0 : U.resource) == null ? void 0 : Ae.id) || ((ea = U == null ? void 0 : U.template) == null ? void 0 : ea.id) || null;
|
|
1707
|
-
if (!P.id && Q) {
|
|
1708
|
-
const st = bs.getState(), ke = st.pendingDashboardDraftMigration;
|
|
1709
|
-
(ke == null ? void 0 : ke.scopeKey) === m ? st.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
|
|
1710
|
-
Q
|
|
1711
|
-
) : ke && st.actions.clearPendingDashboardDraftMigration();
|
|
1712
|
-
}
|
|
1713
|
-
Je(!1), M.success("Dashboard saved!"), De(
|
|
1714
|
-
la(
|
|
1715
|
-
is,
|
|
1716
|
-
N.getState().semanticExecutionPayload
|
|
1717
|
-
)
|
|
1718
|
-
), pe(!1), be(!1), z && (tt(), Ee(), os && Ke()), Se("close");
|
|
1719
|
-
},
|
|
1720
|
-
onError: (U) => {
|
|
1721
|
-
Je(!1), ge("Failed to save dashboard. Please try again.");
|
|
1722
|
-
const Q = U.details, Le = Array.isArray(
|
|
1723
|
-
Q == null ? void 0 : Q.errors
|
|
1724
|
-
) ? (Q.errors || []).filter(
|
|
1725
|
-
(Ae) => typeof Ae == "string"
|
|
1726
|
-
) : [];
|
|
1727
|
-
ve(
|
|
1728
|
-
fr({
|
|
1729
|
-
errors: Le,
|
|
1730
|
-
dashboard: P || void 0
|
|
1731
|
-
})
|
|
1732
|
-
), M.error("Failed to save dashboard");
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
);
|
|
1736
|
-
}
|
|
1737
|
-
async function as() {
|
|
1738
|
-
if (V(!0), !h || !d) return;
|
|
1739
|
-
const o = N.getState().dashboard;
|
|
1740
|
-
if (!o) {
|
|
1741
|
-
V(!1);
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
const P = JSON.stringify(o), z = {
|
|
1745
|
-
...d,
|
|
1746
|
-
template: P,
|
|
1747
|
-
filterValues: $a
|
|
1748
|
-
};
|
|
1749
|
-
await xt(
|
|
1750
|
-
a.apiServiceUrl,
|
|
1751
|
-
z,
|
|
1752
|
-
t == null ? void 0 : t.accessToken
|
|
1753
|
-
), M.success("Lens saved"), je == null || je(o), V(!1);
|
|
1754
|
-
}
|
|
1755
|
-
const jt = (d == null ? void 0 : d.name) || r.title, oe = !!(r != null && r.id);
|
|
1756
|
-
ne.isPending && console.log("Title during update:", {
|
|
1757
|
-
title: jt,
|
|
1758
|
-
dashboardStateTitle: r.title,
|
|
1759
|
-
dashboardId: r == null ? void 0 : r.id,
|
|
1760
|
-
currentLensName: d == null ? void 0 : d.name
|
|
1761
|
-
});
|
|
1762
|
-
const Kt = a.orgUserId || a.tenantId && a.endUserId && a.endUserEmail, ss = !!Kt && !!(t != null && t.accessToken) && !!(a != null && a.apiServiceUrl);
|
|
1763
|
-
ot(() => {
|
|
1764
|
-
!oe && Z && ee(!1);
|
|
1765
|
-
}, [oe, Z]);
|
|
1766
|
-
const ns = l, ie = (r == null ? void 0 : r.id) || null, Me = !!ie && Va === ie, rs = () => {
|
|
1767
|
-
ie && qa({
|
|
1768
|
-
dashboardId: Me ? null : ie
|
|
1769
|
-
});
|
|
1770
|
-
};
|
|
1771
|
-
return /* @__PURE__ */ c(
|
|
1772
|
-
"div",
|
|
1773
|
-
{
|
|
1774
|
-
className: "flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",
|
|
1775
|
-
role: "dashboard-controls",
|
|
1776
|
-
children: [
|
|
1777
|
-
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1778
|
-
Kt && /* @__PURE__ */ c(T, { children: [
|
|
1779
|
-
/* @__PURE__ */ e(
|
|
1780
|
-
rt,
|
|
1781
|
-
{
|
|
1782
|
-
"aria-label": "Manage Dashboards",
|
|
1783
|
-
tooltip: "Manage Dashboards",
|
|
1784
|
-
onClick: () => {
|
|
1785
|
-
Ga(!Ra);
|
|
1786
|
-
},
|
|
1787
|
-
className: "h-7 w-7 px-0",
|
|
1788
|
-
buttonProps: { size: "xs" },
|
|
1789
|
-
children: /* @__PURE__ */ e(An, { className: "h-3.5 w-3.5" })
|
|
1790
|
-
}
|
|
1791
|
-
),
|
|
1792
|
-
ns && !_ && /* @__PURE__ */ e(
|
|
1793
|
-
rt,
|
|
1794
|
-
{
|
|
1795
|
-
"aria-label": "Dashboard Hub",
|
|
1796
|
-
tooltip: "Dashboard Hub",
|
|
1797
|
-
onClick: ts,
|
|
1798
|
-
className: "h-7 w-7 px-0",
|
|
1799
|
-
buttonProps: { size: "xs" },
|
|
1800
|
-
children: /* @__PURE__ */ e(fa, { className: "h-3.5 w-3.5" })
|
|
1801
|
-
}
|
|
1802
|
-
)
|
|
1803
|
-
] }),
|
|
1804
|
-
!_ && l && (p ? /* @__PURE__ */ e(
|
|
1805
|
-
"div",
|
|
1806
|
-
{
|
|
1807
|
-
className: "h-4 w-28 animate-pulse rounded-md bg-muted/70",
|
|
1808
|
-
"aria-label": "Loading dashboard title",
|
|
1809
|
-
role: "status",
|
|
1810
|
-
children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading dashboard title" })
|
|
1811
|
-
}
|
|
1812
|
-
) : /* @__PURE__ */ c(T, { children: [
|
|
1813
|
-
/* @__PURE__ */ e(
|
|
1814
|
-
Qs,
|
|
1815
|
-
{
|
|
1816
|
-
value: jt || "Untitled Dashboard",
|
|
1817
|
-
onSave: (o) => {
|
|
1818
|
-
console.log("EditableText onSave called:", {
|
|
1819
|
-
newTitle: o,
|
|
1820
|
-
canEditDashboard: xe,
|
|
1821
|
-
dashboardId: r == null ? void 0 : r.id
|
|
1822
|
-
});
|
|
1823
|
-
const P = (r == null ? void 0 : r.title) || "";
|
|
1824
|
-
k(o), Qa(o, P);
|
|
1825
|
-
},
|
|
1826
|
-
isEditable: xe && !d,
|
|
1827
|
-
displayClassName: "text-[13px] font-medium",
|
|
1828
|
-
inputClassName: "text-[13px] font-medium",
|
|
1829
|
-
placeholder: "Dashboard Title",
|
|
1830
|
-
isPending: ne.isPending
|
|
1831
|
-
}
|
|
1832
|
-
),
|
|
1833
|
-
ss && ie && /* @__PURE__ */ e(hs, { children: /* @__PURE__ */ c(ps, { children: [
|
|
1834
|
-
/* @__PURE__ */ e(fs, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1835
|
-
L,
|
|
1836
|
-
{
|
|
1837
|
-
variant: "ghost",
|
|
1838
|
-
size: "xs",
|
|
1839
|
-
onClick: rs,
|
|
1840
|
-
disabled: za || !(t != null && t.accessToken) || !(a != null && a.apiServiceUrl),
|
|
1841
|
-
className: "w-7 px-0",
|
|
1842
|
-
"aria-label": Me ? "Remove as default dashboard" : "Make this a default dashboard",
|
|
1843
|
-
children: /* @__PURE__ */ e(
|
|
1844
|
-
Ws,
|
|
1845
|
-
{
|
|
1846
|
-
className: Y(
|
|
1847
|
-
"h-3.5 w-3.5 transition-colors",
|
|
1848
|
-
Me ? "fill-foreground text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
1849
|
-
)
|
|
1850
|
-
}
|
|
1851
|
-
)
|
|
1852
|
-
}
|
|
1853
|
-
) }),
|
|
1854
|
-
/* @__PURE__ */ e(gs, { children: /* @__PURE__ */ e("p", { children: Me ? "Remove as default dashboard" : "Make this a default dashboard" }) })
|
|
1855
|
-
] }) })
|
|
1856
|
-
] }))
|
|
1857
|
-
] }),
|
|
1858
|
-
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1859
|
-
_ && /* @__PURE__ */ c(T, { children: [
|
|
1860
|
-
/* @__PURE__ */ e(fn, {}),
|
|
1861
|
-
/* @__PURE__ */ e(gn, {})
|
|
1862
|
-
] }),
|
|
1863
|
-
!_ && l && ((Zt = J == null ? void 0 : J.permissions) == null ? void 0 : Zt.canShare) && /* @__PURE__ */ c(
|
|
1864
|
-
L,
|
|
1865
|
-
{
|
|
1866
|
-
variant: "outline",
|
|
1867
|
-
size: "xs",
|
|
1868
|
-
onClick: () => x(!0),
|
|
1869
|
-
children: [
|
|
1870
|
-
/* @__PURE__ */ e(Js, { className: "h-3.5 w-3.5" }),
|
|
1871
|
-
"Share"
|
|
1872
|
-
]
|
|
1873
|
-
}
|
|
1874
|
-
),
|
|
1875
|
-
!_ && E && u.canUseFilters && l && /* @__PURE__ */ e(
|
|
1876
|
-
vn,
|
|
1877
|
-
{
|
|
1878
|
-
showFilters: S ? !1 : we,
|
|
1879
|
-
onToggleFilters: () => {
|
|
1880
|
-
if (S && b) {
|
|
1881
|
-
Ut(b, "inputs");
|
|
1882
|
-
return;
|
|
1883
|
-
}
|
|
1884
|
-
we || Pt("dashboard", !1), _t(!we);
|
|
1885
|
-
},
|
|
1886
|
-
onAddFilter: () => {
|
|
1887
|
-
if (S && b) {
|
|
1888
|
-
Ut(b, "inputs");
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
we || (Pt("dashboard", !1), _t(!0));
|
|
1892
|
-
},
|
|
1893
|
-
onAddControl: () => {
|
|
1894
|
-
Vt("create");
|
|
1895
|
-
},
|
|
1896
|
-
onManageControls: () => Vt("manage")
|
|
1897
|
-
}
|
|
1898
|
-
),
|
|
1899
|
-
E && !_ && l && Be ? S ? /* @__PURE__ */ e(
|
|
1900
|
-
vr,
|
|
1901
|
-
{
|
|
1902
|
-
open: !0,
|
|
1903
|
-
onOpenChange: (o) => {
|
|
1904
|
-
o || he(null);
|
|
1905
|
-
},
|
|
1906
|
-
initialMode: Be
|
|
1907
|
-
}
|
|
1908
|
-
) : /* @__PURE__ */ e(
|
|
1909
|
-
bn,
|
|
1910
|
-
{
|
|
1911
|
-
open: !0,
|
|
1912
|
-
onOpenChange: (o) => {
|
|
1913
|
-
o || he(null);
|
|
1914
|
-
},
|
|
1915
|
-
showTrigger: !1,
|
|
1916
|
-
initialMode: Be
|
|
1917
|
-
}
|
|
1918
|
-
) : null,
|
|
1919
|
-
E && !_ && re && d && s && l && /* @__PURE__ */ c(
|
|
1920
|
-
L,
|
|
1921
|
-
{
|
|
1922
|
-
variant: "secondary",
|
|
1923
|
-
size: "xs",
|
|
1924
|
-
disabled: I,
|
|
1925
|
-
onClick: as,
|
|
1926
|
-
children: [
|
|
1927
|
-
/* @__PURE__ */ e(na, { className: "h-3.5 w-3.5" }),
|
|
1928
|
-
"Save Lens"
|
|
1929
|
-
]
|
|
1930
|
-
}
|
|
1931
|
-
),
|
|
1932
|
-
E && !_ && l && !S && /* @__PURE__ */ c(
|
|
1933
|
-
L,
|
|
1934
|
-
{
|
|
1935
|
-
variant: "outline",
|
|
1936
|
-
size: "xs",
|
|
1937
|
-
disabled: !E,
|
|
1938
|
-
onClick: () => ja(),
|
|
1939
|
-
children: [
|
|
1940
|
-
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
1941
|
-
"Visual"
|
|
1942
|
-
]
|
|
1943
|
-
}
|
|
1944
|
-
),
|
|
1945
|
-
!_ && !E && xe && l && /* @__PURE__ */ c(L, { size: "xs", onClick: Wa, children: [
|
|
1946
|
-
/* @__PURE__ */ e(Ys, { className: "h-3.5 w-3.5" }),
|
|
1947
|
-
"Edit"
|
|
1948
|
-
] }),
|
|
1949
|
-
qt && l && zt && /* @__PURE__ */ c(
|
|
1950
|
-
L,
|
|
1951
|
-
{
|
|
1952
|
-
variant: "outline",
|
|
1953
|
-
size: "xs",
|
|
1954
|
-
onClick: es,
|
|
1955
|
-
disabled: Ie,
|
|
1956
|
-
children: [
|
|
1957
|
-
/* @__PURE__ */ e(_n, { className: "h-3.5 w-3.5" }),
|
|
1958
|
-
"Undo"
|
|
1959
|
-
]
|
|
1960
|
-
}
|
|
1961
|
-
),
|
|
1962
|
-
qt && l && /* @__PURE__ */ c(
|
|
1963
|
-
L,
|
|
1964
|
-
{
|
|
1965
|
-
size: "xs",
|
|
1966
|
-
className: Y(!Bt && "opacity-60"),
|
|
1967
|
-
disabled: Ie || !Bt,
|
|
1968
|
-
onClick: () => at(),
|
|
1969
|
-
children: [
|
|
1970
|
-
Ie ? /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(na, { className: "h-3.5 w-3.5" }),
|
|
1971
|
-
Ie ? "Saving..." : "Save"
|
|
1972
|
-
]
|
|
1973
|
-
}
|
|
1974
|
-
),
|
|
1975
|
-
E && !_ && l && /* @__PURE__ */ c(L, { variant: "outline", size: "xs", onClick: Ya, children: [
|
|
1976
|
-
/* @__PURE__ */ e(ga, { className: "h-3.5 w-3.5" }),
|
|
1977
|
-
"Close"
|
|
1978
|
-
] }),
|
|
1979
|
-
!_ && l && /* @__PURE__ */ e("div", { className: "ml-2", children: /* @__PURE__ */ e(yn, {}) }),
|
|
1980
|
-
!_ && s && /* @__PURE__ */ e(Gn, {}),
|
|
1981
|
-
!_ && l && /* @__PURE__ */ c(Xs, { children: [
|
|
1982
|
-
/* @__PURE__ */ e(Zs, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1983
|
-
rt,
|
|
1984
|
-
{
|
|
1985
|
-
tooltip: "More Options",
|
|
1986
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
1987
|
-
buttonProps: {
|
|
1988
|
-
size: "xs",
|
|
1989
|
-
variant: "ghost",
|
|
1990
|
-
"aria-label": "More dashboard options"
|
|
1991
|
-
},
|
|
1992
|
-
children: /* @__PURE__ */ e(en, { className: "h-3.5 w-3.5" })
|
|
1993
|
-
}
|
|
1994
|
-
) }),
|
|
1995
|
-
/* @__PURE__ */ c(
|
|
1996
|
-
tn,
|
|
1997
|
-
{
|
|
1998
|
-
align: "end",
|
|
1999
|
-
className: "w-56 rounded-control border border-border/60 p-1 shadow-sm",
|
|
2000
|
-
children: [
|
|
2001
|
-
/* @__PURE__ */ e(de, { children: "Reports" }),
|
|
2002
|
-
/* @__PURE__ */ c(
|
|
2003
|
-
$,
|
|
2004
|
-
{
|
|
2005
|
-
disabled: v,
|
|
2006
|
-
onSelect: () => At(!0),
|
|
2007
|
-
children: [
|
|
2008
|
-
/* @__PURE__ */ e(an, { className: "h-3.5 w-3.5" }),
|
|
2009
|
-
"Export"
|
|
2010
|
-
]
|
|
2011
|
-
}
|
|
2012
|
-
),
|
|
2013
|
-
/* @__PURE__ */ c(
|
|
2014
|
-
$,
|
|
2015
|
-
{
|
|
2016
|
-
disabled: !oe,
|
|
2017
|
-
onSelect: () => {
|
|
2018
|
-
oe && ee(!0);
|
|
2019
|
-
},
|
|
2020
|
-
children: [
|
|
2021
|
-
/* @__PURE__ */ e(sn, { className: "h-3.5 w-3.5" }),
|
|
2022
|
-
"Schedule"
|
|
2023
|
-
]
|
|
2024
|
-
}
|
|
2025
|
-
),
|
|
2026
|
-
/* @__PURE__ */ e(Te, {}),
|
|
2027
|
-
Ba && /* @__PURE__ */ c(T, { children: [
|
|
2028
|
-
/* @__PURE__ */ e(de, { children: "Access" }),
|
|
2029
|
-
/* @__PURE__ */ c(
|
|
2030
|
-
$,
|
|
2031
|
-
{
|
|
2032
|
-
onClick: () => W(!0),
|
|
2033
|
-
children: [
|
|
2034
|
-
/* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" }),
|
|
2035
|
-
"Manage Groups"
|
|
2036
|
-
]
|
|
2037
|
-
}
|
|
2038
|
-
),
|
|
2039
|
-
/* @__PURE__ */ e(Te, {})
|
|
2040
|
-
] }),
|
|
2041
|
-
/* @__PURE__ */ e(de, { children: "Preferences" }),
|
|
2042
|
-
/* @__PURE__ */ c($, { onClick: () => O(!0), children: [
|
|
2043
|
-
/* @__PURE__ */ e(nn, { className: "h-3.5 w-3.5" }),
|
|
2044
|
-
"Calendar Preferences"
|
|
2045
|
-
] }),
|
|
2046
|
-
/* @__PURE__ */ c($, { onClick: () => B(!0), children: [
|
|
2047
|
-
/* @__PURE__ */ e(rn, { className: "h-3.5 w-3.5" }),
|
|
2048
|
-
"Summary Settings"
|
|
2049
|
-
] }),
|
|
2050
|
-
s && l && /* @__PURE__ */ c(T, { children: [
|
|
2051
|
-
/* @__PURE__ */ e(Te, {}),
|
|
2052
|
-
/* @__PURE__ */ e(de, { children: "Developer" }),
|
|
2053
|
-
/* @__PURE__ */ c(
|
|
2054
|
-
$,
|
|
2055
|
-
{
|
|
2056
|
-
onSelect: () => {
|
|
2057
|
-
var o;
|
|
2058
|
-
t != null && t.accessToken && ((o = navigator == null ? void 0 : navigator.clipboard) != null && o.writeText ? navigator.clipboard.writeText(t.accessToken).then(
|
|
2059
|
-
() => M.success("Token copied to clipboard")
|
|
2060
|
-
).catch(() => M.error("Unable to copy token")) : M.error("Clipboard not available"));
|
|
2061
|
-
},
|
|
2062
|
-
children: [
|
|
2063
|
-
/* @__PURE__ */ e(sa, { className: "h-3.5 w-3.5" }),
|
|
2064
|
-
"Copy token"
|
|
2065
|
-
]
|
|
2066
|
-
}
|
|
2067
|
-
),
|
|
2068
|
-
S && /* @__PURE__ */ c(
|
|
2069
|
-
$,
|
|
2070
|
-
{
|
|
2071
|
-
disabled: !Xe,
|
|
2072
|
-
onSelect: () => {
|
|
2073
|
-
var o;
|
|
2074
|
-
if (!Xe) {
|
|
2075
|
-
M.error(
|
|
2076
|
-
"Open a document sheet with a token to copy the local PDF URL"
|
|
2077
|
-
);
|
|
2078
|
-
return;
|
|
2079
|
-
}
|
|
2080
|
-
(o = navigator == null ? void 0 : navigator.clipboard) != null && o.writeText ? navigator.clipboard.writeText(Xe).then(
|
|
2081
|
-
() => M.success(
|
|
2082
|
-
"Local document PDF URL copied to clipboard"
|
|
2083
|
-
)
|
|
2084
|
-
).catch(
|
|
2085
|
-
() => M.error(
|
|
2086
|
-
"Unable to copy local document PDF URL"
|
|
2087
|
-
)
|
|
2088
|
-
) : M.error("Clipboard not available");
|
|
2089
|
-
},
|
|
2090
|
-
children: [
|
|
2091
|
-
/* @__PURE__ */ e(sa, { className: "h-3.5 w-3.5" }),
|
|
2092
|
-
"Copy local document PDF URL"
|
|
2093
|
-
]
|
|
2094
|
-
}
|
|
2095
|
-
),
|
|
2096
|
-
/* @__PURE__ */ c(
|
|
2097
|
-
$,
|
|
2098
|
-
{
|
|
2099
|
-
onSelect: () => vs(a.apiServiceUrl),
|
|
2100
|
-
children: [
|
|
2101
|
-
/* @__PURE__ */ e(Pn, { className: "h-3.5 w-3.5" }),
|
|
2102
|
-
"Invalidate token"
|
|
2103
|
-
]
|
|
2104
|
-
}
|
|
2105
|
-
),
|
|
2106
|
-
/* @__PURE__ */ c($, { onSelect: i, children: [
|
|
2107
|
-
/* @__PURE__ */ e(In, { className: "h-3.5 w-3.5" }),
|
|
2108
|
-
"Brand Studio"
|
|
2109
|
-
] }),
|
|
2110
|
-
E && /* @__PURE__ */ c(
|
|
2111
|
-
$,
|
|
2112
|
-
{
|
|
2113
|
-
onSelect: () => Rt(!Tt),
|
|
2114
|
-
children: [
|
|
2115
|
-
/* @__PURE__ */ e(Mn, { className: "h-3.5 w-3.5" }),
|
|
2116
|
-
Tt ? "Hide dashboard JSON" : "Show dashboard JSON"
|
|
2117
|
-
]
|
|
2118
|
-
}
|
|
2119
|
-
),
|
|
2120
|
-
re && E && /* @__PURE__ */ c($, { onSelect: () => te(!0), children: [
|
|
2121
|
-
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
2122
|
-
"Add lens"
|
|
2123
|
-
] }),
|
|
2124
|
-
re && /* @__PURE__ */ c(on, { children: [
|
|
2125
|
-
/* @__PURE__ */ c(cn, { children: [
|
|
2126
|
-
/* @__PURE__ */ e(Ln, { className: "h-3.5 w-3.5" }),
|
|
2127
|
-
"Lenses"
|
|
2128
|
-
] }),
|
|
2129
|
-
/* @__PURE__ */ e(ln, { className: "w-60", children: /* @__PURE__ */ e(Hn, {}) })
|
|
2130
|
-
] })
|
|
2131
|
-
] })
|
|
2132
|
-
]
|
|
2133
|
-
}
|
|
2134
|
-
)
|
|
2135
|
-
] }),
|
|
2136
|
-
q && $t && /* @__PURE__ */ e(
|
|
2137
|
-
dn,
|
|
2138
|
-
{
|
|
2139
|
-
resource: $t,
|
|
2140
|
-
resourceType: nt.DASHBOARD,
|
|
2141
|
-
onClose: () => x(!1)
|
|
2142
|
-
}
|
|
2143
|
-
),
|
|
2144
|
-
/* @__PURE__ */ e(
|
|
2145
|
-
hr,
|
|
2146
|
-
{
|
|
2147
|
-
open: H,
|
|
2148
|
-
onOpenChange: W
|
|
2149
|
-
}
|
|
2150
|
-
),
|
|
2151
|
-
oe && (r == null ? void 0 : r.id) && /* @__PURE__ */ e(
|
|
2152
|
-
un,
|
|
2153
|
-
{
|
|
2154
|
-
open: Z,
|
|
2155
|
-
onOpenChange: ee,
|
|
2156
|
-
dashboardId: r.id,
|
|
2157
|
-
dashboardName: r == null ? void 0 : r.title
|
|
2158
|
-
}
|
|
2159
|
-
),
|
|
2160
|
-
/* @__PURE__ */ e(
|
|
2161
|
-
Nn,
|
|
2162
|
-
{
|
|
2163
|
-
open: y,
|
|
2164
|
-
onOpenChange: O
|
|
2165
|
-
}
|
|
2166
|
-
),
|
|
2167
|
-
/* @__PURE__ */ e(
|
|
2168
|
-
Sn,
|
|
2169
|
-
{
|
|
2170
|
-
open: G,
|
|
2171
|
-
onOpenChange: B,
|
|
2172
|
-
dashboard: r,
|
|
2173
|
-
disabled: !E,
|
|
2174
|
-
onApply: (o) => Ze(
|
|
2175
|
-
{
|
|
2176
|
-
...r,
|
|
2177
|
-
summary: o
|
|
2178
|
-
},
|
|
2179
|
-
{
|
|
2180
|
-
semanticExecutionPayload: et
|
|
2181
|
-
}
|
|
2182
|
-
)
|
|
2183
|
-
}
|
|
2184
|
-
),
|
|
2185
|
-
s && re && l && /* @__PURE__ */ e(zn, { open: me, onOpenChange: te }),
|
|
2186
|
-
l && /* @__PURE__ */ e(
|
|
2187
|
-
mn,
|
|
2188
|
-
{
|
|
2189
|
-
open: Ua,
|
|
2190
|
-
onOpenChange: At
|
|
2191
|
-
}
|
|
2192
|
-
),
|
|
2193
|
-
/* @__PURE__ */ e(
|
|
2194
|
-
ya,
|
|
2195
|
-
{
|
|
2196
|
-
open: Fa,
|
|
2197
|
-
onOpenChange: (o) => {
|
|
2198
|
-
!o && We && !fe || (pe(o), o || (ge(null), ve([]), be(!1)));
|
|
2199
|
-
},
|
|
2200
|
-
children: /* @__PURE__ */ c(xa, { className: "max-w-sm", children: [
|
|
2201
|
-
/* @__PURE__ */ c(wa, { children: [
|
|
2202
|
-
/* @__PURE__ */ e(Na, { children: fe ? "Save failed" : "Saving dashboard" }),
|
|
2203
|
-
/* @__PURE__ */ e(Sa, { className: "pt-2", children: fe ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
|
|
2204
|
-
kt.length > 0 && /* @__PURE__ */ c("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
|
|
2205
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-destructive", children: "What needs attention" }),
|
|
2206
|
-
/* @__PURE__ */ e("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: kt.slice(0, 5).map((o) => /* @__PURE__ */ e("li", { children: o }, o)) })
|
|
2207
|
-
] })
|
|
2208
|
-
] }),
|
|
2209
|
-
/* @__PURE__ */ e(Da, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: fe ? /* @__PURE__ */ c(T, { children: [
|
|
2210
|
-
/* @__PURE__ */ e(
|
|
2211
|
-
Ca,
|
|
2212
|
-
{
|
|
2213
|
-
onClick: () => {
|
|
2214
|
-
pe(!1), ge(null), ve([]), be(!1);
|
|
2215
|
-
},
|
|
2216
|
-
className: "m-0",
|
|
2217
|
-
children: "Close"
|
|
2218
|
-
}
|
|
2219
|
-
),
|
|
2220
|
-
/* @__PURE__ */ e(
|
|
2221
|
-
gt,
|
|
2222
|
-
{
|
|
2223
|
-
onClick: () => at({
|
|
2224
|
-
closeAfterSave: Ot,
|
|
2225
|
-
navigateHomeAfterSave: Ye === "home"
|
|
2226
|
-
}),
|
|
2227
|
-
className: "m-0",
|
|
2228
|
-
children: "Retry"
|
|
2229
|
-
}
|
|
2230
|
-
)
|
|
2231
|
-
] }) : /* @__PURE__ */ c(gt, { disabled: !0, className: "m-0 cursor-default", children: [
|
|
2232
|
-
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2233
|
-
"Saving..."
|
|
2234
|
-
] }) })
|
|
2235
|
-
] })
|
|
2236
|
-
}
|
|
2237
|
-
),
|
|
2238
|
-
/* @__PURE__ */ e(
|
|
2239
|
-
xn,
|
|
2240
|
-
{
|
|
2241
|
-
open: Ka,
|
|
2242
|
-
onOpenChange: (o) => {
|
|
2243
|
-
se(o);
|
|
2244
|
-
},
|
|
2245
|
-
onSave: Xa,
|
|
2246
|
-
onDiscard: Za,
|
|
2247
|
-
isSaving: We,
|
|
2248
|
-
saveLabel: "Save",
|
|
2249
|
-
discardLabel: "Discard"
|
|
2250
|
-
}
|
|
2251
|
-
)
|
|
2252
|
-
] })
|
|
2253
|
-
]
|
|
2254
|
-
}
|
|
2255
|
-
);
|
|
2256
|
-
}
|
|
2257
|
-
function Nr({
|
|
2258
|
-
accessToken: t,
|
|
2259
|
-
dashboardId: a,
|
|
2260
|
-
selectedSheetId: n,
|
|
2261
|
-
pageSize: s,
|
|
2262
|
-
orientation: i,
|
|
2263
|
-
theme: u
|
|
2264
|
-
}) {
|
|
2265
|
-
if (!t || !n)
|
|
2266
|
-
return null;
|
|
2267
|
-
const l = new URL("http://localhost:5173/print-document");
|
|
2268
|
-
l.searchParams.set("token", t), a && l.searchParams.set("dashboardId", a), l.searchParams.set("selectedSheetId", n), u && l.searchParams.set("theme", u);
|
|
2269
|
-
const p = new URL("http://127.0.0.1:3002/");
|
|
2270
|
-
return p.searchParams.set("pdfMode", "document"), p.searchParams.set("pageSize", s || "letter"), p.searchParams.set("orientation", i || "portrait"), p.searchParams.set("url", l.toString()), p.toString();
|
|
2271
|
-
}
|
|
2272
|
-
export {
|
|
2273
|
-
Rr as default
|
|
2274
|
-
};
|