react-semaphor 0.1.502 → 0.1.503

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.
Files changed (33) hide show
  1. package/dist/brand-studio/index.cjs +1 -1
  2. package/dist/brand-studio/index.js +1 -1
  3. package/dist/chunks/dashboard-briefing-launcher-CHMQi0pU.cjs +21 -0
  4. package/dist/chunks/{dashboard-briefing-launcher-BeSH0Fcx.js → dashboard-briefing-launcher-COqlnnQ2.js} +716 -686
  5. package/dist/chunks/{dashboard-controls-CMrdk5DH.js → dashboard-controls-Bp6XzVvx.js} +102 -101
  6. package/dist/chunks/{dashboard-controls-CJKV_UEh.cjs → dashboard-controls-D8z05ZfX.cjs} +3 -3
  7. package/dist/chunks/{dashboard-json-Dtt-ZcDP.cjs → dashboard-json-DcvkxkL3.cjs} +1 -1
  8. package/dist/chunks/{dashboard-json-Hp3rxYdE.js → dashboard-json-Dw7kHCe5.js} +2 -2
  9. package/dist/chunks/{edit-dashboard-visual-DriCPFXz.js → edit-dashboard-visual-D5vvLzkS.js} +3 -3
  10. package/dist/chunks/{edit-dashboard-visual-BxsmmZ0X.cjs → edit-dashboard-visual-olfXEK5D.cjs} +1 -1
  11. package/dist/chunks/{editor-action-buttons-aAD93tZz.cjs → editor-action-buttons-BsWibSiV.cjs} +1 -1
  12. package/dist/chunks/{editor-action-buttons-Ld5MY-XV.js → editor-action-buttons-DYiJr5u3.js} +2 -2
  13. package/dist/chunks/index-C3rUIii0.cjs +1417 -0
  14. package/dist/chunks/{index-tzbGUY7m.js → index-ZKSLtc9_.js} +30168 -29888
  15. package/dist/chunks/{report-preferences-dialog-CabpgTu7.js → report-preferences-dialog-BXaILrOK.js} +2 -2
  16. package/dist/chunks/{report-preferences-dialog-Dtz8hYSB.cjs → report-preferences-dialog-BZvi_3DV.cjs} +1 -1
  17. package/dist/chunks/{switch-Lw3Hbryg.js → switch-DWM8d-UR.js} +5 -0
  18. package/dist/chunks/{switch-6The8BTM.cjs → switch-Dej7zCoP.cjs} +1 -1
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/data-app-builder/index.cjs +1 -1
  22. package/dist/data-app-builder/index.js +2 -2
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +6 -6
  25. package/dist/surfboard/index.cjs +1 -1
  26. package/dist/surfboard/index.js +2 -2
  27. package/dist/types/dashboard.d.ts +11 -0
  28. package/dist/types/main.d.ts +14 -1
  29. package/dist/types/surfboard.d.ts +11 -0
  30. package/dist/types/types.d.ts +11 -0
  31. package/package.json +1 -1
  32. package/dist/chunks/dashboard-briefing-launcher-CkyDaDQm.cjs +0 -21
  33. package/dist/chunks/index-CriMt9Bn.cjs +0 -1417
@@ -1,16 +1,16 @@
1
1
  import { jsx as t, jsxs as r, Fragment as j } from "react/jsx-runtime";
2
- import wt, { useState as F, useEffect as Y, useMemo as ee, useCallback as H, useLayoutEffect as Gt, useContext as qt, useRef as he } from "react";
3
- import { B as U, O as Se, Z as Je, L as ae, M as Nt, d as St, a4 as O, c as K, K as Kt, u as T, D as me, z as be, aA as Dt, az as et, E as kt, P as Re, a as Pe, b as Me, aL as Qt, aM as Yt, S as Et, aN as Xt, aO as Zt, aP as Jt, aQ as er, aJ as tr } from "./switch-Lw3Hbryg.js";
4
- import { ck as tt, aF as De, aG as ke, aI as Ee, b9 as At, bX as rr, cl as ar, cm as nr, aX as ge, c8 as Ft, bk as Oe, r as sr, n as or, cn as ir, aN as rt, aQ as at, aR as nt, aS as st, aT as ot, aU as it, aV as lt, aW as It, bi as dt, co as lr, cp as dr, cq as Qe, c9 as $e, ca as je, cr as Lt, cb as We, bV as q, a$ as cr, bA as _e, cs as ur, bU as hr, aH as ct, aJ as ut, ct as mr, aE as pr, b8 as fr, bv as Bt, cu as gr, bY as br, u as xr, aK as vr, b1 as yr, ay as He, N as ue, av as ht, ar as Ut, as as ze, O as Tt, aq as Cr, ax as wr, R as Vt, cv as Nr, cw as Sr, at as bt, Q as Dr, cx as kr, cy as Er, cz as Ar, cA as Fr, cB as Ir, cC as Lr, cD as Rt, cE as Br, b2 as Ur, cF as Tr, cc as Pt, cG as Vr, cH as Rr, cI as Te, cJ as Pr, cK as Mr, cL as Or, am as _r, ao as zr, a2 as $r, a1 as jr, a0 as Wr, $ as Hr, Y as Gr, W as qr, cM as Kr, cN as Qr, cO as Yr, cP as Xr, cQ as Zr, ak as Jr, cR as ea, cS as ta, a8 as ra, cT as aa, cU as na, cV as sa } from "./index-tzbGUY7m.js";
5
- import { L as mt } from "./layout-grid-CiubineE.js";
6
- import { c as Ge, X as qe, C as Mt } from "./x-CXDkqdur.js";
7
- import { u as pt, V as oa, E as Ye, a as Xe, b as ia, c as la, L as da, d as ca, e as Ot, C as _t, F as ua, f as ha } from "./editor-action-buttons-Ld5MY-XV.js";
8
- import { v as xt, s as ma } from "./constants-CTRduy1g.js";
2
+ import Nt, { useState as I, useEffect as Y, useMemo as Z, useCallback as H, useLayoutEffect as xt, useRef as ce, useContext as qt } from "react";
3
+ import { B as T, O as Se, Z as et, L as ae, M as St, d as Dt, a4 as O, c as K, K as Kt, u as L, D as me, z as be, aA as kt, az as tt, E as Et, P as Pe, a as Me, b as Oe, aL as Qt, aM as Yt, S as At, aN as Xt, aO as Zt, aP as Jt, aQ as er, aJ as tr } from "./switch-DWM8d-UR.js";
4
+ import { ck as rt, aF as De, aG as ke, aI as Ee, b9 as It, bX as rr, cl as ar, cm as nr, aX as ge, c8 as Ft, bk as _e, r as sr, n as or, cn as ir, aN as at, aQ as nt, aR as st, aS as ot, aT as it, aU as lt, aV as dt, aW as Lt, bi as ct, co as lr, cp as dr, cq as Ye, c9 as je, ca as We, cr as Bt, cb as He, bV as q, a$ as cr, bA as ze, cs as ur, bU as hr, aH as ut, aJ as ht, ct as mr, aE as pr, b8 as fr, bv as Ut, cu as gr, bY as br, u as xr, aK as vr, b1 as yr, ay as Ge, N as he, av as mt, ar as Tt, as as $e, O as Vt, aq as Cr, ax as wr, R as Rt, cv as Nr, cw as Sr, at as vt, Q as Dr, cx as kr, cy as Er, cz as Ar, cA as Ir, cB as Fr, cC as Lr, cD as Pt, cE as Br, b2 as Ur, cF as Tr, cc as Mt, cG as Vr, cH as Rr, cI as Te, cJ as Pr, cK as Mr, cL as Or, am as _r, ao as zr, a2 as $r, a1 as jr, a0 as Wr, $ as Hr, Y as Gr, W as qr, cM as Kr, cN as Qr, cO as Yr, cP as Xr, cQ as Zr, ak as Jr, cR as ea, cS as ta, a8 as ra, cT as aa, cU as na, cV as sa } from "./index-ZKSLtc9_.js";
5
+ import { L as pt } from "./layout-grid-CiubineE.js";
6
+ import { c as qe, X as Ke, C as Ot } from "./x-CXDkqdur.js";
7
+ import { u as ft, V as oa, E as Xe, a as Ze, b as ia, c as la, L as da, d as ca, e as _t, C as zt, F as ua, f as ha } from "./editor-action-buttons-DYiJr5u3.js";
8
+ import { v as yt, s as ma } from "./constants-CTRduy1g.js";
9
9
  import "./validators-CHlnnHuS.js";
10
10
  import "./matrix-operation-contract-CPgckXxm.js";
11
11
  import "../value-format-preferences/index.js";
12
12
  import { S as pa } from "./search-BHsQIWBV.js";
13
- import { s as vt } from "./normalize-dashboard-for-dirty-check-Bk3VYv_q.js";
13
+ import { s as Ve } from "./normalize-dashboard-for-dirty-check-Bk3VYv_q.js";
14
14
  import { M as fa } from "./mouse-pointer-2-BZvGk45-.js";
15
15
  import { l as ga } from "./matrix-formatter-BTPfthsa.js";
16
16
  import "./appearance-runtime-provider-D0xVQWnH.js";
@@ -28,7 +28,7 @@ import { g as se, d as ba, a as xa } from "./index-BVIet238.js";
28
28
  * This source code is licensed under the ISC license.
29
29
  * See the LICENSE file in the root directory of this source tree.
30
30
  */
31
- const va = Ge("ArrowUpRight", [
31
+ const va = qe("ArrowUpRight", [
32
32
  ["path", { d: "M7 7h10v10", key: "1tivn9" }],
33
33
  ["path", { d: "M7 17 17 7", key: "1vkiza" }]
34
34
  ]);
@@ -38,7 +38,7 @@ const va = Ge("ArrowUpRight", [
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
40
  */
41
- const ya = Ge("CalendarRange", [
41
+ const ya = qe("CalendarRange", [
42
42
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
43
43
  ["path", { d: "M16 2v4", key: "4m81vk" }],
44
44
  ["path", { d: "M3 10h18", key: "8toen8" }],
@@ -54,7 +54,7 @@ const ya = Ge("CalendarRange", [
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
56
  */
57
- const Ca = Ge("FileDown", [
57
+ const Ca = qe("FileDown", [
58
58
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
59
59
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
60
60
  ["path", { d: "M12 18v-6", key: "17g6i2" }],
@@ -66,7 +66,7 @@ const Ca = Ge("FileDown", [
66
66
  * This source code is licensed under the ISC license.
67
67
  * See the LICENSE file in the root directory of this source tree.
68
68
  */
69
- const wa = Ge("Newspaper", [
69
+ const wa = qe("Newspaper", [
70
70
  [
71
71
  "path",
72
72
  {
@@ -100,40 +100,40 @@ function Sa({
100
100
  onSubmit: o,
101
101
  isCreating: n
102
102
  }) {
103
- const l = tt("interactive"), [s, c] = F(""), [p, d] = F("");
103
+ const i = rt("interactive"), [s, c] = I(""), [p, l] = I("");
104
104
  Y(() => {
105
- e || (c(""), d(""));
105
+ e || (c(""), l(""));
106
106
  }, [e]);
107
- const m = () => {
107
+ const u = () => {
108
108
  s.trim() && o({ title: s, description: p });
109
- }, i = (h) => {
110
- a(h);
109
+ }, d = (m) => {
110
+ a(m);
111
111
  };
112
- return /* @__PURE__ */ t(De, { open: e, onOpenChange: i, children: /* @__PURE__ */ r(
112
+ return /* @__PURE__ */ t(De, { open: e, onOpenChange: d, children: /* @__PURE__ */ r(
113
113
  ke,
114
114
  {
115
115
  showCloseButton: !1,
116
116
  className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
117
- style: l.dialogStyle,
117
+ style: i.dialogStyle,
118
118
  children: [
119
119
  /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
120
120
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
121
- /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
121
+ /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
122
122
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
123
123
  /* @__PURE__ */ t(Ee, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
124
124
  /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
125
125
  ] })
126
126
  ] }),
127
127
  /* @__PURE__ */ t(
128
- U,
128
+ T,
129
129
  {
130
130
  size: "xs",
131
131
  variant: "ghost",
132
132
  className: "w-7 px-0 text-muted-foreground hover:text-foreground",
133
- onClick: () => i(!1),
133
+ onClick: () => d(!1),
134
134
  "aria-label": "Close",
135
135
  disabled: n,
136
- children: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" })
136
+ children: /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" })
137
137
  }
138
138
  )
139
139
  ] }),
@@ -142,16 +142,16 @@ function Sa({
142
142
  /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
143
143
  /* @__PURE__ */ t(Se, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
144
144
  /* @__PURE__ */ t(
145
- Je,
145
+ et,
146
146
  {
147
147
  id: "visual-title",
148
148
  size: "sm",
149
149
  placeholder: "Untitled visual",
150
150
  value: s,
151
- onChange: (h) => c(h.target.value),
151
+ onChange: (m) => c(m.target.value),
152
152
  disabled: n,
153
- onKeyDown: (h) => {
154
- h.key === "Enter" && !h.shiftKey && (h.preventDefault(), m());
153
+ onKeyDown: (m) => {
154
+ m.key === "Enter" && !m.shiftKey && (m.preventDefault(), u());
155
155
  }
156
156
  }
157
157
  )
@@ -159,13 +159,13 @@ function Sa({
159
159
  /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
160
160
  /* @__PURE__ */ t(Se, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
161
161
  /* @__PURE__ */ t(
162
- Je,
162
+ et,
163
163
  {
164
164
  id: "visual-description",
165
165
  size: "sm",
166
166
  placeholder: "Optional",
167
167
  value: p,
168
- onChange: (h) => d(h.target.value),
168
+ onChange: (m) => l(m.target.value),
169
169
  disabled: n
170
170
  }
171
171
  )
@@ -173,20 +173,20 @@ function Sa({
173
173
  ] }),
174
174
  /* @__PURE__ */ r("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
175
175
  /* @__PURE__ */ t(
176
- U,
176
+ T,
177
177
  {
178
178
  size: "xs",
179
179
  variant: "outline",
180
- onClick: () => i(!1),
180
+ onClick: () => d(!1),
181
181
  disabled: n,
182
182
  children: "Cancel"
183
183
  }
184
184
  ),
185
185
  /* @__PURE__ */ t(
186
- U,
186
+ T,
187
187
  {
188
188
  size: "xs",
189
- onClick: m,
189
+ onClick: u,
190
190
  disabled: !s.trim() || n,
191
191
  children: n ? /* @__PURE__ */ r(j, { children: [
192
192
  /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }),
@@ -199,28 +199,28 @@ function Sa({
199
199
  }
200
200
  ) });
201
201
  }
202
- function zt(e) {
202
+ function $t(e) {
203
203
  return e ? new Date(e).toLocaleDateString("en-US", {
204
204
  month: "short",
205
205
  day: "numeric",
206
206
  year: "numeric"
207
207
  }) : "Unknown";
208
208
  }
209
- function $t(e, a) {
209
+ function jt(e, a) {
210
210
  var n;
211
211
  const o = (n = e.ownership.createdBy) == null ? void 0 : n.type;
212
212
  return o === "tenant" || o === "organization" && a;
213
213
  }
214
- function ft(e, a) {
214
+ function gt(e, a) {
215
215
  var o, n;
216
- return $t(e, a) ? ((o = e.ownership.createdBy) == null ? void 0 : o.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
216
+ return jt(e, a) ? ((o = e.ownership.createdBy) == null ? void 0 : o.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
217
217
  }
218
218
  function Da(e, a) {
219
- return ft(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
219
+ return gt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
220
220
  }
221
221
  function ka(e) {
222
222
  const a = (e || "").toLowerCase();
223
- return a.includes("table") ? Nt : a.includes("pie") || a.includes("donut") ? lr : a.includes("line") ? dr : a.includes("bar") ? Kt : mt;
223
+ return a.includes("table") ? St : a.includes("pie") || a.includes("donut") ? lr : a.includes("line") ? dr : a.includes("bar") ? Kt : pt;
224
224
  }
225
225
  function Ea({ visual: e }) {
226
226
  const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
@@ -230,17 +230,17 @@ function Kn({
230
230
  open: e,
231
231
  onOpenChange: a
232
232
  }) {
233
- const o = tt("interactive"), [n, l] = F(""), [s, c] = F(/* @__PURE__ */ new Set()), [p, d] = F(!1), [m, i] = F(
233
+ const o = rt("interactive"), [n, i] = I(""), [s, c] = I(/* @__PURE__ */ new Set()), [p, l] = I(!1), [u, d] = I(
234
234
  null
235
- ), [h, u] = F(
235
+ ), [m, h] = I(
236
236
  null
237
- ), [f, g] = F(!1), [k, x] = F(null), [D, S] = F(null), C = () => {
238
- c(/* @__PURE__ */ new Set()), i(null), u(null), g(!1), x(null);
237
+ ), [f, g] = I(!1), [k, x] = I(null), [D, S] = I(null), C = () => {
238
+ c(/* @__PURE__ */ new Set()), d(null), h(null), g(!1), x(null);
239
239
  }, w = () => {
240
240
  a(!1), C();
241
- }, { selectVisual: E } = At(), { handleAddLibraryVisual: V, handleEditLibraryVisual: b } = pt(), { isConsoleMode: v } = rr(), {
242
- resources: B,
243
- isLoading: I,
241
+ }, { selectVisual: E } = It(), { handleAddLibraryVisual: V, handleEditLibraryVisual: b } = ft(), { isConsoleMode: v } = rr(), {
242
+ resources: U,
243
+ isLoading: F,
244
244
  isError: G,
245
245
  createResource: A,
246
246
  updateResource: R,
@@ -251,61 +251,61 @@ function Kn({
251
251
  } = ar(
252
252
  void 0,
253
253
  (y) => {
254
- d(!1), y && (E(y), b(y), w());
254
+ l(!1), y && (E(y), b(y), w());
255
255
  }
256
256
  ), {
257
257
  startUpdating: Ae,
258
- stopUpdating: Fe,
258
+ stopUpdating: Ie,
259
259
  isUpdating: ie
260
- } = nr(), W = B, Z = ee(() => {
260
+ } = nr(), W = U, J = Z(() => {
261
261
  const y = n.trim().toLowerCase();
262
262
  return y ? W.filter(
263
- (L) => {
263
+ (B) => {
264
264
  var M, re, de;
265
- return ((M = L.title) == null ? void 0 : M.toLowerCase().includes(y)) || ((re = L.description) == null ? void 0 : re.toLowerCase().includes(y)) || ((de = L.kind) == null ? void 0 : de.toLowerCase().includes(y));
265
+ return ((M = B.title) == null ? void 0 : M.toLowerCase().includes(y)) || ((re = B.description) == null ? void 0 : re.toLowerCase().includes(y)) || ((de = B.kind) == null ? void 0 : de.toLowerCase().includes(y));
266
266
  }
267
267
  ) : W;
268
- }, [n, W]), le = ee(
268
+ }, [n, W]), le = Z(
269
269
  () => W.filter(
270
270
  (y) => s.has(y.id)
271
271
  ),
272
272
  [s, W]
273
- ), J = le.filter(
273
+ ), ee = le.filter(
274
274
  (y) => y.permissions.canDelete
275
- ), Ie = le.filter(
275
+ ), Fe = le.filter(
276
276
  (y) => y.permissions.canShare
277
- ), ve = Z.length > 0 && Z.every(
277
+ ), ve = J.length > 0 && J.every(
278
278
  (y) => s.has(y.id)
279
- ), ce = Z.some(
279
+ ), ue = J.some(
280
280
  (y) => s.has(y.id)
281
281
  ), pe = (y) => {
282
- const L = new Set(s);
283
- y(L), c(L);
282
+ const B = new Set(s);
283
+ y(B), c(B);
284
284
  }, X = (y) => {
285
- pe((L) => {
286
- L.has(y) ? L.delete(y) : L.add(y);
285
+ pe((B) => {
286
+ B.has(y) ? B.delete(y) : B.add(y);
287
287
  });
288
288
  }, ye = () => {
289
289
  c((y) => {
290
- const L = new Set(y);
291
- return ve ? Z.forEach(
292
- (M) => L.delete(M.id)
293
- ) : Z.forEach(
294
- (M) => L.add(M.id)
295
- ), L;
290
+ const B = new Set(y);
291
+ return ve ? J.forEach(
292
+ (M) => B.delete(M.id)
293
+ ) : J.forEach(
294
+ (M) => B.add(M.id)
295
+ ), B;
296
296
  });
297
297
  }, _ = async (y) => {
298
298
  (await V(y)).success && w();
299
299
  }, z = async () => {
300
300
  const y = le;
301
301
  if (y.length === 0) return;
302
- let L = !1;
302
+ let B = !1;
303
303
  for (const M of y)
304
304
  if (!(await V(M)).success) {
305
- L = !0;
305
+ B = !0;
306
306
  break;
307
307
  }
308
- L || w();
308
+ B || w();
309
309
  }, ne = (y) => {
310
310
  b(y), w();
311
311
  }, fe = (y) => {
@@ -313,18 +313,18 @@ function Kn({
313
313
  onSettled: () => S(null)
314
314
  });
315
315
  }, Le = () => {
316
- if (J.length === 0) {
316
+ if (ee.length === 0) {
317
317
  O.error("Select a visual you can delete");
318
318
  return;
319
319
  }
320
320
  x(null), g(!0);
321
- }, Ke = async () => {
322
- const y = k ? [k] : J;
321
+ }, Qe = async () => {
322
+ const y = k ? [k] : ee;
323
323
  try {
324
- for (const L of y)
325
- await $(L.id);
326
- c((L) => {
327
- const M = new Set(L);
324
+ for (const B of y)
325
+ await $(B.id);
326
+ c((B) => {
327
+ const M = new Set(B);
328
328
  return y.forEach(
329
329
  (re) => M.delete(re.id)
330
330
  ), M;
@@ -341,35 +341,35 @@ function Kn({
341
341
  O.error("You do not have permission to share this visual");
342
342
  return;
343
343
  }
344
- i(y);
344
+ d(y);
345
345
  }, we = ({
346
346
  title: y,
347
- description: L
347
+ description: B
348
348
  }) => {
349
- if (!h) return;
349
+ if (!m) return;
350
350
  const M = {};
351
- if (y !== h.title && (M.title = y), (h.description || "") !== L && (M.description = L), Object.keys(M).length === 0) {
352
- u(null);
351
+ if (y !== m.title && (M.title = y), (m.description || "") !== B && (M.description = B), Object.keys(M).length === 0) {
352
+ h(null);
353
353
  return;
354
354
  }
355
355
  const re = Object.keys(M), de = re.length === 1 ? re[0] : void 0;
356
- Ae(h.id, de), R(
356
+ Ae(m.id, de), R(
357
357
  {
358
- resourceId: h.id,
358
+ resourceId: m.id,
359
359
  data: M
360
360
  },
361
361
  {
362
362
  onSuccess: () => {
363
- Fe(h.id, de), u(null);
363
+ Ie(m.id, de), h(null);
364
364
  },
365
365
  onError: () => {
366
- Fe(h.id, de);
366
+ Ie(m.id, de);
367
367
  }
368
368
  }
369
369
  );
370
370
  }, Q = (y) => {
371
371
  a(y), y || C();
372
- }, Ne = k ? 1 : J.length;
372
+ }, Ne = k ? 1 : ee.length;
373
373
  return /* @__PURE__ */ r(j, { children: [
374
374
  /* @__PURE__ */ t(De, { open: e, onOpenChange: Q, children: /* @__PURE__ */ r(
375
375
  ke,
@@ -380,14 +380,14 @@ function Kn({
380
380
  children: [
381
381
  /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
382
382
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
383
- /* @__PURE__ */ t(Nt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
383
+ /* @__PURE__ */ t(St, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
384
384
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
385
385
  /* @__PURE__ */ t(Ee, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
386
386
  /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
387
387
  ] })
388
388
  ] }),
389
389
  /* @__PURE__ */ t(
390
- U,
390
+ T,
391
391
  {
392
392
  size: "xs",
393
393
  variant: "ghost",
@@ -406,7 +406,7 @@ function Kn({
406
406
  {
407
407
  autoFocus: !0,
408
408
  value: n,
409
- onChange: (y) => l(y.target.value),
409
+ onChange: (y) => i(y.target.value),
410
410
  placeholder: "Search visuals...",
411
411
  className: "h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none",
412
412
  "aria-label": "Search visuals"
@@ -414,12 +414,12 @@ function Kn({
414
414
  )
415
415
  ] }),
416
416
  /* @__PURE__ */ r(
417
- U,
417
+ T,
418
418
  {
419
419
  size: "xs",
420
420
  variant: "outline",
421
421
  className: "ml-auto",
422
- onClick: () => d(!0),
422
+ onClick: () => l(!0),
423
423
  children: [
424
424
  /* @__PURE__ */ t(ge, { className: "h-3.5 w-3.5" }),
425
425
  "New library visual"
@@ -427,23 +427,23 @@ function Kn({
427
427
  }
428
428
  )
429
429
  ] }),
430
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: I ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Na, {}) }) : G ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : Z.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
431
- /* @__PURE__ */ t(mt, { className: "h-5 w-5 text-muted-foreground/60" }),
430
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: F ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Na, {}) }) : G ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : J.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
431
+ /* @__PURE__ */ t(pt, { className: "h-5 w-5 text-muted-foreground/60" }),
432
432
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
433
433
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
434
434
  ] }) : /* @__PURE__ */ t(
435
435
  Aa,
436
436
  {
437
- visuals: Z,
437
+ visuals: J,
438
438
  selectedIds: s,
439
439
  allFilteredSelected: ve,
440
- someFilteredSelected: ce,
440
+ someFilteredSelected: ue,
441
441
  onSelectAll: ye,
442
442
  onToggleSelection: X,
443
443
  onAddVisual: _,
444
444
  onOpenVisual: ne,
445
- onEditDetails: u,
446
- onShareVisual: i,
445
+ onEditDetails: h,
446
+ onShareVisual: d,
447
447
  onDeleteVisual: (y) => {
448
448
  x(y), g(!0);
449
449
  },
@@ -461,7 +461,7 @@ function Kn({
461
461
  "selected"
462
462
  ] }),
463
463
  /* @__PURE__ */ t(
464
- U,
464
+ T,
465
465
  {
466
466
  size: "xs",
467
467
  variant: "ghost",
@@ -470,12 +470,12 @@ function Kn({
470
470
  }
471
471
  ),
472
472
  /* @__PURE__ */ r(
473
- U,
473
+ T,
474
474
  {
475
475
  size: "xs",
476
476
  variant: "outline",
477
477
  onClick: Ce,
478
- disabled: le.length !== 1 || Ie.length !== 1,
478
+ disabled: le.length !== 1 || Fe.length !== 1,
479
479
  children: [
480
480
  /* @__PURE__ */ t(Ft, { className: "h-3.5 w-3.5" }),
481
481
  "Share"
@@ -483,24 +483,24 @@ function Kn({
483
483
  }
484
484
  ),
485
485
  /* @__PURE__ */ r(
486
- U,
486
+ T,
487
487
  {
488
488
  size: "xs",
489
489
  variant: "outline",
490
490
  className: "text-destructive hover:text-destructive",
491
491
  onClick: Le,
492
- disabled: J.length === 0,
492
+ disabled: ee.length === 0,
493
493
  children: [
494
- /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }),
494
+ /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
495
495
  "Delete ",
496
- J.length || s.size
496
+ ee.length || s.size
497
497
  ]
498
498
  }
499
499
  )
500
500
  ] }) }),
501
501
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
502
502
  /* @__PURE__ */ t(
503
- U,
503
+ T,
504
504
  {
505
505
  size: "xs",
506
506
  variant: "outline",
@@ -509,13 +509,13 @@ function Kn({
509
509
  }
510
510
  ),
511
511
  /* @__PURE__ */ r(
512
- U,
512
+ T,
513
513
  {
514
514
  size: "xs",
515
515
  onClick: z,
516
516
  disabled: s.size === 0,
517
517
  children: [
518
- /* @__PURE__ */ t(St, { className: "h-3.5 w-3.5" }),
518
+ /* @__PURE__ */ t(Dt, { className: "h-3.5 w-3.5" }),
519
519
  s.size === 0 ? "Add to dashboard" : `Add ${s.size} visual${s.size === 1 ? "" : "s"}`
520
520
  ]
521
521
  }
@@ -529,60 +529,60 @@ function Kn({
529
529
  Sa,
530
530
  {
531
531
  open: p,
532
- onOpenChange: d,
532
+ onOpenChange: l,
533
533
  onSubmit: A,
534
534
  isCreating: te
535
535
  }
536
536
  ),
537
- m && /* @__PURE__ */ t(
537
+ u && /* @__PURE__ */ t(
538
538
  sr,
539
539
  {
540
- resource: m,
540
+ resource: u,
541
541
  resourceType: or.VISUAL,
542
- onClose: () => i(null)
542
+ onClose: () => d(null)
543
543
  }
544
544
  ),
545
- h && /* @__PURE__ */ t(
545
+ m && /* @__PURE__ */ t(
546
546
  ir,
547
547
  {
548
- open: !!h,
548
+ open: !!m,
549
549
  resourceLabel: "Visual",
550
- initialTitle: h.title || "",
551
- initialDescription: h.description || "",
552
- onClose: () => u(null),
550
+ initialTitle: m.title || "",
551
+ initialDescription: m.description || "",
552
+ onClose: () => h(null),
553
553
  onSave: we,
554
- isSaving: ie(h.id)
554
+ isSaving: ie(m.id)
555
555
  }
556
556
  ),
557
557
  /* @__PURE__ */ t(
558
- rt,
558
+ at,
559
559
  {
560
560
  open: f,
561
561
  onOpenChange: (y) => {
562
562
  !y && oe || (g(y), y || x(null));
563
563
  },
564
- children: /* @__PURE__ */ r(at, { children: [
565
- /* @__PURE__ */ r(nt, { children: [
566
- /* @__PURE__ */ r(st, { children: [
564
+ children: /* @__PURE__ */ r(nt, { children: [
565
+ /* @__PURE__ */ r(st, { children: [
566
+ /* @__PURE__ */ r(ot, { children: [
567
567
  "Delete ",
568
568
  Ne,
569
569
  " visual",
570
570
  Ne === 1 ? "" : "s",
571
571
  "?"
572
572
  ] }),
573
- /* @__PURE__ */ t(ot, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
573
+ /* @__PURE__ */ t(it, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
574
574
  ] }),
575
- /* @__PURE__ */ r(it, { children: [
576
- /* @__PURE__ */ t(lt, { disabled: oe, children: "Cancel" }),
575
+ /* @__PURE__ */ r(lt, { children: [
576
+ /* @__PURE__ */ t(dt, { disabled: oe, children: "Cancel" }),
577
577
  /* @__PURE__ */ r(
578
- It,
578
+ Lt,
579
579
  {
580
580
  onClick: (y) => {
581
- y.preventDefault(), Ke();
581
+ y.preventDefault(), Qe();
582
582
  },
583
583
  disabled: oe || Ne === 0,
584
584
  children: [
585
- oe ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }),
585
+ oe ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
586
586
  oe ? "Deleting..." : "Delete"
587
587
  ]
588
588
  }
@@ -598,25 +598,25 @@ function Aa({
598
598
  selectedIds: a,
599
599
  allFilteredSelected: o,
600
600
  someFilteredSelected: n,
601
- onSelectAll: l,
601
+ onSelectAll: i,
602
602
  onToggleSelection: s,
603
603
  onAddVisual: c,
604
604
  onOpenVisual: p,
605
- onEditDetails: d,
606
- onShareVisual: m,
607
- onDeleteVisual: i,
608
- onDuplicateVisual: h,
609
- duplicatingId: u,
605
+ onEditDetails: l,
606
+ onShareVisual: u,
607
+ onDeleteVisual: d,
608
+ onDuplicateVisual: m,
609
+ duplicatingId: h,
610
610
  isDeleting: f,
611
611
  isConsoleMode: g
612
612
  }) {
613
613
  return /* @__PURE__ */ r("div", { className: "min-w-[48rem]", children: [
614
614
  /* @__PURE__ */ r("div", { className: "grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: [
615
615
  /* @__PURE__ */ t(
616
- dt,
616
+ ct,
617
617
  {
618
618
  checked: o ? !0 : n ? "indeterminate" : !1,
619
- onCheckedChange: l,
619
+ onCheckedChange: i,
620
620
  "aria-label": "Select all visuals"
621
621
  }
622
622
  ),
@@ -628,18 +628,18 @@ function Aa({
628
628
  /* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
629
629
  ] }),
630
630
  e.map((k) => /* @__PURE__ */ t(
631
- Fa,
631
+ Ia,
632
632
  {
633
633
  visual: k,
634
634
  selected: a.has(k.id),
635
635
  onToggleSelection: s,
636
636
  onAddVisual: c,
637
637
  onOpenVisual: p,
638
- onEditDetails: d,
639
- onShareVisual: m,
640
- onDeleteVisual: i,
641
- onDuplicateVisual: h,
642
- duplicatingId: u,
638
+ onEditDetails: l,
639
+ onShareVisual: u,
640
+ onDeleteVisual: d,
641
+ onDuplicateVisual: m,
642
+ duplicatingId: h,
643
643
  isDeleting: f,
644
644
  isConsoleMode: g
645
645
  },
@@ -647,22 +647,22 @@ function Aa({
647
647
  ))
648
648
  ] });
649
649
  }
650
- function Fa({
650
+ function Ia({
651
651
  visual: e,
652
652
  selected: a,
653
653
  onToggleSelection: o,
654
654
  onAddVisual: n,
655
- onOpenVisual: l,
655
+ onOpenVisual: i,
656
656
  onEditDetails: s,
657
657
  onShareVisual: c,
658
658
  onDeleteVisual: p,
659
- onDuplicateVisual: d,
660
- duplicatingId: m,
661
- isDeleting: i,
662
- isConsoleMode: h
659
+ onDuplicateVisual: l,
660
+ duplicatingId: u,
661
+ isDeleting: d,
662
+ isConsoleMode: m
663
663
  }) {
664
664
  var g;
665
- const u = ka(e.kind), f = () => {
665
+ const h = ka(e.kind), f = () => {
666
666
  n(e);
667
667
  };
668
668
  return /* @__PURE__ */ r(
@@ -674,7 +674,7 @@ function Fa({
674
674
  ),
675
675
  children: [
676
676
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
677
- dt,
677
+ ct,
678
678
  {
679
679
  checked: a,
680
680
  onCheckedChange: () => o(e.id),
@@ -689,7 +689,7 @@ function Fa({
689
689
  onClick: f,
690
690
  "aria-label": `Add ${e.title || "visual"} to dashboard`,
691
691
  children: [
692
- /* @__PURE__ */ t(u, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
692
+ /* @__PURE__ */ t(h, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
693
693
  /* @__PURE__ */ r("div", { className: "min-w-0", children: [
694
694
  /* @__PURE__ */ t(
695
695
  "div",
@@ -712,77 +712,77 @@ function Fa({
712
712
  }
713
713
  ),
714
714
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
715
- /* @__PURE__ */ t("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: Da(e, h) }),
716
- /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: ft(e, h) })
715
+ /* @__PURE__ */ t("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: Da(e, m) }),
716
+ /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: gt(e, m) })
717
717
  ] }),
718
- /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: zt(e.updatedAt) }),
718
+ /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: $t(e.updatedAt) }),
719
719
  /* @__PURE__ */ t(Ea, { visual: e }),
720
720
  /* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
721
721
  /* @__PURE__ */ t(
722
- Ia,
722
+ Fa,
723
723
  {
724
724
  visual: e,
725
- onOpenVisual: l,
725
+ onOpenVisual: i,
726
726
  onEditDetails: s,
727
727
  onShareVisual: c,
728
728
  onDeleteVisual: p,
729
- onDuplicateVisual: d,
730
- duplicatingId: m,
731
- isDeleting: i,
732
- isConsoleMode: h
729
+ onDuplicateVisual: l,
730
+ duplicatingId: u,
731
+ isDeleting: d,
732
+ isConsoleMode: m
733
733
  }
734
734
  )
735
735
  ]
736
736
  }
737
737
  );
738
738
  }
739
- function Ia({
739
+ function Fa({
740
740
  visual: e,
741
741
  onOpenVisual: a,
742
742
  onEditDetails: o,
743
743
  onShareVisual: n,
744
- onDeleteVisual: l,
744
+ onDeleteVisual: i,
745
745
  onDuplicateVisual: s,
746
746
  duplicatingId: c,
747
747
  isDeleting: p,
748
- isConsoleMode: d
748
+ isConsoleMode: l
749
749
  }) {
750
750
  return /* @__PURE__ */ r(
751
751
  "div",
752
752
  {
753
753
  className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
754
- onClick: (m) => m.stopPropagation(),
754
+ onClick: (u) => u.stopPropagation(),
755
755
  children: [
756
756
  /* @__PURE__ */ t(
757
- U,
757
+ T,
758
758
  {
759
759
  size: "xs",
760
760
  variant: "ghost",
761
761
  className: "w-7 px-0",
762
762
  onClick: () => a(e),
763
763
  "aria-label": "Edit visual",
764
- children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
764
+ children: /* @__PURE__ */ t(Ye, { className: "h-3.5 w-3.5" })
765
765
  }
766
766
  ),
767
- /* @__PURE__ */ r($e, { modal: !1, children: [
768
- /* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ t(
769
- U,
767
+ /* @__PURE__ */ r(je, { modal: !1, children: [
768
+ /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ t(
769
+ T,
770
770
  {
771
771
  size: "xs",
772
772
  variant: "ghost",
773
773
  className: "w-7 px-0",
774
774
  "aria-label": "More actions",
775
- children: /* @__PURE__ */ t(Lt, { className: "h-3.5 w-3.5" })
775
+ children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
776
776
  }
777
777
  ) }),
778
778
  /* @__PURE__ */ r(
779
- We,
779
+ He,
780
780
  {
781
781
  align: "end",
782
782
  className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
783
783
  children: [
784
784
  /* @__PURE__ */ r(q, { onClick: () => a(e), children: [
785
- /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
785
+ /* @__PURE__ */ t(Ye, { className: "h-3.5 w-3.5" }),
786
786
  "Edit visual"
787
787
  ] }),
788
788
  /* @__PURE__ */ r(
@@ -797,7 +797,7 @@ function Ia({
797
797
  }
798
798
  ),
799
799
  e.permissions.canEdit && /* @__PURE__ */ r(q, { onClick: () => o(e), children: [
800
- /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
800
+ /* @__PURE__ */ t(Ye, { className: "h-3.5 w-3.5" }),
801
801
  "Edit details"
802
802
  ] }),
803
803
  e.permissions.canShare && /* @__PURE__ */ r(q, { onClick: () => n(e), children: [
@@ -805,29 +805,29 @@ function Ia({
805
805
  "Share"
806
806
  ] }),
807
807
  e.permissions.canDelete && /* @__PURE__ */ r(j, { children: [
808
- /* @__PURE__ */ t(_e, {}),
808
+ /* @__PURE__ */ t(ze, {}),
809
809
  /* @__PURE__ */ r(
810
810
  q,
811
811
  {
812
812
  className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
813
- onClick: () => l(e),
813
+ onClick: () => i(e),
814
814
  disabled: p,
815
815
  children: [
816
- /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }),
816
+ /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
817
817
  p ? "Deleting..." : "Delete"
818
818
  ]
819
819
  }
820
820
  )
821
821
  ] }),
822
- /* @__PURE__ */ t(_e, {}),
822
+ /* @__PURE__ */ t(ze, {}),
823
823
  /* @__PURE__ */ r("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
824
- $t(e, d) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
824
+ jt(e, l) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
825
825
  /* @__PURE__ */ t(ur, { className: "h-3 w-3" }),
826
- /* @__PURE__ */ t("span", { className: "truncate", children: ft(e, d) })
826
+ /* @__PURE__ */ t("span", { className: "truncate", children: gt(e, l) })
827
827
  ] }),
828
828
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
829
829
  /* @__PURE__ */ t(hr, { className: "h-3 w-3" }),
830
- /* @__PURE__ */ t("span", { children: zt(e.updatedAt) })
830
+ /* @__PURE__ */ t("span", { children: $t(e.updatedAt) })
831
831
  ] })
832
832
  ] })
833
833
  ]
@@ -838,33 +838,63 @@ function Ia({
838
838
  }
839
839
  );
840
840
  }
841
- function Qn(e, a) {
842
- const o = H(() => {
843
- const n = T.getState().dashboard;
844
- return a || !e || !n || n.id !== e.id ? !1 : vt(n) !== vt(e);
841
+ function Qn(e, a, o = !1) {
842
+ const n = L((u) => u.dashboard), i = L(
843
+ (u) => u.isDashboardEditing
844
+ ), s = L(
845
+ (u) => u.onDashboardLifecycleEvent
846
+ ), c = H(() => {
847
+ const u = L.getState().dashboard;
848
+ return a || !e || !u || u.id !== e.id ? !1 : Ve(u) !== Ve(e);
845
849
  }, [e, a]);
846
- return Gt(() => (T.setState({ checkUnsavedDashboardChanges: o }), () => {
847
- T.getState().checkUnsavedDashboardChanges === o && T.setState({ checkUnsavedDashboardChanges: null });
848
- }), [o]), o;
850
+ xt(() => (L.setState({ checkUnsavedDashboardChanges: c }), () => {
851
+ L.getState().checkUnsavedDashboardChanges === c && L.setState({ checkUnsavedDashboardChanges: null });
852
+ }), [c]);
853
+ const p = Z(() => !o || a || !n || i && (!e || n.id !== e.id) ? null : {
854
+ dashboardId: n.id,
855
+ dirty: i && e ? Ve(n) !== Ve(e) : !1
856
+ }, [
857
+ i,
858
+ a,
859
+ o,
860
+ e,
861
+ n
862
+ ]), l = ce(null);
863
+ return xt(() => {
864
+ if (!s || !p) {
865
+ l.current = null;
866
+ return;
867
+ }
868
+ const u = l.current;
869
+ (u == null ? void 0 : u.callback) === s && u.dashboardId === p.dashboardId && u.dirty === p.dirty || (l.current = {
870
+ callback: s,
871
+ dashboardId: p.dashboardId,
872
+ dirty: p.dirty
873
+ }, s({
874
+ type: "dashboard:dirty-state",
875
+ dashboardId: p.dashboardId,
876
+ payload: { dirty: p.dirty }
877
+ }));
878
+ }, [p, s]), c;
849
879
  }
850
880
  function La({
851
881
  open: e,
852
882
  onOpenChange: a,
853
883
  isLibraryVisual: o,
854
884
  currentVisualName: n,
855
- isSaving: l = !1,
885
+ isSaving: i = !1,
856
886
  destinationMode: s = "both",
857
887
  onConfirm: c
858
888
  }) {
859
- const [p, d] = F(
889
+ const [p, l] = I(
860
890
  o && n ? `Copy of ${n}` : n || ""
861
- ), [m, i] = F("");
862
- wt.useEffect(() => {
863
- e && (d(
891
+ ), [u, d] = I("");
892
+ Nt.useEffect(() => {
893
+ e && (l(
864
894
  o && n ? `Copy of ${n}` : n || ""
865
- ), i(""));
895
+ ), d(""));
866
896
  }, [e, o, n]);
867
- const h = !!p.trim(), u = s === "local" ? {
897
+ const m = !!p.trim(), h = s === "local" ? {
868
898
  saveToLibrary: !1,
869
899
  saveToCurrentDashboard: !0,
870
900
  badgeType: "local",
@@ -883,39 +913,39 @@ function La({
883
913
  description: "Creates a new library visual and adds a linked copy to this dashboard.",
884
914
  actionLabel: "Save Copy as Linked Visual"
885
915
  }, f = () => {
886
- !h || l || c({
916
+ !m || i || c({
887
917
  name: p.trim(),
888
- description: m.trim() || void 0,
889
- saveToLibrary: u.saveToLibrary,
890
- saveToCurrentDashboard: u.saveToCurrentDashboard
918
+ description: u.trim() || void 0,
919
+ saveToLibrary: h.saveToLibrary,
920
+ saveToCurrentDashboard: h.saveToCurrentDashboard
891
921
  });
892
922
  };
893
923
  return /* @__PURE__ */ t(De, { open: e, onOpenChange: a, children: /* @__PURE__ */ r(ke, { className: "sm:max-w-[500px]", children: [
894
- /* @__PURE__ */ r(ct, { children: [
924
+ /* @__PURE__ */ r(ut, { children: [
895
925
  /* @__PURE__ */ r(Ee, { className: "flex items-center gap-2", children: [
896
926
  /* @__PURE__ */ t("span", { children: "Save Visual As" }),
897
- u.badgeType !== "local" && /* @__PURE__ */ t(
927
+ h.badgeType !== "local" && /* @__PURE__ */ t(
898
928
  oa,
899
929
  {
900
- type: u.badgeType,
930
+ type: h.badgeType,
901
931
  showLabel: !0,
902
932
  className: "px-2 py-0.5"
903
933
  }
904
934
  )
905
935
  ] }),
906
- /* @__PURE__ */ t(ut, { children: u.description })
936
+ /* @__PURE__ */ t(ht, { children: h.description })
907
937
  ] }),
908
938
  /* @__PURE__ */ r("div", { className: "grid gap-4 py-4", children: [
909
939
  /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
910
940
  /* @__PURE__ */ t(Se, { htmlFor: "name", children: "Name" }),
911
941
  /* @__PURE__ */ t(
912
- Je,
942
+ et,
913
943
  {
914
944
  id: "name",
915
945
  value: p,
916
- onChange: (g) => d(g.target.value),
946
+ onChange: (g) => l(g.target.value),
917
947
  placeholder: "Enter visual name",
918
- disabled: l
948
+ disabled: i
919
949
  }
920
950
  )
921
951
  ] }),
@@ -925,46 +955,46 @@ function La({
925
955
  mr,
926
956
  {
927
957
  id: "description",
928
- value: m,
929
- onChange: (g) => i(g.target.value),
958
+ value: u,
959
+ onChange: (g) => d(g.target.value),
930
960
  placeholder: "Enter visual description",
931
961
  rows: 3,
932
- disabled: l
962
+ disabled: i
933
963
  }
934
964
  )
935
965
  ] })
936
966
  ] }),
937
967
  /* @__PURE__ */ r(pr, { children: [
938
968
  /* @__PURE__ */ t(
939
- U,
969
+ T,
940
970
  {
941
971
  variant: "outline",
942
972
  onClick: () => a(!1),
943
- disabled: l,
973
+ disabled: i,
944
974
  children: "Cancel"
945
975
  }
946
976
  ),
947
- /* @__PURE__ */ r(U, { onClick: f, disabled: !h || l, children: [
948
- l && /* @__PURE__ */ t(ae, { className: "mr-2 h-4 w-4 animate-spin" }),
949
- u.actionLabel
977
+ /* @__PURE__ */ r(T, { onClick: f, disabled: !m || i, children: [
978
+ i && /* @__PURE__ */ t(ae, { className: "mr-2 h-4 w-4 animate-spin" }),
979
+ h.actionLabel
950
980
  ] })
951
981
  ] })
952
982
  ] }) });
953
983
  }
954
984
  function Ba() {
955
- const [e, a] = F(!1), [o, n] = F(!1), [l, s] = F(null), [c, p] = F(null), d = me((b) => b.frame), m = me((b) => b.card), i = fr(), h = T((b) => b.selectedSheetId), u = T((b) => b.dashboard), { getUpdatedFrame: f } = pt(), { selectVisual: g } = At(), { addFrame: k, setSelectedFrameId: x, setIsVisualEditing: D } = be(), S = Bt(), C = !!(d != null && d.visualId), w = (() => {
985
+ const [e, a] = I(!1), [o, n] = I(!1), [i, s] = I(null), [c, p] = I(null), l = me((b) => b.frame), u = me((b) => b.card), d = fr(), m = L((b) => b.selectedSheetId), h = L((b) => b.dashboard), { getUpdatedFrame: f } = ft(), { selectVisual: g } = It(), { addFrame: k, setSelectedFrameId: x, setIsVisualEditing: D } = be(), S = Ut(), C = !!(l != null && l.visualId), w = (() => {
956
986
  var b, v;
957
- return ((b = d == null ? void 0 : d.cards) == null ? void 0 : b.length) === 1 && ((v = d.cards[0]) != null && v.title) ? d.cards[0].title : i != null && i.title ? i.title : (m == null ? void 0 : m.title) || "Untitled Visual";
987
+ return ((b = l == null ? void 0 : l.cards) == null ? void 0 : b.length) === 1 && ((v = l.cards[0]) != null && v.title) ? l.cards[0].title : d != null && d.title ? d.title : (u == null ? void 0 : u.title) || "Untitled Visual";
958
988
  })(), E = gr((b) => {
959
- b != null && b.id && (g(b), o && l && c && h && (async () => {
989
+ b != null && b.id && (g(b), o && i && c && m && (async () => {
960
990
  try {
961
991
  const v = {
962
- ...l,
963
- id: xt(),
992
+ ...i,
993
+ id: yt(),
964
994
  visualId: b.id
965
995
  // Link to the newly created library visual
966
996
  };
967
- k(h, v, {
997
+ k(m, v, {
968
998
  position: "end",
969
999
  semanticExecutionPayload: c
970
1000
  }), x(v.id), n(!1), s(null), p(null), D(!1);
@@ -982,13 +1012,13 @@ function Ba() {
982
1012
  saveAsDialogOpen: e,
983
1013
  setSaveAsDialogOpen: a,
984
1014
  handleSaveAs: async (b) => {
985
- if (!h) {
1015
+ if (!m) {
986
1016
  O.error("No sheet selected");
987
1017
  return;
988
1018
  }
989
- const v = f(), B = Dt(v);
990
- if (B) {
991
- O.error(B);
1019
+ const v = f(), U = kt(v);
1020
+ if (U) {
1021
+ O.error(U);
992
1022
  return;
993
1023
  }
994
1024
  const G = v.cards.length === 1 ? {
@@ -1004,7 +1034,7 @@ function Ba() {
1004
1034
  if (b.saveToCurrentDashboard)
1005
1035
  try {
1006
1036
  A = await S(G, {
1007
- previousFrame: et(u, G.id)
1037
+ previousFrame: tt(h, G.id)
1008
1038
  });
1009
1039
  } catch ($) {
1010
1040
  console.error(
@@ -1028,15 +1058,15 @@ function Ba() {
1028
1058
  const A = {
1029
1059
  ...G,
1030
1060
  // Card title already synced
1031
- id: xt(),
1061
+ id: yt(),
1032
1062
  visualId: void 0
1033
1063
  // Explicitly no visualId for local visuals
1034
1064
  };
1035
1065
  try {
1036
1066
  const R = await S(G, {
1037
- previousFrame: et(u, G.id)
1067
+ previousFrame: tt(h, G.id)
1038
1068
  });
1039
- k(h, A, {
1069
+ k(m, A, {
1040
1070
  position: "end",
1041
1071
  semanticExecutionPayload: R
1042
1072
  }), x(A.id), O.success("Visual saved to dashboard"), a(!1), D(!1);
@@ -1053,84 +1083,84 @@ function Ba() {
1053
1083
  };
1054
1084
  }
1055
1085
  function Yn(e = {}) {
1056
- const { isInspectionMode: a } = br(), o = me((A) => A.frame), n = me((A) => A.editorContext), l = xr((A) => A.selectedVisual), s = T((A) => A.selectedFrameId), c = T((A) => A.selectedSheetId), p = T((A) => A.dashboard), { setIsVisualEditing: d, updateFrame: m } = be(), [i, h] = F(!1), [u, f] = F("both"), g = Bt(), k = (n == null ? void 0 : n.type) === "documentSection", x = !!(o != null && o.visualId || l != null && l.id), D = !!(o != null && o.visualId && s), S = x && !D, {
1086
+ const { isInspectionMode: a } = br(), o = me((A) => A.frame), n = me((A) => A.editorContext), i = xr((A) => A.selectedVisual), s = L((A) => A.selectedFrameId), c = L((A) => A.selectedSheetId), p = L((A) => A.dashboard), { setIsVisualEditing: l, updateFrame: u } = be(), [d, m] = I(!1), [h, f] = I("both"), g = Ut(), k = (n == null ? void 0 : n.type) === "documentSection", x = !!(o != null && o.visualId || i != null && i.id), D = !!(o != null && o.visualId && s), S = x && !D, {
1057
1087
  saveAsDialogOpen: C,
1058
1088
  setSaveAsDialogOpen: w,
1059
1089
  handleSaveAs: E,
1060
1090
  isLibraryVisual: V,
1061
1091
  currentVisualName: b,
1062
1092
  isSaving: v
1063
- } = Ba(), { getUpdatedFrame: B } = pt();
1093
+ } = Ba(), { getUpdatedFrame: U } = ft();
1064
1094
  if (a)
1065
1095
  return /* @__PURE__ */ r(j, { children: [
1066
1096
  /* @__PURE__ */ t(
1067
- Ye,
1097
+ Xe,
1068
1098
  {
1069
1099
  className: "rounded-control",
1070
1100
  variant: "default"
1071
1101
  }
1072
1102
  ),
1073
- /* @__PURE__ */ t(Xe, {})
1103
+ /* @__PURE__ */ t(Ze, {})
1074
1104
  ] });
1075
1105
  if (k)
1076
1106
  return /* @__PURE__ */ r(j, { children: [
1077
- /* @__PURE__ */ t(Ye, { className: "rounded-control", variant: "default" }),
1078
- /* @__PURE__ */ t(Xe, {})
1107
+ /* @__PURE__ */ t(Xe, { className: "rounded-control", variant: "default" }),
1108
+ /* @__PURE__ */ t(Ze, {})
1079
1109
  ] });
1080
- const I = async () => {
1110
+ const F = async () => {
1081
1111
  if (!c) {
1082
1112
  O.error("No sheet selected");
1083
1113
  return;
1084
1114
  }
1085
- if (i) return;
1086
- h(!0);
1087
- const A = B(), R = Dt(A);
1115
+ if (d) return;
1116
+ m(!0);
1117
+ const A = U(), R = kt(A);
1088
1118
  if (R) {
1089
- h(!1), O.error(R);
1119
+ m(!1), O.error(R);
1090
1120
  return;
1091
1121
  }
1092
1122
  const $ = {
1093
1123
  ...A,
1094
1124
  visualId: void 0
1095
- }, xe = et(p, $.id);
1125
+ }, xe = tt(p, $.id);
1096
1126
  try {
1097
1127
  const te = await g($, {
1098
1128
  previousFrame: xe
1099
1129
  });
1100
- m(c, $, {
1130
+ u(c, $, {
1101
1131
  semanticExecutionPayload: te
1102
1132
  });
1103
1133
  } catch (te) {
1104
- console.error("Failed to apply local semantic metadata:", te), h(!1), O.error(
1134
+ console.error("Failed to apply local semantic metadata:", te), m(!1), O.error(
1105
1135
  te instanceof Error ? te.message : "Failed to prepare semantic metadata for this visual"
1106
1136
  );
1107
1137
  return;
1108
1138
  }
1109
1139
  setTimeout(() => {
1110
- h(!1), O.success("Changes applied. Visual is now local to this dashboard"), d(!1);
1140
+ m(!1), O.success("Changes applied. Visual is now local to this dashboard"), l(!1);
1111
1141
  }, 300);
1112
1142
  }, G = (A) => {
1113
1143
  f(A), w(!0);
1114
1144
  };
1115
1145
  return /* @__PURE__ */ r(j, { children: [
1116
1146
  /* @__PURE__ */ r("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
1117
- !x && /* @__PURE__ */ t(Ye, { className: "!rounded-none", variant: "default" }),
1147
+ !x && /* @__PURE__ */ t(Xe, { className: "!rounded-none", variant: "default" }),
1118
1148
  x && S && /* @__PURE__ */ t(ia, { className: "!rounded-none", variant: "default" }),
1119
1149
  x && D && /* @__PURE__ */ t(la, { className: "!rounded-none" }),
1120
- /* @__PURE__ */ r($e, { modal: !1, children: [
1121
- /* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ t(
1122
- U,
1150
+ /* @__PURE__ */ r(je, { modal: !1, children: [
1151
+ /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ t(
1152
+ T,
1123
1153
  {
1124
1154
  variant: "default",
1125
1155
  size: "xs",
1126
1156
  className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
1127
1157
  "aria-label": "Open visual save options",
1128
- disabled: v || i,
1129
- children: /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" })
1158
+ disabled: v || d,
1159
+ children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
1130
1160
  }
1131
1161
  ) }),
1132
1162
  /* @__PURE__ */ r(
1133
- We,
1163
+ He,
1134
1164
  {
1135
1165
  align: "end",
1136
1166
  className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
@@ -1139,15 +1169,15 @@ function Yn(e = {}) {
1139
1169
  /* @__PURE__ */ r(
1140
1170
  q,
1141
1171
  {
1142
- onClick: I,
1143
- disabled: i,
1172
+ onClick: F,
1173
+ disabled: d,
1144
1174
  children: [
1145
- /* @__PURE__ */ t(St, { className: "h-3.5 w-3.5" }),
1146
- i ? "Applying..." : "Apply Locally"
1175
+ /* @__PURE__ */ t(Dt, { className: "h-3.5 w-3.5" }),
1176
+ d ? "Applying..." : "Apply Locally"
1147
1177
  ]
1148
1178
  }
1149
1179
  ),
1150
- /* @__PURE__ */ t(_e, {})
1180
+ /* @__PURE__ */ t(ze, {})
1151
1181
  ] }),
1152
1182
  /* @__PURE__ */ r(
1153
1183
  q,
@@ -1187,7 +1217,7 @@ function Yn(e = {}) {
1187
1217
  )
1188
1218
  ] })
1189
1219
  ] }),
1190
- /* @__PURE__ */ t(Xe, {}),
1220
+ /* @__PURE__ */ t(Ze, {}),
1191
1221
  /* @__PURE__ */ t(
1192
1222
  La,
1193
1223
  {
@@ -1198,31 +1228,31 @@ function Yn(e = {}) {
1198
1228
  isLibraryVisual: V,
1199
1229
  currentVisualName: b,
1200
1230
  isSaving: v,
1201
- destinationMode: u,
1231
+ destinationMode: h,
1202
1232
  onConfirm: E
1203
1233
  }
1204
1234
  )
1205
1235
  ] });
1206
1236
  }
1207
1237
  function Xn({ className: e }) {
1208
- const a = me((i) => i.isDevMode), o = me((i) => i.card.type), n = T((i) => i.isVisualEditing), { setIsDevMode: l } = kt(), { config: s } = qt(vr).tokenProps, c = (s == null ? void 0 : s.showAdvancedMode) !== !1;
1238
+ const a = me((d) => d.isDevMode), o = me((d) => d.card.type), n = L((d) => d.isVisualEditing), { setIsDevMode: i } = Et(), { config: s } = qt(vr).tokenProps, c = (s == null ? void 0 : s.showAdvancedMode) !== !1;
1209
1239
  if (!n || !c || !ma(o))
1210
1240
  return null;
1211
- const p = a ? fa : yr, d = a ? "Visual editor" : "SQL editor", m = a ? "Switch to visual editor" : "Switch to SQL editor";
1241
+ const p = a ? fa : yr, l = a ? "Visual editor" : "SQL editor", u = a ? "Switch to visual editor" : "Switch to SQL editor";
1212
1242
  return /* @__PURE__ */ r(
1213
1243
  "button",
1214
1244
  {
1215
1245
  type: "button",
1216
- "aria-label": m,
1217
- title: m,
1218
- onClick: () => l(!a),
1246
+ "aria-label": u,
1247
+ title: u,
1248
+ onClick: () => i(!a),
1219
1249
  className: K(
1220
1250
  "inline-flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:outline-none",
1221
1251
  e
1222
1252
  ),
1223
1253
  children: [
1224
1254
  /* @__PURE__ */ t(p, { className: "h-3 w-3 text-muted-foreground" }),
1225
- d
1255
+ l
1226
1256
  ]
1227
1257
  }
1228
1258
  );
@@ -1232,42 +1262,42 @@ function Zn({
1232
1262
  onOpenChange: a,
1233
1263
  onSave: o,
1234
1264
  onDiscard: n,
1235
- isSaving: l,
1265
+ isSaving: i,
1236
1266
  title: s = "Unsaved changes",
1237
1267
  description: c = "You have unsaved changes to this dashboard. What would you like to do?",
1238
1268
  cancelLabel: p = "Cancel",
1239
- discardLabel: d = "Discard changes",
1240
- saveLabel: m = "Save"
1269
+ discardLabel: l = "Discard changes",
1270
+ saveLabel: u = "Save"
1241
1271
  }) {
1242
- return /* @__PURE__ */ t(rt, { open: e, onOpenChange: (h) => {
1243
- !h && l || a(h);
1244
- }, children: /* @__PURE__ */ r(at, { children: [
1245
- /* @__PURE__ */ r(nt, { children: [
1246
- /* @__PURE__ */ t(st, { children: s }),
1247
- /* @__PURE__ */ t(ot, { children: c })
1272
+ return /* @__PURE__ */ t(at, { open: e, onOpenChange: (m) => {
1273
+ !m && i || a(m);
1274
+ }, children: /* @__PURE__ */ r(nt, { children: [
1275
+ /* @__PURE__ */ r(st, { children: [
1276
+ /* @__PURE__ */ t(ot, { children: s }),
1277
+ /* @__PURE__ */ t(it, { children: c })
1248
1278
  ] }),
1249
- /* @__PURE__ */ r(it, { children: [
1279
+ /* @__PURE__ */ r(lt, { children: [
1250
1280
  /* @__PURE__ */ t(
1251
- U,
1281
+ T,
1252
1282
  {
1253
1283
  type: "button",
1254
1284
  size: "xs",
1255
1285
  onClick: n,
1256
- disabled: l,
1286
+ disabled: i,
1257
1287
  variant: "outline",
1258
1288
  className: "mr-auto text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
1259
- children: d
1289
+ children: l
1260
1290
  }
1261
1291
  ),
1262
- /* @__PURE__ */ t(lt, { disabled: l, children: p }),
1263
- /* @__PURE__ */ t(U, { type: "button", size: "xs", onClick: o, disabled: l, children: l ? /* @__PURE__ */ r(j, { children: [
1292
+ /* @__PURE__ */ t(dt, { disabled: i, children: p }),
1293
+ /* @__PURE__ */ t(T, { type: "button", size: "xs", onClick: o, disabled: i, children: i ? /* @__PURE__ */ r(j, { children: [
1264
1294
  /* @__PURE__ */ t(ae, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
1265
1295
  "Saving..."
1266
- ] }) : m })
1296
+ ] }) : u })
1267
1297
  ] })
1268
1298
  ] }) });
1269
1299
  }
1270
- function gt(e, a) {
1300
+ function bt(e, a) {
1271
1301
  return {
1272
1302
  id: e.id,
1273
1303
  status: e.status,
@@ -1284,44 +1314,44 @@ function gt(e, a) {
1284
1314
  downloadUrl: a
1285
1315
  };
1286
1316
  }
1287
- const Ua = 1e4, Ta = 15e3, Va = 3e4, Ra = 3e4, Pa = 12e4, yt = 2 * 60 * 60 * 1e3;
1317
+ const Ua = 1e4, Ta = 15e3, Va = 3e4, Ra = 3e4, Pa = 12e4, Ct = 2 * 60 * 60 * 1e3;
1288
1318
  function Ma(e) {
1289
1319
  const a = Date.now() - e.getTime();
1290
1320
  return a < Ra ? Ua : a < Pa ? Ta : Va;
1291
1321
  }
1292
1322
  function Jn() {
1293
- const { authToken: e, tokenProps: a } = He(), o = ue((u) => u.activeExports), [n, l] = F(
1323
+ const { authToken: e, tokenProps: a } = Ge(), o = he((h) => h.activeExports), [n, i] = I(
1294
1324
  typeof document < "u" ? !document.hidden : !0
1295
- ), s = he(null), c = he(!1), p = he(void 0), d = a == null ? void 0 : a.apiServiceUrl, m = e == null ? void 0 : e.accessToken, i = H(() => {
1296
- const u = ue.getState().activeExports;
1297
- return Array.from(u.values()).filter(
1298
- (f) => ht(f.status)
1325
+ ), s = ce(null), c = ce(!1), p = ce(void 0), l = a == null ? void 0 : a.apiServiceUrl, u = e == null ? void 0 : e.accessToken, d = H(() => {
1326
+ const h = he.getState().activeExports;
1327
+ return Array.from(h.values()).filter(
1328
+ (f) => mt(f.status)
1299
1329
  );
1300
1330
  }, []);
1301
1331
  Y(() => {
1302
1332
  if (typeof document > "u") return;
1303
- const u = () => {
1304
- l(!document.hidden);
1333
+ const h = () => {
1334
+ i(!document.hidden);
1305
1335
  };
1306
- return document.addEventListener("visibilitychange", u), () => {
1307
- document.removeEventListener("visibilitychange", u);
1336
+ return document.addEventListener("visibilitychange", h), () => {
1337
+ document.removeEventListener("visibilitychange", h);
1308
1338
  };
1309
1339
  }, []);
1310
- const h = H(async () => {
1311
- if (!d || !m) {
1340
+ const m = H(async () => {
1341
+ if (!l || !u) {
1312
1342
  c.current = !1;
1313
1343
  return;
1314
1344
  }
1315
- const u = i();
1316
- if (u.length === 0) {
1345
+ const h = d();
1346
+ if (h.length === 0) {
1317
1347
  c.current = !1;
1318
1348
  return;
1319
1349
  }
1320
- const f = Date.now(), g = u.filter(
1321
- (C) => f - C.startedAt.getTime() > yt
1350
+ const f = Date.now(), g = h.filter(
1351
+ (C) => f - C.startedAt.getTime() > Ct
1322
1352
  );
1323
1353
  if (g.length > 0) {
1324
- const { updateExport: C } = ue.getState().actions;
1354
+ const { updateExport: C } = he.getState().actions;
1325
1355
  for (const w of g)
1326
1356
  C(w.id, {
1327
1357
  status: "failed",
@@ -1329,8 +1359,8 @@ function Jn() {
1329
1359
  lastUpdatedAt: /* @__PURE__ */ new Date()
1330
1360
  });
1331
1361
  }
1332
- const k = u.filter(
1333
- (C) => f - C.startedAt.getTime() <= yt
1362
+ const k = h.filter(
1363
+ (C) => f - C.startedAt.getTime() <= Ct
1334
1364
  );
1335
1365
  if (k.length === 0) {
1336
1366
  c.current = !1;
@@ -1339,18 +1369,18 @@ function Jn() {
1339
1369
  const x = await Promise.allSettled(
1340
1370
  k.map(async (C) => {
1341
1371
  try {
1342
- const w = await Ut(d, m, C.id);
1372
+ const w = await Tt(l, u, C.id);
1343
1373
  let E;
1344
1374
  if (w.status === "completed")
1345
1375
  try {
1346
- E = await ze(d, m, C.id);
1376
+ E = await $e(l, u, C.id);
1347
1377
  } catch (V) {
1348
1378
  console.error(
1349
1379
  `[useExportPolling] Failed to get download URL for ${C.id}:`,
1350
1380
  V
1351
1381
  );
1352
1382
  }
1353
- return gt(w, E);
1383
+ return bt(w, E);
1354
1384
  } catch (w) {
1355
1385
  return console.error(
1356
1386
  `[useExportPolling] Failed to poll export ${C.id}:`,
@@ -1358,10 +1388,10 @@ function Jn() {
1358
1388
  ), null;
1359
1389
  }
1360
1390
  })
1361
- ), { updateExport: D } = ue.getState().actions;
1391
+ ), { updateExport: D } = he.getState().actions;
1362
1392
  for (const C of x)
1363
1393
  C.status === "fulfilled" && C.value && D(C.value.id, C.value);
1364
- const S = i();
1394
+ const S = d();
1365
1395
  if (S.length > 0 && !document.hidden) {
1366
1396
  const C = S.reduce(
1367
1397
  (E, V) => V.startedAt < E ? V.startedAt : E,
@@ -1373,66 +1403,66 @@ function Jn() {
1373
1403
  }, w);
1374
1404
  } else
1375
1405
  c.current = !1;
1376
- }, [d, m, i]);
1406
+ }, [l, u, d]);
1377
1407
  return Y(() => {
1378
- p.current = h;
1379
- }, [h]), Y(() => {
1408
+ p.current = m;
1409
+ }, [m]), Y(() => {
1380
1410
  var f;
1381
- i().length > 0 && n && !c.current && (c.current = !0, (f = p.current) == null || f.call(p));
1382
- }, [o, n, i]), Y(() => {
1411
+ d().length > 0 && n && !c.current && (c.current = !0, (f = p.current) == null || f.call(p));
1412
+ }, [o, n, d]), Y(() => {
1383
1413
  var f;
1384
- const u = i();
1385
- n && u.length > 0 && !c.current && (c.current = !0, (f = p.current) == null || f.call(p));
1386
- }, [n, i]), Y(() => {
1414
+ const h = d();
1415
+ n && h.length > 0 && !c.current && (c.current = !0, (f = p.current) == null || f.call(p));
1416
+ }, [n, d]), Y(() => {
1387
1417
  !n && s.current && (clearTimeout(s.current), s.current = null, c.current = !1);
1388
1418
  }, [n]), Y(() => () => {
1389
1419
  s.current && (clearTimeout(s.current), s.current = null);
1390
1420
  }, []), {
1391
1421
  isPolling: c.current,
1392
1422
  isTabVisible: n,
1393
- inProgressCount: i().length
1423
+ inProgressCount: d().length
1394
1424
  };
1395
1425
  }
1396
1426
  function es() {
1397
- const { authToken: e, tokenProps: a } = He(), o = ue((p) => p.activeExports), { addExport: n } = Tt(), l = he(!1), s = a == null ? void 0 : a.apiServiceUrl, c = e == null ? void 0 : e.accessToken;
1427
+ const { authToken: e, tokenProps: a } = Ge(), o = he((p) => p.activeExports), { addExport: n } = Vt(), i = ce(!1), s = a == null ? void 0 : a.apiServiceUrl, c = e == null ? void 0 : e.accessToken;
1398
1428
  Y(() => {
1399
- if (l.current || !s || !c) return;
1429
+ if (i.current || !s || !c) return;
1400
1430
  (async () => {
1401
1431
  try {
1402
- const { exports: d } = await Cr(s, c, {
1432
+ const { exports: l } = await Cr(s, c, {
1403
1433
  status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
1404
1434
  limit: 20
1405
1435
  // Limit to recent exports
1406
1436
  });
1407
- for (const m of d) {
1408
- if (o.has(m.id)) continue;
1409
- let i;
1410
- if (m.status === "completed")
1437
+ for (const u of l) {
1438
+ if (o.has(u.id)) continue;
1439
+ let d;
1440
+ if (u.status === "completed")
1411
1441
  try {
1412
- i = await ze(s, c, m.id);
1413
- } catch (u) {
1442
+ d = await $e(s, c, u.id);
1443
+ } catch (h) {
1414
1444
  console.error(
1415
- `[useExportRecovery] Failed to get download URL for ${m.id}:`,
1416
- u
1445
+ `[useExportRecovery] Failed to get download URL for ${u.id}:`,
1446
+ h
1417
1447
  );
1418
1448
  }
1419
- const h = {
1420
- ...gt(m, i),
1421
- title: Oa(m),
1422
- startedAt: new Date(m.createdAt),
1423
- expiresAt: new Date(m.expiresAt)
1449
+ const m = {
1450
+ ...bt(u, d),
1451
+ title: Oa(u),
1452
+ startedAt: new Date(u.createdAt),
1453
+ expiresAt: new Date(u.expiresAt)
1424
1454
  };
1425
- n(h);
1455
+ n(m);
1426
1456
  }
1427
- l.current = !0;
1428
- } catch (d) {
1429
- console.error("[useExportRecovery] Failed to recover exports:", d), l.current = !0;
1457
+ i.current = !0;
1458
+ } catch (l) {
1459
+ console.error("[useExportRecovery] Failed to recover exports:", l), i.current = !0;
1430
1460
  }
1431
1461
  })();
1432
1462
  }, [s, c, n, o]);
1433
1463
  }
1434
1464
  function Oa(e) {
1435
- return e.title ? e.title : ht(
1465
+ return e.title ? e.title : mt(
1436
1466
  e.status
1437
1467
  ) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
1438
1468
  }
@@ -1441,21 +1471,21 @@ function _a({
1441
1471
  onRemove: a,
1442
1472
  onDownload: o
1443
1473
  }) {
1444
- const [n, l] = F("idle");
1474
+ const [n, i] = I("idle");
1445
1475
  Y(() => {
1446
- e.downloadUrl && l("idle");
1476
+ e.downloadUrl && i("idle");
1447
1477
  }, [e.downloadUrl]);
1448
1478
  const s = async () => {
1449
1479
  if (!o) {
1450
1480
  e.downloadUrl && window.open(e.downloadUrl, "_blank");
1451
1481
  return;
1452
1482
  }
1453
- l("preparing");
1483
+ i("preparing");
1454
1484
  const g = await o(e);
1455
- l(g === "denied" ? "denied" : "idle");
1485
+ i(g === "denied" ? "denied" : "idle");
1456
1486
  }, c = (g) => {
1457
1487
  g.stopPropagation(), a == null || a(e.id);
1458
- }, p = ht(e.status), d = (() => {
1488
+ }, p = mt(e.status), l = (() => {
1459
1489
  switch (e.status) {
1460
1490
  case "pending":
1461
1491
  return "Queued...";
@@ -1464,18 +1494,18 @@ function _a({
1464
1494
  default:
1465
1495
  return "Processing...";
1466
1496
  }
1467
- })(), m = e.status === "completed" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "pending" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", i = e.status === "completed" ? "Ready" : e.status === "failed" ? "Failed" : "In progress", h = ga(e.startedAt, { addSuffix: !0 }), u = [
1497
+ })(), u = e.status === "completed" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "pending" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", d = e.status === "completed" ? "Ready" : e.status === "failed" ? "Failed" : "In progress", m = ga(e.startedAt, { addSuffix: !0 }), h = [
1468
1498
  e.status === "completed" && e.totalRows !== null ? `${e.totalRows.toLocaleString()} rows` : null,
1469
1499
  e.status === "completed" && e.fileSize ? wr(e.fileSize) : null
1470
1500
  ].filter((g) => !!g), f = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
1471
1501
  return /* @__PURE__ */ r("div", { className: "group flex items-start gap-2.5 px-3 py-2 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
1472
- /* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${m}` }) }),
1473
- /* @__PURE__ */ t("span", { className: "sr-only", children: i }),
1502
+ /* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${u}` }) }),
1503
+ /* @__PURE__ */ t("span", { className: "sr-only", children: d }),
1474
1504
  /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
1475
1505
  /* @__PURE__ */ r("div", { className: "flex h-5 items-center gap-2", children: [
1476
1506
  /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: e.title }),
1477
1507
  e.status === "completed" && n === "preparing" && /* @__PURE__ */ r("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: [
1478
- /* @__PURE__ */ t(Vt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }),
1508
+ /* @__PURE__ */ t(Rt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }),
1479
1509
  "Preparing"
1480
1510
  ] }),
1481
1511
  e.status === "completed" && n !== "preparing" && /* @__PURE__ */ t(
@@ -1488,7 +1518,7 @@ function _a({
1488
1518
  }
1489
1519
  ),
1490
1520
  /* @__PURE__ */ t(
1491
- U,
1521
+ T,
1492
1522
  {
1493
1523
  variant: "ghost",
1494
1524
  size: "xs",
@@ -1496,27 +1526,27 @@ function _a({
1496
1526
  onClick: c,
1497
1527
  "aria-label": "Remove notification",
1498
1528
  title: "Remove",
1499
- children: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
1529
+ children: /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
1500
1530
  }
1501
1531
  )
1502
1532
  ] }),
1503
1533
  !p && e.status !== "failed" && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
1504
- u.length > 0 && // Disclosed on hover or focus only; the time is what a reader scans.
1534
+ h.length > 0 && // Disclosed on hover or focus only; the time is what a reader scans.
1505
1535
  /* @__PURE__ */ r("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
1506
- u.map((g, k) => /* @__PURE__ */ r(wt.Fragment, { children: [
1536
+ h.map((g, k) => /* @__PURE__ */ r(Nt.Fragment, { children: [
1507
1537
  k > 0 && f,
1508
1538
  /* @__PURE__ */ t("span", { children: g })
1509
1539
  ] }, k)),
1510
1540
  f
1511
1541
  ] }),
1512
- /* @__PURE__ */ t("span", { children: h })
1542
+ /* @__PURE__ */ t("span", { children: m })
1513
1543
  ] }),
1514
1544
  e.status === "completed" && n === "denied" && /* @__PURE__ */ r("div", { role: "alert", className: "mt-1 flex items-start gap-1.5 text-[12px] leading-4 text-foreground", children: [
1515
1545
  /* @__PURE__ */ t(Nr, { className: "mt-0.5 h-3 w-3 shrink-0 text-destructive", strokeWidth: 1.75 }),
1516
1546
  /* @__PURE__ */ t("span", { children: "This link expired. Refresh the tray to sign the file again." })
1517
1547
  ] }),
1518
1548
  p && /* @__PURE__ */ r("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
1519
- d,
1549
+ l,
1520
1550
  (e.progress !== null || e.rowsProcessed !== void 0) && /* @__PURE__ */ r(j, { children: [
1521
1551
  " ",
1522
1552
  f,
@@ -1529,7 +1559,7 @@ function _a({
1529
1559
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
1530
1560
  /* @__PURE__ */ t("span", { children: "Failed" }),
1531
1561
  f,
1532
- /* @__PURE__ */ t("span", { children: h })
1562
+ /* @__PURE__ */ t("span", { children: m })
1533
1563
  ] }),
1534
1564
  /* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: e.error || "Export failed" })
1535
1565
  ] })
@@ -1537,11 +1567,11 @@ function _a({
1537
1567
  ] });
1538
1568
  }
1539
1569
  function za() {
1540
- const { authToken: e, tokenProps: a } = He(), o = ue((x) => x.activeExports), { clearCompleted: n, removeExport: l, updateExport: s } = Tt(), [c, p] = F(!1), [d, m] = F(!1), i = Array.from(o.values()).sort(
1570
+ const { authToken: e, tokenProps: a } = Ge(), o = he((x) => x.activeExports), { clearCompleted: n, removeExport: i, updateExport: s } = Vt(), [c, p] = I(!1), [l, u] = I(!1), d = Array.from(o.values()).sort(
1541
1571
  (x, D) => D.startedAt.getTime() - x.startedAt.getTime()
1542
- ), h = i.some(
1572
+ ), m = d.some(
1543
1573
  (x) => x.status === "completed" || x.status === "failed"
1544
- ), u = H(async () => {
1574
+ ), h = H(async () => {
1545
1575
  const x = a == null ? void 0 : a.apiServiceUrl, D = e == null ? void 0 : e.accessToken;
1546
1576
  if (!(!x || !D)) {
1547
1577
  p(!0);
@@ -1550,11 +1580,11 @@ function za() {
1550
1580
  await Promise.all(
1551
1581
  S.map(async (C) => {
1552
1582
  try {
1553
- const w = await Ut(x, D, C.id);
1583
+ const w = await Tt(x, D, C.id);
1554
1584
  let E;
1555
1585
  if (w.status === "completed")
1556
1586
  try {
1557
- E = await ze(
1587
+ E = await $e(
1558
1588
  x,
1559
1589
  D,
1560
1590
  C.id
@@ -1562,7 +1592,7 @@ function za() {
1562
1592
  } catch (V) {
1563
1593
  console.error(`Failed to get download URL for ${C.id}:`, V);
1564
1594
  }
1565
- s(C.id, gt(w, E));
1595
+ s(C.id, bt(w, E));
1566
1596
  } catch (w) {
1567
1597
  s(C.id, { downloadUrl: void 0 }), console.error(`Failed to refresh export ${C.id}:`, w);
1568
1598
  }
@@ -1583,37 +1613,37 @@ function za() {
1583
1613
  n();
1584
1614
  return;
1585
1615
  }
1586
- m(!0);
1616
+ u(!0);
1587
1617
  try {
1588
- const S = i.filter(
1618
+ const S = d.filter(
1589
1619
  (w) => w.status === "completed" || w.status === "failed"
1590
1620
  ), C = await Promise.allSettled(
1591
- S.map(async (w) => (await bt(x, D, w.id), w.id))
1621
+ S.map(async (w) => (await vt(x, D, w.id), w.id))
1592
1622
  );
1593
1623
  for (const w of C)
1594
- w.status === "fulfilled" ? l(w.value) : console.error("Failed to delete export:", w.reason);
1624
+ w.status === "fulfilled" ? i(w.value) : console.error("Failed to delete export:", w.reason);
1595
1625
  } finally {
1596
- m(!1);
1626
+ u(!1);
1597
1627
  }
1598
1628
  }, [
1599
- i,
1629
+ d,
1600
1630
  a == null ? void 0 : a.apiServiceUrl,
1601
1631
  e == null ? void 0 : e.accessToken,
1602
1632
  n,
1603
- l
1633
+ i
1604
1634
  ]), g = H(
1605
1635
  async (x) => {
1606
1636
  const D = a == null ? void 0 : a.apiServiceUrl, S = e == null ? void 0 : e.accessToken;
1607
1637
  if (D && S)
1608
1638
  try {
1609
- await bt(D, S, x), l(x);
1639
+ await vt(D, S, x), i(x);
1610
1640
  return;
1611
1641
  } catch (C) {
1612
1642
  console.error(`Failed to cancel export ${x}:`, C);
1613
1643
  }
1614
- l(x);
1644
+ i(x);
1615
1645
  },
1616
- [a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, l]
1646
+ [a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, i]
1617
1647
  ), k = H(
1618
1648
  async (x) => {
1619
1649
  if (x.downloadUrl)
@@ -1621,7 +1651,7 @@ function za() {
1621
1651
  const D = a == null ? void 0 : a.apiServiceUrl, S = e == null ? void 0 : e.accessToken;
1622
1652
  if (!D || !S) return "denied";
1623
1653
  try {
1624
- const C = await ze(D, S, x.id);
1654
+ const C = await $e(D, S, x.id);
1625
1655
  return s(x.id, { downloadUrl: C }), window.open(C, "_blank"), "opened";
1626
1656
  } catch (C) {
1627
1657
  return console.error(`Failed to get download URL for ${x.id}:`, C), s(x.id, { downloadUrl: void 0 }), "denied";
@@ -1629,38 +1659,38 @@ function za() {
1629
1659
  },
1630
1660
  [a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, s]
1631
1661
  );
1632
- return i.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
1662
+ return d.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
1633
1663
  /* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(Ca, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
1634
1664
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: "No exports yet" }),
1635
1665
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Large exports run in the background and land here." })
1636
1666
  ] }) : /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
1637
1667
  /* @__PURE__ */ r("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
1638
1668
  /* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Exports" }),
1639
- /* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: i.length }),
1669
+ /* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: d.length }),
1640
1670
  /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-0.5", children: [
1641
- h && /* @__PURE__ */ t(
1642
- U,
1671
+ m && /* @__PURE__ */ t(
1672
+ T,
1643
1673
  {
1644
1674
  variant: "ghost",
1645
1675
  size: "xs",
1646
1676
  className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
1647
1677
  onClick: f,
1648
- disabled: d,
1649
- children: d ? "Clearing" : "Clear all"
1678
+ disabled: l,
1679
+ children: l ? "Clearing" : "Clear all"
1650
1680
  }
1651
1681
  ),
1652
1682
  /* @__PURE__ */ t(
1653
- U,
1683
+ T,
1654
1684
  {
1655
1685
  variant: "ghost",
1656
1686
  size: "xs",
1657
1687
  className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
1658
- onClick: u,
1688
+ onClick: h,
1659
1689
  disabled: c,
1660
1690
  title: "Refresh status",
1661
1691
  "aria-label": "Refresh status",
1662
1692
  children: /* @__PURE__ */ t(
1663
- Vt,
1693
+ Rt,
1664
1694
  {
1665
1695
  strokeWidth: 1.75,
1666
1696
  className: `h-3.5 w-3.5 ${c ? "animate-spin" : ""}`
@@ -1670,7 +1700,7 @@ function za() {
1670
1700
  )
1671
1701
  ] })
1672
1702
  ] }),
1673
- /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y divide-border/70", children: i.map((x) => /* @__PURE__ */ t(
1703
+ /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y divide-border/70", children: d.map((x) => /* @__PURE__ */ t(
1674
1704
  _a,
1675
1705
  {
1676
1706
  export: x,
@@ -1684,12 +1714,12 @@ function za() {
1684
1714
  function ts({
1685
1715
  variant: e
1686
1716
  }) {
1687
- const a = ue((d) => d.activeExports), o = Dr(), n = a.size > 0, l = Array.from(a.values()).some(
1688
- (d) => d.status === "completed" || d.status === "failed"
1717
+ const a = he((l) => l.activeExports), o = Dr(), n = a.size > 0, i = Array.from(a.values()).some(
1718
+ (l) => l.status === "completed" || l.status === "failed"
1689
1719
  ), c = o > 0 ? o > 9 ? "9+" : String(o) : null;
1690
- return /* @__PURE__ */ r(Re, { children: [
1691
- /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ r(
1692
- U,
1720
+ return /* @__PURE__ */ r(Pe, { children: [
1721
+ /* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ r(
1722
+ T,
1693
1723
  {
1694
1724
  variant: e ?? "ghost",
1695
1725
  size: "xs",
@@ -1707,7 +1737,7 @@ function ts({
1707
1737
  ]
1708
1738
  }
1709
1739
  ) }),
1710
- /* @__PURE__ */ t(Me, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(za, {}) })
1740
+ /* @__PURE__ */ t(Oe, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(za, {}) })
1711
1741
  ] });
1712
1742
  }
1713
1743
  function $a(e) {
@@ -1724,19 +1754,19 @@ function ja({
1724
1754
  onOpenChange: a,
1725
1755
  trigger: o,
1726
1756
  showTrigger: n = !0,
1727
- initialMode: l = "manage"
1757
+ initialMode: i = "manage"
1728
1758
  }) {
1729
- const s = l === "create", {
1759
+ const s = i === "create", {
1730
1760
  forceClose: c,
1731
1761
  handleOpenChange: p,
1732
- isCreateFlowActive: d,
1733
- preventPassiveDismissDuringCreate: m,
1734
- resolvedOpen: i,
1735
- setIsCreateFlowActive: h
1736
- } = Ot({
1762
+ isCreateFlowActive: l,
1763
+ preventPassiveDismissDuringCreate: u,
1764
+ resolvedOpen: d,
1765
+ setIsCreateFlowActive: m
1766
+ } = _t({
1737
1767
  open: e,
1738
1768
  onOpenChange: a,
1739
- initialCreateFlowActive: l === "create",
1769
+ initialCreateFlowActive: i === "create",
1740
1770
  // Dialog mode renders a built-in X close button — allow explicit
1741
1771
  // closes through `handleOpenChange`. Popover mode has no X; its
1742
1772
  // only close-via-trigger path is a re-click that would silently
@@ -1744,16 +1774,16 @@ function ja({
1744
1774
  // create and make consumers use `forceClose()` from a dedicated
1745
1775
  // button.
1746
1776
  dismissMode: n ? "passive" : "explicit-only"
1747
- }), u = T((v) => v.dashboard), { setDashboardControlsModel: f } = be(), { participants: g } = Er(Qt(u)), k = Array.from(
1777
+ }), h = L((v) => v.dashboard), { setDashboardControlsModel: f } = be(), { participants: g } = Er(Qt(h)), k = Array.from(
1748
1778
  new Map(
1749
1779
  g.flatMap(
1750
- (v) => v.fieldChoices.map((B) => {
1751
- var I;
1780
+ (v) => v.fieldChoices.map((U) => {
1781
+ var F;
1752
1782
  return [
1753
- B.value,
1783
+ U.value,
1754
1784
  {
1755
- option: B,
1756
- target: (I = v.fieldTargetMap) == null ? void 0 : I[B.value]
1785
+ option: U,
1786
+ target: (F = v.fieldTargetMap) == null ? void 0 : F[U.value]
1757
1787
  }
1758
1788
  ];
1759
1789
  })
@@ -1762,91 +1792,91 @@ function ja({
1762
1792
  ), x = Array.from(
1763
1793
  new Map(
1764
1794
  g.flatMap(
1765
- (v) => v.metricChoices.map((B) => {
1766
- var I;
1795
+ (v) => v.metricChoices.map((U) => {
1796
+ var F;
1767
1797
  return [
1768
- B.value,
1798
+ U.value,
1769
1799
  {
1770
- option: B,
1771
- target: (I = v.metricTargetMap) == null ? void 0 : I[B.value]
1800
+ option: U,
1801
+ target: (F = v.metricTargetMap) == null ? void 0 : F[U.value]
1772
1802
  }
1773
1803
  ];
1774
1804
  })
1775
1805
  )
1776
1806
  ).values()
1777
1807
  ), D = Yt({
1778
- ...u || {},
1808
+ ...h || {},
1779
1809
  controls: []
1780
- }), S = Ar(u), C = (v, B, I) => {
1810
+ }), S = Ar(h), C = (v, U, F) => {
1781
1811
  f(
1782
1812
  v,
1783
- B,
1784
- $a(I)
1813
+ U,
1814
+ $a(F)
1785
1815
  );
1786
1816
  }, w = H(() => {
1787
1817
  if (s) {
1788
1818
  c();
1789
1819
  return;
1790
1820
  }
1791
- h(!1);
1792
- }, [s, c, h]), E = /* @__PURE__ */ t(
1793
- _t,
1821
+ m(!1);
1822
+ }, [s, c, m]), E = /* @__PURE__ */ t(
1823
+ zt,
1794
1824
  {
1795
1825
  scope: "dashboard",
1796
- controls: u.controls || [],
1826
+ controls: h.controls || [],
1797
1827
  reservedControlIds: D,
1798
- defaultValues: u.defaultControlValues || {},
1799
- usageByControlId: Fr(u),
1828
+ defaultValues: h.defaultControlValues || {},
1829
+ usageByControlId: Ir(h),
1800
1830
  availableFieldChoices: k,
1801
1831
  availableMetricChoices: x,
1802
1832
  structuralParticipants: g,
1803
1833
  structuralParticipantIdsByControlId: S,
1804
- initialCreateFlow: l === "create",
1805
- onCreateFlowActiveChange: h,
1834
+ initialCreateFlow: i === "create",
1835
+ onCreateFlowActiveChange: m,
1806
1836
  onCreateFlowComplete: w,
1807
1837
  onChange: C,
1808
1838
  emptyMessage: "No dashboard controls yet."
1809
1839
  }
1810
- ), V = d ? "Add dashboard control" : "Dashboard Controls", b = /* @__PURE__ */ r(j, { children: [
1840
+ ), V = l ? "Add dashboard control" : "Dashboard Controls", b = /* @__PURE__ */ r(j, { children: [
1811
1841
  /* @__PURE__ */ r("div", { className: "space-y-1", children: [
1812
1842
  /* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
1813
1843
  /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control." })
1814
1844
  ] }),
1815
1845
  E
1816
1846
  ] });
1817
- return n ? /* @__PURE__ */ r(Re, { open: i, onOpenChange: p, children: [
1818
- /* @__PURE__ */ t(Pe, { asChild: !0, children: o || /* @__PURE__ */ r(U, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
1819
- /* @__PURE__ */ t(Et, { className: "mr-2 h-4 w-4" }),
1847
+ return n ? /* @__PURE__ */ r(Pe, { open: d, onOpenChange: p, children: [
1848
+ /* @__PURE__ */ t(Me, { asChild: !0, children: o || /* @__PURE__ */ r(T, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
1849
+ /* @__PURE__ */ t(At, { className: "mr-2 h-4 w-4" }),
1820
1850
  "Controls"
1821
1851
  ] }) }),
1822
1852
  /* @__PURE__ */ t(
1823
- Me,
1853
+ Oe,
1824
1854
  {
1825
1855
  className: "w-[620px] max-w-[95vw] space-y-4",
1826
1856
  align: "end",
1827
- onEscapeKeyDown: m,
1828
- onPointerDownOutside: m,
1857
+ onEscapeKeyDown: u,
1858
+ onPointerDownOutside: u,
1829
1859
  children: b
1830
1860
  }
1831
1861
  )
1832
- ] }) : /* @__PURE__ */ t(De, { open: i, onOpenChange: p, children: /* @__PURE__ */ r(
1862
+ ] }) : /* @__PURE__ */ t(De, { open: d, onOpenChange: p, children: /* @__PURE__ */ r(
1833
1863
  ke,
1834
1864
  {
1835
1865
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
1836
- onEscapeKeyDown: m,
1837
- onPointerDownOutside: m,
1866
+ onEscapeKeyDown: u,
1867
+ onPointerDownOutside: u,
1838
1868
  children: [
1839
1869
  /* @__PURE__ */ r(
1840
- ct,
1870
+ ut,
1841
1871
  {
1842
- className: d ? "space-y-0" : void 0,
1872
+ className: l ? "space-y-0" : void 0,
1843
1873
  children: [
1844
1874
  /* @__PURE__ */ t(Ee, { className: "text-[15px]", children: V }),
1845
1875
  /* @__PURE__ */ t(
1846
- ut,
1876
+ ht,
1847
1877
  {
1848
- className: d ? "sr-only" : "text-[13px]",
1849
- children: d ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
1878
+ className: l ? "sr-only" : "text-[13px]",
1879
+ children: l ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
1850
1880
  }
1851
1881
  )
1852
1882
  ]
@@ -1872,74 +1902,74 @@ function Ha({
1872
1902
  }) {
1873
1903
  var b;
1874
1904
  const n = o === "create", {
1875
- forceClose: l,
1905
+ forceClose: i,
1876
1906
  handleOpenChange: s,
1877
1907
  isCreateFlowActive: c,
1878
1908
  preventPassiveDismissDuringCreate: p,
1879
- resolvedOpen: d,
1880
- setIsCreateFlowActive: m
1881
- } = Ot({
1909
+ resolvedOpen: l,
1910
+ setIsCreateFlowActive: u
1911
+ } = _t({
1882
1912
  open: e,
1883
1913
  onOpenChange: a,
1884
1914
  initialCreateFlowActive: o === "create",
1885
1915
  dismissMode: "explicit-only"
1886
- }), i = T((v) => v.dashboard), h = T((v) => v.selectedSheetId), { setDashboardInputs: u } = be(), f = (b = i.sheets) == null ? void 0 : b.find(
1887
- (v) => v.id === h
1888
- ), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, k = ee(
1889
- () => g && (f != null && f.document) ? Ir(i, f.id) : [],
1890
- [i, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
1891
- ), x = ee(
1916
+ }), d = L((v) => v.dashboard), m = L((v) => v.selectedSheetId), { setDashboardInputs: h } = be(), f = (b = d.sheets) == null ? void 0 : b.find(
1917
+ (v) => v.id === m
1918
+ ), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, k = Z(
1919
+ () => g && (f != null && f.document) ? Fr(d, f.id) : [],
1920
+ [d, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
1921
+ ), x = Z(
1892
1922
  () => k.filter(
1893
1923
  (v) => v.kind === "control"
1894
1924
  ),
1895
1925
  [k]
1896
- ), D = ee(
1926
+ ), D = Z(
1897
1927
  () => x.map((v) => v.control),
1898
1928
  [x]
1899
- ), S = ee(
1929
+ ), S = Z(
1900
1930
  () => qa(D),
1901
1931
  [D]
1902
- ), C = ee(
1903
- () => Ga(i),
1904
- [i]
1932
+ ), C = Z(
1933
+ () => Ga(d),
1934
+ [d]
1905
1935
  ), w = H(() => {
1906
1936
  if (n) {
1907
- l();
1937
+ i();
1908
1938
  return;
1909
1939
  }
1910
- m(!1);
1911
- }, [n, l, m]), E = H(
1912
- (v, B, I) => {
1913
- !g || !(f != null && f.document) || u(
1940
+ u(!1);
1941
+ }, [n, i, u]), E = H(
1942
+ (v, U, F) => {
1943
+ !g || !(f != null && f.document) || h(
1914
1944
  Qa({
1915
- allInputs: i.inputs || [],
1945
+ allInputs: d.inputs || [],
1916
1946
  documentSheetId: f.id,
1917
1947
  currentDocumentInputs: k,
1918
1948
  nextControls: v,
1919
- nextDefaultValues: B,
1920
- change: I
1949
+ nextDefaultValues: U,
1950
+ change: F
1921
1951
  })
1922
1952
  );
1923
1953
  },
1924
1954
  [
1925
- i.inputs,
1955
+ d.inputs,
1926
1956
  k,
1927
1957
  g,
1928
1958
  f,
1929
- u
1959
+ h
1930
1960
  ]
1931
1961
  );
1932
- return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(De, { open: d, onOpenChange: s, children: /* @__PURE__ */ r(
1962
+ return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(De, { open: l, onOpenChange: s, children: /* @__PURE__ */ r(
1933
1963
  ke,
1934
1964
  {
1935
1965
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
1936
1966
  onEscapeKeyDown: p,
1937
1967
  onPointerDownOutside: p,
1938
1968
  children: [
1939
- /* @__PURE__ */ r(ct, { className: c ? "space-y-0" : void 0, children: [
1969
+ /* @__PURE__ */ r(ut, { className: c ? "space-y-0" : void 0, children: [
1940
1970
  /* @__PURE__ */ t(Ee, { className: "text-[15px]", children: c ? "Add document control" : "Document Controls" }),
1941
1971
  /* @__PURE__ */ t(
1942
- ut,
1972
+ ht,
1943
1973
  {
1944
1974
  className: c ? "sr-only" : "text-[13px]",
1945
1975
  children: c ? "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."
@@ -1947,7 +1977,7 @@ function Ha({
1947
1977
  )
1948
1978
  ] }),
1949
1979
  /* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ t(
1950
- _t,
1980
+ zt,
1951
1981
  {
1952
1982
  scope: "dashboard",
1953
1983
  controls: D,
@@ -1960,7 +1990,7 @@ function Ha({
1960
1990
  structuralParticipantIdsByControlId: {},
1961
1991
  allowedControlTypes: Wa,
1962
1992
  initialCreateFlow: o === "create",
1963
- onCreateFlowActiveChange: m,
1993
+ onCreateFlowActiveChange: u,
1964
1994
  onCreateFlowComplete: w,
1965
1995
  onChange: E,
1966
1996
  emptyMessage: "No document controls yet."
@@ -1990,66 +2020,66 @@ function Qa({
1990
2020
  documentSheetId: a,
1991
2021
  currentDocumentInputs: o,
1992
2022
  nextControls: n,
1993
- nextDefaultValues: l,
2023
+ nextDefaultValues: i,
1994
2024
  change: s
1995
2025
  }) {
1996
2026
  const c = new Map(
1997
- n.map((u) => [
1998
- u.id,
1999
- Ka(u, l)
2027
+ n.map((h) => [
2028
+ h.id,
2029
+ Ka(h, i)
2000
2030
  ])
2001
- ), p = (s == null ? void 0 : s.type) === "rename" ? { oldId: s.oldId, newId: s.newId } : null, d = /* @__PURE__ */ new Set(), m = [];
2002
- for (const u of o) {
2003
- if (u.kind !== "control") {
2004
- m.push(u);
2031
+ ), p = (s == null ? void 0 : s.type) === "rename" ? { oldId: s.oldId, newId: s.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
2032
+ for (const h of o) {
2033
+ if (h.kind !== "control") {
2034
+ u.push(h);
2005
2035
  continue;
2006
2036
  }
2007
- const f = c.get(u.control.id) || ((p == null ? void 0 : p.oldId) === u.control.id ? c.get(p.newId) : void 0);
2037
+ const f = c.get(h.control.id) || ((p == null ? void 0 : p.oldId) === h.control.id ? c.get(p.newId) : void 0);
2008
2038
  if (!f)
2009
2039
  continue;
2010
- d.add(f.id);
2040
+ l.add(f.id);
2011
2041
  const g = Xt(
2012
2042
  f.id,
2013
- [...e, ...m].filter(
2014
- (x) => x.id !== u.id
2043
+ [...e, ...u].filter(
2044
+ (x) => x.id !== h.id
2015
2045
  )
2016
2046
  ), k = f.id === g ? f : { ...f, id: g };
2017
- m.push({
2018
- ...u,
2047
+ u.push({
2048
+ ...h,
2019
2049
  label: k.label,
2020
2050
  variableName: g,
2021
2051
  requiredAtExecution: k.requiredAtExecution,
2022
2052
  control: k
2023
2053
  });
2024
2054
  }
2025
- for (const u of c.values())
2026
- d.has(u.id) || m.push(
2055
+ for (const h of c.values())
2056
+ l.has(h.id) || u.push(
2027
2057
  Lr({
2028
- control: u,
2029
- existingInputs: [...e, ...m],
2058
+ control: h,
2059
+ existingInputs: [...e, ...u],
2030
2060
  sheetId: a
2031
2061
  })
2032
2062
  );
2033
- const i = new Set(
2034
- o.map((u) => u.id)
2063
+ const d = new Set(
2064
+ o.map((h) => h.id)
2035
2065
  );
2036
2066
  return [...e.filter(
2037
- (u) => !i.has(u.id)
2038
- ), ...m];
2067
+ (h) => !d.has(h.id)
2068
+ ), ...u];
2039
2069
  }
2040
2070
  function Ya({
2041
2071
  showFilters: e,
2042
2072
  onShowFiltersChange: a,
2043
2073
  pickerContent: o,
2044
2074
  settingsContent: n,
2045
- size: l = "default",
2075
+ size: i = "default",
2046
2076
  className: s,
2047
2077
  primaryButtonClassName: c,
2048
2078
  secondaryButtonClassName: p,
2049
- pickerContentClassName: d,
2050
- settingsContentClassName: m
2079
+ pickerContentClassName: l,
2080
+ settingsContentClassName: u
2051
2081
  }) {
2052
- const i = l === "toolbar", [h, u] = F(!1), f = tt("interactive");
2082
+ const d = i === "toolbar", [m, h] = I(!1), f = rt("interactive");
2053
2083
  return /* @__PURE__ */ r(
2054
2084
  "div",
2055
2085
  {
@@ -2058,13 +2088,13 @@ function Ya({
2058
2088
  // h-7 box (matches regular `size="xs"` buttons). Inner triggers
2059
2089
  // stretch to fill via `h-full`.
2060
2090
  "relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
2061
- i ? "h-8" : "h-7",
2091
+ d ? "h-8" : "h-7",
2062
2092
  s
2063
2093
  ),
2064
2094
  children: [
2065
- /* @__PURE__ */ r(Re, { open: e, onOpenChange: a, children: [
2066
- /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ r(
2067
- U,
2095
+ /* @__PURE__ */ r(Pe, { open: e, onOpenChange: a, children: [
2096
+ /* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ r(
2097
+ T,
2068
2098
  {
2069
2099
  variant: "ghost",
2070
2100
  size: "xs",
@@ -2073,28 +2103,28 @@ function Ya({
2073
2103
  c
2074
2104
  ),
2075
2105
  children: [
2076
- e ? /* @__PURE__ */ t(ua, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Rt, { className: "h-3.5 w-3.5" }),
2106
+ e ? /* @__PURE__ */ t(ua, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5" }),
2077
2107
  "Filter"
2078
2108
  ]
2079
2109
  }
2080
2110
  ) }),
2081
2111
  /* @__PURE__ */ t(
2082
- Me,
2112
+ Oe,
2083
2113
  {
2084
2114
  align: "end",
2085
2115
  sideOffset: 6,
2086
2116
  className: K(
2087
2117
  "w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
2088
- d
2118
+ l
2089
2119
  ),
2090
2120
  style: f.contentStyle,
2091
2121
  children: o
2092
2122
  }
2093
2123
  )
2094
2124
  ] }),
2095
- /* @__PURE__ */ r(Re, { open: h, onOpenChange: u, children: [
2096
- /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ t(
2097
- U,
2125
+ /* @__PURE__ */ r(Pe, { open: m, onOpenChange: h, children: [
2126
+ /* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ t(
2127
+ T,
2098
2128
  {
2099
2129
  variant: "ghost",
2100
2130
  size: "xs",
@@ -2103,20 +2133,20 @@ function Ya({
2103
2133
  p
2104
2134
  ),
2105
2135
  "aria-label": "Filter and control actions",
2106
- children: /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" })
2136
+ children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
2107
2137
  }
2108
2138
  ) }),
2109
2139
  /* @__PURE__ */ t(
2110
- Me,
2140
+ Oe,
2111
2141
  {
2112
2142
  align: "end",
2113
2143
  sideOffset: 6,
2114
2144
  className: K(
2115
2145
  "w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
2116
- m
2146
+ u
2117
2147
  ),
2118
2148
  style: f.contentStyle,
2119
- children: n(() => u(!1))
2149
+ children: n(() => h(!1))
2120
2150
  }
2121
2151
  )
2122
2152
  ] })
@@ -2126,29 +2156,29 @@ function Ya({
2126
2156
  }
2127
2157
  function Xa() {
2128
2158
  ha();
2129
- const e = T((d) => d.selectedSheetId), a = T((d) => d.selectedFrameId), o = T((d) => d.dashboard), n = T((d) => d.actions.getSelectedFrame), { setSelectedFrameId: l } = be(), { setCard: s } = kt(), c = me((d) => d.card.dataSource);
2159
+ const e = L((l) => l.selectedSheetId), a = L((l) => l.selectedFrameId), o = L((l) => l.dashboard), n = L((l) => l.actions.getSelectedFrame), { setSelectedFrameId: i } = be(), { setCard: s } = Et(), c = me((l) => l.card.dataSource);
2130
2160
  return Y(() => {
2131
- var m, i;
2132
- let d = n();
2133
- if (!d) {
2134
- const h = (m = o == null ? void 0 : o.sheets) == null ? void 0 : m.find((f) => f.id === e), u = (i = h == null ? void 0 : h.frames) == null ? void 0 : i[0];
2135
- u && (l(u.id), d = u);
2161
+ var u, d;
2162
+ let l = n();
2163
+ if (!l) {
2164
+ const m = (u = o == null ? void 0 : o.sheets) == null ? void 0 : u.find((f) => f.id === e), h = (d = m == null ? void 0 : m.frames) == null ? void 0 : d[0];
2165
+ h && (i(h.id), l = h);
2136
2166
  }
2137
- if (d) {
2138
- const h = d.cards.find((u) => u.id === d.activeCardId);
2139
- h && s(h);
2167
+ if (l) {
2168
+ const m = l.cards.find((h) => h.id === l.activeCardId);
2169
+ m && s(m);
2140
2170
  }
2141
- }, [n, e, a, o, l, s]), {
2171
+ }, [n, e, a, o, i, s]), {
2142
2172
  hasEntities: !!(c != null && c.selectedEntities && c.selectedEntities.length > 0)
2143
2173
  };
2144
2174
  }
2145
2175
  function Za() {
2146
- const e = T((d) => d.dashboard), a = T(
2147
- (d) => d.semanticExecutionPayload
2148
- ), o = T((d) => d.actions.addFilter), { hasEntities: n } = Xa(), { isLoading: l } = Br(), s = ee(
2176
+ const e = L((l) => l.dashboard), a = L(
2177
+ (l) => l.semanticExecutionPayload
2178
+ ), o = L((l) => l.actions.addFilter), { hasEntities: n } = Xa(), { isLoading: i } = Br(), s = Z(
2149
2179
  () => Zt(e, a),
2150
2180
  [e, a]
2151
- ), p = !Jt(e.filters) && s.hasEligibleCards && !l;
2181
+ ), p = !Jt(e.filters) && s.hasEligibleCards && !i;
2152
2182
  return /* @__PURE__ */ r("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
2153
2183
  p && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ r(
2154
2184
  "button",
@@ -2174,24 +2204,24 @@ function Za() {
2174
2204
  n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(Tr, { context: "filter" }) })
2175
2205
  ] });
2176
2206
  }
2177
- const Ct = !1;
2207
+ const wt = !1;
2178
2208
  function Ja({
2179
2209
  onAddFilter: e,
2180
2210
  onAddControl: a,
2181
2211
  onManageControls: o,
2182
2212
  onDismiss: n
2183
2213
  }) {
2184
- const l = T(
2214
+ const i = L(
2185
2215
  (p) => p.dashboard.filterLayout
2186
2216
  ), { setFilterLayout: s } = be();
2187
- l != null && l.displayMode;
2188
- const c = (l == null ? void 0 : l.toolbarWrap) ?? !1;
2189
- return l == null || l.showDownloadButton, /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
2217
+ i != null && i.displayMode;
2218
+ const c = (i == null ? void 0 : i.toolbarWrap) ?? !1;
2219
+ return i == null || i.showDownloadButton, /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
2190
2220
  /* @__PURE__ */ r("div", { className: "p-1", children: [
2191
2221
  /* @__PURE__ */ t(
2192
- Ze,
2222
+ Je,
2193
2223
  {
2194
- icon: Rt,
2224
+ icon: Pt,
2195
2225
  label: "Add filter",
2196
2226
  onClick: () => {
2197
2227
  e(), n();
@@ -2199,9 +2229,9 @@ function Ja({
2199
2229
  }
2200
2230
  ),
2201
2231
  /* @__PURE__ */ t(
2202
- Ze,
2232
+ Je,
2203
2233
  {
2204
- icon: Et,
2234
+ icon: At,
2205
2235
  label: "Add control",
2206
2236
  onClick: () => {
2207
2237
  a(), n();
@@ -2209,9 +2239,9 @@ function Ja({
2209
2239
  }
2210
2240
  ),
2211
2241
  /* @__PURE__ */ t(
2212
- Ze,
2242
+ Je,
2213
2243
  {
2214
- icon: Pt,
2244
+ icon: Mt,
2215
2245
  label: "Manage controls",
2216
2246
  onClick: () => {
2217
2247
  o(), n();
@@ -2222,7 +2252,7 @@ function Ja({
2222
2252
  /* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
2223
2253
  /* @__PURE__ */ r("div", { className: "space-y-1 p-2", children: [
2224
2254
  /* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
2225
- Ct,
2255
+ wt,
2226
2256
  /* @__PURE__ */ t(
2227
2257
  en,
2228
2258
  {
@@ -2232,11 +2262,11 @@ function Ja({
2232
2262
  onCheckedChange: (p) => s({ toolbarWrap: p === !0 })
2233
2263
  }
2234
2264
  ),
2235
- Ct
2265
+ wt
2236
2266
  ] })
2237
2267
  ] });
2238
2268
  }
2239
- function Ze({
2269
+ function Je({
2240
2270
  icon: e,
2241
2271
  label: a,
2242
2272
  onClick: o
@@ -2261,7 +2291,7 @@ function en({
2261
2291
  onCheckedChange: n
2262
2292
  }) {
2263
2293
  return /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
2264
- /* @__PURE__ */ t(dt, { id: e, checked: o, onCheckedChange: n }),
2294
+ /* @__PURE__ */ t(ct, { id: e, checked: o, onCheckedChange: n }),
2265
2295
  /* @__PURE__ */ t(
2266
2296
  Se,
2267
2297
  {
@@ -2277,29 +2307,29 @@ function rs({
2277
2307
  className: a,
2278
2308
  primaryButtonClassName: o,
2279
2309
  secondaryButtonClassName: n,
2280
- pickerContentClassName: l,
2310
+ pickerContentClassName: i,
2281
2311
  settingsContentClassName: s
2282
2312
  }) {
2283
2313
  var V;
2284
- const [c, p] = F(null), d = T((b) => b.dashboard), m = T((b) => b.selectedSheetId), i = T((b) => b.showFilters), h = Vr((b) => b.setPanelOpen), u = T((b) => b.actions), { setDocumentInspectorTab: f, setShowFilters: g } = u, k = (V = d.sheets) == null ? void 0 : V.find(
2285
- (b) => b.id === m
2314
+ const [c, p] = I(null), l = L((b) => b.dashboard), u = L((b) => b.selectedSheetId), d = L((b) => b.showFilters), m = Vr((b) => b.setPanelOpen), h = L((b) => b.actions), { setDocumentInspectorTab: f, setShowFilters: g } = h, k = (V = l.sheets) == null ? void 0 : V.find(
2315
+ (b) => b.id === u
2286
2316
  ), x = tr(k), D = H((b) => {
2287
2317
  window.setTimeout(() => {
2288
2318
  p(b);
2289
2319
  }, 0);
2290
2320
  }, []), S = H(
2291
2321
  (b) => {
2292
- if (x && m) {
2293
- b && f(m, "inputs");
2322
+ if (x && u) {
2323
+ b && f(u, "inputs");
2294
2324
  return;
2295
2325
  }
2296
- b && h("dashboard", !1), g(b);
2326
+ b && m("dashboard", !1), g(b);
2297
2327
  },
2298
2328
  [
2299
2329
  x,
2300
- m,
2330
+ u,
2301
2331
  f,
2302
- h,
2332
+ m,
2303
2333
  g
2304
2334
  ]
2305
2335
  ), C = H(() => {
@@ -2313,7 +2343,7 @@ function rs({
2313
2343
  /* @__PURE__ */ t(
2314
2344
  Ya,
2315
2345
  {
2316
- showFilters: x ? !1 : i,
2346
+ showFilters: x ? !1 : d,
2317
2347
  onShowFiltersChange: S,
2318
2348
  pickerContent: /* @__PURE__ */ t(Za, {}),
2319
2349
  settingsContent: (b) => /* @__PURE__ */ t(
@@ -2329,7 +2359,7 @@ function rs({
2329
2359
  className: a,
2330
2360
  primaryButtonClassName: o,
2331
2361
  secondaryButtonClassName: n,
2332
- pickerContentClassName: l,
2362
+ pickerContentClassName: i,
2333
2363
  settingsContentClassName: s
2334
2364
  }
2335
2365
  ),
@@ -2361,9 +2391,9 @@ function tn({
2361
2391
  className: o,
2362
2392
  onClick: n
2363
2393
  }) {
2364
- const l = typeof a == "number" && a > 0;
2394
+ const i = typeof a == "number" && a > 0;
2365
2395
  return /* @__PURE__ */ r(
2366
- U,
2396
+ T,
2367
2397
  {
2368
2398
  type: "button",
2369
2399
  size: "xs",
@@ -2375,12 +2405,12 @@ function tn({
2375
2405
  children: [
2376
2406
  /* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
2377
2407
  "Reports & briefings",
2378
- l ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
2408
+ i ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
2379
2409
  ]
2380
2410
  }
2381
2411
  );
2382
2412
  }
2383
- const rn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", jt = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Ve = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
2413
+ const rn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Wt = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Re = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
2384
2414
  function an(e) {
2385
2415
  return e === "dashboard" ? "This dashboard" : "Project";
2386
2416
  }
@@ -2391,9 +2421,9 @@ function nn(e) {
2391
2421
  const o = Date.now() - a.getTime(), n = Math.round(o / 6e4);
2392
2422
  if (n < 1) return "now";
2393
2423
  if (n < 60) return `${n}m ago`;
2394
- const l = Math.round(n / 60);
2395
- if (l < 24) return `${l}h ago`;
2396
- const s = Math.round(l / 24);
2424
+ const i = Math.round(n / 60);
2425
+ if (i < 24) return `${i}h ago`;
2426
+ const s = Math.round(i / 24);
2397
2427
  if (s < 7) return `${s}d ago`;
2398
2428
  const c = Math.round(s / 7);
2399
2429
  return c < 5 ? `${c}w ago` : `${Math.round(s / 30)}mo ago`;
@@ -2411,7 +2441,7 @@ function on(e) {
2411
2441
  }
2412
2442
  return null;
2413
2443
  }
2414
- function Wt(e) {
2444
+ function Ht(e) {
2415
2445
  return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
2416
2446
  }
2417
2447
  function ln(e) {
@@ -2453,15 +2483,15 @@ function cn({
2453
2483
  dashboardLabel: a,
2454
2484
  sourceView: o,
2455
2485
  error: n,
2456
- loading: l,
2486
+ loading: i,
2457
2487
  onSourceViewChange: s,
2458
2488
  onClose: c,
2459
2489
  onEdit: p,
2460
- onNew: d,
2461
- canCreate: m,
2462
- canCreateScheduledReport: i,
2463
- analyticalBriefingsEnabled: h,
2464
- onRunNow: u,
2490
+ onNew: l,
2491
+ canCreate: u,
2492
+ canCreateScheduledReport: d,
2493
+ analyticalBriefingsEnabled: m,
2494
+ onRunNow: h,
2465
2495
  onTogglePause: f,
2466
2496
  onDelete: g,
2467
2497
  selectingId: k,
@@ -2470,7 +2500,7 @@ function cn({
2470
2500
  contentKind: S,
2471
2501
  hideHeader: C = !1
2472
2502
  }) {
2473
- const w = e.length, E = e.filter((I) => I.status === "ACTIVE").length, V = S === "reports" ? w === 1 ? "report" : "reports" : S === "briefings" ? w === 1 ? "briefing" : "briefings" : w === 1 ? "item" : "items", b = e.find((I) => I.hasActiveRun) ?? null, v = S ?? "reports & briefings", B = o === "dashboard" ? a : `Project ${v}`;
2503
+ const w = e.length, E = e.filter((F) => F.status === "ACTIVE").length, V = S === "reports" ? w === 1 ? "report" : "reports" : S === "briefings" ? w === 1 ? "briefing" : "briefings" : w === 1 ? "item" : "items", b = e.find((F) => F.hasActiveRun) ?? null, v = S ?? "reports & briefings", U = o === "dashboard" ? a : `Project ${v}`;
2474
2504
  return /* @__PURE__ */ r(
2475
2505
  "section",
2476
2506
  {
@@ -2480,7 +2510,7 @@ function cn({
2480
2510
  C ? null : /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
2481
2511
  /* @__PURE__ */ r("div", { className: "min-w-0", children: [
2482
2512
  /* @__PURE__ */ t("div", { className: rn, children: v }),
2483
- /* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: B })
2513
+ /* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: U })
2484
2514
  ] }),
2485
2515
  /* @__PURE__ */ t(
2486
2516
  "button",
@@ -2489,7 +2519,7 @@ function cn({
2489
2519
  onClick: c,
2490
2520
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
2491
2521
  "aria-label": `Close ${v.replace("&", "and")} panel`,
2492
- children: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" })
2522
+ children: /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" })
2493
2523
  }
2494
2524
  )
2495
2525
  ] }),
@@ -2502,7 +2532,7 @@ function cn({
2502
2532
  onChange: s
2503
2533
  }
2504
2534
  ),
2505
- /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: l && w === 0 ? /* @__PURE__ */ r("span", { children: [
2535
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && w === 0 ? /* @__PURE__ */ r("span", { children: [
2506
2536
  "Loading ",
2507
2537
  v,
2508
2538
  "…"
@@ -2524,43 +2554,43 @@ function cn({
2524
2554
  ] }) })
2525
2555
  ] }),
2526
2556
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
2527
- l ? (
2557
+ i ? (
2528
2558
  // Auto-refresh on open; surface a quiet spinner near the count
2529
2559
  // when a manual reload is in flight, but don't show a separate
2530
2560
  // refresh button — close+reopen handles the rare "stale list"
2531
2561
  // case without crowding the toolbar.
2532
2562
  /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
2533
2563
  ) : null,
2534
- w > 0 && m ? h && i ? /* @__PURE__ */ r($e, { children: [
2535
- /* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Ve, children: [
2564
+ w > 0 && u ? m && d ? /* @__PURE__ */ r(je, { children: [
2565
+ /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Re, children: [
2536
2566
  /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
2537
2567
  " New"
2538
2568
  ] }) }),
2539
- /* @__PURE__ */ r(We, { align: "end", children: [
2540
- /* @__PURE__ */ t(q, { onClick: () => d("scheduled_report"), children: "Schedule a report" }),
2569
+ /* @__PURE__ */ r(He, { align: "end", children: [
2570
+ /* @__PURE__ */ t(q, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
2541
2571
  /* @__PURE__ */ t(
2542
2572
  q,
2543
2573
  {
2544
- onClick: () => d("analytical_briefing"),
2574
+ onClick: () => l("analytical_briefing"),
2545
2575
  children: "Create analytical briefing"
2546
2576
  }
2547
2577
  )
2548
2578
  ] })
2549
- ] }) : i ? /* @__PURE__ */ r(
2579
+ ] }) : d ? /* @__PURE__ */ r(
2550
2580
  "button",
2551
2581
  {
2552
- onClick: () => d("scheduled_report"),
2553
- className: Ve,
2582
+ onClick: () => l("scheduled_report"),
2583
+ className: Re,
2554
2584
  children: [
2555
2585
  /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
2556
2586
  " Schedule report"
2557
2587
  ]
2558
2588
  }
2559
- ) : h ? /* @__PURE__ */ r(
2589
+ ) : m ? /* @__PURE__ */ r(
2560
2590
  "button",
2561
2591
  {
2562
- onClick: () => d("analytical_briefing"),
2563
- className: Ve,
2592
+ onClick: () => l("analytical_briefing"),
2593
+ className: Re,
2564
2594
  children: [
2565
2595
  /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
2566
2596
  " New briefing"
@@ -2573,39 +2603,39 @@ function cn({
2573
2603
  /* @__PURE__ */ t(ae, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
2574
2604
  /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: b.name }),
2575
2605
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
2576
- /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Wt(b) })
2606
+ /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Ht(b) })
2577
2607
  ] }) : null,
2578
2608
  /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: [
2579
2609
  n ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
2580
- !l && e.length === 0 && !n ? /* @__PURE__ */ t(
2610
+ !i && e.length === 0 && !n ? /* @__PURE__ */ t(
2581
2611
  un,
2582
2612
  {
2583
- onNew: d,
2584
- canCreate: m,
2585
- canCreateScheduledReport: i,
2586
- analyticalBriefingsEnabled: h,
2613
+ onNew: l,
2614
+ canCreate: u,
2615
+ canCreateScheduledReport: d,
2616
+ analyticalBriefingsEnabled: m,
2587
2617
  contentKind: S
2588
2618
  }
2589
2619
  ) : null,
2590
- e.map((I) => /* @__PURE__ */ t(
2620
+ e.map((F) => /* @__PURE__ */ t(
2591
2621
  mn,
2592
2622
  {
2593
- briefing: I,
2594
- isOpening: k === I.id,
2595
- isBusy: x === I.id,
2596
- onOpen: () => p(I.id),
2597
- onRunNow: () => u(I),
2598
- onTogglePause: () => f(I),
2599
- onDelete: () => g(I)
2623
+ briefing: F,
2624
+ isOpening: k === F.id,
2625
+ isBusy: x === F.id,
2626
+ onOpen: () => p(F.id),
2627
+ onRunNow: () => h(F),
2628
+ onTogglePause: () => f(F),
2629
+ onDelete: () => g(F)
2600
2630
  },
2601
- I.id
2631
+ F.id
2602
2632
  ))
2603
2633
  ] }),
2604
2634
  D ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ r(
2605
2635
  "a",
2606
2636
  {
2607
2637
  href: D,
2608
- className: K(jt, "h-6 px-1 text-[11px]"),
2638
+ className: K(Wt, "h-6 px-1 text-[11px]"),
2609
2639
  children: [
2610
2640
  "Manage all reports & briefings",
2611
2641
  /* @__PURE__ */ t(va, { className: "h-3 w-3" })
@@ -2621,12 +2651,12 @@ function un({
2621
2651
  canCreate: a,
2622
2652
  canCreateScheduledReport: o,
2623
2653
  analyticalBriefingsEnabled: n,
2624
- contentKind: l
2654
+ contentKind: i
2625
2655
  }) {
2626
- const s = l === "reports" ? {
2656
+ const s = i === "reports" ? {
2627
2657
  title: "No reports yet",
2628
2658
  description: "Schedule an emailed dashboard or visual report to see it here."
2629
- } : l === "briefings" ? {
2659
+ } : i === "briefings" ? {
2630
2660
  title: "No briefings yet",
2631
2661
  description: "Create an analytical briefing to monitor this dashboard and brief your team."
2632
2662
  } : null;
@@ -2639,7 +2669,7 @@ function un({
2639
2669
  "button",
2640
2670
  {
2641
2671
  onClick: () => e("scheduled_report"),
2642
- className: Ve,
2672
+ className: Re,
2643
2673
  children: [
2644
2674
  /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
2645
2675
  " Schedule a report"
@@ -2650,7 +2680,7 @@ function un({
2650
2680
  "button",
2651
2681
  {
2652
2682
  onClick: () => e("analytical_briefing"),
2653
- className: jt,
2683
+ className: Wt,
2654
2684
  children: "Create analytical briefing"
2655
2685
  }
2656
2686
  ) : null
@@ -2839,11 +2869,11 @@ function mn({
2839
2869
  isOpening: a,
2840
2870
  isBusy: o,
2841
2871
  onOpen: n,
2842
- onRunNow: l,
2872
+ onRunNow: i,
2843
2873
  onTogglePause: s,
2844
2874
  onDelete: c
2845
2875
  }) {
2846
- const p = e.status === "PAUSED", d = e.hasActiveRun, m = on(e), i = nn(e.lastRunAt), h = e.lastRunStatus, u = se(e), f = h === "SUCCESS" ? Te.success.dot : h === "FAILED" ? Te.danger.dot : h ? Te.warning.dot : Te.neutral.dot;
2876
+ const p = e.status === "PAUSED", l = e.hasActiveRun, u = on(e), d = nn(e.lastRunAt), m = e.lastRunStatus, h = se(e), f = m === "SUCCESS" ? Te.success.dot : m === "FAILED" ? Te.danger.dot : m ? Te.warning.dot : Te.neutral.dot;
2847
2877
  return /* @__PURE__ */ r(
2848
2878
  "div",
2849
2879
  {
@@ -2868,7 +2898,7 @@ function mn({
2868
2898
  p ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
2869
2899
  ] }),
2870
2900
  /* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
2871
- /* @__PURE__ */ t("span", { children: u.typeLabel }),
2901
+ /* @__PURE__ */ t("span", { children: h.typeLabel }),
2872
2902
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
2873
2903
  /* @__PURE__ */ t("span", { children: ln(e) }),
2874
2904
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
@@ -2878,12 +2908,12 @@ function mn({
2878
2908
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
2879
2909
  /* @__PURE__ */ r("span", { children: [
2880
2910
  "Last run ",
2881
- i
2911
+ d
2882
2912
  ] })
2883
2913
  ] }) : null
2884
2914
  ] }),
2885
- m || d ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
2886
- d ? /* @__PURE__ */ t(ae, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
2915
+ u || l ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
2916
+ l ? /* @__PURE__ */ t(ae, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
2887
2917
  "span",
2888
2918
  {
2889
2919
  className: K(
@@ -2892,33 +2922,33 @@ function mn({
2892
2922
  )
2893
2923
  }
2894
2924
  ),
2895
- /* @__PURE__ */ t("span", { className: "truncate", children: d ? Wt(e) : m })
2925
+ /* @__PURE__ */ t("span", { className: "truncate", children: l ? Ht(e) : u })
2896
2926
  ] }) : null
2897
2927
  ]
2898
2928
  }
2899
2929
  ),
2900
- /* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r($e, { children: [
2901
- /* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ t(
2930
+ /* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r(je, { children: [
2931
+ /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ t(
2902
2932
  "button",
2903
2933
  {
2904
2934
  type: "button",
2905
2935
  onClick: (g) => g.stopPropagation(),
2906
2936
  className: "inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100",
2907
- "aria-label": `${u.noun === "report" ? "Report" : "Briefing"} actions`,
2908
- children: /* @__PURE__ */ t(Lt, { className: "h-3.5 w-3.5" })
2937
+ "aria-label": `${h.noun === "report" ? "Report" : "Briefing"} actions`,
2938
+ children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
2909
2939
  }
2910
2940
  ) }),
2911
- /* @__PURE__ */ r(We, { align: "end", className: "w-44", children: [
2941
+ /* @__PURE__ */ r(He, { align: "end", className: "w-44", children: [
2912
2942
  /* @__PURE__ */ r(q, { onClick: n, children: [
2913
- /* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5" }),
2943
+ /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" }),
2914
2944
  "Edit ",
2915
- u.noun
2945
+ h.noun
2916
2946
  ] }),
2917
2947
  /* @__PURE__ */ r(
2918
2948
  q,
2919
2949
  {
2920
2950
  onClick: (g) => {
2921
- g.preventDefault(), l();
2951
+ g.preventDefault(), i();
2922
2952
  },
2923
2953
  children: [
2924
2954
  /* @__PURE__ */ t(Pr, { className: "h-3.5 w-3.5" }),
@@ -2941,7 +2971,7 @@ function mn({
2941
2971
  ] })
2942
2972
  }
2943
2973
  ) : null,
2944
- /* @__PURE__ */ t(_e, {}),
2974
+ /* @__PURE__ */ t(ze, {}),
2945
2975
  /* @__PURE__ */ r(
2946
2976
  q,
2947
2977
  {
@@ -2950,9 +2980,9 @@ function mn({
2950
2980
  },
2951
2981
  className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
2952
2982
  children: [
2953
- /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }),
2983
+ /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
2954
2984
  "Delete ",
2955
- u.noun
2985
+ h.noun
2956
2986
  ]
2957
2987
  }
2958
2988
  )
@@ -2976,14 +3006,14 @@ function xn(e, a, o) {
2976
3006
  }
2977
3007
  async function vn(e) {
2978
3008
  const o = [];
2979
- let n = 1, l = 0, s = Number.POSITIVE_INFINITY;
2980
- for (; l < s; ) {
3009
+ let n = 1, i = 0, s = Number.POSITIVE_INFINITY;
3010
+ for (; i < s; ) {
2981
3011
  const c = await e.apiClient.listBriefings(
2982
3012
  e.apiServiceUrl,
2983
3013
  e.token,
2984
3014
  { scope: "organization", page: n, pageSize: 100 }
2985
3015
  );
2986
- if (o.push(...c.briefings), l += c.briefings.length, s = c.total, c.briefings.length === 0 || l >= s) break;
3016
+ if (o.push(...c.briefings), i += c.briefings.length, s = c.total, c.briefings.length === 0 || i >= s) break;
2987
3017
  n += 1;
2988
3018
  }
2989
3019
  return o;
@@ -3001,33 +3031,33 @@ function Cn({
3001
3031
  initialRun: a,
3002
3032
  apiServiceUrl: o,
3003
3033
  token: n,
3004
- onTerminal: l,
3034
+ onTerminal: i,
3005
3035
  onTimeout: s,
3006
3036
  onExpand: c
3007
3037
  }) {
3008
- const [p, d] = F(a), { startRun: m } = ta({
3038
+ const [p, l] = I(a), { startRun: u } = ta({
3009
3039
  apiServiceUrl: o,
3010
3040
  token: n,
3011
3041
  intervalMs: pn,
3012
3042
  timeoutMs: fn,
3013
3043
  fetchRun: ({
3014
- apiServiceUrl: h,
3015
- token: u,
3044
+ apiServiceUrl: m,
3045
+ token: h,
3016
3046
  runId: f
3017
- }) => ra(h, u, e, f),
3018
- onRun: (h) => {
3019
- d(h);
3047
+ }) => ra(m, h, e, f),
3048
+ onRun: (m) => {
3049
+ l(m);
3020
3050
  },
3021
- onTerminalRun: (h) => {
3022
- l(h);
3051
+ onTerminalRun: (m) => {
3052
+ i(m);
3023
3053
  },
3024
3054
  onTimeout: () => {
3025
3055
  s();
3026
3056
  }
3027
- }), i = he(!1);
3057
+ }), d = ce(!1);
3028
3058
  return Y(() => {
3029
- i.current || (i.current = !0, aa(a.status) ? m(a) : na(a.status) && l(a));
3030
- }, [a, l, m]), /* @__PURE__ */ t(sa, { run: p, onExpand: c });
3059
+ d.current || (d.current = !0, aa(a.status) ? u(a) : na(a.status) && i(a));
3060
+ }, [a, i, u]), /* @__PURE__ */ t(sa, { run: p, onExpand: c });
3031
3061
  }
3032
3062
  function as(e) {
3033
3063
  return /* @__PURE__ */ t(_r, { children: /* @__PURE__ */ t(wn, { ...e }) });
@@ -3037,45 +3067,45 @@ function wn({
3037
3067
  dashboardTitle: a,
3038
3068
  apiServiceUrl: o,
3039
3069
  token: n,
3040
- disabled: l,
3070
+ disabled: i,
3041
3071
  className: s,
3042
3072
  manageBriefingsHref: c,
3043
3073
  open: p,
3044
- onOpenChange: d,
3045
- hideTrigger: m = !1,
3046
- workflowIntent: i,
3047
- client: h
3074
+ onOpenChange: l,
3075
+ hideTrigger: u = !1,
3076
+ workflowIntent: d,
3077
+ client: m
3048
3078
  }) {
3049
- const { authToken: u, tokenProps: f } = He(), g = zr(), k = !i || g.canCreate && (i === "scheduled_report" || g.analyticalBriefingsEnabled), [x, D] = F(!1), S = p ?? x, C = (N) => {
3050
- p === void 0 && D(N), d == null || d(N);
3051
- }, [w, E] = F(
3052
- i ? "author" : "list"
3053
- ), [V, b] = F(
3054
- i ?? "analytical_briefing"
3055
- ), [v, B] = F("dashboard"), [I, G] = F(
3079
+ const { authToken: h, tokenProps: f } = Ge(), g = zr(), k = !d || g.canCreate && (d === "scheduled_report" || g.analyticalBriefingsEnabled), [x, D] = I(!1), S = p ?? x, C = (N) => {
3080
+ p === void 0 && D(N), l == null || l(N);
3081
+ }, [w, E] = I(
3082
+ d ? "author" : "list"
3083
+ ), [V, b] = I(
3084
+ d ?? "analytical_briefing"
3085
+ ), [v, U] = I("dashboard"), [F, G] = I(
3056
3086
  []
3057
- ), [A, R] = F(null), $ = i && !k && !A ? "list" : w, [xe, te] = F(!1), [oe, Ae] = F(null), [Fe, ie] = F(null), [W, Z] = F(
3087
+ ), [A, R] = I(null), $ = d && !k && !A ? "list" : w, [xe, te] = I(!1), [oe, Ae] = I(null), [Ie, ie] = I(null), [W, J] = I(
3058
3088
  null
3059
- ), [le, J] = F(null), Ie = he(null), ve = he(S);
3089
+ ), [le, ee] = I(null), Fe = ce(null), ve = ce(S);
3060
3090
  Y(() => {
3061
3091
  const N = S && !ve.current;
3062
- ve.current = S, !(!N || !i) && (R(null), B("dashboard"), b(i), E("author"), J(null));
3063
- }, [S, i]);
3064
- const [ce, pe] = F(
3092
+ ve.current = S, !(!N || !d) && (R(null), U("dashboard"), b(d), E("author"), ee(null));
3093
+ }, [S, d]);
3094
+ const [ue, pe] = I(
3065
3095
  null
3066
- ), [X, ye] = F(null), _ = o ?? (f == null ? void 0 : f.apiServiceUrl), z = n ?? (u == null ? void 0 : u.accessToken), ne = ee(() => ({ ...yn, ...h }), [h]), fe = gn(a), Le = ee(() => {
3096
+ ), [X, ye] = I(null), _ = o ?? (f == null ? void 0 : f.apiServiceUrl), z = n ?? (h == null ? void 0 : h.accessToken), ne = Z(() => ({ ...yn, ...m }), [m]), fe = gn(a), Le = Z(() => {
3067
3097
  const N = xn(
3068
- I,
3098
+ F,
3069
3099
  v,
3070
3100
  e
3071
3101
  );
3072
- if (!i)
3102
+ if (!d)
3073
3103
  return N;
3074
- const P = i === "scheduled_report" ? "report" : "briefing";
3104
+ const P = d === "scheduled_report" ? "report" : "briefing";
3075
3105
  return N.filter(
3076
3106
  (Be) => se(Be).noun === P
3077
3107
  );
3078
- }, [e, I, v, i]), Ke = ee(() => v === "dashboard" ? {
3108
+ }, [e, F, v, d]), Qe = Z(() => v === "dashboard" ? {
3079
3109
  source: { type: "dashboard", dashboardId: e },
3080
3110
  label: fe,
3081
3111
  detail: bn(fe)
@@ -3089,7 +3119,7 @@ function wn({
3089
3119
  scheduledReportAvailable: v === "dashboard"
3090
3120
  }), Q = H(async () => {
3091
3121
  if (!(!_ || !z)) {
3092
- te(!0), J(null);
3122
+ te(!0), ee(null);
3093
3123
  try {
3094
3124
  G(
3095
3125
  await vn({
@@ -3099,7 +3129,7 @@ function wn({
3099
3129
  })
3100
3130
  );
3101
3131
  } catch (N) {
3102
- J(
3132
+ ee(
3103
3133
  N instanceof Error ? N.message : "Could not load briefings."
3104
3134
  );
3105
3135
  } finally {
@@ -3111,12 +3141,12 @@ function wn({
3111
3141
  !S || $ !== "list" || !Ce || Q();
3112
3142
  }, [Ce, $, Q, S]);
3113
3143
  const Ne = () => {
3114
- R(null), B("dashboard"), E("list"), C(!0);
3144
+ R(null), U("dashboard"), E("list"), C(!0);
3115
3145
  }, y = (N) => {
3116
3146
  R(null), b(N), E("author");
3117
- }, L = async (N) => {
3147
+ }, B = async (N) => {
3118
3148
  if (!(!_ || !z)) {
3119
- Ae(N), J(null);
3149
+ Ae(N), ee(null);
3120
3150
  try {
3121
3151
  const P = await ne.getBriefing(
3122
3152
  _,
@@ -3125,7 +3155,7 @@ function wn({
3125
3155
  );
3126
3156
  R(P.briefing), E("author");
3127
3157
  } catch (P) {
3128
- J(
3158
+ ee(
3129
3159
  P instanceof Error ? P.message : "Could not open briefing."
3130
3160
  );
3131
3161
  } finally {
@@ -3185,7 +3215,7 @@ function wn({
3185
3215
  N.id
3186
3216
  );
3187
3217
  const { noun: P } = se(N);
3188
- O.success(`${P === "report" ? "Report" : "Briefing"} deleted`), Z(null), Q();
3218
+ O.success(`${P === "report" ? "Report" : "Briefing"} deleted`), J(null), Q();
3189
3219
  } catch (P) {
3190
3220
  O.error(
3191
3221
  P instanceof Error ? P.message : "Could not delete the briefing."
@@ -3193,13 +3223,13 @@ function wn({
3193
3223
  } finally {
3194
3224
  ie(null);
3195
3225
  }
3196
- }, Ht = Le.length;
3226
+ }, Gt = Le.length;
3197
3227
  return g.surfaceVisible ? /* @__PURE__ */ r(Kr, { open: S, onOpenChange: C, children: [
3198
- m ? null : /* @__PURE__ */ t(
3228
+ u ? null : /* @__PURE__ */ t(
3199
3229
  tn,
3200
3230
  {
3201
- disabled: l || !Ce,
3202
- briefingCount: Ht,
3231
+ disabled: i || !Ce,
3232
+ briefingCount: Gt,
3203
3233
  className: s,
3204
3234
  onClick: Ne
3205
3235
  }
@@ -3207,26 +3237,26 @@ function wn({
3207
3237
  /* @__PURE__ */ r(
3208
3238
  Qr,
3209
3239
  {
3210
- ref: Ie,
3240
+ ref: Fe,
3211
3241
  side: "right",
3212
3242
  hideClose: !0,
3213
3243
  className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
3214
3244
  onOpenAutoFocus: (N) => {
3215
3245
  var P;
3216
- N.preventDefault(), (P = Ie.current) == null || P.focus({ preventScroll: !0 });
3246
+ N.preventDefault(), (P = Fe.current) == null || P.focus({ preventScroll: !0 });
3217
3247
  },
3218
3248
  children: [
3219
3249
  /* @__PURE__ */ r(Yr, { className: "sr-only", children: [
3220
3250
  /* @__PURE__ */ t(Xr, { children: "Reports & briefings" }),
3221
3251
  /* @__PURE__ */ t(Zr, { children: "Manage reports and briefings for this dashboard." })
3222
3252
  ] }),
3223
- i ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
3253
+ d ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
3224
3254
  /* @__PURE__ */ r(
3225
3255
  "div",
3226
3256
  {
3227
3257
  className: "flex items-center gap-5",
3228
3258
  role: "tablist",
3229
- "aria-label": i === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
3259
+ "aria-label": d === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
3230
3260
  children: [
3231
3261
  /* @__PURE__ */ t(
3232
3262
  "button",
@@ -3241,9 +3271,9 @@ function wn({
3241
3271
  !k && "cursor-not-allowed opacity-50"
3242
3272
  ),
3243
3273
  onClick: () => {
3244
- k && (R(null), b(i), B("dashboard"), E("author"));
3274
+ k && (R(null), b(d), U("dashboard"), E("author"));
3245
3275
  },
3246
- children: A ? `Edit ${se(A).noun}` : i === "scheduled_report" ? "Schedule report" : "Create briefing"
3276
+ children: A ? `Edit ${se(A).noun}` : d === "scheduled_report" ? "Schedule report" : "Create briefing"
3247
3277
  }
3248
3278
  ),
3249
3279
  /* @__PURE__ */ t(
@@ -3257,7 +3287,7 @@ function wn({
3257
3287
  $ === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
3258
3288
  ),
3259
3289
  onClick: () => E("list"),
3260
- children: i === "scheduled_report" ? "Manage reports" : "Manage briefings"
3290
+ children: d === "scheduled_report" ? "Manage reports" : "Manage briefings"
3261
3291
  }
3262
3292
  )
3263
3293
  ]
@@ -3269,8 +3299,8 @@ function wn({
3269
3299
  type: "button",
3270
3300
  onClick: () => C(!1),
3271
3301
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
3272
- "aria-label": i === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
3273
- children: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" })
3302
+ "aria-label": d === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
3303
+ children: /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" })
3274
3304
  }
3275
3305
  )
3276
3306
  ] }) : null,
@@ -3282,13 +3312,13 @@ function wn({
3282
3312
  sourceView: v,
3283
3313
  error: le,
3284
3314
  loading: xe,
3285
- onSourceViewChange: B,
3315
+ onSourceViewChange: U,
3286
3316
  onClose: () => C(!1),
3287
3317
  onEdit: (N) => {
3288
- L(N);
3318
+ B(N);
3289
3319
  },
3290
3320
  onNew: y,
3291
- canCreate: !i && we.length > 0,
3321
+ canCreate: !d && we.length > 0,
3292
3322
  canCreateScheduledReport: we.includes(
3293
3323
  "scheduled_report"
3294
3324
  ),
@@ -3301,12 +3331,12 @@ function wn({
3301
3331
  onTogglePause: (N) => {
3302
3332
  re(N);
3303
3333
  },
3304
- onDelete: (N) => Z(N),
3334
+ onDelete: (N) => J(N),
3305
3335
  selectingId: oe,
3306
- busyId: Fe,
3336
+ busyId: Ie,
3307
3337
  manageBriefingsHref: c,
3308
- contentKind: i === "scheduled_report" ? "reports" : i === "analytical_briefing" ? "briefings" : void 0,
3309
- hideHeader: !!i
3338
+ contentKind: d === "scheduled_report" ? "reports" : d === "analytical_briefing" ? "briefings" : void 0,
3339
+ hideHeader: !!d
3310
3340
  }
3311
3341
  ) : /* @__PURE__ */ t(
3312
3342
  Jr,
@@ -3315,11 +3345,11 @@ function wn({
3315
3345
  token: z,
3316
3346
  briefing: A,
3317
3347
  intent: V,
3318
- sourceContext: A ? void 0 : Ke,
3348
+ sourceContext: A ? void 0 : Qe,
3319
3349
  title: A ? `Edit ${se(A).noun}` : V === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
3320
- hideHeader: !!i,
3350
+ hideHeader: !!d,
3321
3351
  className: "h-full min-h-0 max-w-none border-0 shadow-none",
3322
- onBack: i ? void 0 : () => E("list"),
3352
+ onBack: d ? void 0 : () => E("list"),
3323
3353
  onCancel: () => C(!1),
3324
3354
  onDeleted: () => {
3325
3355
  const N = A ? se(A).noun : "briefing";
@@ -3338,16 +3368,16 @@ function wn({
3338
3368
  ]
3339
3369
  }
3340
3370
  ),
3341
- ce && _ && z ? /* @__PURE__ */ t(
3371
+ ue && _ && z ? /* @__PURE__ */ t(
3342
3372
  Cn,
3343
3373
  {
3344
- briefingId: ce.briefing.id,
3345
- initialRun: ce.run,
3374
+ briefingId: ue.briefing.id,
3375
+ initialRun: ue.run,
3346
3376
  apiServiceUrl: _,
3347
3377
  token: z,
3348
3378
  onTerminal: (N) => {
3349
3379
  ye({
3350
- briefing: ce.briefing,
3380
+ briefing: ue.briefing,
3351
3381
  run: N
3352
3382
  }), pe(null), Q();
3353
3383
  },
@@ -3355,7 +3385,7 @@ function wn({
3355
3385
  pe(null), Q();
3356
3386
  },
3357
3387
  onExpand: () => {
3358
- R(ce.briefing), E("author"), pe(null), C(!0);
3388
+ R(ue.briefing), E("author"), pe(null), C(!0);
3359
3389
  }
3360
3390
  }
3361
3391
  ) : null,
@@ -3377,30 +3407,30 @@ function wn({
3377
3407
  }
3378
3408
  ) }) : null,
3379
3409
  /* @__PURE__ */ t(
3380
- rt,
3410
+ at,
3381
3411
  {
3382
3412
  open: !!W,
3383
3413
  onOpenChange: (N) => {
3384
- N || Z(null);
3414
+ N || J(null);
3385
3415
  },
3386
- children: /* @__PURE__ */ r(at, { children: [
3387
- /* @__PURE__ */ r(nt, { children: [
3388
- /* @__PURE__ */ r(st, { children: [
3416
+ children: /* @__PURE__ */ r(nt, { children: [
3417
+ /* @__PURE__ */ r(st, { children: [
3418
+ /* @__PURE__ */ r(ot, { children: [
3389
3419
  "Delete",
3390
3420
  " ",
3391
3421
  W ? se(W).noun : "briefing",
3392
3422
  "?"
3393
3423
  ] }),
3394
- /* @__PURE__ */ r(ot, { children: [
3424
+ /* @__PURE__ */ r(it, { children: [
3395
3425
  "This permanently deletes ",
3396
3426
  /* @__PURE__ */ t("strong", { children: W == null ? void 0 : W.name }),
3397
3427
  ". Recipients will stop receiving it."
3398
3428
  ] })
3399
3429
  ] }),
3400
- /* @__PURE__ */ r(it, { children: [
3401
- /* @__PURE__ */ t(lt, { children: "Cancel" }),
3430
+ /* @__PURE__ */ r(lt, { children: [
3431
+ /* @__PURE__ */ t(dt, { children: "Cancel" }),
3402
3432
  /* @__PURE__ */ r(
3403
- It,
3433
+ Lt,
3404
3434
  {
3405
3435
  className: "bg-destructive/90 hover:bg-destructive",
3406
3436
  onClick: de,