react-semaphor 0.1.596 → 0.1.597

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 (19) hide show
  1. package/dist/chunks/{assistant-chat-DodZKMI6.js → assistant-chat-DUDiH9z4.js} +2 -2
  2. package/dist/chunks/{card-filter-builder-BZIj-ib3.js → card-filter-builder-2-OxEBWf.js} +1 -1
  3. package/dist/chunks/{dashboard-briefing-launcher-CE_z5Gh1.js → dashboard-briefing-launcher-CVDhvsTk.js} +1104 -1099
  4. package/dist/chunks/{dashboard-controls-IG2KRX1y.js → dashboard-controls-CtQY-J33.js} +4 -4
  5. package/dist/chunks/{dashboard-BCd8aKDN.js → dashboard-g-7XY0Kw.js} +1 -1
  6. package/dist/chunks/{dashboard-json-o-XrNqNW.js → dashboard-json-DkhzPI3-.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-HPTVtWGk.js → edit-dashboard-visual-DWn74pCl.js} +3 -3
  8. package/dist/chunks/{report-preferences-dialog-CgskMwZJ.js → report-preferences-dialog-5WUi6jC0.js} +5 -5
  9. package/dist/chunks/{semaphor-ready-indicator-BuasVClR.js → semaphor-ready-indicator-miYoJ-HP.js} +25794 -25577
  10. package/dist/chunks/{shelf-drop-preview-context-DjOcz0mb.js → shelf-drop-preview-context-D-awfyyo.js} +1 -1
  11. package/dist/dashboard/index.js +1 -1
  12. package/dist/index.js +7 -7
  13. package/dist/style.css +1 -1
  14. package/dist/surfboard/index.js +1 -1
  15. package/dist/types/components/shared/unsaved-changes/unsaved-changes-alert.d.ts +2 -1
  16. package/dist/types/components/sharing-and-management/hooks/paged-list.d.ts +22 -0
  17. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +17 -2
  18. package/dist/types/lib/hooks/use-dashboard-unsaved-changes-check.d.ts +9 -1
  19. package/package.json +1 -1
@@ -1,34 +1,34 @@
1
- import { jsx as t, jsxs as r, Fragment as U } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as s, Fragment as U } from "react/jsx-runtime";
2
2
  import la, { useState as E, useEffect as Ee, useCallback as ie, useMemo as Y, useLayoutEffect as Ut, useRef as et, useContext as Va } from "react";
3
- import { dN as it, bG as Le, bH as Ve, bJ as Pe, dO as Pa, b8 as $e, b5 as ot, dP as Ba, dQ as lt, dR as Ct, an as dt, ak as ve, u as w, dS as _a, dT as Oa, bF as z, dU as za, am as oe, b3 as Ra, ca as Ma, dV as Ua, dW as $a, bZ as da, b_ as be, cu as ca, bY as tt, w as ja, q as qa, dX as Wa, cx as wt, cy as St, cz as kt, cA as Dt, cB as At, cC as Ft, cD as Et, cE as ua, cH as It, dY as Qa, du as Ka, cm as pt, cj as je, ck as qe, dG as ha, cl as We, c6 as re, cv as Ga, cq as at, dZ as Ha, c3 as Ya, d_ as ma, bu as ct, bI as Tt, bK as ut, d$ as pa, bE as Xa, e0 as Za, bv as Ja, o as en, cN as tn, e1 as an, W as nn, P as fa, bp as rn, X as sn, G as on, e2 as ln, e3 as dn, e4 as ga, e5 as cn, e6 as un, e7 as Ce, e8 as hn, R as ba, e9 as mn, ea as pn, b0 as fn, eb as gn, ec as ge, ed as bn, aa as Lt, ee as xn, ef as ft, eg as vn, eh as $t, ei as yn, ej as Nn, ek as Cn, el as xa, cY as wn, em as Sn, en as kn, eo as Dn, dA as Vt, cI as va, ep as An, eq as jt, er as Fn, es as En, et as In, eu as Tn, b7 as Ln, bz as Vn, c9 as ya, ev as Pn, ew as Bn, ex as Xe, ey as _n, ez as On, eA as zn, A as Rn, aR as Mn, aS as Un, ax as $n, aw as jn, av as qn, au as Wn, ar as Qn, ap as Kn, eB as Gn, eC as Hn, eD as Yn, eE as Xn, eF as Zn, aP as Jn } from "./semaphor-ready-indicator-BuasVClR.js";
4
- import { c as Ae, B as L, X as Qe, s as Me, x as xe, L as de, q as Pt, j as Bt, p as er, F as _t, e as Ie, a8 as Na, h as Te, f as nt, i as Ca, g as Nt, y as we, z as Se, A as ke, D as De, E as fe, a9 as tr } from "./style-sheet-parts-DM_Mw_sm.js";
3
+ import { dN as it, bG as Le, bH as Ve, bJ as Pe, dO as Pa, b8 as $e, b5 as ot, dP as Ba, dQ as lt, dR as Ct, an as dt, ak as ve, u as N, dS as _a, dT as Oa, bF as z, dU as za, am as oe, b3 as Ra, ca as Ma, dV as Ua, dW as $a, bZ as da, b_ as be, cu as ca, bY as tt, w as ja, q as qa, dX as Wa, cx as wt, cy as St, cz as kt, cA as Dt, cB as At, cC as Ft, cD as Et, cE as ua, cH as It, dY as Qa, du as Ka, cm as pt, cj as je, ck as qe, dG as ha, cl as We, c6 as re, cv as Ga, cq as at, dZ as Ha, c3 as Ya, d_ as ma, bu as ct, bI as Tt, bK as ut, d$ as pa, bE as Xa, e0 as Za, bv as Ja, o as en, cN as tn, e1 as an, W as nn, P as fa, bp as rn, X as sn, G as on, e2 as ln, e3 as dn, e4 as cn, e5 as ga, e6 as un, e7 as hn, e8 as Ce, e9 as mn, R as ba, ea as pn, eb as fn, b0 as gn, ec as bn, ed as ge, ee as xn, aa as Lt, ef as vn, eg as ft, eh as yn, ei as $t, ej as Nn, ek as Cn, el as wn, em as xa, cY as Sn, en as kn, eo as Dn, ep as An, dA as Vt, cI as va, eq as Fn, er as jt, es as En, et as In, eu as Tn, ev as Ln, b7 as Vn, bz as Pn, c9 as ya, ew as Bn, ex as _n, ey as Xe, ez as On, eA as zn, eB as Rn, A as Mn, aR as Un, aS as $n, ax as jn, aw as qn, av as Wn, au as Qn, ar as Kn, ap as Gn, eC as Hn, eD as Yn, eE as Xn, eF as Zn, eG as Jn, aP as er } from "./semaphor-ready-indicator-miYoJ-HP.js";
4
+ import { c as Ae, B as L, X as Qe, s as Me, x as xe, L as de, q as Pt, j as Bt, p as tr, F as _t, e as Ie, a8 as Na, h as Te, f as nt, i as Ca, g as Nt, y as we, z as Se, A as ke, D as De, E as fe, a9 as ar } from "./style-sheet-parts-DM_Mw_sm.js";
5
5
  import { L as Ue } from "./layout-grid-DoFIfQGd.js";
6
6
  import { c as Z } from "./pickers-DkqmtnTL.js";
7
- import { U as ar } from "./validators-BlEWWX9O.js";
7
+ import { U as nr } from "./validators-BlEWWX9O.js";
8
8
  import "./matrix-operation-contract-CAanJeCj.js";
9
9
  import "./analytics-base-schemas-8wz9vqn_.js";
10
10
  import "../value-format-preferences/index.js";
11
11
  import { s as Ze } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
12
- import { bQ as qt, bm as Wt, fb as Qt, gL as nr, gM as rt, gK as Kt, gN as rr, t as Ke, gO as sr, u as ir, gP as or, gQ as lr, gR as dr, cT as cr, gS as ur, o as hr, g7 as mr, gT as pr, gU as fr, a as Ot, aV as gr, a7 as br, cx as xr, gV as vr, gW as yr, cI as Nr, gX as Cr, gY as Gt, gZ as wr } from "./resolve-dashboard-input-context-DfJshnw8.js";
12
+ import { bQ as qt, bm as Wt, fb as Qt, gL as rr, gM as rt, gK as Kt, gN as sr, t as Ke, gO as ir, u as or, gP as lr, gQ as dr, gR as cr, cT as ur, gS as hr, o as mr, g7 as pr, gT as fr, gU as gr, a as Ot, aV as br, a7 as xr, cx as vr, gV as yr, gW as Nr, cI as Cr, gX as wr, gY as Gt, gZ as Sr } from "./resolve-dashboard-input-context-DfJshnw8.js";
13
13
  import { S as wa } from "./save-C9CZAk6V.js";
14
- import { V as Sr, L as kr, u as Sa, C as ka, F as Dr, a as Ar, A as Fr, b as Er } from "./card-filter-builder-BZIj-ib3.js";
15
- import { createPortal as Ir } from "react-dom";
16
- import { b4 as Ht, aC as Tr } from "./pivot-result-contract-expectations-Dt0E1Wou.js";
17
- import { aD as Lr, ar as Vr, F as Pr, ac as st, T as Br } from "./bookmark-state-Be2W3s6t.js";
14
+ import { V as kr, L as Dr, u as Sa, C as ka, F as Ar, a as Fr, A as Er, b as Ir } from "./card-filter-builder-2-OxEBWf.js";
15
+ import { createPortal as Tr } from "react-dom";
16
+ import { b4 as Ht, aC as Lr } from "./pivot-result-contract-expectations-Dt0E1Wou.js";
17
+ import { aD as Vr, ar as Pr, F as Br, ac as st, T as _r } from "./bookmark-state-Be2W3s6t.js";
18
18
  import "zod";
19
19
  import "./schema-C9NPiIru.js";
20
20
  import "./index-CV_Kzou0.js";
21
21
  import "./context-CVXTFljo.js";
22
- import { v as _r, G as Or } from "./filter-reach-copy-DoXmRmk-.js";
23
- import { a as Yt, d as Xt, c as zr, i as Rr, b as Mr, e as Ur, v as Zt, f as Jt, g as $r } from "./variable-draft-CxdgKDCx.js";
24
- import { g as pe, d as jr, a as qr } from "./index-C0jX5wlM.js";
22
+ import { v as Or, G as zr } from "./filter-reach-copy-DoXmRmk-.js";
23
+ import { a as Yt, d as Xt, c as Rr, i as Mr, b as Ur, e as $r, v as Zt, f as Jt, g as jr } from "./variable-draft-CxdgKDCx.js";
24
+ import { g as pe, d as qr, a as Wr } from "./index-C0jX5wlM.js";
25
25
  /**
26
26
  * @license lucide-react v0.453.0 - ISC
27
27
  *
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 Wr = Ae("ArrowUpRight", [
31
+ const Qr = Ae("ArrowUpRight", [
32
32
  ["path", { d: "M7 7h10v10", key: "1tivn9" }],
33
33
  ["path", { d: "M7 17 17 7", key: "1vkiza" }]
34
34
  ]);
@@ -48,7 +48,7 @@ const ea = Ae("Bell", [
48
48
  * This source code is licensed under the ISC license.
49
49
  * See the LICENSE file in the root directory of this source tree.
50
50
  */
51
- const Qr = Ae("CodeXml", [
51
+ const Kr = Ae("CodeXml", [
52
52
  ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
53
53
  ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
54
54
  ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
@@ -71,7 +71,7 @@ const ta = Ae("MonitorSmartphone", [
71
71
  * This source code is licensed under the ISC license.
72
72
  * See the LICENSE file in the root directory of this source tree.
73
73
  */
74
- const Kr = Ae("MousePointer2", [
74
+ const Gr = Ae("MousePointer2", [
75
75
  [
76
76
  "path",
77
77
  {
@@ -86,7 +86,7 @@ const Kr = Ae("MousePointer2", [
86
86
  * This source code is licensed under the ISC license.
87
87
  * See the LICENSE file in the root directory of this source tree.
88
88
  */
89
- const Gr = Ae("Newspaper", [
89
+ const Hr = Ae("Newspaper", [
90
90
  [
91
91
  "path",
92
92
  {
@@ -104,18 +104,18 @@ const Gr = Ae("Newspaper", [
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
106
  */
107
- const Hr = Ae("Terminal", [
107
+ const Yr = Ae("Terminal", [
108
108
  ["polyline", { points: "4 17 10 11 4 5", key: "akl6gq" }],
109
109
  ["line", { x1: "12", x2: "20", y1: "19", y2: "19", key: "q2wloq" }]
110
110
  ]);
111
- function Yr() {
112
- return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, a) => /* @__PURE__ */ r(
111
+ function Xr() {
112
+ return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, a) => /* @__PURE__ */ s(
113
113
  "div",
114
114
  {
115
115
  className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
116
116
  children: [
117
117
  /* @__PURE__ */ t("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
118
- /* @__PURE__ */ r("div", { className: "flex-1 space-y-1.5", children: [
118
+ /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
119
119
  /* @__PURE__ */ t("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
120
120
  /* @__PURE__ */ t("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
121
121
  ] })
@@ -124,32 +124,32 @@ function Yr() {
124
124
  a
125
125
  )) });
126
126
  }
127
- function Xr({
127
+ function Zr({
128
128
  open: e,
129
129
  onOpenChange: a,
130
- onSubmit: s,
130
+ onSubmit: r,
131
131
  isCreating: n
132
132
  }) {
133
- const i = it("interactive"), [o, l] = E(""), [u, c] = E("");
133
+ const i = it("interactive"), [o, l] = E(""), [h, d] = E("");
134
134
  Ee(() => {
135
- e || (l(""), c(""));
135
+ e || (l(""), d(""));
136
136
  }, [e]);
137
- const d = () => {
138
- o.trim() && s({ title: o, description: u });
139
- }, h = (p) => {
137
+ const c = () => {
138
+ o.trim() && r({ title: o, description: h });
139
+ }, u = (p) => {
140
140
  a(p);
141
141
  };
142
- return /* @__PURE__ */ t(Le, { open: e, onOpenChange: h, children: /* @__PURE__ */ r(
142
+ return /* @__PURE__ */ t(Le, { open: e, onOpenChange: u, children: /* @__PURE__ */ s(
143
143
  Ve,
144
144
  {
145
145
  showCloseButton: !1,
146
146
  className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
147
147
  style: i.dialogStyle,
148
148
  children: [
149
- /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
150
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
149
+ /* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
150
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
151
151
  /* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
152
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
152
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
153
153
  /* @__PURE__ */ t(Pe, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
154
154
  /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
155
155
  ] })
@@ -160,16 +160,16 @@ function Xr({
160
160
  size: "xs",
161
161
  variant: "ghost",
162
162
  className: "w-7 px-0 text-muted-foreground hover:text-foreground",
163
- onClick: () => h(!1),
163
+ onClick: () => u(!1),
164
164
  "aria-label": "Close",
165
165
  disabled: n,
166
166
  children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
167
167
  }
168
168
  )
169
169
  ] }),
170
- /* @__PURE__ */ r("div", { className: "space-y-3 px-4 py-3", children: [
170
+ /* @__PURE__ */ s("div", { className: "space-y-3 px-4 py-3", children: [
171
171
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
172
- /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
172
+ /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
173
173
  /* @__PURE__ */ t(Me, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
174
174
  /* @__PURE__ */ t(
175
175
  xe,
@@ -181,12 +181,12 @@ function Xr({
181
181
  onChange: (p) => l(p.target.value),
182
182
  disabled: n,
183
183
  onKeyDown: (p) => {
184
- p.key === "Enter" && !p.shiftKey && (p.preventDefault(), d());
184
+ p.key === "Enter" && !p.shiftKey && (p.preventDefault(), c());
185
185
  }
186
186
  }
187
187
  )
188
188
  ] }),
189
- /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
189
+ /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
190
190
  /* @__PURE__ */ t(Me, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
191
191
  /* @__PURE__ */ t(
192
192
  xe,
@@ -194,20 +194,20 @@ function Xr({
194
194
  id: "visual-description",
195
195
  size: "sm",
196
196
  placeholder: "Optional",
197
- value: u,
198
- onChange: (p) => c(p.target.value),
197
+ value: h,
198
+ onChange: (p) => d(p.target.value),
199
199
  disabled: n
200
200
  }
201
201
  )
202
202
  ] })
203
203
  ] }),
204
- /* @__PURE__ */ r("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
204
+ /* @__PURE__ */ s("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
205
205
  /* @__PURE__ */ t(
206
206
  L,
207
207
  {
208
208
  size: "xs",
209
209
  variant: "outline",
210
- onClick: () => h(!1),
210
+ onClick: () => u(!1),
211
211
  disabled: n,
212
212
  children: "Cancel"
213
213
  }
@@ -216,9 +216,9 @@ function Xr({
216
216
  L,
217
217
  {
218
218
  size: "xs",
219
- onClick: d,
219
+ onClick: c,
220
220
  disabled: !o.trim() || n,
221
- children: n ? /* @__PURE__ */ r(U, { children: [
221
+ children: n ? /* @__PURE__ */ s(U, { children: [
222
222
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
223
223
  "Creating..."
224
224
  ] }) : "Create library visual"
@@ -229,11 +229,11 @@ function Xr({
229
229
  }
230
230
  ) });
231
231
  }
232
- function Zr(e) {
233
- const [a, s] = E(null), [n, i] = E(null), o = Pa();
232
+ function Jr(e) {
233
+ const [a, r] = E(null), [n, i] = E(null), o = Pa();
234
234
  return Ee(() => {
235
235
  if (!e || e.trim() === "") {
236
- s(null), i(null);
236
+ r(null), i(null);
237
237
  return;
238
238
  }
239
239
  if (!o)
@@ -247,38 +247,38 @@ function Zr(e) {
247
247
  } catch {
248
248
  throw new Error(`Invalid URL: ${e}`);
249
249
  }
250
- const c = `${e.endsWith("/") ? e : `${e}/`}index.js`;
250
+ const d = `${e.endsWith("/") ? e : `${e}/`}index.js`;
251
251
  try {
252
- if (!(await fetch(c, { method: "HEAD" })).ok)
253
- throw new Error(`Module not found at ${c}`);
252
+ if (!(await fetch(d, { method: "HEAD" })).ok)
253
+ throw new Error(`Module not found at ${d}`);
254
254
  } catch {
255
255
  }
256
- const d = await import(
256
+ const c = await import(
257
257
  /* @vite-ignore */
258
258
  /* webpackIgnore: true */
259
- c
259
+ d
260
260
  );
261
- if (typeof d.useChartStore != "function")
261
+ if (typeof c.useChartStore != "function")
262
262
  throw new Error("useChartStore is not a function");
263
- s(() => d.useChartStore), i(null);
264
- } catch (u) {
265
- const c = u instanceof Error ? u.message : "Unknown error";
266
- console.error("Failed to load remote chart store:", c), i(c), s(null);
263
+ r(() => c.useChartStore), i(null);
264
+ } catch (h) {
265
+ const d = h instanceof Error ? h.message : "Unknown error";
266
+ console.error("Failed to load remote chart store:", d), i(d), r(null);
267
267
  }
268
268
  })();
269
269
  }, [e, o]), a;
270
270
  }
271
- function Jr(e, a) {
271
+ function es(e, a) {
272
272
  if (e.length === 0)
273
273
  return "";
274
- const s = e.find(
274
+ const r = e.find(
275
275
  (n) => {
276
276
  var i, o;
277
277
  return ((i = n.customCardPreferences) == null ? void 0 : i.visualType) === "multiple" || !!((o = n.customCardPreferences) != null && o.dataInputCardIds);
278
278
  }
279
279
  );
280
- if (s)
281
- return s.id;
280
+ if (r)
281
+ return r.id;
282
282
  if (a) {
283
283
  const n = e.find((i) => i.id === a);
284
284
  if (n) {
@@ -286,41 +286,41 @@ function Jr(e, a) {
286
286
  if (i == "All__Header")
287
287
  return e[0].id;
288
288
  if (i && i.endsWith("__Header")) {
289
- const l = i.split("__")[0], u = e.find(
290
- (c) => c.tabTitle === l
289
+ const l = i.split("__")[0], h = e.find(
290
+ (d) => d.tabTitle === l
291
291
  );
292
- return u ? u.id : e[0].id;
292
+ return h ? h.id : e[0].id;
293
293
  }
294
294
  return a;
295
295
  }
296
296
  }
297
297
  return e[0].id;
298
298
  }
299
- async function aa(e, a, s, n, i = "Opening library visual...") {
300
- if (!a || !s)
299
+ async function aa(e, a, r, n, i = "Opening library visual...") {
300
+ if (!a || !r)
301
301
  throw new Error("Missing auth token or visual ID");
302
- const o = ["resource-by-id", "visual", s], l = n.getQueryData(o);
302
+ const o = ["resource-by-id", "visual", r], l = n.getQueryData(o);
303
303
  if (l)
304
- return console.log("Using cached visual data for:", s), { data: l, fromCache: !0 };
305
- console.log("Fetching visual data from network for:", s);
306
- const u = z.loading(i, {
304
+ return console.log("Using cached visual data for:", r), { data: l, fromCache: !0 };
305
+ console.log("Fetching visual data from network for:", r);
306
+ const h = z.loading(i, {
307
307
  position: "top-center"
308
308
  });
309
309
  try {
310
- const c = await fetch(
311
- `${e}/management/v1/visuals/${s}`,
310
+ const d = await fetch(
311
+ `${e}/management/v1/visuals/${r}`,
312
312
  {
313
313
  headers: {
314
314
  Authorization: `Bearer ${a}`
315
315
  }
316
316
  }
317
317
  );
318
- if (!c.ok)
318
+ if (!d.ok)
319
319
  throw new Error("Failed to load visual");
320
- const d = await c.json();
321
- return n.setQueryData(o, d), z.dismiss(u), { data: d, fromCache: !1 };
322
- } catch (c) {
323
- throw z.dismiss(u), c;
320
+ const c = await d.json();
321
+ return n.setQueryData(o, c), z.dismiss(h), { data: c, fromCache: !1 };
322
+ } catch (d) {
323
+ throw z.dismiss(h), d;
324
324
  }
325
325
  }
326
326
  function Da(e) {
@@ -330,16 +330,16 @@ function Da(e) {
330
330
  return e;
331
331
  throw new Error("Invalid frame object format");
332
332
  }
333
- function es(e, a) {
333
+ function ts(e, a) {
334
334
  var o, l;
335
- const s = (e == null ? void 0 : e.frameObject) ?? ((o = e == null ? void 0 : e.visual) == null ? void 0 : o.frameObject);
336
- if (!s)
335
+ const r = (e == null ? void 0 : e.frameObject) ?? ((o = e == null ? void 0 : e.visual) == null ? void 0 : o.frameObject);
336
+ if (!r)
337
337
  return !1;
338
- const n = Da(s);
338
+ const n = Da(r);
339
339
  if (!(n != null && n.cards) || n.cards.length === 0)
340
340
  return !1;
341
341
  const i = (l = n.cards) == null ? void 0 : l.find(
342
- (u) => u.id === n.activeCardId
342
+ (h) => h.id === n.activeCardId
343
343
  );
344
344
  return i ? (za({
345
345
  ...a,
@@ -348,36 +348,36 @@ function es(e, a) {
348
348
  visualId: (e == null ? void 0 : e.id) || n.visualId
349
349
  }), !0) : !1;
350
350
  }
351
- function ts() {
351
+ function as() {
352
352
  const e = oe(
353
353
  (n) => {
354
354
  var i;
355
355
  return ((i = n.card.customCardPreferences) == null ? void 0 : i.url) || "";
356
356
  }
357
- ), a = Zr(e);
357
+ ), a = Jr(e);
358
358
  return { getUpdatedFrame: ie(() => {
359
- var N;
359
+ var C;
360
360
  Ra();
361
361
  const {
362
362
  frame: n,
363
363
  card: i,
364
364
  isDevMode: o,
365
365
  selectedSchemaName: l,
366
- selectedDatabaseName: u,
367
- selectedTableName: c,
368
- selectedConnectionId: d
369
- } = oe.getState(), h = i.sql, p = (N = a == null ? void 0 : a.getState()) == null ? void 0 : N.settings, m = qt(i, {
366
+ selectedDatabaseName: h,
367
+ selectedTableName: d,
368
+ selectedConnectionId: c
369
+ } = oe.getState(), u = i.sql, p = (C = a == null ? void 0 : a.getState()) == null ? void 0 : C.settings, m = qt(i, {
370
370
  isDevMode: o,
371
- cardSql: h,
371
+ cardSql: u,
372
372
  selectedSchemaName: l,
373
- selectedDatabaseName: u,
374
- selectedTableName: c,
375
- selectedConnectionId: d,
373
+ selectedDatabaseName: h,
374
+ selectedTableName: d,
375
+ selectedConnectionId: c,
376
376
  remoteChartSettings: p,
377
377
  stripConfig: Wt
378
378
  }), f = n.cards.map((k) => {
379
379
  if (k.id === i.id) return Qt({ before: i, after: m });
380
- const V = nr(k) ? qt(k, { isDevMode: !0, cardSql: k.sql, stripConfig: Wt }) : k;
380
+ const V = rr(k) ? qt(k, { isDevMode: !0, cardSql: k.sql, stripConfig: Wt }) : k;
381
381
  return Qt({ before: k, after: V });
382
382
  }), g = f.flatMap((k) => k.dropped);
383
383
  g.length && z.info("Some conditional formatting rules were removed", {
@@ -387,23 +387,23 @@ function ts() {
387
387
  return {
388
388
  ...n,
389
389
  cards: y,
390
- activeCardId: Jr(y, n.activeCardId)
390
+ activeCardId: es(y, n.activeCardId)
391
391
  };
392
392
  }, [a]) };
393
393
  }
394
394
  function Be() {
395
- const { authToken: e, tokenProps: a } = $e(), s = ot(), n = Ba(), i = lt(), { selectVisual: o } = Ct(), {
395
+ const { authToken: e, tokenProps: a } = $e(), r = ot(), n = Ba(), i = lt(), { selectVisual: o } = Ct(), {
396
396
  setFrame: l,
397
- loadCard: u,
398
- setIsDevMode: c,
399
- initializeModeDrafts: d,
400
- setActiveTabCardId: h,
397
+ loadCard: h,
398
+ setIsDevMode: d,
399
+ initializeModeDrafts: c,
400
+ setActiveTabCardId: u,
401
401
  updateDataSource: p,
402
402
  setQueryResultColumns: m,
403
403
  setSelectedConnectionId: f,
404
404
  setSelectedDatabaseName: g,
405
405
  setSelectedSchemaName: y,
406
- setSelectedTableName: N,
406
+ setSelectedTableName: C,
407
407
  setSelectedDatamodelId: k,
408
408
  setInlineFilterValuesMap: V,
409
409
  setApplyFilters: P,
@@ -412,7 +412,7 @@ function Be() {
412
412
  setIsDashboardEditing: O,
413
413
  setIsVisualEditing: b,
414
414
  clearSelectedFrameId: S
415
- } = ve(), v = w((_) => _.selectedSheetId), T = w((_) => _.selectedFrameId), F = w((_) => _.dashboard), G = w(
415
+ } = ve(), v = N((_) => _.selectedSheetId), T = N((_) => _.selectedFrameId), F = N((_) => _.dashboard), G = N(
416
416
  (_) => _.inlineFilterValuesMap
417
417
  ), B = _a((i == null ? void 0 : i.id) || "", {
418
418
  enabled: !!(i != null && i.id) && !!(e != null && e.accessToken)
@@ -424,21 +424,21 @@ function Be() {
424
424
  a.apiServiceUrl,
425
425
  (e == null ? void 0 : e.accessToken) || "",
426
426
  _.id,
427
- s,
427
+ r,
428
428
  "Opening library visual..."
429
429
  );
430
- if (!es(te, {
430
+ if (!ts(te, {
431
431
  setFrame: l,
432
- loadCard: u,
433
- setIsDevMode: c,
434
- initializeModeDrafts: d,
435
- setActiveTabCardId: h,
432
+ loadCard: h,
433
+ setIsDevMode: d,
434
+ initializeModeDrafts: c,
435
+ setActiveTabCardId: u,
436
436
  updateDataSource: p,
437
437
  setQueryResultColumns: m,
438
438
  setSelectedConnectionId: f,
439
439
  setSelectedDatabaseName: g,
440
440
  setSelectedSchemaName: y,
441
- setSelectedTableName: N,
441
+ setSelectedTableName: C,
442
442
  setSelectedDatamodelId: k,
443
443
  setInlineFilterValuesMap: V,
444
444
  setApplyFilters: P,
@@ -458,21 +458,21 @@ function Be() {
458
458
  [
459
459
  e == null ? void 0 : e.accessToken,
460
460
  a.apiServiceUrl,
461
- s,
461
+ r,
462
462
  o,
463
463
  l,
464
- u,
464
+ h,
465
465
  O,
466
466
  b,
467
- c,
468
467
  d,
469
- h,
468
+ c,
469
+ u,
470
470
  p,
471
471
  m,
472
472
  f,
473
473
  g,
474
474
  y,
475
- N,
475
+ C,
476
476
  k,
477
477
  V,
478
478
  P,
@@ -494,7 +494,7 @@ function Be() {
494
494
  a.apiServiceUrl,
495
495
  (e == null ? void 0 : e.accessToken) || "",
496
496
  _.id,
497
- s,
497
+ r,
498
498
  "Adding visual to dashboard..."
499
499
  ), ae = (H == null ? void 0 : H.frameObject) ?? ((J = H == null ? void 0 : H.visual) == null ? void 0 : J.frameObject);
500
500
  if (!ae)
@@ -517,7 +517,7 @@ function Be() {
517
517
  [
518
518
  e == null ? void 0 : e.accessToken,
519
519
  a.apiServiceUrl,
520
- s,
520
+ r,
521
521
  o,
522
522
  v,
523
523
  O,
@@ -531,7 +531,7 @@ function Be() {
531
531
  error: B.error,
532
532
  handleEditLibraryVisual: Q,
533
533
  handleAddLibraryVisual: X,
534
- getUpdatedFrame: ts().getUpdatedFrame,
534
+ getUpdatedFrame: as().getUpdatedFrame,
535
535
  refetch: B.refetch
536
536
  };
537
537
  }
@@ -544,34 +544,34 @@ function Aa(e) {
544
544
  }
545
545
  function Fa(e, a) {
546
546
  var n;
547
- const s = (n = e.ownership.createdBy) == null ? void 0 : n.type;
548
- return s === "tenant" || s === "organization" && a;
547
+ const r = (n = e.ownership.createdBy) == null ? void 0 : n.type;
548
+ return r === "tenant" || r === "organization" && a;
549
549
  }
550
550
  function zt(e, a) {
551
- var s, n;
552
- return Fa(e, a) ? ((s = e.ownership.createdBy) == null ? void 0 : s.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
551
+ var r, n;
552
+ return Fa(e, a) ? ((r = e.ownership.createdBy) == null ? void 0 : r.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
553
553
  }
554
- function as(e, a) {
554
+ function ns(e, a) {
555
555
  return zt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
556
556
  }
557
- function ns(e) {
557
+ function rs(e) {
558
558
  const a = (e || "").toLowerCase();
559
- return a.includes("table") ? Pt : a.includes("pie") || a.includes("donut") ? Qa : a.includes("line") ? Ka : a.includes("bar") ? er : Ue;
559
+ return a.includes("table") ? Pt : a.includes("pie") || a.includes("donut") ? Qa : a.includes("line") ? Ka : a.includes("bar") ? tr : Ue;
560
560
  }
561
- function rs({ visual: e }) {
561
+ function ss({ visual: e }) {
562
562
  const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
563
563
  return /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: a });
564
564
  }
565
- function ji({
565
+ function qi({
566
566
  open: e,
567
567
  onOpenChange: a
568
568
  }) {
569
- const s = it("interactive"), [n, i] = E(""), [o, l] = E(/* @__PURE__ */ new Set()), [u, c] = E(!1), [d, h] = E(
569
+ const r = it("interactive"), [n, i] = E(""), [o, l] = E(/* @__PURE__ */ new Set()), [h, d] = E(!1), [c, u] = E(
570
570
  null
571
571
  ), [p, m] = E(
572
572
  null
573
- ), [f, g] = E(!1), [y, N] = E(null), [k, V] = E(null), P = () => {
574
- l(/* @__PURE__ */ new Set()), h(null), m(null), g(!1), N(null);
573
+ ), [f, g] = E(!1), [y, C] = E(null), [k, V] = E(null), P = () => {
574
+ l(/* @__PURE__ */ new Set()), u(null), m(null), g(!1), C(null);
575
575
  }, D = () => {
576
576
  a(!1), P();
577
577
  }, { selectVisual: O } = Ct(), { handleAddLibraryVisual: b, handleEditLibraryVisual: S } = Be(), { isConsoleMode: v } = Ma(), {
@@ -586,66 +586,66 @@ function ji({
586
586
  isDeleting: J
587
587
  } = Ua(
588
588
  void 0,
589
- (C) => {
590
- c(!1), C && (O(C), S(C), D());
589
+ (w) => {
590
+ d(!1), w && (O(w), S(w), D());
591
591
  }
592
592
  ), {
593
593
  startUpdating: H,
594
594
  stopUpdating: I,
595
595
  isUpdating: ae
596
596
  } = $a(), j = T, R = Y(() => {
597
- const C = n.trim().toLowerCase();
598
- return C ? j.filter(
597
+ const w = n.trim().toLowerCase();
598
+ return w ? j.filter(
599
599
  (q) => {
600
600
  var ee, me, Ne;
601
- return ((ee = q.title) == null ? void 0 : ee.toLowerCase().includes(C)) || ((me = q.description) == null ? void 0 : me.toLowerCase().includes(C)) || ((Ne = q.kind) == null ? void 0 : Ne.toLowerCase().includes(C));
601
+ return ((ee = q.title) == null ? void 0 : ee.toLowerCase().includes(w)) || ((me = q.description) == null ? void 0 : me.toLowerCase().includes(w)) || ((Ne = q.kind) == null ? void 0 : Ne.toLowerCase().includes(w));
602
602
  }
603
603
  ) : j;
604
604
  }, [n, j]), ne = Y(
605
605
  () => j.filter(
606
- (C) => o.has(C.id)
606
+ (w) => o.has(w.id)
607
607
  ),
608
608
  [o, j]
609
609
  ), ue = ne.filter(
610
- (C) => C.permissions.canDelete
610
+ (w) => w.permissions.canDelete
611
611
  ), he = ne.filter(
612
- (C) => C.permissions.canShare
612
+ (w) => w.permissions.canShare
613
613
  ), ye = R.length > 0 && R.every(
614
- (C) => o.has(C.id)
614
+ (w) => o.has(w.id)
615
615
  ), x = R.some(
616
- (C) => o.has(C.id)
617
- ), M = (C) => {
616
+ (w) => o.has(w.id)
617
+ ), M = (w) => {
618
618
  const q = new Set(o);
619
- C(q), l(q);
620
- }, $ = (C) => {
619
+ w(q), l(q);
620
+ }, $ = (w) => {
621
621
  M((q) => {
622
- q.has(C) ? q.delete(C) : q.add(C);
622
+ q.has(w) ? q.delete(w) : q.add(w);
623
623
  });
624
624
  }, K = () => {
625
- l((C) => {
626
- const q = new Set(C);
625
+ l((w) => {
626
+ const q = new Set(w);
627
627
  return ye ? R.forEach(
628
628
  (ee) => q.delete(ee.id)
629
629
  ) : R.forEach(
630
630
  (ee) => q.add(ee.id)
631
631
  ), q;
632
632
  });
633
- }, le = async (C) => {
634
- (await b(C)).success && D();
633
+ }, le = async (w) => {
634
+ (await b(w)).success && D();
635
635
  }, _e = async () => {
636
- const C = ne;
637
- if (C.length === 0) return;
636
+ const w = ne;
637
+ if (w.length === 0) return;
638
638
  let q = !1;
639
- for (const ee of C)
639
+ for (const ee of w)
640
640
  if (!(await b(ee)).success) {
641
641
  q = !0;
642
642
  break;
643
643
  }
644
644
  q || D();
645
- }, ht = (C) => {
646
- S(C), D();
647
- }, Fe = (C) => {
648
- V(C), _(C, {
645
+ }, ht = (w) => {
646
+ S(w), D();
647
+ }, Fe = (w) => {
648
+ V(w), _(w, {
649
649
  onSettled: () => V(null)
650
650
  });
651
651
  }, Ge = () => {
@@ -653,18 +653,18 @@ function ji({
653
653
  z.error("Select a visual you can delete");
654
654
  return;
655
655
  }
656
- N(null), g(!0);
656
+ C(null), g(!0);
657
657
  }, mt = async () => {
658
- const C = y ? [y] : ue;
658
+ const w = y ? [y] : ue;
659
659
  try {
660
- for (const q of C)
660
+ for (const q of w)
661
661
  await X(q.id);
662
662
  l((q) => {
663
663
  const ee = new Set(q);
664
- return C.forEach(
664
+ return w.forEach(
665
665
  (me) => ee.delete(me.id)
666
666
  ), ee;
667
- }), g(!1), N(null);
667
+ }), g(!1), C(null);
668
668
  } catch {
669
669
  }
670
670
  }, Oe = () => {
@@ -672,19 +672,19 @@ function ji({
672
672
  z.error("Select one visual to share");
673
673
  return;
674
674
  }
675
- const [C] = ne;
676
- if (!C.permissions.canShare) {
675
+ const [w] = ne;
676
+ if (!w.permissions.canShare) {
677
677
  z.error("You do not have permission to share this visual");
678
678
  return;
679
679
  }
680
- h(C);
680
+ u(w);
681
681
  }, ze = ({
682
- title: C,
682
+ title: w,
683
683
  description: q
684
684
  }) => {
685
685
  if (!p) return;
686
686
  const ee = {};
687
- if (C !== p.title && (ee.title = C), (p.description || "") !== q && (ee.description = q), Object.keys(ee).length === 0) {
687
+ if (w !== p.title && (ee.title = w), (p.description || "") !== q && (ee.description = q), Object.keys(ee).length === 0) {
688
688
  m(null);
689
689
  return;
690
690
  }
@@ -703,21 +703,21 @@ function ji({
703
703
  }
704
704
  }
705
705
  );
706
- }, ce = (C) => {
707
- a(C), C || P();
706
+ }, ce = (w) => {
707
+ a(w), w || P();
708
708
  }, Re = y ? 1 : ue.length;
709
- return /* @__PURE__ */ r(U, { children: [
710
- /* @__PURE__ */ t(Le, { open: e, onOpenChange: ce, children: /* @__PURE__ */ r(
709
+ return /* @__PURE__ */ s(U, { children: [
710
+ /* @__PURE__ */ t(Le, { open: e, onOpenChange: ce, children: /* @__PURE__ */ s(
711
711
  Ve,
712
712
  {
713
713
  showCloseButton: !1,
714
714
  className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
715
- style: s.dialogStyle,
715
+ style: r.dialogStyle,
716
716
  children: [
717
- /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
718
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
717
+ /* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
718
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
719
719
  /* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
720
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
720
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
721
721
  /* @__PURE__ */ t(Pe, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
722
722
  /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
723
723
  ] })
@@ -734,28 +734,28 @@ function ji({
734
734
  }
735
735
  )
736
736
  ] }),
737
- /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
738
- /* @__PURE__ */ r("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
737
+ /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
738
+ /* @__PURE__ */ s("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
739
739
  /* @__PURE__ */ t(da, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
740
740
  /* @__PURE__ */ t(
741
741
  "input",
742
742
  {
743
743
  autoFocus: !0,
744
744
  value: n,
745
- onChange: (C) => i(C.target.value),
745
+ onChange: (w) => i(w.target.value),
746
746
  placeholder: "Search visuals...",
747
747
  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",
748
748
  "aria-label": "Search visuals"
749
749
  }
750
750
  )
751
751
  ] }),
752
- /* @__PURE__ */ r(
752
+ /* @__PURE__ */ s(
753
753
  L,
754
754
  {
755
755
  size: "xs",
756
756
  variant: "outline",
757
757
  className: "ml-auto",
758
- onClick: () => c(!0),
758
+ onClick: () => d(!0),
759
759
  children: [
760
760
  /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" }),
761
761
  "New library visual"
@@ -763,12 +763,12 @@ function ji({
763
763
  }
764
764
  )
765
765
  ] }),
766
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: F ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Yr, {}) }) : 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" }) }) : R.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
766
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: F ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Xr, {}) }) : 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" }) }) : R.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
767
767
  /* @__PURE__ */ t(Ue, { className: "h-5 w-5 text-muted-foreground/60" }),
768
768
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
769
769
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
770
770
  ] }) : /* @__PURE__ */ t(
771
- ss,
771
+ is,
772
772
  {
773
773
  visuals: R,
774
774
  selectedIds: o,
@@ -779,9 +779,9 @@ function ji({
779
779
  onAddVisual: le,
780
780
  onOpenVisual: ht,
781
781
  onEditDetails: m,
782
- onShareVisual: h,
783
- onDeleteVisual: (C) => {
784
- N(C), g(!0);
782
+ onShareVisual: u,
783
+ onDeleteVisual: (w) => {
784
+ C(w), g(!0);
785
785
  },
786
786
  onDuplicateVisual: Fe,
787
787
  duplicatingId: k,
@@ -789,9 +789,9 @@ function ji({
789
789
  isConsoleMode: v
790
790
  }
791
791
  ) }),
792
- /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
793
- /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: o.size > 0 && /* @__PURE__ */ r(U, { children: [
794
- /* @__PURE__ */ r("span", { className: "text-[12px] text-muted-foreground", children: [
792
+ /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
793
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: o.size > 0 && /* @__PURE__ */ s(U, { children: [
794
+ /* @__PURE__ */ s("span", { className: "text-[12px] text-muted-foreground", children: [
795
795
  /* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: o.size }),
796
796
  " ",
797
797
  "selected"
@@ -805,7 +805,7 @@ function ji({
805
805
  children: "Clear"
806
806
  }
807
807
  ),
808
- /* @__PURE__ */ r(
808
+ /* @__PURE__ */ s(
809
809
  L,
810
810
  {
811
811
  size: "xs",
@@ -818,7 +818,7 @@ function ji({
818
818
  ]
819
819
  }
820
820
  ),
821
- /* @__PURE__ */ r(
821
+ /* @__PURE__ */ s(
822
822
  L,
823
823
  {
824
824
  size: "xs",
@@ -834,7 +834,7 @@ function ji({
834
834
  }
835
835
  )
836
836
  ] }) }),
837
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
837
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
838
838
  /* @__PURE__ */ t(
839
839
  L,
840
840
  {
@@ -844,7 +844,7 @@ function ji({
844
844
  children: "Close"
845
845
  }
846
846
  ),
847
- /* @__PURE__ */ r(
847
+ /* @__PURE__ */ s(
848
848
  L,
849
849
  {
850
850
  size: "xs",
@@ -862,20 +862,20 @@ function ji({
862
862
  }
863
863
  ) }),
864
864
  /* @__PURE__ */ t(
865
- Xr,
865
+ Zr,
866
866
  {
867
- open: u,
868
- onOpenChange: c,
867
+ open: h,
868
+ onOpenChange: d,
869
869
  onSubmit: B,
870
870
  isCreating: te
871
871
  }
872
872
  ),
873
- d && /* @__PURE__ */ t(
873
+ c && /* @__PURE__ */ t(
874
874
  ja,
875
875
  {
876
- resource: d,
876
+ resource: c,
877
877
  resourceType: qa.VISUAL,
878
- onClose: () => h(null)
878
+ onClose: () => u(null)
879
879
  }
880
880
  ),
881
881
  p && /* @__PURE__ */ t(
@@ -894,12 +894,12 @@ function ji({
894
894
  wt,
895
895
  {
896
896
  open: f,
897
- onOpenChange: (C) => {
898
- !C && J || (g(C), C || N(null));
897
+ onOpenChange: (w) => {
898
+ !w && J || (g(w), w || C(null));
899
899
  },
900
- children: /* @__PURE__ */ r(St, { children: [
901
- /* @__PURE__ */ r(kt, { children: [
902
- /* @__PURE__ */ r(Dt, { children: [
900
+ children: /* @__PURE__ */ s(St, { children: [
901
+ /* @__PURE__ */ s(kt, { children: [
902
+ /* @__PURE__ */ s(Dt, { children: [
903
903
  "Delete ",
904
904
  Re,
905
905
  " visual",
@@ -908,13 +908,13 @@ function ji({
908
908
  ] }),
909
909
  /* @__PURE__ */ t(At, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
910
910
  ] }),
911
- /* @__PURE__ */ r(Ft, { children: [
911
+ /* @__PURE__ */ s(Ft, { children: [
912
912
  /* @__PURE__ */ t(Et, { disabled: J, children: "Cancel" }),
913
- /* @__PURE__ */ r(
913
+ /* @__PURE__ */ s(
914
914
  ua,
915
915
  {
916
- onClick: (C) => {
917
- C.preventDefault(), mt();
916
+ onClick: (w) => {
917
+ w.preventDefault(), mt();
918
918
  },
919
919
  disabled: J || Re === 0,
920
920
  children: [
@@ -929,29 +929,29 @@ function ji({
929
929
  )
930
930
  ] });
931
931
  }
932
- function ss({
932
+ function is({
933
933
  visuals: e,
934
934
  selectedIds: a,
935
- allFilteredSelected: s,
935
+ allFilteredSelected: r,
936
936
  someFilteredSelected: n,
937
937
  onSelectAll: i,
938
938
  onToggleSelection: o,
939
939
  onAddVisual: l,
940
- onOpenVisual: u,
941
- onEditDetails: c,
942
- onShareVisual: d,
943
- onDeleteVisual: h,
940
+ onOpenVisual: h,
941
+ onEditDetails: d,
942
+ onShareVisual: c,
943
+ onDeleteVisual: u,
944
944
  onDuplicateVisual: p,
945
945
  duplicatingId: m,
946
946
  isDeleting: f,
947
947
  isConsoleMode: g
948
948
  }) {
949
- return /* @__PURE__ */ r("div", { className: "min-w-[48rem]", children: [
950
- /* @__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: [
949
+ return /* @__PURE__ */ s("div", { className: "min-w-[48rem]", children: [
950
+ /* @__PURE__ */ s("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: [
951
951
  /* @__PURE__ */ t(
952
952
  It,
953
953
  {
954
- checked: s ? !0 : n ? "indeterminate" : !1,
954
+ checked: r ? !0 : n ? "indeterminate" : !1,
955
955
  onCheckedChange: i,
956
956
  "aria-label": "Select all visuals"
957
957
  }
@@ -964,16 +964,16 @@ function ss({
964
964
  /* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
965
965
  ] }),
966
966
  e.map((y) => /* @__PURE__ */ t(
967
- is,
967
+ os,
968
968
  {
969
969
  visual: y,
970
970
  selected: a.has(y.id),
971
971
  onToggleSelection: o,
972
972
  onAddVisual: l,
973
- onOpenVisual: u,
974
- onEditDetails: c,
975
- onShareVisual: d,
976
- onDeleteVisual: h,
973
+ onOpenVisual: h,
974
+ onEditDetails: d,
975
+ onShareVisual: c,
976
+ onDeleteVisual: u,
977
977
  onDuplicateVisual: p,
978
978
  duplicatingId: m,
979
979
  isDeleting: f,
@@ -983,25 +983,25 @@ function ss({
983
983
  ))
984
984
  ] });
985
985
  }
986
- function is({
986
+ function os({
987
987
  visual: e,
988
988
  selected: a,
989
- onToggleSelection: s,
989
+ onToggleSelection: r,
990
990
  onAddVisual: n,
991
991
  onOpenVisual: i,
992
992
  onEditDetails: o,
993
993
  onShareVisual: l,
994
- onDeleteVisual: u,
995
- onDuplicateVisual: c,
996
- duplicatingId: d,
997
- isDeleting: h,
994
+ onDeleteVisual: h,
995
+ onDuplicateVisual: d,
996
+ duplicatingId: c,
997
+ isDeleting: u,
998
998
  isConsoleMode: p
999
999
  }) {
1000
1000
  var g;
1001
- const m = ns(e.kind), f = () => {
1001
+ const m = rs(e.kind), f = () => {
1002
1002
  n(e);
1003
1003
  };
1004
- return /* @__PURE__ */ r(
1004
+ return /* @__PURE__ */ s(
1005
1005
  "div",
1006
1006
  {
1007
1007
  className: Z(
@@ -1013,11 +1013,11 @@ function is({
1013
1013
  It,
1014
1014
  {
1015
1015
  checked: a,
1016
- onCheckedChange: () => s(e.id),
1016
+ onCheckedChange: () => r(e.id),
1017
1017
  "aria-label": `Select ${e.title || "visual"}`
1018
1018
  }
1019
1019
  ) }),
1020
- /* @__PURE__ */ r(
1020
+ /* @__PURE__ */ s(
1021
1021
  "button",
1022
1022
  {
1023
1023
  type: "button",
@@ -1026,7 +1026,7 @@ function is({
1026
1026
  "aria-label": `Add ${e.title || "visual"} to dashboard`,
1027
1027
  children: [
1028
1028
  /* @__PURE__ */ t(m, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
1029
- /* @__PURE__ */ r("div", { className: "min-w-0", children: [
1029
+ /* @__PURE__ */ s("div", { className: "min-w-0", children: [
1030
1030
  /* @__PURE__ */ t(
1031
1031
  "div",
1032
1032
  {
@@ -1047,24 +1047,24 @@ function is({
1047
1047
  ]
1048
1048
  }
1049
1049
  ),
1050
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
1051
- /* @__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: as(e, p) }),
1050
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
1051
+ /* @__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: ns(e, p) }),
1052
1052
  /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: zt(e, p) })
1053
1053
  ] }),
1054
1054
  /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Aa(e.updatedAt) }),
1055
- /* @__PURE__ */ t(rs, { visual: e }),
1055
+ /* @__PURE__ */ t(ss, { visual: e }),
1056
1056
  /* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
1057
1057
  /* @__PURE__ */ t(
1058
- os,
1058
+ ls,
1059
1059
  {
1060
1060
  visual: e,
1061
1061
  onOpenVisual: i,
1062
1062
  onEditDetails: o,
1063
1063
  onShareVisual: l,
1064
- onDeleteVisual: u,
1065
- onDuplicateVisual: c,
1066
- duplicatingId: d,
1067
- isDeleting: h,
1064
+ onDeleteVisual: h,
1065
+ onDuplicateVisual: d,
1066
+ duplicatingId: c,
1067
+ isDeleting: u,
1068
1068
  isConsoleMode: p
1069
1069
  }
1070
1070
  )
@@ -1072,22 +1072,22 @@ function is({
1072
1072
  }
1073
1073
  );
1074
1074
  }
1075
- function os({
1075
+ function ls({
1076
1076
  visual: e,
1077
1077
  onOpenVisual: a,
1078
- onEditDetails: s,
1078
+ onEditDetails: r,
1079
1079
  onShareVisual: n,
1080
1080
  onDeleteVisual: i,
1081
1081
  onDuplicateVisual: o,
1082
1082
  duplicatingId: l,
1083
- isDeleting: u,
1084
- isConsoleMode: c
1083
+ isDeleting: h,
1084
+ isConsoleMode: d
1085
1085
  }) {
1086
- return /* @__PURE__ */ r(
1086
+ return /* @__PURE__ */ s(
1087
1087
  "div",
1088
1088
  {
1089
1089
  className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
1090
- onClick: (d) => d.stopPropagation(),
1090
+ onClick: (c) => c.stopPropagation(),
1091
1091
  children: [
1092
1092
  /* @__PURE__ */ t(
1093
1093
  L,
@@ -1100,7 +1100,7 @@ function os({
1100
1100
  children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
1101
1101
  }
1102
1102
  ),
1103
- /* @__PURE__ */ r(je, { modal: !1, children: [
1103
+ /* @__PURE__ */ s(je, { modal: !1, children: [
1104
1104
  /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
1105
1105
  L,
1106
1106
  {
@@ -1111,17 +1111,17 @@ function os({
1111
1111
  children: /* @__PURE__ */ t(ha, { className: "h-3.5 w-3.5" })
1112
1112
  }
1113
1113
  ) }),
1114
- /* @__PURE__ */ r(
1114
+ /* @__PURE__ */ s(
1115
1115
  We,
1116
1116
  {
1117
1117
  align: "end",
1118
1118
  className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
1119
1119
  children: [
1120
- /* @__PURE__ */ r(re, { onClick: () => a(e), children: [
1120
+ /* @__PURE__ */ s(re, { onClick: () => a(e), children: [
1121
1121
  /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" }),
1122
1122
  "Edit visual"
1123
1123
  ] }),
1124
- /* @__PURE__ */ r(
1124
+ /* @__PURE__ */ s(
1125
1125
  re,
1126
1126
  {
1127
1127
  onClick: () => o(e.id),
@@ -1132,36 +1132,36 @@ function os({
1132
1132
  ]
1133
1133
  }
1134
1134
  ),
1135
- e.permissions.canEdit && /* @__PURE__ */ r(re, { onClick: () => s(e), children: [
1135
+ e.permissions.canEdit && /* @__PURE__ */ s(re, { onClick: () => r(e), children: [
1136
1136
  /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" }),
1137
1137
  "Edit details"
1138
1138
  ] }),
1139
- e.permissions.canShare && /* @__PURE__ */ r(re, { onClick: () => n(e), children: [
1139
+ e.permissions.canShare && /* @__PURE__ */ s(re, { onClick: () => n(e), children: [
1140
1140
  /* @__PURE__ */ t(ca, { className: "h-3.5 w-3.5" }),
1141
1141
  "Share"
1142
1142
  ] }),
1143
- e.permissions.canDelete && /* @__PURE__ */ r(U, { children: [
1143
+ e.permissions.canDelete && /* @__PURE__ */ s(U, { children: [
1144
1144
  /* @__PURE__ */ t(at, {}),
1145
- /* @__PURE__ */ r(
1145
+ /* @__PURE__ */ s(
1146
1146
  re,
1147
1147
  {
1148
1148
  className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
1149
1149
  onClick: () => i(e),
1150
- disabled: u,
1150
+ disabled: h,
1151
1151
  children: [
1152
1152
  /* @__PURE__ */ t(tt, { className: "h-3.5 w-3.5" }),
1153
- u ? "Deleting..." : "Delete"
1153
+ h ? "Deleting..." : "Delete"
1154
1154
  ]
1155
1155
  }
1156
1156
  )
1157
1157
  ] }),
1158
1158
  /* @__PURE__ */ t(at, {}),
1159
- /* @__PURE__ */ r("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
1160
- Fa(e, c) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
1159
+ /* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
1160
+ Fa(e, d) && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
1161
1161
  /* @__PURE__ */ t(Ha, { className: "h-3 w-3" }),
1162
- /* @__PURE__ */ t("span", { className: "truncate", children: zt(e, c) })
1162
+ /* @__PURE__ */ t("span", { className: "truncate", children: zt(e, d) })
1163
1163
  ] }),
1164
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
1164
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
1165
1165
  /* @__PURE__ */ t(Ya, { className: "h-3 w-3" }),
1166
1166
  /* @__PURE__ */ t("span", { children: Aa(e.updatedAt) })
1167
1167
  ] })
@@ -1174,49 +1174,50 @@ function os({
1174
1174
  }
1175
1175
  );
1176
1176
  }
1177
- function qi(e, a, s = !1) {
1178
- const n = w((d) => d.dashboard), i = w(
1179
- (d) => d.isDashboardEditing
1180
- ), o = w(
1181
- (d) => d.onDashboardLifecycleEvent
1182
- ), l = ie(() => {
1183
- const d = w.getState().dashboard;
1184
- return a || !e || !d || d.id !== e.id ? !1 : Ze(d) !== Ze(e);
1177
+ function Wi(e, a, r = !1) {
1178
+ const n = N((u) => u.dashboard), i = N(
1179
+ (u) => u.isDashboardEditing
1180
+ ), o = N((u) => u.isVisualEditing), l = N(
1181
+ (u) => u.onDashboardLifecycleEvent
1182
+ ), h = ie(() => {
1183
+ const { dashboard: u, isVisualEditing: p } = N.getState();
1184
+ return a || !e || !u || u.id !== e.id ? !1 : p ? !0 : Ze(u) !== Ze(e);
1185
1185
  }, [e, a]);
1186
- Ut(() => (w.setState({ checkUnsavedDashboardChanges: l }), () => {
1187
- w.getState().checkUnsavedDashboardChanges === l && w.setState({ checkUnsavedDashboardChanges: null });
1188
- }), [l]);
1189
- const u = Y(() => !s || a || !n || i && (!e || n.id !== e.id) ? null : {
1186
+ Ut(() => (N.setState({ checkUnsavedDashboardChanges: h }), () => {
1187
+ N.getState().checkUnsavedDashboardChanges === h && N.setState({ checkUnsavedDashboardChanges: null });
1188
+ }), [h]);
1189
+ const d = Y(() => !r || a || !n || i && (!e || n.id !== e.id) ? null : {
1190
1190
  dashboardId: n.id,
1191
- dirty: i && e ? Ze(n) !== Ze(e) : !1
1191
+ dirty: i && e ? o || Ze(n) !== Ze(e) : !1
1192
1192
  }, [
1193
1193
  i,
1194
+ o,
1194
1195
  a,
1195
- s,
1196
+ r,
1196
1197
  e,
1197
1198
  n
1198
1199
  ]), c = et(null);
1199
1200
  return Ut(() => {
1200
- if (!o || !u) {
1201
+ if (!l || !d) {
1201
1202
  c.current = null;
1202
1203
  return;
1203
1204
  }
1204
- const d = c.current;
1205
- (d == null ? void 0 : d.callback) === o && d.dashboardId === u.dashboardId && d.dirty === u.dirty || (c.current = {
1206
- callback: o,
1207
- dashboardId: u.dashboardId,
1208
- dirty: u.dirty
1209
- }, o({
1205
+ const u = c.current;
1206
+ (u == null ? void 0 : u.callback) === l && u.dashboardId === d.dashboardId && u.dirty === d.dirty || (c.current = {
1207
+ callback: l,
1208
+ dashboardId: d.dashboardId,
1209
+ dirty: d.dirty
1210
+ }, l({
1210
1211
  type: "dashboard:dirty-state",
1211
- dashboardId: u.dashboardId,
1212
- payload: { dirty: u.dirty }
1212
+ dashboardId: d.dashboardId,
1213
+ payload: { dirty: d.dirty }
1213
1214
  }));
1214
- }, [u, o]), l;
1215
+ }, [d, l]), h;
1215
1216
  }
1216
1217
  function Rt(e) {
1217
1218
  var a;
1218
- for (const s of e.cards)
1219
- if (s.type === "matrixTable" && !ar.safeParse((a = s.config) == null ? void 0 : a.matrix).success)
1219
+ for (const r of e.cards)
1220
+ if (r.type === "matrixTable" && !nr.safeParse((a = r.config) == null ? void 0 : a.matrix).success)
1220
1221
  return z.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
1221
1222
  return !0;
1222
1223
  }
@@ -1224,12 +1225,12 @@ function gt({
1224
1225
  className: e,
1225
1226
  variant: a = "outline"
1226
1227
  }) {
1227
- const s = oe((o) => o.onSave), { getUpdatedFrame: n } = Be();
1228
+ const r = oe((o) => o.onSave), { getUpdatedFrame: n } = Be();
1228
1229
  function i() {
1229
1230
  const o = n();
1230
- Rt(o) && (s == null || s(o));
1231
+ Rt(o) && (r == null || r(o));
1231
1232
  }
1232
- return /* @__PURE__ */ r(
1233
+ return /* @__PURE__ */ s(
1233
1234
  L,
1234
1235
  {
1235
1236
  onClick: i,
@@ -1243,11 +1244,11 @@ function gt({
1243
1244
  }
1244
1245
  );
1245
1246
  }
1246
- function ls({
1247
+ function ds({
1247
1248
  className: e,
1248
1249
  variant: a = "default"
1249
1250
  }) {
1250
- const s = ot(), [n, i] = E(!1), { setIsVisualEditing: o } = ve(), { getUpdatedFrame: l } = Be(), u = lt(), c = oe((p) => p.frame), d = ma();
1251
+ const r = ot(), [n, i] = E(!1), { setIsVisualEditing: o } = ve(), { getUpdatedFrame: l } = Be(), h = lt(), d = oe((p) => p.frame), c = ma();
1251
1252
  return /* @__PURE__ */ t(
1252
1253
  L,
1253
1254
  {
@@ -1255,12 +1256,12 @@ function ls({
1255
1256
  const p = l();
1256
1257
  if (!Rt(p))
1257
1258
  return;
1258
- const m = (c == null ? void 0 : c.visualId) || (u == null ? void 0 : u.id);
1259
+ const m = (d == null ? void 0 : d.visualId) || (h == null ? void 0 : h.id);
1259
1260
  if (!m) {
1260
1261
  z.error("No visual to save");
1261
1262
  return;
1262
1263
  }
1263
- i(!0), d.mutate(
1264
+ i(!0), c.mutate(
1264
1265
  {
1265
1266
  visualId: m,
1266
1267
  data: {
@@ -1269,7 +1270,7 @@ function ls({
1269
1270
  },
1270
1271
  {
1271
1272
  onSuccess: () => {
1272
- i(!1), z.success("Visual updated successfully"), s.invalidateQueries({
1273
+ i(!1), z.success("Visual updated successfully"), r.invalidateQueries({
1273
1274
  queryKey: ["resource-by-id", "visual", m],
1274
1275
  exact: !0
1275
1276
  });
@@ -1283,20 +1284,20 @@ function ls({
1283
1284
  className: e,
1284
1285
  size: "xs",
1285
1286
  variant: a,
1286
- children: n ? /* @__PURE__ */ r(U, { children: [
1287
+ children: n ? /* @__PURE__ */ s(U, { children: [
1287
1288
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
1288
1289
  "Saving"
1289
- ] }) : /* @__PURE__ */ r(U, { children: [
1290
+ ] }) : /* @__PURE__ */ s(U, { children: [
1290
1291
  /* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
1291
1292
  "Save to Library"
1292
1293
  ] })
1293
1294
  }
1294
1295
  );
1295
1296
  }
1296
- function ds({
1297
+ function cs({
1297
1298
  className: e
1298
1299
  }) {
1299
- const a = ot(), [s, n] = E(!1), i = lt(), o = oe((g) => g.frame), l = w((g) => g.selectedSheetId), u = w((g) => g.dashboard), { updateFrame: c, setIsVisualEditing: d } = ve(), { getUpdatedFrame: h } = Be(), p = ma(), m = ct();
1300
+ const a = ot(), [r, n] = E(!1), i = lt(), o = oe((g) => g.frame), l = N((g) => g.selectedSheetId), h = N((g) => g.dashboard), { updateFrame: d, setIsVisualEditing: c } = ve(), { getUpdatedFrame: u } = Be(), p = ma(), m = ct();
1300
1301
  return /* @__PURE__ */ t(
1301
1302
  L,
1302
1303
  {
@@ -1312,16 +1313,16 @@ function ds({
1312
1313
  }
1313
1314
  n(!0);
1314
1315
  try {
1315
- const y = h();
1316
+ const y = u();
1316
1317
  if (!Rt(y)) {
1317
1318
  n(!1);
1318
1319
  return;
1319
1320
  }
1320
- const N = {
1321
+ const C = {
1321
1322
  ...y,
1322
1323
  visualId: g
1323
1324
  // Keep the link to library visual
1324
- }, k = rt(u, N.id), V = await m(N, {
1325
+ }, k = rt(h, C.id), V = await m(C, {
1325
1326
  previousFrame: k
1326
1327
  });
1327
1328
  await p.mutateAsync({
@@ -1329,10 +1330,10 @@ function ds({
1329
1330
  data: {
1330
1331
  frameObject: y
1331
1332
  }
1332
- }), c(l, N, {
1333
+ }), d(l, C, {
1333
1334
  semanticExecutionPayload: V
1334
1335
  }), a.invalidateQueries({ queryKey: ["visuals"] }), a.invalidateQueries({ queryKey: ["visual", g] }), z.success("Saved to library and applied locally"), setTimeout(() => {
1335
- d(!1);
1336
+ c(!1);
1336
1337
  }, 300);
1337
1338
  } catch (y) {
1338
1339
  console.error("Failed to save and apply:", y), z.error(
@@ -1345,11 +1346,11 @@ function ds({
1345
1346
  className: e,
1346
1347
  size: "xs",
1347
1348
  variant: "default",
1348
- disabled: s,
1349
- children: s ? /* @__PURE__ */ r(U, { children: [
1349
+ disabled: r,
1350
+ children: r ? /* @__PURE__ */ s(U, { children: [
1350
1351
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
1351
1352
  "Saving..."
1352
- ] }) : /* @__PURE__ */ r(U, { children: [
1353
+ ] }) : /* @__PURE__ */ s(U, { children: [
1353
1354
  /* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
1354
1355
  "Save & Apply"
1355
1356
  ] })
@@ -1357,15 +1358,15 @@ function ds({
1357
1358
  );
1358
1359
  }
1359
1360
  function bt({ className: e }) {
1360
- const { setTempQueryData: a, setSqlGen: s } = dt(), n = ot(), i = oe((u) => u.tempQueryData), o = oe((u) => u.onClose);
1361
+ const { setTempQueryData: a, setSqlGen: r } = dt(), n = ot(), i = oe((h) => h.tempQueryData), o = oe((h) => h.onClose);
1361
1362
  function l() {
1362
1363
  if (i) {
1363
- const { queryKey: u, queryData: c } = i;
1364
- u && c && n.setQueryData(u, c);
1364
+ const { queryKey: h, queryData: d } = i;
1365
+ h && d && n.setQueryData(h, d);
1365
1366
  }
1366
- s({}), o == null || o();
1367
+ r({}), o == null || o();
1367
1368
  }
1368
- return /* @__PURE__ */ r(
1369
+ return /* @__PURE__ */ s(
1369
1370
  L,
1370
1371
  {
1371
1372
  onClick: l,
@@ -1379,24 +1380,24 @@ function bt({ className: e }) {
1379
1380
  }
1380
1381
  );
1381
1382
  }
1382
- function cs({
1383
+ function us({
1383
1384
  open: e,
1384
1385
  onOpenChange: a,
1385
- isLibraryVisual: s,
1386
+ isLibraryVisual: r,
1386
1387
  currentVisualName: n,
1387
1388
  isSaving: i = !1,
1388
1389
  destinationMode: o = "both",
1389
1390
  onConfirm: l
1390
1391
  }) {
1391
- const [u, c] = E(
1392
- s && n ? `Copy of ${n}` : n || ""
1393
- ), [d, h] = E("");
1392
+ const [h, d] = E(
1393
+ r && n ? `Copy of ${n}` : n || ""
1394
+ ), [c, u] = E("");
1394
1395
  la.useEffect(() => {
1395
- e && (c(
1396
- s && n ? `Copy of ${n}` : n || ""
1397
- ), h(""));
1398
- }, [e, s, n]);
1399
- const p = !!u.trim(), m = o === "local" ? {
1396
+ e && (d(
1397
+ r && n ? `Copy of ${n}` : n || ""
1398
+ ), u(""));
1399
+ }, [e, r, n]);
1400
+ const p = !!h.trim(), m = o === "local" ? {
1400
1401
  saveToLibrary: !1,
1401
1402
  saveToCurrentDashboard: !0,
1402
1403
  badgeType: "local",
@@ -1416,18 +1417,18 @@ function cs({
1416
1417
  actionLabel: "Save Copy as Linked Visual"
1417
1418
  }, f = () => {
1418
1419
  !p || i || l({
1419
- name: u.trim(),
1420
- description: d.trim() || void 0,
1420
+ name: h.trim(),
1421
+ description: c.trim() || void 0,
1421
1422
  saveToLibrary: m.saveToLibrary,
1422
1423
  saveToCurrentDashboard: m.saveToCurrentDashboard
1423
1424
  });
1424
1425
  };
1425
- return /* @__PURE__ */ t(Le, { open: e, onOpenChange: a, children: /* @__PURE__ */ r(Ve, { className: "sm:max-w-[500px]", children: [
1426
- /* @__PURE__ */ r(Tt, { children: [
1427
- /* @__PURE__ */ r(Pe, { className: "flex items-center gap-2", children: [
1426
+ return /* @__PURE__ */ t(Le, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(Ve, { className: "sm:max-w-[500px]", children: [
1427
+ /* @__PURE__ */ s(Tt, { children: [
1428
+ /* @__PURE__ */ s(Pe, { className: "flex items-center gap-2", children: [
1428
1429
  /* @__PURE__ */ t("span", { children: "Save Visual As" }),
1429
1430
  m.badgeType !== "local" && /* @__PURE__ */ t(
1430
- Sr,
1431
+ kr,
1431
1432
  {
1432
1433
  type: m.badgeType,
1433
1434
  showLabel: !0,
@@ -1437,28 +1438,28 @@ function cs({
1437
1438
  ] }),
1438
1439
  /* @__PURE__ */ t(ut, { children: m.description })
1439
1440
  ] }),
1440
- /* @__PURE__ */ r("div", { className: "grid gap-4 py-4", children: [
1441
- /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
1441
+ /* @__PURE__ */ s("div", { className: "grid gap-4 py-4", children: [
1442
+ /* @__PURE__ */ s("div", { className: "grid gap-2", children: [
1442
1443
  /* @__PURE__ */ t(Me, { htmlFor: "name", children: "Name" }),
1443
1444
  /* @__PURE__ */ t(
1444
1445
  xe,
1445
1446
  {
1446
1447
  id: "name",
1447
- value: u,
1448
- onChange: (g) => c(g.target.value),
1448
+ value: h,
1449
+ onChange: (g) => d(g.target.value),
1449
1450
  placeholder: "Enter visual name",
1450
1451
  disabled: i
1451
1452
  }
1452
1453
  )
1453
1454
  ] }),
1454
- /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
1455
+ /* @__PURE__ */ s("div", { className: "grid gap-2", children: [
1455
1456
  /* @__PURE__ */ t(Me, { htmlFor: "description", children: "Description (optional)" }),
1456
1457
  /* @__PURE__ */ t(
1457
1458
  pa,
1458
1459
  {
1459
1460
  id: "description",
1460
- value: d,
1461
- onChange: (g) => h(g.target.value),
1461
+ value: c,
1462
+ onChange: (g) => u(g.target.value),
1462
1463
  placeholder: "Enter visual description",
1463
1464
  rows: 3,
1464
1465
  disabled: i
@@ -1466,7 +1467,7 @@ function cs({
1466
1467
  )
1467
1468
  ] })
1468
1469
  ] }),
1469
- /* @__PURE__ */ r(Xa, { children: [
1470
+ /* @__PURE__ */ s(Xa, { children: [
1470
1471
  /* @__PURE__ */ t(
1471
1472
  L,
1472
1473
  {
@@ -1476,19 +1477,19 @@ function cs({
1476
1477
  children: "Cancel"
1477
1478
  }
1478
1479
  ),
1479
- /* @__PURE__ */ r(L, { onClick: f, disabled: !p || i, children: [
1480
+ /* @__PURE__ */ s(L, { onClick: f, disabled: !p || i, children: [
1480
1481
  i && /* @__PURE__ */ t(de, { className: "mr-2 h-4 w-4 animate-spin" }),
1481
1482
  m.actionLabel
1482
1483
  ] })
1483
1484
  ] })
1484
1485
  ] }) });
1485
1486
  }
1486
- function us() {
1487
- const [e, a] = E(!1), [s, n] = E(!1), [i, o] = E(null), [l, u] = E(null), c = oe((b) => b.frame), d = oe((b) => b.card), h = lt(), p = w((b) => b.selectedSheetId), m = w((b) => b.dashboard), { getUpdatedFrame: f } = Be(), { selectVisual: g } = Ct(), { addFrame: y, setIsVisualEditing: N } = ve(), k = ct(), V = !!(c != null && c.visualId), P = (() => {
1487
+ function hs() {
1488
+ const [e, a] = E(!1), [r, n] = E(!1), [i, o] = E(null), [l, h] = E(null), d = oe((b) => b.frame), c = oe((b) => b.card), u = lt(), p = N((b) => b.selectedSheetId), m = N((b) => b.dashboard), { getUpdatedFrame: f } = Be(), { selectVisual: g } = Ct(), { addFrame: y, setIsVisualEditing: C } = ve(), k = ct(), V = !!(d != null && d.visualId), P = (() => {
1488
1489
  var b, S;
1489
- return ((b = c == null ? void 0 : c.cards) == null ? void 0 : b.length) === 1 && ((S = c.cards[0]) != null && S.title) ? c.cards[0].title : h != null && h.title ? h.title : (d == null ? void 0 : d.title) || "Untitled Visual";
1490
+ return ((b = d == null ? void 0 : d.cards) == null ? void 0 : b.length) === 1 && ((S = d.cards[0]) != null && S.title) ? d.cards[0].title : u != null && u.title ? u.title : (c == null ? void 0 : c.title) || "Untitled Visual";
1490
1491
  })(), D = Za((b) => {
1491
- b != null && b.id && (g(b), s && i && l && p && (async () => {
1492
+ b != null && b.id && (g(b), r && i && l && p && (async () => {
1492
1493
  try {
1493
1494
  const S = {
1494
1495
  ...i,
@@ -1498,7 +1499,7 @@ function us() {
1498
1499
  };
1499
1500
  y(p, S, {
1500
1501
  semanticExecutionPayload: l
1501
- }), n(!1), o(null), u(null), N(!1);
1502
+ }), n(!1), o(null), h(null), C(!1);
1502
1503
  } catch (S) {
1503
1504
  console.error(
1504
1505
  "Failed to promote semantic metadata for saved visual:",
@@ -1541,7 +1542,7 @@ function us() {
1541
1542
  );
1542
1543
  return;
1543
1544
  }
1544
- n(b.saveToCurrentDashboard), o(T), u(F);
1545
+ n(b.saveToCurrentDashboard), o(T), h(F);
1545
1546
  const G = {
1546
1547
  title: b.name,
1547
1548
  description: b.description,
@@ -1564,7 +1565,7 @@ function us() {
1564
1565
  });
1565
1566
  y(p, F, {
1566
1567
  semanticExecutionPayload: G
1567
- }), z.success("Visual saved to dashboard"), a(!1), N(!1);
1568
+ }), z.success("Visual saved to dashboard"), a(!1), C(!1);
1568
1569
  } catch (G) {
1569
1570
  console.error("Failed to save visual to dashboard:", G), z.error(
1570
1571
  G instanceof Error ? G.message : "Failed to prepare semantic metadata for the visual"
@@ -1577,17 +1578,17 @@ function us() {
1577
1578
  isSaving: D.isPending
1578
1579
  };
1579
1580
  }
1580
- function Wi(e = {}) {
1581
- const { isInspectionMode: a } = Ja(), s = oe((B) => B.frame), n = oe((B) => B.editorContext), i = en((B) => B.selectedVisual), o = w((B) => B.selectedFrameId), l = w((B) => B.selectedSheetId), u = w((B) => B.dashboard), { setIsVisualEditing: c, updateFrame: d } = ve(), [h, p] = E(!1), [m, f] = E("both"), g = ct(), y = (n == null ? void 0 : n.type) === "documentSection", N = !!(s != null && s.visualId || i != null && i.id), k = !!(s != null && s.visualId && o), V = N && !k, {
1581
+ function Qi(e = {}) {
1582
+ const { isInspectionMode: a } = Ja(), r = oe((B) => B.frame), n = oe((B) => B.editorContext), i = en((B) => B.selectedVisual), o = N((B) => B.selectedFrameId), l = N((B) => B.selectedSheetId), h = N((B) => B.dashboard), { setIsVisualEditing: d, updateFrame: c } = ve(), [u, p] = E(!1), [m, f] = E("both"), g = ct(), y = (n == null ? void 0 : n.type) === "documentSection", C = !!(r != null && r.visualId || i != null && i.id), k = !!(r != null && r.visualId && o), V = C && !k, {
1582
1583
  saveAsDialogOpen: P,
1583
1584
  setSaveAsDialogOpen: D,
1584
1585
  handleSaveAs: O,
1585
1586
  isLibraryVisual: b,
1586
1587
  currentVisualName: S,
1587
1588
  isSaving: v
1588
- } = us(), { getUpdatedFrame: T } = Be();
1589
+ } = hs(), { getUpdatedFrame: T } = Be();
1589
1590
  if (a)
1590
- return /* @__PURE__ */ r(U, { children: [
1591
+ return /* @__PURE__ */ s(U, { children: [
1591
1592
  /* @__PURE__ */ t(
1592
1593
  gt,
1593
1594
  {
@@ -1598,7 +1599,7 @@ function Wi(e = {}) {
1598
1599
  /* @__PURE__ */ t(bt, {})
1599
1600
  ] });
1600
1601
  if (y)
1601
- return /* @__PURE__ */ r(U, { children: [
1602
+ return /* @__PURE__ */ s(U, { children: [
1602
1603
  /* @__PURE__ */ t(gt, { className: "rounded-control", variant: "default" }),
1603
1604
  /* @__PURE__ */ t(bt, {})
1604
1605
  ] });
@@ -1607,17 +1608,17 @@ function Wi(e = {}) {
1607
1608
  z.error("No sheet selected");
1608
1609
  return;
1609
1610
  }
1610
- if (h) return;
1611
+ if (u) return;
1611
1612
  p(!0);
1612
1613
  const Q = {
1613
1614
  ...T(),
1614
1615
  visualId: void 0
1615
- }, X = rt(u, Q.id);
1616
+ }, X = rt(h, Q.id);
1616
1617
  try {
1617
1618
  const _ = await g(Q, {
1618
1619
  previousFrame: X
1619
1620
  });
1620
- d(l, Q, {
1621
+ c(l, Q, {
1621
1622
  semanticExecutionPayload: _
1622
1623
  });
1623
1624
  } catch (_) {
@@ -1627,17 +1628,17 @@ function Wi(e = {}) {
1627
1628
  return;
1628
1629
  }
1629
1630
  setTimeout(() => {
1630
- p(!1), z.success("Changes applied. Visual is now local to this dashboard"), c(!1);
1631
+ p(!1), z.success("Changes applied. Visual is now local to this dashboard"), d(!1);
1631
1632
  }, 300);
1632
1633
  }, G = (B) => {
1633
1634
  f(B), D(!0);
1634
1635
  };
1635
- return /* @__PURE__ */ r(U, { children: [
1636
- /* @__PURE__ */ r("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
1637
- !N && /* @__PURE__ */ t(gt, { className: "!rounded-none", variant: "default" }),
1638
- N && V && /* @__PURE__ */ t(ls, { className: "!rounded-none", variant: "default" }),
1639
- N && k && /* @__PURE__ */ t(ds, { className: "!rounded-none" }),
1640
- /* @__PURE__ */ r(je, { modal: !1, children: [
1636
+ return /* @__PURE__ */ s(U, { children: [
1637
+ /* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
1638
+ !C && /* @__PURE__ */ t(gt, { className: "!rounded-none", variant: "default" }),
1639
+ C && V && /* @__PURE__ */ t(ds, { className: "!rounded-none", variant: "default" }),
1640
+ C && k && /* @__PURE__ */ t(cs, { className: "!rounded-none" }),
1641
+ /* @__PURE__ */ s(je, { modal: !1, children: [
1641
1642
  /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
1642
1643
  L,
1643
1644
  {
@@ -1645,31 +1646,31 @@ function Wi(e = {}) {
1645
1646
  size: "xs",
1646
1647
  className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
1647
1648
  "aria-label": "Open visual save options",
1648
- disabled: v || h,
1649
+ disabled: v || u,
1649
1650
  children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
1650
1651
  }
1651
1652
  ) }),
1652
- /* @__PURE__ */ r(
1653
+ /* @__PURE__ */ s(
1653
1654
  We,
1654
1655
  {
1655
1656
  align: "end",
1656
1657
  className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
1657
1658
  children: [
1658
- k && /* @__PURE__ */ r(U, { children: [
1659
- /* @__PURE__ */ r(
1659
+ k && /* @__PURE__ */ s(U, { children: [
1660
+ /* @__PURE__ */ s(
1660
1661
  re,
1661
1662
  {
1662
1663
  onClick: F,
1663
- disabled: h,
1664
+ disabled: u,
1664
1665
  children: [
1665
1666
  /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" }),
1666
- h ? "Applying..." : "Apply Locally"
1667
+ u ? "Applying..." : "Apply Locally"
1667
1668
  ]
1668
1669
  }
1669
1670
  ),
1670
1671
  /* @__PURE__ */ t(at, {})
1671
1672
  ] }),
1672
- /* @__PURE__ */ r(
1673
+ /* @__PURE__ */ s(
1673
1674
  re,
1674
1675
  {
1675
1676
  onClick: () => G("local"),
@@ -1680,18 +1681,18 @@ function Wi(e = {}) {
1680
1681
  ]
1681
1682
  }
1682
1683
  ),
1683
- /* @__PURE__ */ r(
1684
+ /* @__PURE__ */ s(
1684
1685
  re,
1685
1686
  {
1686
1687
  onClick: () => G("library"),
1687
1688
  disabled: v,
1688
1689
  children: [
1689
- /* @__PURE__ */ t(kr, { className: "h-3.5 w-3.5" }),
1690
+ /* @__PURE__ */ t(Dr, { className: "h-3.5 w-3.5" }),
1690
1691
  "Save as Library Visual"
1691
1692
  ]
1692
1693
  }
1693
1694
  ),
1694
- /* @__PURE__ */ r(
1695
+ /* @__PURE__ */ s(
1695
1696
  re,
1696
1697
  {
1697
1698
  onClick: () => G("both"),
@@ -1709,7 +1710,7 @@ function Wi(e = {}) {
1709
1710
  ] }),
1710
1711
  /* @__PURE__ */ t(bt, {}),
1711
1712
  /* @__PURE__ */ t(
1712
- cs,
1713
+ us,
1713
1714
  {
1714
1715
  open: P,
1715
1716
  onOpenChange: (B) => {
@@ -1724,64 +1725,64 @@ function Wi(e = {}) {
1724
1725
  )
1725
1726
  ] });
1726
1727
  }
1727
- function Qi({ className: e }) {
1728
- const a = oe((h) => h.isDevMode), s = oe((h) => h.card.type), n = w((h) => h.isVisualEditing), { setIsDevMode: i } = dt(), { config: o } = Va(an).tokenProps, l = (o == null ? void 0 : o.showAdvancedMode) !== !1;
1729
- if (!n || !l || !rr(s))
1728
+ function Ki({ className: e }) {
1729
+ const a = oe((u) => u.isDevMode), r = oe((u) => u.card.type), n = N((u) => u.isVisualEditing), { setIsDevMode: i } = dt(), { config: o } = Va(an).tokenProps, l = (o == null ? void 0 : o.showAdvancedMode) !== !1;
1730
+ if (!n || !l || !sr(r))
1730
1731
  return null;
1731
- const u = a ? Kr : Qr, c = a ? "Visual editor" : "SQL editor", d = a ? "Switch to visual editor" : "Switch to SQL editor";
1732
- return /* @__PURE__ */ r(
1732
+ const h = a ? Gr : Kr, d = a ? "Visual editor" : "SQL editor", c = a ? "Switch to visual editor" : "Switch to SQL editor";
1733
+ return /* @__PURE__ */ s(
1733
1734
  "button",
1734
1735
  {
1735
1736
  type: "button",
1736
- "aria-label": d,
1737
- title: d,
1737
+ "aria-label": c,
1738
+ title: c,
1738
1739
  onClick: () => i(!a),
1739
1740
  className: Z(
1740
1741
  "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",
1741
1742
  e
1742
1743
  ),
1743
1744
  children: [
1744
- /* @__PURE__ */ t(u, { className: "h-3 w-3 text-muted-foreground" }),
1745
- c
1745
+ /* @__PURE__ */ t(h, { className: "h-3 w-3 text-muted-foreground" }),
1746
+ d
1746
1747
  ]
1747
1748
  }
1748
1749
  );
1749
1750
  }
1750
- function Ki() {
1751
- const e = nn() === "sm", a = w((c) => c.isDashboardEditing), s = w((c) => c.isVisualEditing), n = w((c) => {
1752
- var h;
1753
- const d = ((h = c.dashboard) == null ? void 0 : h.sheets) ?? [];
1754
- return d.find((p) => p.id === c.selectedSheetId) ?? d[0];
1755
- }), i = w((c) => c.actions.arrangeSheet), o = w((c) => c.actions.undoArrange);
1756
- if (!a || s || !n || Ke(n)) return null;
1757
- const l = !(n.frames ?? []).length, u = (c) => {
1758
- const d = i(n.id, { keepOrder: c });
1759
- if (!d.ok) {
1760
- z.error(d.reason === "not_a_grid" ? "This sheet has no grid to arrange." : "The dashboard can't be arranged right now.");
1751
+ function Gi() {
1752
+ const e = nn() === "sm", a = N((d) => d.isDashboardEditing), r = N((d) => d.isVisualEditing), n = N((d) => {
1753
+ var u;
1754
+ const c = ((u = d.dashboard) == null ? void 0 : u.sheets) ?? [];
1755
+ return c.find((p) => p.id === d.selectedSheetId) ?? c[0];
1756
+ }), i = N((d) => d.actions.arrangeSheet), o = N((d) => d.actions.undoArrange);
1757
+ if (!a || r || !n || Ke(n)) return null;
1758
+ const l = !(n.frames ?? []).length, h = (d) => {
1759
+ const c = i(n.id, { keepOrder: d });
1760
+ if (!c.ok) {
1761
+ z.error(c.reason === "not_a_grid" ? "This sheet has no grid to arrange." : "The dashboard can't be arranged right now.");
1761
1762
  return;
1762
1763
  }
1763
1764
  z("Arranged", {
1764
1765
  // Long enough to reach Undo after looking at the result; the default 4 seconds isn't.
1765
1766
  duration: 1e4,
1766
- description: c ? "Sizes and gaps fixed on every screen size, in your order." : "KPIs on top, charts in pairs, tables full width, on every screen size.",
1767
+ description: d ? "Sizes and gaps fixed on every screen size, in your order." : "KPIs on top, charts in pairs, tables full width, on every screen size.",
1767
1768
  action: {
1768
1769
  label: "Undo",
1769
1770
  onClick: () => {
1770
- const h = o();
1771
- !h.ok && h.reason === "changed_since" && z.info("The dashboard changed after Arrange, so it can't be undone from here.");
1771
+ const u = o();
1772
+ !u.ok && u.reason === "changed_since" && z.info("The dashboard changed after Arrange, so it can't be undone from here.");
1772
1773
  }
1773
1774
  }
1774
1775
  });
1775
1776
  };
1776
- return /* @__PURE__ */ r("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background", children: [
1777
- /* @__PURE__ */ r(
1777
+ return /* @__PURE__ */ s("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background", children: [
1778
+ /* @__PURE__ */ s(
1778
1779
  L,
1779
1780
  {
1780
1781
  variant: "ghost",
1781
1782
  size: "xs",
1782
1783
  disabled: l,
1783
1784
  title: l ? "This sheet has no cards to arrange" : "Lay out the cards by kind on every screen size",
1784
- onClick: () => u(!1),
1785
+ onClick: () => h(!1),
1785
1786
  "aria-label": e ? "Arrange" : void 0,
1786
1787
  className: `h-full rounded-none border-0 shadow-none hover:bg-accent${e ? " w-7 px-0" : ""}`,
1787
1788
  children: [
@@ -1790,7 +1791,7 @@ function Ki() {
1790
1791
  ]
1791
1792
  }
1792
1793
  ),
1793
- /* @__PURE__ */ r(je, { modal: !1, children: [
1794
+ /* @__PURE__ */ s(je, { modal: !1, children: [
1794
1795
  /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
1795
1796
  L,
1796
1797
  {
@@ -1802,19 +1803,19 @@ function Ki() {
1802
1803
  children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
1803
1804
  }
1804
1805
  ) }),
1805
- /* @__PURE__ */ t(We, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ r(re, { onClick: () => u(!0), children: [
1806
+ /* @__PURE__ */ t(We, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ s(re, { onClick: () => h(!0), children: [
1806
1807
  /* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5" }),
1807
1808
  "Keep my order"
1808
1809
  ] }) })
1809
1810
  ] })
1810
1811
  ] });
1811
1812
  }
1812
- function Gi() {
1813
- const e = w((i) => i.screenSizesOpen), a = w((i) => {
1814
- var u, c;
1815
- const o = ((u = i.dashboard) == null ? void 0 : u.sheets) ?? [], l = o.find((d) => d.id === i.selectedSheetId) ?? o[0];
1816
- return !!l && !Ke(l) && !!((c = l.frames) != null && c.length);
1817
- }), s = w((i) => i.actions.setScreenSizesOpen), n = fa(
1813
+ function Hi() {
1814
+ const e = N((i) => i.screenSizesOpen), a = N((i) => {
1815
+ var h, d;
1816
+ const o = ((h = i.dashboard) == null ? void 0 : h.sheets) ?? [], l = o.find((c) => c.id === i.selectedSheetId) ?? o[0];
1817
+ return !!l && !Ke(l) && !!((d = l.frames) != null && d.length);
1818
+ }), r = N((i) => i.actions.setScreenSizesOpen), n = fa(
1818
1819
  "screen-sizes",
1819
1820
  "lg",
1820
1821
  a ? {
@@ -1822,7 +1823,7 @@ function Gi() {
1822
1823
  icon: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
1823
1824
  checked: e,
1824
1825
  order: 40,
1825
- onSelect: () => s(!e)
1826
+ onSelect: () => r(!e)
1826
1827
  } : void 0
1827
1828
  );
1828
1829
  return !a || n.collapsed ? null : /* @__PURE__ */ t(
@@ -1834,68 +1835,68 @@ function Gi() {
1834
1835
  "aria-pressed": e,
1835
1836
  "aria-label": "Screen sizes",
1836
1837
  title: "Screen sizes",
1837
- onClick: () => s(!e),
1838
+ onClick: () => r(!e),
1838
1839
  className: "w-7 px-0",
1839
1840
  children: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
1840
1841
  }
1841
1842
  );
1842
1843
  }
1843
- function Hi({ dashboardId: e }) {
1844
- const { openDashboardId: a, access: s, printMode: n, serverIsFavorite: i, fetchedAt: o } = w(
1845
- rn((c) => {
1846
- var d;
1844
+ function Yi({ dashboardId: e }) {
1845
+ const { openDashboardId: a, access: r, printMode: n, serverIsFavorite: i, fetchedAt: o } = N(
1846
+ rn((d) => {
1847
+ var c;
1847
1848
  return {
1848
- openDashboardId: (d = c.dashboard) == null ? void 0 : d.id,
1849
- access: c.viewer.access,
1850
- printMode: c.viewer.printMode,
1851
- serverIsFavorite: c.viewer.isFavorite,
1852
- fetchedAt: c.viewer.fetchedAt
1849
+ openDashboardId: (c = d.dashboard) == null ? void 0 : c.id,
1850
+ access: d.viewer.access,
1851
+ printMode: d.viewer.printMode,
1852
+ serverIsFavorite: d.viewer.isFavorite,
1853
+ fetchedAt: d.viewer.fetchedAt
1853
1854
  };
1854
1855
  })
1855
- ), l = sn(), u = l.isFavorite(e, i, o);
1856
- return a !== e || n || s === "session-only" ? null : /* @__PURE__ */ t(
1856
+ ), l = sn(), h = l.isFavorite(e, i, o);
1857
+ return a !== e || n || r === "session-only" ? null : /* @__PURE__ */ t(
1857
1858
  on,
1858
1859
  {
1859
1860
  variant: "toolbar",
1860
- isFavorite: u,
1861
- readOnly: s === "read-only",
1861
+ isFavorite: h,
1862
+ readOnly: r === "read-only",
1862
1863
  pending: l.isPending(e),
1863
- onToggle: () => void l.setFavorite({ dashboardId: e, isFavorite: !u })
1864
+ onToggle: () => void l.setFavorite({ dashboardId: e, isFavorite: !h })
1864
1865
  }
1865
1866
  );
1866
1867
  }
1867
- function Yi(e) {
1868
- var c;
1869
- const { authToken: a, tokenProps: s } = $e(), { data: n } = ln(), { mutate: i, isPending: o } = dn(), l = !!e && ((c = n == null ? void 0 : n.preference) == null ? void 0 : c.defaultDashboardId) === e, u = !n || o;
1868
+ function Xi(e) {
1869
+ var d;
1870
+ const { authToken: a, tokenProps: r } = $e(), { data: n } = ln(), { mutate: i, isPending: o } = dn(), l = !!e && ((d = n == null ? void 0 : n.preference) == null ? void 0 : d.defaultDashboardId) === e, h = !n || o;
1870
1871
  return {
1871
- available: !!e && !!(a != null && a.accessToken) && !!(s != null && s.apiServiceUrl),
1872
+ available: !!e && !!(a != null && a.accessToken) && !!(r != null && r.apiServiceUrl),
1872
1873
  isDefault: l,
1873
- disabled: u,
1874
+ disabled: h,
1874
1875
  toggle: () => {
1875
- !e || u || i({ dashboardId: l ? null : e });
1876
+ !e || h || i({ dashboardId: l ? null : e });
1876
1877
  }
1877
1878
  };
1878
1879
  }
1879
- function Xi({
1880
+ function Zi({
1880
1881
  open: e,
1881
1882
  onOpenChange: a,
1882
- onSave: s,
1883
+ onSave: r,
1883
1884
  onDiscard: n,
1884
1885
  isSaving: i,
1885
1886
  title: o = "Unsaved changes",
1886
1887
  description: l = "You have unsaved changes to this dashboard. What would you like to do?",
1887
- cancelLabel: u = "Cancel",
1888
- discardLabel: c = "Discard changes",
1889
- saveLabel: d = "Save"
1888
+ cancelLabel: h = "Cancel",
1889
+ discardLabel: d = "Discard changes",
1890
+ saveLabel: c = "Save"
1890
1891
  }) {
1891
1892
  return /* @__PURE__ */ t(wt, { open: e, onOpenChange: (p) => {
1892
1893
  !p && i || a(p);
1893
- }, children: /* @__PURE__ */ r(St, { children: [
1894
- /* @__PURE__ */ r(kt, { children: [
1894
+ }, children: /* @__PURE__ */ s(St, { children: [
1895
+ /* @__PURE__ */ s(kt, { children: [
1895
1896
  /* @__PURE__ */ t(Dt, { children: o }),
1896
1897
  /* @__PURE__ */ t(At, { children: l })
1897
1898
  ] }),
1898
- /* @__PURE__ */ r(Ft, { children: [
1899
+ /* @__PURE__ */ s(Ft, { children: [
1899
1900
  /* @__PURE__ */ t(
1900
1901
  L,
1901
1902
  {
@@ -1905,23 +1906,27 @@ function Xi({
1905
1906
  disabled: i,
1906
1907
  variant: "outline",
1907
1908
  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",
1908
- children: c
1909
+ children: d
1909
1910
  }
1910
1911
  ),
1911
- /* @__PURE__ */ t(Et, { disabled: i, children: u }),
1912
- /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: s, disabled: i, children: i ? /* @__PURE__ */ r(U, { children: [
1912
+ r ? /* @__PURE__ */ t(Et, { disabled: i, children: h }) : (
1913
+ // Without Save, staying is the safe action: primary, and still
1914
+ // the dialog's Cancel so it takes the first focus, not Discard.
1915
+ /* @__PURE__ */ t(cn, { asChild: !0, children: /* @__PURE__ */ t(L, { type: "button", size: "xs", children: h }) })
1916
+ ),
1917
+ r && /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: r, disabled: i, children: i ? /* @__PURE__ */ s(U, { children: [
1913
1918
  /* @__PURE__ */ t(de, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
1914
1919
  "Saving..."
1915
- ] }) : d })
1920
+ ] }) : c })
1916
1921
  ] })
1917
1922
  ] }) });
1918
1923
  }
1919
- async function Zi(e) {
1924
+ async function Ji(e) {
1920
1925
  var o, l;
1921
- const a = (l = (o = w.getState()) == null ? void 0 : o.authToken) == null ? void 0 : l.accessToken;
1926
+ const a = (l = (o = N.getState()) == null ? void 0 : o.authToken) == null ? void 0 : l.accessToken;
1922
1927
  if (!a)
1923
1928
  return;
1924
- const s = `${e}/v1/invalidate-token`, n = await fetch(s, {
1929
+ const r = `${e}/v1/invalidate-token`, n = await fetch(r, {
1925
1930
  method: "POST",
1926
1931
  headers: {
1927
1932
  Authorization: `Bearer ${a}`
@@ -1932,20 +1937,20 @@ async function Zi(e) {
1932
1937
  const i = await n.json();
1933
1938
  return console.log("invalidateToken", i), i;
1934
1939
  }
1935
- function hs(e) {
1936
- var s;
1940
+ function ms(e) {
1941
+ var r;
1937
1942
  const a = e.item;
1938
1943
  return a.kind === "export" ? {
1939
1944
  title: a.title,
1940
1945
  status: a.status,
1941
1946
  startedAt: a.startedAt,
1942
1947
  finishedAt: a.finishedAt,
1943
- running: gn(a.stage),
1948
+ running: bn(a.stage),
1944
1949
  finishedDetail: [
1945
1950
  a.totalRows !== null ? `${a.totalRows.toLocaleString("en-US")} rows` : null,
1946
- a.fileSize ? fn(a.fileSize) : null
1951
+ a.fileSize ? gn(a.fileSize) : null
1947
1952
  ].filter((n) => !!n),
1948
- failure: ((s = a.failure) == null ? void 0 : s.kind) === "export" ? a.failure.message : a.status === "failed" ? Ce.failedFallback : null,
1953
+ failure: ((r = a.failure) == null ? void 0 : r.kind) === "export" ? a.failure.message : a.status === "failed" ? Ce.failedFallback : null,
1949
1954
  note: null
1950
1955
  } : {
1951
1956
  title: a.title,
@@ -1958,17 +1963,17 @@ function hs(e) {
1958
1963
  note: a.omittedAttachmentCount > 0 ? ge.attachmentsLeftOut(a.omittedAttachmentCount) : null
1959
1964
  };
1960
1965
  }
1961
- function na({ row: e, now: a, api: s }) {
1962
- const [n, i] = E("idle"), o = un(e, s), l = async () => {
1966
+ function na({ row: e, now: a, api: r }) {
1967
+ const [n, i] = E("idle"), o = hn(e, r), l = async () => {
1963
1968
  if (!o) return;
1964
1969
  i("working");
1965
- const u = await bn(s, e, o);
1966
- i(u === "done" ? "idle" : u);
1970
+ const h = await xn(r, e, o);
1971
+ i(h === "done" ? "idle" : h);
1967
1972
  };
1968
1973
  return /* @__PURE__ */ t(
1969
1974
  Ea,
1970
1975
  {
1971
- shown: hs(e),
1976
+ shown: ms(e),
1972
1977
  now: a,
1973
1978
  longRunningHint: e.item.kind === "export",
1974
1979
  action: o ? { label: ga[o], run: () => void l() } : null,
@@ -1977,8 +1982,8 @@ function na({ row: e, now: a, api: s }) {
1977
1982
  }
1978
1983
  );
1979
1984
  }
1980
- function ms({ work: e, now: a }) {
1981
- const s = e.stage === "preparing" ? e.cancel : null;
1985
+ function ps({ work: e, now: a }) {
1986
+ const r = e.stage === "preparing" ? e.cancel : null;
1982
1987
  return /* @__PURE__ */ t(
1983
1988
  Ea,
1984
1989
  {
@@ -1987,14 +1992,14 @@ function ms({ work: e, now: a }) {
1987
1992
  status: "running",
1988
1993
  startedAt: e.startedAt,
1989
1994
  finishedAt: null,
1990
- running: cn(e),
1995
+ running: un(e),
1991
1996
  finishedDetail: [],
1992
1997
  failure: null,
1993
1998
  note: null
1994
1999
  },
1995
2000
  now: a,
1996
2001
  longRunningHint: !1,
1997
- action: s ? { label: ga.cancel, run: s } : null,
2002
+ action: r ? { label: ga.cancel, run: r } : null,
1998
2003
  working: !1,
1999
2004
  problem: null
2000
2005
  }
@@ -2003,17 +2008,17 @@ function ms({ work: e, now: a }) {
2003
2008
  function Ea({
2004
2009
  shown: e,
2005
2010
  now: a,
2006
- longRunningHint: s,
2011
+ longRunningHint: r,
2007
2012
  action: n,
2008
2013
  working: i,
2009
2014
  problem: o
2010
2015
  }) {
2011
- const l = e.status === "ready" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", u = e.status === "ready" ? Ce.ready : e.status === "failed" ? Ce.failed : e.status === "cancelled" ? Ce.cancelled : Ce.inProgress, c = Date.parse(e.startedAt), d = Ht(Date.parse(e.finishedAt ?? e.startedAt), a, { addSuffix: !0 }), h = e.status === "running" && s && a - c >= hn, p = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
2012
- 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: [
2016
+ const l = e.status === "ready" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", h = e.status === "ready" ? Ce.ready : e.status === "failed" ? Ce.failed : e.status === "cancelled" ? Ce.cancelled : Ce.inProgress, d = Date.parse(e.startedAt), c = Ht(Date.parse(e.finishedAt ?? e.startedAt), a, { addSuffix: !0 }), u = e.status === "running" && r && a - d >= mn, p = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
2017
+ return /* @__PURE__ */ s("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: [
2013
2018
  /* @__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 ${l}` }) }),
2014
- /* @__PURE__ */ t("span", { className: "sr-only", children: u }),
2015
- /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
2016
- /* @__PURE__ */ r("div", { className: "flex h-5 items-center gap-2", children: [
2019
+ /* @__PURE__ */ t("span", { className: "sr-only", children: h }),
2020
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
2021
+ /* @__PURE__ */ s("div", { className: "flex h-5 items-center gap-2", children: [
2017
2022
  /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: e.title }),
2018
2023
  n && i && /* @__PURE__ */ t("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: /* @__PURE__ */ t(ba, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }) }),
2019
2024
  n && !i && /* @__PURE__ */ t(
@@ -2026,9 +2031,9 @@ function Ea({
2026
2031
  }
2027
2032
  )
2028
2033
  ] }),
2029
- e.status === "running" && e.running && /* @__PURE__ */ r("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
2034
+ e.status === "running" && e.running && /* @__PURE__ */ s("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
2030
2035
  /* @__PURE__ */ t("span", { className: "tabular-nums", children: e.running.text }),
2031
- e.running.detail && /* @__PURE__ */ r(U, { children: [
2036
+ e.running.detail && /* @__PURE__ */ s(U, { children: [
2032
2037
  " ",
2033
2038
  p,
2034
2039
  " ",
@@ -2037,49 +2042,49 @@ function Ea({
2037
2042
  " ",
2038
2043
  p,
2039
2044
  " ",
2040
- /* @__PURE__ */ t("span", { children: Ce.started(Ht(c, a)) }),
2041
- e.running.percent !== void 0 && /* @__PURE__ */ t(mn, { value: e.running.percent, className: "mt-1.5 h-1" }),
2042
- h && /* @__PURE__ */ t("div", { className: "mt-1", children: Ce.longRunning })
2045
+ /* @__PURE__ */ t("span", { children: Ce.started(Ht(d, a)) }),
2046
+ e.running.percent !== void 0 && /* @__PURE__ */ t(pn, { value: e.running.percent, className: "mt-1.5 h-1" }),
2047
+ u && /* @__PURE__ */ t("div", { className: "mt-1", children: Ce.longRunning })
2043
2048
  ] }),
2044
- e.status !== "running" && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
2049
+ e.status !== "running" && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
2045
2050
  e.status === "ready" && e.finishedDetail.length > 0 ? (
2046
2051
  // Disclosed on hover or focus only; the time is what a reader scans.
2047
- /* @__PURE__ */ r("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
2048
- e.finishedDetail.map((m, f) => /* @__PURE__ */ r(la.Fragment, { children: [
2052
+ /* @__PURE__ */ s("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
2053
+ e.finishedDetail.map((m, f) => /* @__PURE__ */ s(la.Fragment, { children: [
2049
2054
  f > 0 && p,
2050
2055
  /* @__PURE__ */ t("span", { children: m })
2051
2056
  ] }, f)),
2052
2057
  p
2053
2058
  ] })
2054
- ) : e.status !== "ready" ? /* @__PURE__ */ r(U, { children: [
2055
- /* @__PURE__ */ t("span", { children: u }),
2059
+ ) : e.status !== "ready" ? /* @__PURE__ */ s(U, { children: [
2060
+ /* @__PURE__ */ t("span", { children: h }),
2056
2061
  p
2057
2062
  ] }) : null,
2058
- /* @__PURE__ */ t("span", { children: d })
2063
+ /* @__PURE__ */ t("span", { children: c })
2059
2064
  ] }),
2060
2065
  e.note && /* @__PURE__ */ t("div", { className: "text-[12px] leading-4 text-muted-foreground", children: e.note }),
2061
2066
  e.status === "failed" && e.failure && /* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: e.failure }),
2062
- o && /* @__PURE__ */ t(pn, { problem: o, className: "mt-1" })
2067
+ o && /* @__PURE__ */ t(fn, { problem: o, className: "mt-1" })
2063
2068
  ] })
2064
2069
  ] });
2065
2070
  }
2066
- function Ji({ variant: e }) {
2067
- const { snapshot: a, markSeen: s } = Lt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = fa("activity", "md", {
2071
+ function eo({ variant: e }) {
2072
+ const { snapshot: a, markSeen: r } = Lt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = fa("activity", "md", {
2068
2073
  label: ge.title,
2069
2074
  icon: /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
2070
2075
  hint: n || (n === "" ? "New" : void 0),
2071
2076
  order: 30,
2072
- onOpen: s
2077
+ onOpen: r
2073
2078
  });
2074
- return i.collapsed ? /* @__PURE__ */ r(
2079
+ return i.collapsed ? /* @__PURE__ */ s(
2075
2080
  Ie,
2076
2081
  {
2077
2082
  open: i.popoverOpen,
2078
2083
  onOpenChange: (o) => {
2079
- i.setPopoverOpen(o), o && s();
2084
+ i.setPopoverOpen(o), o && r();
2080
2085
  },
2081
2086
  children: [
2082
- i.anchorSlot && Ir(
2087
+ i.anchorSlot && Tr(
2083
2088
  /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-0 top-0 h-7 w-px" }) }),
2084
2089
  i.anchorSlot
2085
2090
  ),
@@ -2095,10 +2100,10 @@ function Ji({ variant: e }) {
2095
2100
  )
2096
2101
  ]
2097
2102
  }
2098
- ) : /* @__PURE__ */ r(Ie, { onOpenChange: (o) => {
2099
- o && s();
2103
+ ) : /* @__PURE__ */ s(Ie, { onOpenChange: (o) => {
2104
+ o && r();
2100
2105
  }, children: [
2101
- /* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ r(
2106
+ /* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ s(
2102
2107
  L,
2103
2108
  {
2104
2109
  variant: e ?? "ghost",
@@ -2122,19 +2127,19 @@ function Ji({ variant: e }) {
2122
2127
  ] });
2123
2128
  }
2124
2129
  function ra() {
2125
- const e = Lt(), a = xn(), { rows: s, browserRows: n, activeTruncated: i } = e.snapshot, o = s.some((d) => ft(d.item.status)), l = [
2126
- ...s.filter((d) => !ft(d.item.status)).map((d) => ({ startedAt: d.item.startedAt, row: d })),
2127
- ...n.map((d) => ({ startedAt: d.startedAt, work: d }))
2128
- ].sort((d, h) => h.startedAt.localeCompare(d.startedAt)), u = s.filter((d) => ft(d.item.status)), c = s.length + n.length;
2129
- return c === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
2130
- /* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(vn, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
2130
+ const e = Lt(), a = vn(), { rows: r, browserRows: n, activeTruncated: i } = e.snapshot, o = r.some((c) => ft(c.item.status)), l = [
2131
+ ...r.filter((c) => !ft(c.item.status)).map((c) => ({ startedAt: c.item.startedAt, row: c })),
2132
+ ...n.map((c) => ({ startedAt: c.startedAt, work: c }))
2133
+ ].sort((c, u) => u.startedAt.localeCompare(c.startedAt)), h = r.filter((c) => ft(c.item.status)), d = r.length + n.length;
2134
+ return d === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
2135
+ /* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(yn, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
2131
2136
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: ge.title }),
2132
2137
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: ge.empty })
2133
- ] }) : /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
2134
- /* @__PURE__ */ r("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
2138
+ ] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
2139
+ /* @__PURE__ */ s("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
2135
2140
  /* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: ge.title }),
2136
- /* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: c }),
2137
- /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-0.5", children: [
2141
+ /* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: d }),
2142
+ /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-0.5", children: [
2138
2143
  o && /* @__PURE__ */ t(
2139
2144
  L,
2140
2145
  {
@@ -2160,13 +2165,13 @@ function ra() {
2160
2165
  ] })
2161
2166
  ] }),
2162
2167
  i && /* @__PURE__ */ t("p", { className: "border-b border-border px-3 py-2 text-[12px] leading-4 text-muted-foreground", children: ge.truncated }),
2163
- /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ r("div", { className: "divide-y divide-border/70", children: [
2164
- l.map((d) => "work" in d ? /* @__PURE__ */ t(ms, { work: d.work, now: a }, d.work.id) : /* @__PURE__ */ t(na, { row: d.row, now: a, api: e }, $t(d.row))),
2165
- u.map((d) => /* @__PURE__ */ t(na, { row: d, now: a, api: e }, $t(d)))
2168
+ /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ s("div", { className: "divide-y divide-border/70", children: [
2169
+ l.map((c) => "work" in c ? /* @__PURE__ */ t(ps, { work: c.work, now: a }, c.work.id) : /* @__PURE__ */ t(na, { row: c.row, now: a, api: e }, $t(c.row))),
2170
+ h.map((c) => /* @__PURE__ */ t(na, { row: c, now: a, api: e }, $t(c)))
2166
2171
  ] }) })
2167
2172
  ] });
2168
2173
  }
2169
- function ps(e) {
2174
+ function fs(e) {
2170
2175
  if (e)
2171
2176
  return {
2172
2177
  renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
@@ -2175,19 +2180,19 @@ function ps(e) {
2175
2180
  affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
2176
2181
  };
2177
2182
  }
2178
- function fs({
2183
+ function gs({
2179
2184
  open: e,
2180
2185
  onOpenChange: a,
2181
- trigger: s,
2186
+ trigger: r,
2182
2187
  showTrigger: n = !0,
2183
2188
  initialMode: i = "manage"
2184
2189
  }) {
2185
2190
  const o = i === "create", {
2186
2191
  forceClose: l,
2187
- handleOpenChange: u,
2188
- isCreateFlowActive: c,
2189
- preventPassiveDismissDuringCreate: d,
2190
- resolvedOpen: h,
2192
+ handleOpenChange: h,
2193
+ isCreateFlowActive: d,
2194
+ preventPassiveDismissDuringCreate: c,
2195
+ resolvedOpen: u,
2191
2196
  setIsCreateFlowActive: p
2192
2197
  } = Sa({
2193
2198
  open: e,
@@ -2200,7 +2205,7 @@ function fs({
2200
2205
  // create and make consumers use `forceClose()` from a dedicated
2201
2206
  // button.
2202
2207
  dismissMode: n ? "passive" : "explicit-only"
2203
- }), m = w((v) => v.dashboard), { setDashboardControlsModel: f } = ve(), { participants: g } = yn(Lr(m)), y = Array.from(
2208
+ }), m = N((v) => v.dashboard), { setDashboardControlsModel: f } = ve(), { participants: g } = Nn(Vr(m)), y = Array.from(
2204
2209
  new Map(
2205
2210
  g.flatMap(
2206
2211
  (v) => v.fieldChoices.map((T) => {
@@ -2215,7 +2220,7 @@ function fs({
2215
2220
  })
2216
2221
  )
2217
2222
  ).values()
2218
- ), N = Array.from(
2223
+ ), C = Array.from(
2219
2224
  new Map(
2220
2225
  g.flatMap(
2221
2226
  (v) => v.metricChoices.map((T) => {
@@ -2230,14 +2235,14 @@ function fs({
2230
2235
  })
2231
2236
  )
2232
2237
  ).values()
2233
- ), k = sr({
2238
+ ), k = ir({
2234
2239
  ...m || {},
2235
2240
  controls: []
2236
- }), V = Nn(m), P = (v, T, F) => {
2241
+ }), V = Cn(m), P = (v, T, F) => {
2237
2242
  f(
2238
2243
  v,
2239
2244
  T,
2240
- ps(F)
2245
+ fs(F)
2241
2246
  );
2242
2247
  }, D = ie(() => {
2243
2248
  if (o) {
@@ -2252,9 +2257,9 @@ function fs({
2252
2257
  controls: m.controls || [],
2253
2258
  reservedControlIds: k,
2254
2259
  defaultValues: m.defaultControlValues || {},
2255
- usageByControlId: Cn(m),
2260
+ usageByControlId: wn(m),
2256
2261
  availableFieldChoices: y,
2257
- availableMetricChoices: N,
2262
+ availableMetricChoices: C,
2258
2263
  structuralParticipants: g,
2259
2264
  structuralParticipantIdsByControlId: V,
2260
2265
  initialCreateFlow: i === "create",
@@ -2263,15 +2268,15 @@ function fs({
2263
2268
  onChange: P,
2264
2269
  emptyMessage: "No dashboard controls yet."
2265
2270
  }
2266
- ), b = c ? "Add dashboard control" : "Dashboard Controls", S = /* @__PURE__ */ r(U, { children: [
2267
- /* @__PURE__ */ r("div", { className: "space-y-1", children: [
2271
+ ), b = d ? "Add dashboard control" : "Dashboard Controls", S = /* @__PURE__ */ s(U, { children: [
2272
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
2268
2273
  /* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
2269
2274
  /* @__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." })
2270
2275
  ] }),
2271
2276
  O
2272
2277
  ] });
2273
- return n ? /* @__PURE__ */ r(Ie, { open: h, onOpenChange: u, children: [
2274
- /* @__PURE__ */ t(nt, { asChild: !0, children: s || /* @__PURE__ */ r(L, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
2278
+ return n ? /* @__PURE__ */ s(Ie, { open: u, onOpenChange: h, children: [
2279
+ /* @__PURE__ */ t(nt, { asChild: !0, children: r || /* @__PURE__ */ s(L, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
2275
2280
  /* @__PURE__ */ t(Ca, { className: "mr-2 h-4 w-4" }),
2276
2281
  "Controls"
2277
2282
  ] }) }),
@@ -2280,29 +2285,29 @@ function fs({
2280
2285
  {
2281
2286
  className: "w-[620px] max-w-[95vw] space-y-4",
2282
2287
  align: "end",
2283
- onEscapeKeyDown: d,
2284
- onPointerDownOutside: d,
2288
+ onEscapeKeyDown: c,
2289
+ onPointerDownOutside: c,
2285
2290
  children: S
2286
2291
  }
2287
2292
  )
2288
- ] }) : /* @__PURE__ */ t(Le, { open: h, onOpenChange: u, children: /* @__PURE__ */ r(
2293
+ ] }) : /* @__PURE__ */ t(Le, { open: u, onOpenChange: h, children: /* @__PURE__ */ s(
2289
2294
  Ve,
2290
2295
  {
2291
2296
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
2292
- onEscapeKeyDown: d,
2293
- onPointerDownOutside: d,
2297
+ onEscapeKeyDown: c,
2298
+ onPointerDownOutside: c,
2294
2299
  children: [
2295
- /* @__PURE__ */ r(
2300
+ /* @__PURE__ */ s(
2296
2301
  Tt,
2297
2302
  {
2298
- className: c ? "space-y-0" : void 0,
2303
+ className: d ? "space-y-0" : void 0,
2299
2304
  children: [
2300
2305
  /* @__PURE__ */ t(Pe, { className: "text-[15px]", children: b }),
2301
2306
  /* @__PURE__ */ t(
2302
2307
  ut,
2303
2308
  {
2304
- className: c ? "sr-only" : "text-[13px]",
2305
- children: c ? "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."
2309
+ className: d ? "sr-only" : "text-[13px]",
2310
+ 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."
2306
2311
  }
2307
2312
  )
2308
2313
  ]
@@ -2313,7 +2318,7 @@ function fs({
2313
2318
  }
2314
2319
  ) });
2315
2320
  }
2316
- const gs = [
2321
+ const bs = [
2317
2322
  "enum",
2318
2323
  "multi_enum",
2319
2324
  "text",
@@ -2321,57 +2326,57 @@ const gs = [
2321
2326
  "boolean",
2322
2327
  "date"
2323
2328
  ];
2324
- function bs({
2329
+ function xs({
2325
2330
  open: e,
2326
2331
  onOpenChange: a,
2327
- initialMode: s = "manage"
2332
+ initialMode: r = "manage"
2328
2333
  }) {
2329
2334
  var S;
2330
- const n = s === "create", {
2335
+ const n = r === "create", {
2331
2336
  forceClose: i,
2332
2337
  handleOpenChange: o,
2333
2338
  isCreateFlowActive: l,
2334
- preventPassiveDismissDuringCreate: u,
2335
- resolvedOpen: c,
2336
- setIsCreateFlowActive: d
2339
+ preventPassiveDismissDuringCreate: h,
2340
+ resolvedOpen: d,
2341
+ setIsCreateFlowActive: c
2337
2342
  } = Sa({
2338
2343
  open: e,
2339
2344
  onOpenChange: a,
2340
- initialCreateFlowActive: s === "create",
2345
+ initialCreateFlowActive: r === "create",
2341
2346
  dismissMode: "explicit-only"
2342
- }), h = w((v) => v.dashboard), p = w((v) => v.selectedSheetId), { setDashboardInputs: m } = ve(), f = (S = h.sheets) == null ? void 0 : S.find(
2347
+ }), u = N((v) => v.dashboard), p = N((v) => v.selectedSheetId), { setDashboardInputs: m } = ve(), f = (S = u.sheets) == null ? void 0 : S.find(
2343
2348
  (v) => v.id === p
2344
2349
  ), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, y = Y(
2345
- () => g && (f != null && f.document) ? ir(h, f.id) : [],
2346
- [h, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
2347
- ), N = Y(
2350
+ () => g && (f != null && f.document) ? or(u, f.id) : [],
2351
+ [u, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
2352
+ ), C = Y(
2348
2353
  () => y.filter(
2349
2354
  (v) => v.kind === "control"
2350
2355
  ),
2351
2356
  [y]
2352
2357
  ), k = Y(
2353
- () => N.map((v) => v.control),
2354
- [N]
2358
+ () => C.map((v) => v.control),
2359
+ [C]
2355
2360
  ), V = Y(
2356
- () => vs(k),
2361
+ () => ys(k),
2357
2362
  [k]
2358
2363
  ), P = Y(
2359
2364
  () => [
2360
- ...xs(h),
2361
- ...(h.variables ?? []).map((v) => v.name)
2365
+ ...vs(u),
2366
+ ...(u.variables ?? []).map((v) => v.name)
2362
2367
  ],
2363
- [h]
2368
+ [u]
2364
2369
  ), D = ie(() => {
2365
2370
  if (n) {
2366
2371
  i();
2367
2372
  return;
2368
2373
  }
2369
- d(!1);
2370
- }, [n, i, d]), O = ie(
2374
+ c(!1);
2375
+ }, [n, i, c]), O = ie(
2371
2376
  (v, T, F) => {
2372
2377
  !g || !(f != null && f.document) || m(
2373
- Ns({
2374
- dashboard: h,
2378
+ Cs({
2379
+ dashboard: u,
2375
2380
  documentSheetId: f.id,
2376
2381
  currentDocumentInputs: y,
2377
2382
  nextControls: v,
@@ -2381,21 +2386,21 @@ function bs({
2381
2386
  );
2382
2387
  },
2383
2388
  [
2384
- h,
2389
+ u,
2385
2390
  y,
2386
2391
  g,
2387
2392
  f,
2388
2393
  m
2389
2394
  ]
2390
2395
  );
2391
- return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(Le, { open: c, onOpenChange: o, children: /* @__PURE__ */ r(
2396
+ return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(Le, { open: d, onOpenChange: o, children: /* @__PURE__ */ s(
2392
2397
  Ve,
2393
2398
  {
2394
2399
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
2395
- onEscapeKeyDown: u,
2396
- onPointerDownOutside: u,
2400
+ onEscapeKeyDown: h,
2401
+ onPointerDownOutside: h,
2397
2402
  children: [
2398
- /* @__PURE__ */ r(Tt, { className: l ? "space-y-0" : void 0, children: [
2403
+ /* @__PURE__ */ s(Tt, { className: l ? "space-y-0" : void 0, children: [
2399
2404
  /* @__PURE__ */ t(Pe, { className: "text-[15px]", children: l ? "Add document control" : "Document Controls" }),
2400
2405
  /* @__PURE__ */ t(
2401
2406
  ut,
@@ -2417,9 +2422,9 @@ function bs({
2417
2422
  availableMetricChoices: [],
2418
2423
  structuralParticipants: [],
2419
2424
  structuralParticipantIdsByControlId: {},
2420
- allowedControlTypes: gs,
2421
- initialCreateFlow: s === "create",
2422
- onCreateFlowActiveChange: d,
2425
+ allowedControlTypes: bs,
2426
+ initialCreateFlow: r === "create",
2427
+ onCreateFlowActiveChange: c,
2423
2428
  onCreateFlowComplete: D,
2424
2429
  onChange: O,
2425
2430
  emptyMessage: "No document controls yet."
@@ -2429,25 +2434,25 @@ function bs({
2429
2434
  }
2430
2435
  ) });
2431
2436
  }
2432
- function xs(e) {
2437
+ function vs(e) {
2433
2438
  return (e.controls || []).map((a) => a.id);
2434
2439
  }
2435
- function vs(e) {
2440
+ function ys(e) {
2436
2441
  const a = {};
2437
- for (const s of e)
2438
- s.defaultValue !== void 0 && (a[s.id] = s.defaultValue);
2442
+ for (const r of e)
2443
+ r.defaultValue !== void 0 && (a[r.id] = r.defaultValue);
2439
2444
  return a;
2440
2445
  }
2441
- function ys(e, a) {
2446
+ function Ns(e, a) {
2442
2447
  return a ? Object.prototype.hasOwnProperty.call(a, e.id) ? {
2443
2448
  ...e,
2444
2449
  defaultValue: a[e.id]
2445
2450
  } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
2446
2451
  }
2447
- function Ns({
2452
+ function Cs({
2448
2453
  dashboard: e,
2449
2454
  documentSheetId: a,
2450
- currentDocumentInputs: s,
2455
+ currentDocumentInputs: r,
2451
2456
  nextControls: n,
2452
2457
  nextDefaultValues: i,
2453
2458
  change: o
@@ -2455,61 +2460,61 @@ function Ns({
2455
2460
  const l = new Map(
2456
2461
  n.map((f) => [
2457
2462
  f.id,
2458
- ys(f, i)
2463
+ Ns(f, i)
2459
2464
  ])
2460
- ), u = (o == null ? void 0 : o.type) === "rename" ? { oldId: o.oldId, newId: o.newId } : null, c = /* @__PURE__ */ new Set(), d = [];
2461
- for (const f of s) {
2465
+ ), h = (o == null ? void 0 : o.type) === "rename" ? { oldId: o.oldId, newId: o.newId } : null, d = /* @__PURE__ */ new Set(), c = [];
2466
+ for (const f of r) {
2462
2467
  if (f.kind !== "control") {
2463
- d.push(f);
2468
+ c.push(f);
2464
2469
  continue;
2465
2470
  }
2466
- const g = l.get(f.control.id) || ((u == null ? void 0 : u.oldId) === f.control.id ? l.get(u.newId) : void 0);
2471
+ const g = l.get(f.control.id) || ((h == null ? void 0 : h.oldId) === f.control.id ? l.get(h.newId) : void 0);
2467
2472
  if (!g)
2468
2473
  continue;
2469
- c.add(g.id);
2470
- const y = or(
2474
+ d.add(g.id);
2475
+ const y = lr(
2471
2476
  e,
2472
2477
  { name: g.id },
2473
- { exclude: { source: "input", inputId: f.id }, alsoTaken: d }
2474
- ), N = g.id === y ? g : { ...g, id: y };
2475
- d.push({
2478
+ { exclude: { source: "input", inputId: f.id }, alsoTaken: c }
2479
+ ), C = g.id === y ? g : { ...g, id: y };
2480
+ c.push({
2476
2481
  ...f,
2477
- label: N.label,
2482
+ label: C.label,
2478
2483
  variableName: y,
2479
- requiredAtExecution: N.requiredAtExecution,
2480
- control: N
2484
+ requiredAtExecution: C.requiredAtExecution,
2485
+ control: C
2481
2486
  });
2482
2487
  }
2483
2488
  for (const f of l.values())
2484
- c.has(f.id) || d.push(
2485
- lr({
2489
+ d.has(f.id) || c.push(
2490
+ dr({
2486
2491
  control: f,
2487
2492
  dashboard: e,
2488
- alsoTaken: d,
2493
+ alsoTaken: c,
2489
2494
  sheetId: a
2490
2495
  })
2491
2496
  );
2492
- const h = new Set(
2493
- s.map((f) => f.id)
2497
+ const u = new Set(
2498
+ r.map((f) => f.id)
2494
2499
  );
2495
2500
  return [...(Array.isArray(e.inputs) ? e.inputs : []).filter(
2496
- (f) => !h.has(f.id)
2497
- ), ...d];
2501
+ (f) => !u.has(f.id)
2502
+ ), ...c];
2498
2503
  }
2499
- function Cs({
2504
+ function ws({
2500
2505
  showFilters: e,
2501
2506
  onShowFiltersChange: a,
2502
- pickerContent: s,
2507
+ pickerContent: r,
2503
2508
  settingsContent: n,
2504
2509
  size: i = "default",
2505
2510
  className: o,
2506
2511
  primaryButtonClassName: l,
2507
- secondaryButtonClassName: u,
2508
- pickerContentClassName: c,
2509
- settingsContentClassName: d
2512
+ secondaryButtonClassName: h,
2513
+ pickerContentClassName: d,
2514
+ settingsContentClassName: c
2510
2515
  }) {
2511
- const h = i === "toolbar", [p, m] = E(!1), f = it("interactive");
2512
- return /* @__PURE__ */ r(
2516
+ const u = i === "toolbar", [p, m] = E(!1), f = it("interactive");
2517
+ return /* @__PURE__ */ s(
2513
2518
  "div",
2514
2519
  {
2515
2520
  className: Z(
@@ -2517,12 +2522,12 @@ function Cs({
2517
2522
  // h-7 box (matches regular `size="xs"` buttons). Inner triggers
2518
2523
  // stretch to fill via `h-full`.
2519
2524
  "relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
2520
- h ? "h-8" : "h-7",
2525
+ u ? "h-8" : "h-7",
2521
2526
  o
2522
2527
  ),
2523
2528
  children: [
2524
- /* @__PURE__ */ r(Ie, { open: e, onOpenChange: a, children: [
2525
- /* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ r(
2529
+ /* @__PURE__ */ s(Ie, { open: e, onOpenChange: a, children: [
2530
+ /* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ s(
2526
2531
  L,
2527
2532
  {
2528
2533
  variant: "ghost",
@@ -2532,7 +2537,7 @@ function Cs({
2532
2537
  l
2533
2538
  ),
2534
2539
  children: [
2535
- e ? /* @__PURE__ */ t(Dr, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(xa, { className: "h-3.5 w-3.5" }),
2540
+ e ? /* @__PURE__ */ t(Ar, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(xa, { className: "h-3.5 w-3.5" }),
2536
2541
  "Filter"
2537
2542
  ]
2538
2543
  }
@@ -2544,14 +2549,14 @@ function Cs({
2544
2549
  sideOffset: 6,
2545
2550
  className: Z(
2546
2551
  "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)]",
2547
- c
2552
+ d
2548
2553
  ),
2549
2554
  style: f.contentStyle,
2550
- children: s
2555
+ children: r
2551
2556
  }
2552
2557
  )
2553
2558
  ] }),
2554
- /* @__PURE__ */ r(Ie, { open: p, onOpenChange: m, children: [
2559
+ /* @__PURE__ */ s(Ie, { open: p, onOpenChange: m, children: [
2555
2560
  /* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ t(
2556
2561
  L,
2557
2562
  {
@@ -2559,7 +2564,7 @@ function Cs({
2559
2564
  size: "xs",
2560
2565
  className: Z(
2561
2566
  "h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
2562
- u
2567
+ h
2563
2568
  ),
2564
2569
  "aria-label": "Filter and control actions",
2565
2570
  children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
@@ -2572,7 +2577,7 @@ function Cs({
2572
2577
  sideOffset: 6,
2573
2578
  className: Z(
2574
2579
  "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)]",
2575
- d
2580
+ c
2576
2581
  ),
2577
2582
  style: f.contentStyle,
2578
2583
  children: n(() => m(!1))
@@ -2583,72 +2588,72 @@ function Cs({
2583
2588
  }
2584
2589
  );
2585
2590
  }
2586
- function ws() {
2587
- Ar();
2588
- const e = w((c) => c.selectedSheetId), a = w((c) => c.selectedFrameId), s = w((c) => c.dashboard), n = w((c) => c.actions.getSelectedFrame), { setSelectedFrameId: i } = ve(), { setCard: o } = dt(), l = oe((c) => c.card.dataSource);
2591
+ function Ss() {
2592
+ Fr();
2593
+ const e = N((d) => d.selectedSheetId), a = N((d) => d.selectedFrameId), r = N((d) => d.dashboard), n = N((d) => d.actions.getSelectedFrame), { setSelectedFrameId: i } = ve(), { setCard: o } = dt(), l = oe((d) => d.card.dataSource);
2589
2594
  return Ee(() => {
2590
- var d, h;
2591
- let c = n();
2592
- if (!c) {
2593
- const p = (d = s == null ? void 0 : s.sheets) == null ? void 0 : d.find((f) => f.id === e), m = (h = p == null ? void 0 : p.frames) == null ? void 0 : h[0];
2594
- m && (i(m.id), c = m);
2595
+ var c, u;
2596
+ let d = n();
2597
+ if (!d) {
2598
+ const p = (c = r == null ? void 0 : r.sheets) == null ? void 0 : c.find((f) => f.id === e), m = (u = p == null ? void 0 : p.frames) == null ? void 0 : u[0];
2599
+ m && (i(m.id), d = m);
2595
2600
  }
2596
- if (c) {
2597
- const p = c.cards.find((m) => m.id === c.activeCardId);
2601
+ if (d) {
2602
+ const p = d.cards.find((m) => m.id === d.activeCardId);
2598
2603
  p && o(p);
2599
2604
  }
2600
- }, [n, e, a, s, i, o]), {
2605
+ }, [n, e, a, r, i, o]), {
2601
2606
  hasEntities: !!(l != null && l.selectedEntities && l.selectedEntities.length > 0)
2602
2607
  };
2603
2608
  }
2604
- function Ss() {
2605
- const e = w((c) => c.dashboard), a = w(
2606
- (c) => c.semanticExecutionPayload
2607
- ), s = w(
2608
- (c) => c.actions.addFilterInput
2609
- ), { hasEntities: n } = ws(), { isLoading: i } = wn(), o = Y(
2610
- () => dr(e, a),
2609
+ function ks() {
2610
+ const e = N((d) => d.dashboard), a = N(
2611
+ (d) => d.semanticExecutionPayload
2612
+ ), r = N(
2613
+ (d) => d.actions.addFilterInput
2614
+ ), { hasEntities: n } = Ss(), { isLoading: i } = Sn(), o = Y(
2615
+ () => cr(e, a),
2611
2616
  [e, a]
2612
- ), u = !cr(e) && o.hasEligibleCards && !i;
2613
- return /* @__PURE__ */ r("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
2614
- u && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ r(
2617
+ ), h = !ur(e) && o.hasEligibleCards && !i;
2618
+ return /* @__PURE__ */ s("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
2619
+ h && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ s(
2615
2620
  "button",
2616
2621
  {
2617
2622
  type: "button",
2618
- onClick: () => s(ur(), {
2623
+ onClick: () => r(hr(), {
2619
2624
  kind: "allSheets",
2620
2625
  sheetKinds: ["dashboard"]
2621
2626
  }),
2622
2627
  title: `Applies to ${o.eligibleCardCount} of ${o.totalCardCount} date-aware cards`,
2623
2628
  className: "flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
2624
2629
  children: [
2625
- /* @__PURE__ */ t(Sn, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
2626
- /* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col", children: [
2630
+ /* @__PURE__ */ t(kn, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
2631
+ /* @__PURE__ */ s("span", { className: "flex min-w-0 flex-col", children: [
2627
2632
  /* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
2628
2633
  /* @__PURE__ */ t("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
2629
2634
  ] })
2630
2635
  ]
2631
2636
  }
2632
2637
  ) }),
2633
- !n && /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
2634
- /* @__PURE__ */ t(kn, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
2638
+ !n && /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
2639
+ /* @__PURE__ */ t(Dn, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
2635
2640
  /* @__PURE__ */ t("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
2636
2641
  /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
2637
2642
  ] }),
2638
- n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(Dn, { context: "filter" }) })
2643
+ n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(An, { context: "filter" }) })
2639
2644
  ] });
2640
2645
  }
2641
- function ks({
2646
+ function Ds({
2642
2647
  onAddFilter: e,
2643
2648
  onAddControl: a,
2644
- onManageControls: s,
2649
+ onManageControls: r,
2645
2650
  onDismiss: n
2646
2651
  }) {
2647
- const i = w(
2648
- (u) => u.dashboard.filterLayout
2652
+ const i = N(
2653
+ (h) => h.dashboard.filterLayout
2649
2654
  ), { setFilterLayout: o } = ve(), l = (i == null ? void 0 : i.toolbarWrap) ?? !1;
2650
- return /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
2651
- /* @__PURE__ */ r("div", { className: "p-1", children: [
2655
+ return /* @__PURE__ */ s("div", { className: "w-[300px]", children: [
2656
+ /* @__PURE__ */ s("div", { className: "p-1", children: [
2652
2657
  /* @__PURE__ */ t(
2653
2658
  xt,
2654
2659
  {
@@ -2675,21 +2680,21 @@ function ks({
2675
2680
  icon: Vt,
2676
2681
  label: "Manage controls",
2677
2682
  onClick: () => {
2678
- s(), n();
2683
+ r(), n();
2679
2684
  }
2680
2685
  }
2681
2686
  )
2682
2687
  ] }),
2683
2688
  /* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
2684
- /* @__PURE__ */ r("div", { className: "space-y-1 p-2", children: [
2689
+ /* @__PURE__ */ s("div", { className: "space-y-1 p-2", children: [
2685
2690
  /* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
2686
2691
  /* @__PURE__ */ t(
2687
- Ds,
2692
+ As,
2688
2693
  {
2689
2694
  id: "filter-display-wrap",
2690
2695
  label: "Wrap to multiple lines",
2691
2696
  checked: l,
2692
- onCheckedChange: (u) => o({ toolbarWrap: u === !0 })
2697
+ onCheckedChange: (h) => o({ toolbarWrap: h === !0 })
2693
2698
  }
2694
2699
  )
2695
2700
  ] })
@@ -2698,13 +2703,13 @@ function ks({
2698
2703
  function xt({
2699
2704
  icon: e,
2700
2705
  label: a,
2701
- onClick: s
2706
+ onClick: r
2702
2707
  }) {
2703
- return /* @__PURE__ */ r(
2708
+ return /* @__PURE__ */ s(
2704
2709
  "button",
2705
2710
  {
2706
2711
  type: "button",
2707
- onClick: s,
2712
+ onClick: r,
2708
2713
  className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",
2709
2714
  children: [
2710
2715
  /* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-muted-foreground" }),
@@ -2713,14 +2718,14 @@ function xt({
2713
2718
  }
2714
2719
  );
2715
2720
  }
2716
- function Ds({
2721
+ function As({
2717
2722
  id: e,
2718
2723
  label: a,
2719
- checked: s,
2724
+ checked: r,
2720
2725
  onCheckedChange: n
2721
2726
  }) {
2722
- 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: [
2723
- /* @__PURE__ */ t(It, { id: e, checked: s, onCheckedChange: n }),
2727
+ return /* @__PURE__ */ s("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: [
2728
+ /* @__PURE__ */ t(It, { id: e, checked: r, onCheckedChange: n }),
2724
2729
  /* @__PURE__ */ t(
2725
2730
  Me,
2726
2731
  {
@@ -2731,25 +2736,25 @@ function Ds({
2731
2736
  )
2732
2737
  ] });
2733
2738
  }
2734
- function eo({
2739
+ function to({
2735
2740
  size: e,
2736
2741
  className: a,
2737
- primaryButtonClassName: s,
2742
+ primaryButtonClassName: r,
2738
2743
  secondaryButtonClassName: n,
2739
2744
  pickerContentClassName: i,
2740
2745
  settingsContentClassName: o
2741
2746
  }) {
2742
2747
  var O;
2743
- const [l, u] = E(null), c = w((b) => b.dashboard), d = w((b) => b.selectedSheetId), h = w((b) => b.showFilters), p = w((b) => b.actions), { setDocumentPanelTarget: m, setShowFilters: f } = p, g = (O = c.sheets) == null ? void 0 : O.find(
2744
- (b) => b.id === d
2745
- ), y = Ke(g), N = ie((b) => {
2748
+ const [l, h] = E(null), d = N((b) => b.dashboard), c = N((b) => b.selectedSheetId), u = N((b) => b.showFilters), p = N((b) => b.actions), { setDocumentPanelTarget: m, setShowFilters: f } = p, g = (O = d.sheets) == null ? void 0 : O.find(
2749
+ (b) => b.id === c
2750
+ ), y = Ke(g), C = ie((b) => {
2746
2751
  window.setTimeout(() => {
2747
- u(b);
2752
+ h(b);
2748
2753
  }, 0);
2749
2754
  }, []), k = ie(
2750
2755
  (b) => {
2751
- if (y && d) {
2752
- b && m(d, {
2756
+ if (y && c) {
2757
+ b && m(c, {
2753
2758
  kind: "document",
2754
2759
  group: "inputs"
2755
2760
  });
@@ -2759,26 +2764,26 @@ function eo({
2759
2764
  },
2760
2765
  [
2761
2766
  y,
2762
- d,
2767
+ c,
2763
2768
  m,
2764
2769
  f
2765
2770
  ]
2766
2771
  ), V = ie(() => {
2767
2772
  k(!0);
2768
2773
  }, [k]), P = ie(() => {
2769
- N("create");
2770
- }, [N]), D = ie(() => {
2771
- N("manage");
2772
- }, [N]);
2773
- return /* @__PURE__ */ r(U, { children: [
2774
+ C("create");
2775
+ }, [C]), D = ie(() => {
2776
+ C("manage");
2777
+ }, [C]);
2778
+ return /* @__PURE__ */ s(U, { children: [
2774
2779
  /* @__PURE__ */ t(
2775
- Cs,
2780
+ ws,
2776
2781
  {
2777
- showFilters: y ? !1 : h,
2782
+ showFilters: y ? !1 : u,
2778
2783
  onShowFiltersChange: k,
2779
- pickerContent: /* @__PURE__ */ t(Ss, {}),
2784
+ pickerContent: /* @__PURE__ */ t(ks, {}),
2780
2785
  settingsContent: (b) => /* @__PURE__ */ t(
2781
- ks,
2786
+ Ds,
2782
2787
  {
2783
2788
  onAddFilter: V,
2784
2789
  onAddControl: P,
@@ -2788,27 +2793,27 @@ function eo({
2788
2793
  ),
2789
2794
  size: e,
2790
2795
  className: a,
2791
- primaryButtonClassName: s,
2796
+ primaryButtonClassName: r,
2792
2797
  secondaryButtonClassName: n,
2793
2798
  pickerContentClassName: i,
2794
2799
  settingsContentClassName: o
2795
2800
  }
2796
2801
  ),
2797
2802
  l ? y ? /* @__PURE__ */ t(
2798
- bs,
2803
+ xs,
2799
2804
  {
2800
2805
  open: !0,
2801
2806
  onOpenChange: (b) => {
2802
- b || u(null);
2807
+ b || h(null);
2803
2808
  },
2804
2809
  initialMode: l
2805
2810
  }
2806
2811
  ) : /* @__PURE__ */ t(
2807
- fs,
2812
+ gs,
2808
2813
  {
2809
2814
  open: !0,
2810
2815
  onOpenChange: (b) => {
2811
- b || u(null);
2816
+ b || h(null);
2812
2817
  },
2813
2818
  showTrigger: !1,
2814
2819
  initialMode: l
@@ -2816,45 +2821,45 @@ function eo({
2816
2821
  ) : null
2817
2822
  ] });
2818
2823
  }
2819
- function As(e, a) {
2820
- return (e.variables ?? []).map((s) => {
2821
- const n = Vr(e, s.id);
2824
+ function Fs(e, a) {
2825
+ return (e.variables ?? []).map((r) => {
2826
+ const n = Pr(e, r.id);
2822
2827
  return {
2823
- variable: s,
2824
- question: _r(s),
2828
+ variable: r,
2829
+ question: Or(r),
2825
2830
  places: n,
2826
2831
  usedHere: !!a && n.some((i) => i.sheetId === a)
2827
2832
  };
2828
2833
  });
2829
2834
  }
2830
- function Fs(e, a) {
2831
- const s = a ? e.places.filter((i) => i.sheetId === a).length : 0, n = e.places.length - s;
2832
- return e.places.length ? s && n ? `Used here · ${n} elsewhere` : s ? "Used here" : `Used in ${n} ${n === 1 ? "place" : "places"}` : "Not used yet";
2835
+ function Es(e, a) {
2836
+ const r = a ? e.places.filter((i) => i.sheetId === a).length : 0, n = e.places.length - r;
2837
+ return e.places.length ? r && n ? `Used here · ${n} elsewhere` : r ? "Used here" : `Used in ${n} ${n === 1 ? "place" : "places"}` : "Not used yet";
2833
2838
  }
2834
- function Es({
2839
+ function Is({
2835
2840
  dashboard: e,
2836
2841
  sheetId: a,
2837
- sheetTitle: s,
2842
+ sheetTitle: r,
2838
2843
  onOpen: n,
2839
2844
  onNew: i
2840
2845
  }) {
2841
- const [o, l] = E(""), u = Y(() => As(e, a), [e, a]), c = o.trim().toLowerCase(), d = u.filter(
2842
- (m) => !c || m.variable.name.toLowerCase().includes(c) || (m.variable.label ?? "").toLowerCase().includes(c) || m.question.toLowerCase().includes(c)
2843
- ), h = d.filter((m) => m.usedHere), p = d.filter((m) => !m.usedHere);
2844
- return /* @__PURE__ */ r("div", { className: "w-[380px] max-w-[calc(100vw-24px)] overflow-hidden", "data-testid": "variables-list", children: [
2845
- /* @__PURE__ */ r("div", { className: "flex h-11 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
2846
- /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
2846
+ const [o, l] = E(""), h = Y(() => Fs(e, a), [e, a]), d = o.trim().toLowerCase(), c = h.filter(
2847
+ (m) => !d || m.variable.name.toLowerCase().includes(d) || (m.variable.label ?? "").toLowerCase().includes(d) || m.question.toLowerCase().includes(d)
2848
+ ), u = c.filter((m) => m.usedHere), p = c.filter((m) => !m.usedHere);
2849
+ return /* @__PURE__ */ s("div", { className: "w-[380px] max-w-[calc(100vw-24px)] overflow-hidden", "data-testid": "variables-list", children: [
2850
+ /* @__PURE__ */ s("div", { className: "flex h-11 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
2851
+ /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
2847
2852
  /* @__PURE__ */ t(Nt, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
2848
2853
  /* @__PURE__ */ t("span", { className: "text-[13px] font-medium", children: "Data variables" }),
2849
- u.length ? /* @__PURE__ */ t("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground", children: u.length }) : null
2854
+ h.length ? /* @__PURE__ */ t("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground", children: h.length }) : null
2850
2855
  ] }),
2851
- u.length ? /* @__PURE__ */ r(L, { size: "xs", className: "gap-1", onClick: i, children: [
2856
+ h.length ? /* @__PURE__ */ s(L, { size: "xs", className: "gap-1", onClick: i, children: [
2852
2857
  /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
2853
2858
  " New variable"
2854
2859
  ] }) : null
2855
2860
  ] }),
2856
- u.length ? /* @__PURE__ */ r(U, { children: [
2857
- /* @__PURE__ */ t("div", { className: "px-3 py-2", children: /* @__PURE__ */ r("div", { className: "flex h-7 items-center gap-1.5 rounded-control border border-border px-2 text-[12px] text-muted-foreground", children: [
2861
+ h.length ? /* @__PURE__ */ s(U, { children: [
2862
+ /* @__PURE__ */ t("div", { className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "flex h-7 items-center gap-1.5 rounded-control border border-border px-2 text-[12px] text-muted-foreground", children: [
2858
2863
  /* @__PURE__ */ t(da, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
2859
2864
  /* @__PURE__ */ t(
2860
2865
  "input",
@@ -2867,18 +2872,18 @@ function Es({
2867
2872
  }
2868
2873
  )
2869
2874
  ] }) }),
2870
- /* @__PURE__ */ r("div", { className: "max-h-[360px] overflow-y-auto", children: [
2871
- h.length ? /* @__PURE__ */ t(sa, { children: s ? `On ${s}` : "On this tab" }) : null,
2872
- h.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n }, m.variable.id)),
2873
- p.length ? /* @__PURE__ */ t(sa, { children: h.length ? "Elsewhere on this dashboard" : "On this dashboard" }) : null,
2874
- p.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n, muted: !!h.length }, m.variable.id)),
2875
- d.length ? null : /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-muted-foreground", children: "No variable matches." })
2875
+ /* @__PURE__ */ s("div", { className: "max-h-[360px] overflow-y-auto", children: [
2876
+ u.length ? /* @__PURE__ */ t(sa, { children: r ? `On ${r}` : "On this tab" }) : null,
2877
+ u.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n }, m.variable.id)),
2878
+ p.length ? /* @__PURE__ */ t(sa, { children: u.length ? "Elsewhere on this dashboard" : "On this dashboard" }) : null,
2879
+ p.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n, muted: !!u.length }, m.variable.id)),
2880
+ c.length ? null : /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-muted-foreground", children: "No variable matches." })
2876
2881
  ] })
2877
- ] }) : /* @__PURE__ */ r("div", { className: "px-6 py-8 text-center", children: [
2882
+ ] }) : /* @__PURE__ */ s("div", { className: "px-6 py-8 text-center", children: [
2878
2883
  /* @__PURE__ */ t("span", { className: "mx-auto flex h-8 w-8 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ t(Nt, { className: "h-4 w-4 text-muted-foreground", "aria-hidden": !0 }) }),
2879
2884
  /* @__PURE__ */ t("p", { className: "mt-3 text-[13px] font-medium", children: "No variables yet" }),
2880
2885
  /* @__PURE__ */ t("p", { className: "mx-auto mt-1 max-w-[280px] text-[12px] leading-[1.5] text-muted-foreground", children: "A variable shows a value from your data in any text: a name or address in a header, the latest date in a footer." }),
2881
- /* @__PURE__ */ r(L, { size: "xs", className: "mt-4 gap-1", onClick: i, children: [
2886
+ /* @__PURE__ */ s(L, { size: "xs", className: "mt-4 gap-1", onClick: i, children: [
2882
2887
  /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
2883
2888
  " New variable"
2884
2889
  ] })
@@ -2891,38 +2896,38 @@ function sa({ children: e }) {
2891
2896
  function ia({
2892
2897
  row: e,
2893
2898
  sheetId: a,
2894
- onOpen: s,
2899
+ onOpen: r,
2895
2900
  muted: n
2896
2901
  }) {
2897
- return /* @__PURE__ */ r(
2902
+ return /* @__PURE__ */ s(
2898
2903
  "button",
2899
2904
  {
2900
2905
  type: "button",
2901
- onClick: () => s(e.variable.id),
2906
+ onClick: () => r(e.variable.id),
2902
2907
  className: "grid w-full grid-cols-[minmax(0,1fr)_132px] items-center gap-3 border-t border-border/60 px-4 py-2 text-left first:border-t-0 hover:bg-muted/50",
2903
2908
  children: [
2904
- /* @__PURE__ */ r("span", { className: "min-w-0", children: [
2909
+ /* @__PURE__ */ s("span", { className: "min-w-0", children: [
2905
2910
  /* @__PURE__ */ t("span", { className: Z("block truncate text-[12px] font-medium text-foreground", !e.variable.label && "font-mono"), children: e.variable.label || e.variable.name }),
2906
2911
  /* @__PURE__ */ t("span", { className: "mt-0.5 block truncate text-[11px] text-muted-foreground", children: e.question })
2907
2912
  ] }),
2908
- /* @__PURE__ */ t("span", { className: Z("truncate text-right text-[11px]", n ? "text-muted-foreground/70" : "text-muted-foreground"), children: Fs(e, a) })
2913
+ /* @__PURE__ */ t("span", { className: Z("truncate text-right text-[11px]", n ? "text-muted-foreground/70" : "text-muted-foreground"), children: Es(e, a) })
2909
2914
  ]
2910
2915
  }
2911
2916
  );
2912
2917
  }
2913
- function to() {
2914
- const e = w((s) => {
2918
+ function ao() {
2919
+ const e = N((r) => {
2915
2920
  var n;
2916
- return ((n = s.dashboard.variables) == null ? void 0 : n.length) ?? 0;
2917
- }), a = w((s) => s.actions.setVariablesListOpen);
2921
+ return ((n = r.dashboard.variables) == null ? void 0 : n.length) ?? 0;
2922
+ }), a = N((r) => r.actions.setVariablesListOpen);
2918
2923
  return { label: "Data variables", count: e, open: () => a(!0) };
2919
2924
  }
2920
- function ao() {
2921
- var c;
2922
- const e = w((d) => d.variablesListOpen), a = w((d) => d.actions.setVariablesListOpen), s = w((d) => d.dashboard), n = w((d) => d.selectedSheetId), i = w((d) => d.actions.openVariableEditor), o = it("interactive"), l = (c = s.sheets) == null ? void 0 : c.find((d) => d.id === n), u = (d) => {
2923
- a(!1), i(d);
2925
+ function no() {
2926
+ var d;
2927
+ const e = N((c) => c.variablesListOpen), a = N((c) => c.actions.setVariablesListOpen), r = N((c) => c.dashboard), n = N((c) => c.selectedSheetId), i = N((c) => c.actions.openVariableEditor), o = it("interactive"), l = (d = r.sheets) == null ? void 0 : d.find((c) => c.id === n), h = (c) => {
2928
+ a(!1), i(c);
2924
2929
  };
2925
- return /* @__PURE__ */ r(Ie, { open: e, onOpenChange: a, children: [
2930
+ return /* @__PURE__ */ s(Ie, { open: e, onOpenChange: a, children: [
2926
2931
  /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "pointer-events-none inline-block h-7 w-0 self-center" }) }),
2927
2932
  /* @__PURE__ */ t(
2928
2933
  Te,
@@ -2930,62 +2935,62 @@ function ao() {
2930
2935
  align: "end",
2931
2936
  sideOffset: 6,
2932
2937
  collisionPadding: 12,
2933
- onFocusOutside: (d) => d.preventDefault(),
2938
+ onFocusOutside: (c) => c.preventDefault(),
2934
2939
  className: "z-50 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)]",
2935
2940
  style: o.contentStyle,
2936
2941
  children: /* @__PURE__ */ t(
2937
- Es,
2942
+ Is,
2938
2943
  {
2939
- dashboard: s,
2944
+ dashboard: r,
2940
2945
  sheetId: n ?? void 0,
2941
2946
  sheetTitle: l == null ? void 0 : l.title,
2942
- onOpen: (d) => u({ kind: "edit", variableId: d }),
2943
- onNew: () => u({ kind: "new" })
2947
+ onOpen: (c) => h({ kind: "edit", variableId: c }),
2948
+ onNew: () => h({ kind: "new" })
2944
2949
  }
2945
2950
  )
2946
2951
  }
2947
2952
  )
2948
2953
  ] });
2949
2954
  }
2950
- function Is(e, a) {
2951
- const s = hr(e);
2955
+ function Ts(e, a) {
2956
+ const r = mr(e);
2952
2957
  return new Set(
2953
2958
  (e.sheets ?? []).map((i) => {
2954
2959
  const o = { sheetId: i.id, cardId: a, sheetKind: Ke(i) ? "document" : "dashboard" };
2955
- return s.filter((l) => Pr(l, o)).map((l) => l.runtimeScope === "shared" ? l.id : `${l.id}@${i.id}`).join(`
2960
+ return r.filter((l) => Br(l, o)).map((l) => l.runtimeScope === "shared" ? l.id : `${l.id}@${i.id}`).join(`
2956
2961
  `);
2957
2962
  })
2958
2963
  ).size > 1;
2959
2964
  }
2960
- const Ts = [];
2965
+ const Ls = [];
2961
2966
  function vt(e) {
2962
2967
  return Object.fromEntries(
2963
2968
  Object.entries(e).filter(([, a]) => a != null)
2964
2969
  );
2965
2970
  }
2966
- function Ls(e) {
2971
+ function Vs(e) {
2967
2972
  const a = e == null ? void 0 : e.type;
2968
- return a === "dataset" || a === "model" || pr.includes(a);
2973
+ return a === "dataset" || a === "model" || fr.includes(a);
2969
2974
  }
2970
- function Vs(e, a) {
2971
- return Or(
2972
- e.map((s, n) => {
2975
+ function Ps(e, a) {
2976
+ return zr(
2977
+ e.map((r, n) => {
2973
2978
  var i, o;
2974
2979
  return {
2975
- target: s,
2980
+ target: r,
2976
2981
  columns: (i = a[n]) == null ? void 0 : i.columns,
2977
2982
  calculatedFields: (o = a[n]) == null ? void 0 : o.calculatedFields
2978
2983
  };
2979
2984
  })
2980
2985
  ).columns;
2981
2986
  }
2982
- function Ps(e) {
2983
- const { tokenProps: a } = $e(), s = w((m) => m.authToken), { connections: n } = va(), i = e == null ? void 0 : e.connectionId, o = n.find((m) => m.id === i), l = Y(
2984
- () => ((e == null ? void 0 : e.selectedEntities) ?? []).filter(Ls),
2987
+ function Bs(e) {
2988
+ const { tokenProps: a } = $e(), r = N((m) => m.authToken), { connections: n } = va(), i = e == null ? void 0 : e.connectionId, o = n.find((m) => m.id === i), l = Y(
2989
+ () => ((e == null ? void 0 : e.selectedEntities) ?? []).filter(Vs),
2985
2990
  [e == null ? void 0 : e.selectedEntities]
2986
- ), u = (m) => {
2991
+ ), h = (m) => {
2987
2992
  var g;
2988
- if (!(s != null && s.accessToken)) return !1;
2993
+ if (!(r != null && r.accessToken)) return !1;
2989
2994
  if (m.type === "dataset") {
2990
2995
  const y = m;
2991
2996
  return !!(y.domainId && y.name);
@@ -2993,26 +2998,26 @@ function Ps(e) {
2993
2998
  if (m.type === "model") return !!(i && m.id);
2994
2999
  const f = ((g = o == null ? void 0 : o.capabilities) == null ? void 0 : g.path) || [];
2995
3000
  return !(!i || !m.name || f.includes("database") && !m.database || f.includes("schema") && !m.schema);
2996
- }, c = ie(
3001
+ }, d = ie(
2997
3002
  (m) => {
2998
3003
  var g, y;
2999
- const f = Vs(
3004
+ const f = Ps(
3000
3005
  l,
3001
- m.map((N) => N.data)
3006
+ m.map((C) => C.data)
3002
3007
  );
3003
3008
  return {
3004
- fields: f.length ? f : Ts,
3005
- isLoading: m.some((N) => N.isLoading),
3006
- error: (y = (g = m.find((N) => N.error)) == null ? void 0 : g.error) == null ? void 0 : y.message
3009
+ fields: f.length ? f : Ls,
3010
+ isLoading: m.some((C) => C.isLoading),
3011
+ error: (y = (g = m.find((C) => C.error)) == null ? void 0 : g.error) == null ? void 0 : y.message
3007
3012
  };
3008
3013
  },
3009
3014
  [l]
3010
- ), { fields: d, isLoading: h, error: p } = An({
3015
+ ), { fields: c, isLoading: u, error: p } = Fn({
3011
3016
  queries: l.map((m) => ({
3012
3017
  queryKey: ["columns", i, m, (e == null ? void 0 : e.semanticDomainId) ?? null],
3013
- queryFn: () => mr(
3018
+ queryFn: () => pr(
3014
3019
  `${a.apiServiceUrl}/v1/columns`,
3015
- (s == null ? void 0 : s.accessToken) || "",
3020
+ (r == null ? void 0 : r.accessToken) || "",
3016
3021
  m.type === "model" ? vt({
3017
3022
  connection_id: i,
3018
3023
  datamodel_id: m.id,
@@ -3034,22 +3039,22 @@ function Ps(e) {
3034
3039
  table_name: m.name
3035
3040
  })
3036
3041
  ),
3037
- enabled: u(m),
3042
+ enabled: h(m),
3038
3043
  staleTime: 6e4
3039
3044
  })),
3040
- combine: c
3045
+ combine: d
3041
3046
  });
3042
- return { fields: d, isLoading: h, error: p };
3047
+ return { fields: c, isLoading: u, error: p };
3043
3048
  }
3044
- function Bs(e) {
3045
- var s;
3046
- const a = ((s = e.comparison) == null ? void 0 : s.mode) === "explicit" ? e.comparison.spec : void 0;
3049
+ function _s(e) {
3050
+ var r;
3051
+ const a = ((r = e.comparison) == null ? void 0 : r.mode) === "explicit" ? e.comparison.spec : void 0;
3047
3052
  return a && a.kind !== "target" ? { mode: "period", spec: a } : { mode: "off" };
3048
3053
  }
3049
- function _s(e) {
3050
- return e.mode === "period" ? gr(e.spec) : void 0;
3054
+ function Os(e) {
3055
+ return e.mode === "period" ? br(e.spec) : void 0;
3051
3056
  }
3052
- const Mt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Os = {
3057
+ const Mt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", zs = {
3053
3058
  connectionId: "",
3054
3059
  connectionType: "",
3055
3060
  mode: "semanticDomain",
@@ -3058,14 +3063,14 @@ const Mt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreg
3058
3063
  function se({
3059
3064
  label: e,
3060
3065
  hint: a,
3061
- aside: s,
3066
+ aside: r,
3062
3067
  children: n,
3063
3068
  className: i
3064
3069
  }) {
3065
- return /* @__PURE__ */ r("div", { className: i, children: [
3066
- /* @__PURE__ */ r("div", { className: "mb-1 flex min-h-5 items-center justify-between gap-2", children: [
3070
+ return /* @__PURE__ */ s("div", { className: i, children: [
3071
+ /* @__PURE__ */ s("div", { className: "mb-1 flex min-h-5 items-center justify-between gap-2", children: [
3067
3072
  /* @__PURE__ */ t("p", { className: Mt, children: e }),
3068
- s
3073
+ r
3069
3074
  ] }),
3070
3075
  n,
3071
3076
  a ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: a }) : null
@@ -3074,7 +3079,7 @@ function se({
3074
3079
  function yt({
3075
3080
  muted: e,
3076
3081
  onClick: a,
3077
- children: s,
3082
+ children: r,
3078
3083
  ariaLabel: n
3079
3084
  }) {
3080
3085
  return /* @__PURE__ */ t(
@@ -3087,36 +3092,36 @@ function yt({
3087
3092
  "flex h-7 w-full items-center gap-1.5 rounded-control border border-input bg-background px-2 text-left text-[12px] hover:bg-muted/50",
3088
3093
  e ? "text-muted-foreground" : "text-foreground"
3089
3094
  ),
3090
- children: s
3095
+ children: r
3091
3096
  }
3092
3097
  );
3093
3098
  }
3094
- function zs(e) {
3095
- var s;
3096
- const a = (s = e == null ? void 0 : e.selectedEntities) == null ? void 0 : s[0];
3099
+ function Rs(e) {
3100
+ var r;
3101
+ const a = (r = e == null ? void 0 : e.selectedEntities) == null ? void 0 : r[0];
3097
3102
  if (a)
3098
3103
  return a.label || a.name;
3099
3104
  }
3100
- function Rs(e) {
3105
+ function Ms(e) {
3101
3106
  const a = Ot(e);
3102
3107
  return a === "date" ? "date" : a === "string" ? "text" : a === "number" ? "number" : a === "boolean" ? "yes/no" : a;
3103
3108
  }
3104
3109
  const oa = "__new_calculated_field__";
3105
- function Ms({
3110
+ function Us({
3106
3111
  draft: e,
3107
3112
  onChange: a,
3108
- handle: s,
3113
+ handle: r,
3109
3114
  onCalculatedFieldOpenChange: n
3110
3115
  }) {
3111
3116
  var _, te, J, H, I, ae, j, R, ne, ue, he, ye;
3112
- const { tokenProps: i } = $e(), o = ((_ = i.config) == null ? void 0 : _.showAdvancedMode) !== !1, l = ((te = i.config) == null ? void 0 : te.showDirectSource) !== !1, { connections: u } = va(), [c, d] = E(!1), [h, p] = E(!1), [m, f] = E(!1), g = (x) => {
3117
+ const { tokenProps: i } = $e(), o = ((_ = i.config) == null ? void 0 : _.showAdvancedMode) !== !1, l = ((te = i.config) == null ? void 0 : te.showDirectSource) !== !1, { connections: h } = va(), [d, c] = E(!1), [u, p] = E(!1), [m, f] = E(!1), g = (x) => {
3113
3118
  p(x), n == null || n(x);
3114
- }, { fields: y, isLoading: N, error: k } = Ps(e.mode === "data" ? e.dataSource : void 0), V = [...e.calculatedFields ?? [], ...y], P = (x) => x && (V.find((M) => M.id === x.id) ?? V.find((M) => Us(M, x))), D = [
3119
+ }, { fields: y, isLoading: C, error: k } = Bs(e.mode === "data" ? e.dataSource : void 0), V = [...e.calculatedFields ?? [], ...y], P = (x) => x && (V.find((M) => M.id === x.id) ?? V.find((M) => $s(M, x))), D = [
3115
3120
  ...V,
3116
3121
  ...[e.field, e.sortField].filter(
3117
3122
  (x) => !!x && !P(x) && !V.some((M) => M.id === x.id)
3118
3123
  )
3119
- ], O = ((J = P(e.field)) == null ? void 0 : J.id) ?? ((H = e.field) == null ? void 0 : H.id) ?? "", b = ((I = P(e.sortField ?? e.field)) == null ? void 0 : I.id) ?? ((ae = e.sortField ?? e.field) == null ? void 0 : ae.id) ?? "", S = (x) => a({ ...e, ...x }), v = zs(e.dataSource), T = ((j = e.dataSource) == null ? void 0 : j.mode) === "database" ? Pt : jt, F = "mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", G = {
3124
+ ], O = ((J = P(e.field)) == null ? void 0 : J.id) ?? ((H = e.field) == null ? void 0 : H.id) ?? "", b = ((I = P(e.sortField ?? e.field)) == null ? void 0 : I.id) ?? ((ae = e.sortField ?? e.field) == null ? void 0 : ae.id) ?? "", S = (x) => a({ ...e, ...x }), v = Rs(e.dataSource), T = ((j = e.dataSource) == null ? void 0 : j.mode) === "database" ? Pt : jt, F = "mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", G = {
3120
3125
  connectionId: ((R = e.dataSource) == null ? void 0 : R.connectionId) || e.connectionId,
3121
3126
  dataSource: e.dataSource,
3122
3127
  config: e.conditions ? { filters: e.conditions } : {},
@@ -3131,8 +3136,8 @@ function Ms({
3131
3136
  const $ = Yt(M).some((K) => K.value === e.get) && e.field !== void 0;
3132
3137
  S({ field: M, get: $ ? e.get : Xt(M) });
3133
3138
  };
3134
- return h ? /* @__PURE__ */ t(
3135
- Fn,
3139
+ return u ? /* @__PURE__ */ t(
3140
+ En,
3136
3141
  {
3137
3142
  inline: !0,
3138
3143
  open: !0,
@@ -3149,12 +3154,12 @@ function Ms({
3149
3154
  }), g(!1);
3150
3155
  }
3151
3156
  }
3152
- ) : /* @__PURE__ */ r(U, { children: [
3157
+ ) : /* @__PURE__ */ s(U, { children: [
3153
3158
  /* @__PURE__ */ t(
3154
3159
  se,
3155
3160
  {
3156
3161
  label: "Name",
3157
- aside: /* @__PURE__ */ t(js, { value: e.name, placeholder: s, editing: m, onEditing: f, onChange: (x) => S({ name: x }) }),
3162
+ aside: /* @__PURE__ */ t(qs, { value: e.name, placeholder: r, editing: m, onEditing: f, onChange: (x) => S({ name: x }) }),
3158
3163
  hint: m ? "The key: what you type after {{, and what links and agents use. Letters, digits and underscores." : void 0,
3159
3164
  children: /* @__PURE__ */ t(
3160
3165
  xe,
@@ -3168,20 +3173,20 @@ function Ms({
3168
3173
  )
3169
3174
  }
3170
3175
  ),
3171
- e.mode === "sql" ? /* @__PURE__ */ r(U, { children: [
3172
- /* @__PURE__ */ r(se, { label: "Connection", children: [
3173
- /* @__PURE__ */ r(
3176
+ e.mode === "sql" ? /* @__PURE__ */ s(U, { children: [
3177
+ /* @__PURE__ */ s(se, { label: "Connection", children: [
3178
+ /* @__PURE__ */ s(
3174
3179
  we,
3175
3180
  {
3176
3181
  value: e.connectionId ?? "",
3177
3182
  onValueChange: (x) => S({ connectionId: x }),
3178
3183
  children: [
3179
3184
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Connection", children: /* @__PURE__ */ t(ke, { placeholder: "Choose a connection" }) }),
3180
- /* @__PURE__ */ t(De, { children: u.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: x.name }, x.id)) })
3185
+ /* @__PURE__ */ t(De, { children: h.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: x.name }, x.id)) })
3181
3186
  ]
3182
3187
  }
3183
3188
  ),
3184
- /* @__PURE__ */ r("button", { type: "button", onClick: () => S({ mode: "data" }), className: F, children: [
3189
+ /* @__PURE__ */ s("button", { type: "button", onClick: () => S({ mode: "data" }), className: F, children: [
3185
3190
  /* @__PURE__ */ t(jt, { className: "h-3 w-3", "aria-hidden": !0 }),
3186
3191
  " Use a dataset or table instead"
3187
3192
  ] })
@@ -3204,41 +3209,41 @@ function Ms({
3204
3209
  )
3205
3210
  }
3206
3211
  ),
3207
- /* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ r(
3212
+ /* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ s(
3208
3213
  we,
3209
3214
  {
3210
3215
  value: e.get === "first" ? "first" : "only",
3211
3216
  onValueChange: (x) => S({ get: x }),
3212
3217
  children: [
3213
3218
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Get", children: /* @__PURE__ */ t(ke, {}) }),
3214
- /* @__PURE__ */ r(De, { children: [
3219
+ /* @__PURE__ */ s(De, { children: [
3215
3220
  /* @__PURE__ */ t(fe, { value: "only", children: "The only row" }),
3216
3221
  /* @__PURE__ */ t(fe, { value: "first", children: "The first row" })
3217
3222
  ] })
3218
3223
  ]
3219
3224
  }
3220
3225
  ) })
3221
- ] }) : /* @__PURE__ */ r(U, { children: [
3222
- /* @__PURE__ */ r(se, { label: "Source", children: [
3223
- /* @__PURE__ */ t(yt, { muted: !v, onClick: () => d(!0), ariaLabel: "Source", children: v ? /* @__PURE__ */ r(U, { children: [
3226
+ ] }) : /* @__PURE__ */ s(U, { children: [
3227
+ /* @__PURE__ */ s(se, { label: "Source", children: [
3228
+ /* @__PURE__ */ t(yt, { muted: !v, onClick: () => c(!0), ariaLabel: "Source", children: v ? /* @__PURE__ */ s(U, { children: [
3224
3229
  /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
3225
3230
  " ",
3226
3231
  v
3227
3232
  ] }) : l ? "Choose a dataset or table" : "Choose a dataset" }),
3228
- o ? /* @__PURE__ */ r("button", { type: "button", onClick: () => {
3233
+ o ? /* @__PURE__ */ s("button", { type: "button", onClick: () => {
3229
3234
  var x;
3230
3235
  return S({ mode: "sql", connectionId: ((x = e.dataSource) == null ? void 0 : x.connectionId) || e.connectionId });
3231
3236
  }, className: F, children: [
3232
- /* @__PURE__ */ t(Hr, { className: "h-3 w-3", "aria-hidden": !0 }),
3237
+ /* @__PURE__ */ t(Yr, { className: "h-3 w-3", "aria-hidden": !0 }),
3233
3238
  " Write SQL instead"
3234
3239
  ] }) : null
3235
3240
  ] }),
3236
3241
  /* @__PURE__ */ t(
3237
- Fr,
3242
+ Er,
3238
3243
  {
3239
- open: c,
3240
- onOpenChange: d,
3241
- dataSource: e.dataSource ?? Os,
3244
+ open: d,
3245
+ onOpenChange: c,
3246
+ dataSource: e.dataSource ?? zs,
3242
3247
  incomingSelectedEntities: ((he = e.dataSource) == null ? void 0 : he.selectedEntities) ?? [],
3243
3248
  onDataSourceChange: (x) => {
3244
3249
  var $;
@@ -3249,22 +3254,22 @@ function Ms({
3249
3254
  }
3250
3255
  }
3251
3256
  ),
3252
- /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3", children: [
3253
- /* @__PURE__ */ t(se, { label: "Field", children: v ? /* @__PURE__ */ r(we, { value: O, onValueChange: X, disabled: N && !D.length, children: [
3254
- /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Field", children: /* @__PURE__ */ t(ke, { placeholder: N ? "Loading fields…" : k ? "Fields unavailable" : "Choose a field" }) }),
3255
- /* @__PURE__ */ r(De, { children: [
3256
- D.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
3257
+ /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
3258
+ /* @__PURE__ */ t(se, { label: "Field", children: v ? /* @__PURE__ */ s(we, { value: O, onValueChange: X, disabled: C && !D.length, children: [
3259
+ /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Field", children: /* @__PURE__ */ t(ke, { placeholder: C ? "Loading fields…" : k ? "Fields unavailable" : "Choose a field" }) }),
3260
+ /* @__PURE__ */ s(De, { children: [
3261
+ D.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
3257
3262
  /* @__PURE__ */ t("span", { children: x.label || x.name }),
3258
- /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Rs(x.dataType) })
3263
+ /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Ms(x.dataType) })
3259
3264
  ] }) }, x.id)),
3260
- /* @__PURE__ */ t(tr, {}),
3261
- /* @__PURE__ */ t(fe, { value: oa, children: /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5", children: [
3265
+ /* @__PURE__ */ t(ar, {}),
3266
+ /* @__PURE__ */ t(fe, { value: oa, children: /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
3262
3267
  /* @__PURE__ */ t(be, { className: "h-3 w-3", "aria-hidden": !0 }),
3263
3268
  " New calculated field…"
3264
3269
  ] }) })
3265
3270
  ] })
3266
3271
  ] }) : /* @__PURE__ */ t(yt, { muted: !0, children: "Choose a source first" }) }),
3267
- /* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ r(
3272
+ /* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ s(
3268
3273
  we,
3269
3274
  {
3270
3275
  value: e.get,
@@ -3278,23 +3283,23 @@ function Ms({
3278
3283
  ) }),
3279
3284
  e.field && Q ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-muted-foreground", children: Q }) : null,
3280
3285
  k ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-destructive", children: k }) : null,
3281
- zr(e) ? /* @__PURE__ */ t(
3286
+ Rr(e) ? /* @__PURE__ */ t(
3282
3287
  se,
3283
3288
  {
3284
3289
  label: "Compare with",
3285
3290
  className: "col-span-2",
3286
3291
  children: /* @__PURE__ */ t(
3287
- En,
3292
+ In,
3288
3293
  {
3289
3294
  controlLabel: "Variable",
3290
- selection: Bs(e),
3291
- onChange: (x) => S({ comparison: _s(x) })
3295
+ selection: _s(e),
3296
+ onChange: (x) => S({ comparison: Os(x) })
3292
3297
  }
3293
3298
  )
3294
3299
  }
3295
3300
  ) : null,
3296
- e.field && !Rr(e.get) && e.get !== "only" ? /* @__PURE__ */ r("div", { className: Z("col-span-2 grid gap-3", e.get === "list" ? "grid-cols-3" : "grid-cols-2"), children: [
3297
- /* @__PURE__ */ t(se, { label: "Order by", children: /* @__PURE__ */ r(
3301
+ e.field && !Mr(e.get) && e.get !== "only" ? /* @__PURE__ */ s("div", { className: Z("col-span-2 grid gap-3", e.get === "list" ? "grid-cols-3" : "grid-cols-2"), children: [
3302
+ /* @__PURE__ */ t(se, { label: "Order by", children: /* @__PURE__ */ s(
3298
3303
  we,
3299
3304
  {
3300
3305
  value: `${b}|${e.sortDirection}`,
@@ -3305,16 +3310,16 @@ function Ms({
3305
3310
  children: [
3306
3311
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Order by", children: /* @__PURE__ */ t(ke, {}) }),
3307
3312
  /* @__PURE__ */ t(De, { children: D.flatMap(
3308
- (x) => ["asc", "desc"].map((M) => /* @__PURE__ */ r(fe, { value: `${x.id}|${M}`, children: [
3313
+ (x) => ["asc", "desc"].map((M) => /* @__PURE__ */ s(fe, { value: `${x.id}|${M}`, children: [
3309
3314
  x.label || x.name,
3310
3315
  ", ",
3311
- $s(x, M)
3316
+ js(x, M)
3312
3317
  ] }, `${x.id}|${M}`))
3313
3318
  ) })
3314
3319
  ]
3315
3320
  }
3316
3321
  ) }),
3317
- e.get === "list" ? /* @__PURE__ */ r(U, { children: [
3322
+ e.get === "list" ? /* @__PURE__ */ s(U, { children: [
3318
3323
  /* @__PURE__ */ t(se, { label: "Show up to", children: /* @__PURE__ */ t(
3319
3324
  xe,
3320
3325
  {
@@ -3336,7 +3341,7 @@ function Ms({
3336
3341
  {
3337
3342
  size: "xs",
3338
3343
  value: e.listSeparator ?? ", ",
3339
- maxLength: fr,
3344
+ maxLength: gr,
3340
3345
  onChange: (x) => S({ listSeparator: x.target.value }),
3341
3346
  className: "font-mono",
3342
3347
  "aria-label": "Separator"
@@ -3349,7 +3354,7 @@ function Ms({
3349
3354
  // In place, not a dialog over the dialog: each edit is the draft's, and
3350
3355
  // Cancel or Done here keeps or drops it. A new source starts a new list.
3351
3356
  /* @__PURE__ */ t(
3352
- Er,
3357
+ Ir,
3353
3358
  {
3354
3359
  filters: e.conditions ?? null,
3355
3360
  availableFields: D,
@@ -3362,21 +3367,21 @@ function Ms({
3362
3367
  ] })
3363
3368
  ] });
3364
3369
  }
3365
- function Us(e, a) {
3370
+ function $s(e, a) {
3366
3371
  return e.name === a.name && (e.qualifiedEntityName ?? e.entityName ?? "") === (a.qualifiedEntityName ?? a.entityName ?? "");
3367
3372
  }
3368
- function $s(e, a) {
3369
- const s = Ot(e.dataType);
3370
- return s === "date" ? a === "asc" ? "earliest first" : "latest first" : s === "number" ? a === "asc" ? "lowest first" : "highest first" : a === "asc" ? "A to Z" : "Z to A";
3373
+ function js(e, a) {
3374
+ const r = Ot(e.dataType);
3375
+ return r === "date" ? a === "asc" ? "earliest first" : "latest first" : r === "number" ? a === "asc" ? "lowest first" : "highest first" : a === "asc" ? "A to Z" : "Z to A";
3371
3376
  }
3372
- function js({
3377
+ function qs({
3373
3378
  value: e,
3374
3379
  placeholder: a,
3375
- editing: s,
3380
+ editing: r,
3376
3381
  onEditing: n,
3377
3382
  onChange: i
3378
3383
  }) {
3379
- return s ? /* @__PURE__ */ t(
3384
+ return r ? /* @__PURE__ */ t(
3380
3385
  xe,
3381
3386
  {
3382
3387
  size: "xs",
@@ -3391,7 +3396,7 @@ function js({
3391
3396
  className: "h-6 w-44 font-mono text-[11px]",
3392
3397
  "aria-label": "Key"
3393
3398
  }
3394
- ) : /* @__PURE__ */ r(
3399
+ ) : /* @__PURE__ */ s(
3395
3400
  "button",
3396
3401
  {
3397
3402
  type: "button",
@@ -3406,26 +3411,26 @@ function js({
3406
3411
  }
3407
3412
  );
3408
3413
  }
3409
- const qs = [
3414
+ const Ws = [
3410
3415
  { id: "data", label: "Data" },
3411
3416
  { id: "filters", label: "Dashboard filters" },
3412
3417
  { id: "display", label: "Display" }
3413
3418
  ];
3414
- function Ws(e) {
3415
- const { name: a, label: s, presentation: n, emptyText: i, ...o } = e;
3419
+ function Qs(e) {
3420
+ const { name: a, label: r, presentation: n, emptyText: i, ...o } = e;
3416
3421
  return JSON.stringify(o);
3417
3422
  }
3418
- function Qs({
3423
+ function Ks({
3419
3424
  variable: e,
3420
3425
  onClose: a,
3421
- onHoldEscape: s
3426
+ onHoldEscape: r
3422
3427
  }) {
3423
3428
  var J, H;
3424
- const n = w((I) => I.dashboard), i = w((I) => I.selectedSheetId), o = w((I) => I.actions.saveVariableChange), [l, u] = E(
3425
- () => e ? Mr(e) : Ur()
3426
- ), [c, d] = E("data"), [h, p] = E(!1), m = (I) => {
3427
- p(I), s == null || s(I);
3428
- }, [f, g] = E([]), [y, N] = E(null), k = !e, V = Ws(l), P = Y(
3429
+ const n = N((I) => I.dashboard), i = N((I) => I.selectedSheetId), o = N((I) => I.actions.saveVariableChange), [l, h] = E(
3430
+ () => e ? Ur(e) : $r()
3431
+ ), [d, c] = E("data"), [u, p] = E(!1), m = (I) => {
3432
+ p(I), r == null || r(I);
3433
+ }, [f, g] = E([]), [y, C] = E(null), k = !e, V = Qs(l), P = Y(
3429
3434
  () => Zt({ ...JSON.parse(V), name: "" }, n),
3430
3435
  [V, n]
3431
3436
  ), { name: D, label: O, presentation: b, emptyText: S } = l, v = Y(
@@ -3444,18 +3449,18 @@ function Qs({
3444
3449
  variables: [...(n.variables ?? []).filter((I) => I.id !== v.id), v]
3445
3450
  }),
3446
3451
  [n, v]
3447
- ), F = $r(l), G = ct(), B = w((I) => I.actions.mergeSemanticExecutionPayload), [Q, X] = E(!1), _ = async () => {
3452
+ ), F = jr(l), G = ct(), B = N((I) => I.actions.mergeSemanticExecutionPayload), [Q, X] = E(!1), _ = async () => {
3448
3453
  const I = Zt(l, n);
3449
3454
  X(!0);
3450
3455
  let ae;
3451
3456
  try {
3452
- const R = Nr(n, e ? { kind: "update", id: e.id, patch: I } : { kind: "add", variable: I });
3457
+ const R = Cr(n, e ? { kind: "update", id: e.id, patch: I } : { kind: "add", variable: I });
3453
3458
  if (!R.ok) {
3454
3459
  X(!1), g(R.issues);
3455
3460
  return;
3456
3461
  }
3457
3462
  const [ne] = R.queryFrames;
3458
- ae = ne ? await G(ne, e ? { previousFrame: Cr(n, e) } : void 0) : { domainsById: {} };
3463
+ ae = ne ? await G(ne, e ? { previousFrame: wr(n, e) } : void 0) : { domainsById: {} };
3459
3464
  } catch (R) {
3460
3465
  X(!1), g([
3461
3466
  {
@@ -3467,7 +3472,7 @@ function Qs({
3467
3472
  return;
3468
3473
  }
3469
3474
  const j = o(
3470
- k ? { kind: "add", variable: I } : { kind: "update", id: I.id, patch: Ks(I) }
3475
+ k ? { kind: "add", variable: I } : { kind: "update", id: I.id, patch: Gs(I) }
3471
3476
  );
3472
3477
  if (X(!1), !j.ok) {
3473
3478
  g(j.issues);
@@ -3480,7 +3485,7 @@ function Qs({
3480
3485
  if (!ae.ok) {
3481
3486
  const j = ae.issues.find((R) => R.code === "inUse");
3482
3487
  if (j && !I) {
3483
- N(j);
3488
+ C(j);
3484
3489
  return;
3485
3490
  }
3486
3491
  g(ae.issues);
@@ -3488,17 +3493,17 @@ function Qs({
3488
3493
  }
3489
3494
  a();
3490
3495
  };
3491
- return /* @__PURE__ */ r(
3496
+ return /* @__PURE__ */ s(
3492
3497
  "div",
3493
3498
  {
3494
3499
  className: "flex h-[600px] max-h-[85vh] w-[600px] max-w-[calc(100vw-24px)] flex-col overflow-hidden",
3495
3500
  "data-testid": "variable-editor",
3496
3501
  children: [
3497
- /* @__PURE__ */ r("div", { className: "flex min-h-12 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1.5", children: [
3498
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-start gap-2", children: [
3502
+ /* @__PURE__ */ s("div", { className: "flex min-h-12 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1.5", children: [
3503
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-start gap-2", children: [
3499
3504
  /* @__PURE__ */ t(Nt, { className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": !0 }),
3500
- /* @__PURE__ */ r("div", { className: "min-w-0", children: [
3501
- /* @__PURE__ */ r("p", { className: "flex items-center gap-2", children: [
3505
+ /* @__PURE__ */ s("div", { className: "min-w-0", children: [
3506
+ /* @__PURE__ */ s("p", { className: "flex items-center gap-2", children: [
3502
3507
  /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: k ? "New variable" : e.label || e.name }),
3503
3508
  /* @__PURE__ */ t("span", { className: Mt, children: "Variable from data" })
3504
3509
  ] }),
@@ -3516,39 +3521,39 @@ function Qs({
3516
3521
  }
3517
3522
  )
3518
3523
  ] }),
3519
- h ? null : /* @__PURE__ */ t("nav", { role: "tablist", "aria-label": "Variable settings sections", className: "flex h-9 shrink-0 items-stretch gap-4 border-b border-border/60 px-4", children: qs.map((I) => /* @__PURE__ */ r(
3524
+ u ? null : /* @__PURE__ */ t("nav", { role: "tablist", "aria-label": "Variable settings sections", className: "flex h-9 shrink-0 items-stretch gap-4 border-b border-border/60 px-4", children: Ws.map((I) => /* @__PURE__ */ s(
3520
3525
  "button",
3521
3526
  {
3522
3527
  role: "tab",
3523
- "aria-selected": c === I.id,
3524
- onClick: () => d(I.id),
3528
+ "aria-selected": d === I.id,
3529
+ onClick: () => c(I.id),
3525
3530
  className: Z(
3526
3531
  "relative -mb-px inline-flex items-center text-[13px] transition-colors focus-visible:outline-none",
3527
- c === I.id ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
3532
+ d === I.id ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
3528
3533
  ),
3529
3534
  children: [
3530
3535
  I.label,
3531
- c === I.id ? /* @__PURE__ */ t("span", { className: "absolute inset-x-0 -bottom-px h-[2px] bg-foreground" }) : null
3536
+ d === I.id ? /* @__PURE__ */ t("span", { className: "absolute inset-x-0 -bottom-px h-[2px] bg-foreground" }) : null
3532
3537
  ]
3533
3538
  },
3534
3539
  I.id
3535
3540
  )) }),
3536
- /* @__PURE__ */ r("div", { className: Z("min-h-0 flex-1 overflow-y-auto", c === "filters" || h ? "" : "space-y-4 px-4 py-4"), children: [
3537
- c === "data" ? /* @__PURE__ */ t(
3538
- Ms,
3541
+ /* @__PURE__ */ s("div", { className: Z("min-h-0 flex-1 overflow-y-auto", d === "filters" || u ? "" : "space-y-4 px-4 py-4"), children: [
3542
+ d === "data" ? /* @__PURE__ */ t(
3543
+ Us,
3539
3544
  {
3540
3545
  draft: l,
3541
- onChange: u,
3546
+ onChange: h,
3542
3547
  handle: Jt(n, l),
3543
3548
  onCalculatedFieldOpenChange: m
3544
3549
  }
3545
3550
  ) : null,
3546
- c === "filters" ? /* @__PURE__ */ t(Gs, { draft: l, draftDashboard: T }) : null,
3547
- c === "display" ? /* @__PURE__ */ t(Xs, { draft: l, onChange: u }) : null
3551
+ d === "filters" ? /* @__PURE__ */ t(Hs, { draft: l, draftDashboard: T }) : null,
3552
+ d === "display" ? /* @__PURE__ */ t(Zs, { draft: l, onChange: h }) : null
3548
3553
  ] }),
3549
- h ? null : /* @__PURE__ */ r(U, { children: [
3554
+ u ? null : /* @__PURE__ */ s(U, { children: [
3550
3555
  /* @__PURE__ */ t(
3551
- Zs,
3556
+ Js,
3552
3557
  {
3553
3558
  draft: l,
3554
3559
  draftVariable: v,
@@ -3557,13 +3562,13 @@ function Qs({
3557
3562
  selectedSheetId: i ?? void 0
3558
3563
  }
3559
3564
  ),
3560
- f.length ? /* @__PURE__ */ t("div", { className: "shrink-0 border-t border-border/60 bg-destructive/5 px-4 py-2 text-[11px] leading-4 text-destructive", role: "alert", children: f.map((I) => /* @__PURE__ */ r("p", { children: [
3565
+ f.length ? /* @__PURE__ */ t("div", { className: "shrink-0 border-t border-border/60 bg-destructive/5 px-4 py-2 text-[11px] leading-4 text-destructive", role: "alert", children: f.map((I) => /* @__PURE__ */ s("p", { children: [
3561
3566
  I.message,
3562
3567
  " ",
3563
3568
  I.fix
3564
3569
  ] }, `${I.code}:${I.path ?? ""}`)) }) : null,
3565
- y ? /* @__PURE__ */ r("div", { className: "shrink-0 border-t border-border/60 bg-amber-500/10 px-4 py-2 text-[11px] leading-4 text-amber-800 dark:text-amber-300", role: "alertdialog", children: [
3566
- /* @__PURE__ */ r("p", { children: [
3570
+ y ? /* @__PURE__ */ s("div", { className: "shrink-0 border-t border-border/60 bg-amber-500/10 px-4 py-2 text-[11px] leading-4 text-amber-800 dark:text-amber-300", role: "alertdialog", children: [
3571
+ /* @__PURE__ */ s("p", { children: [
3567
3572
  y.message,
3568
3573
  " Used in ",
3569
3574
  ((J = y.places) == null ? void 0 : J.length) ?? 0,
@@ -3571,12 +3576,12 @@ function Qs({
3571
3576
  ((H = y.places) == null ? void 0 : H.length) === 1 ? "place" : "places",
3572
3577
  ". Its chips then read as missing."
3573
3578
  ] }),
3574
- /* @__PURE__ */ r("div", { className: "mt-1.5 flex gap-1.5", children: [
3575
- /* @__PURE__ */ t(L, { variant: "outline", size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => N(null), children: "Keep it" }),
3579
+ /* @__PURE__ */ s("div", { className: "mt-1.5 flex gap-1.5", children: [
3580
+ /* @__PURE__ */ t(L, { variant: "outline", size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => C(null), children: "Keep it" }),
3576
3581
  /* @__PURE__ */ t(L, { size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => te(!0), children: "Remove anyway" })
3577
3582
  ] })
3578
3583
  ] }) : null,
3579
- /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-4 py-2.5", children: [
3584
+ /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-4 py-2.5", children: [
3580
3585
  k ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t(
3581
3586
  L,
3582
3587
  {
@@ -3587,7 +3592,7 @@ function Qs({
3587
3592
  children: "Delete"
3588
3593
  }
3589
3594
  ),
3590
- /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5", children: [
3595
+ /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
3591
3596
  /* @__PURE__ */ t(L, { variant: "outline", size: "xs", onClick: a, children: "Cancel" }),
3592
3597
  /* @__PURE__ */ t(L, { size: "xs", disabled: !!F || Q, title: F, onClick: () => void _(), children: k ? "Create" : "Done" })
3593
3598
  ] })
@@ -3597,36 +3602,36 @@ function Qs({
3597
3602
  }
3598
3603
  );
3599
3604
  }
3600
- function Ks(e) {
3601
- const { id: a, ...s } = e;
3605
+ function Gs(e) {
3606
+ const { id: a, ...r } = e;
3602
3607
  return {
3603
- ...s,
3608
+ ...r,
3604
3609
  // Fields the draft cleared come back as `undefined`, so an update drops them.
3605
- label: s.label,
3606
- presentation: s.presentation,
3607
- emptyText: s.emptyText
3610
+ label: r.label,
3611
+ presentation: r.presentation,
3612
+ emptyText: r.emptyText
3608
3613
  };
3609
3614
  }
3610
- function Gs({ draft: e, draftDashboard: a }) {
3611
- const s = Y(() => br(a), [a]), n = s.inputs.filter(
3612
- (o) => s.reachedVariables({ inputId: o.input.id }).some((l) => l.variableId === e.id)
3613
- ), i = e.mode === "sql" && xr(e.sql);
3614
- return n.length ? /* @__PURE__ */ r("div", { className: "divide-y divide-border/60", children: [
3615
+ function Hs({ draft: e, draftDashboard: a }) {
3616
+ const r = Y(() => xr(a), [a]), n = r.inputs.filter(
3617
+ (o) => r.reachedVariables({ inputId: o.input.id }).some((l) => l.variableId === e.id)
3618
+ ), i = e.mode === "sql" && vr(e.sql);
3619
+ return n.length ? /* @__PURE__ */ s("div", { className: "divide-y divide-border/60", children: [
3615
3620
  /* @__PURE__ */ t("p", { className: "px-4 py-2 text-[11px] leading-4 text-muted-foreground", children: "How each filter applies here. Change a mapping on the filter's Cards tab, under Variables." }),
3616
3621
  n.map((o) => {
3617
- var c;
3618
- const l = (c = o.input.application) == null ? void 0 : c.cards.find((d) => d.cardId === e.id), u = i ? "Subscribes in SQL" : e.mode === "sql" ? "Not named in the SQL" : (l == null ? void 0 : l.kind) === "excluded" ? "Don't apply" : (l == null ? void 0 : l.kind) === "bound" ? `${l.target.kind === "field" ? "Field" : "Path"} · ${l.target.field.name}` : "Auto";
3619
- return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 px-4 py-2 text-[12px]", children: [
3620
- /* @__PURE__ */ r("span", { className: "min-w-0", children: [
3622
+ var d;
3623
+ const l = (d = o.input.application) == null ? void 0 : d.cards.find((c) => c.cardId === e.id), h = i ? "Subscribes in SQL" : e.mode === "sql" ? "Not named in the SQL" : (l == null ? void 0 : l.kind) === "excluded" ? "Don't apply" : (l == null ? void 0 : l.kind) === "bound" ? `${l.target.kind === "field" ? "Field" : "Path"} · ${l.target.field.name}` : "Auto";
3624
+ return /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 px-4 py-2 text-[12px]", children: [
3625
+ /* @__PURE__ */ s("span", { className: "min-w-0", children: [
3621
3626
  /* @__PURE__ */ t("span", { className: "block truncate font-medium text-foreground", children: o.input.label || o.input.filter.title }),
3622
- /* @__PURE__ */ t("span", { className: "block truncate text-[11px] text-muted-foreground", children: Hs(o.input.scope) })
3627
+ /* @__PURE__ */ t("span", { className: "block truncate text-[11px] text-muted-foreground", children: Ys(o.input.scope) })
3623
3628
  ] }),
3624
- /* @__PURE__ */ t("span", { className: Z("shrink-0 text-[11px]", u === "Don't apply" || u === "Not named in the SQL" ? "text-muted-foreground" : "text-foreground"), children: u })
3629
+ /* @__PURE__ */ t("span", { className: Z("shrink-0 text-[11px]", h === "Don't apply" || h === "Not named in the SQL" ? "text-muted-foreground" : "text-foreground"), children: h })
3625
3630
  ] }, o.input.id);
3626
3631
  })
3627
3632
  ] }) : /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-muted-foreground", children: "No filter reaches this variable. A filter on the tabs or Documents where it is used reaches it; a variable used nowhere yet follows every tab's filters." });
3628
3633
  }
3629
- function Hs(e) {
3634
+ function Ys(e) {
3630
3635
  switch (e.kind) {
3631
3636
  case "allSheets":
3632
3637
  return "On every tab";
@@ -3638,30 +3643,30 @@ function Hs(e) {
3638
3643
  return e.kind;
3639
3644
  }
3640
3645
  }
3641
- const Ys = [
3646
+ const Xs = [
3642
3647
  { value: "auto", label: "Automatic" },
3643
3648
  { value: "short", label: "Short" },
3644
3649
  { value: "medium", label: "Medium" },
3645
3650
  { value: "long", label: "Long" },
3646
3651
  { value: "pattern", label: "Custom pattern…" }
3647
3652
  ];
3648
- function Xs({ draft: e, onChange: a }) {
3649
- var u, c;
3650
- const s = e.mode === "sql" ? "unknown" : Ot((u = e.field) == null ? void 0 : u.dataType), n = (c = e.presentation) == null ? void 0 : c.temporal, i = n ? n.mode === "style" ? n.dateStyle : n.mode === "pattern" ? "pattern" : "auto" : "auto", o = (n == null ? void 0 : n.mode) === "pattern" ? Tr(n.pattern) : null, l = (d) => a({ ...e, presentation: d && Object.keys(d).length ? d : void 0 });
3651
- return /* @__PURE__ */ r(U, { children: [
3652
- s === "date" || s === "unknown" ? /* @__PURE__ */ r(se, { label: "Dates read as", hint: "A chip can change this for itself.", children: [
3653
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3654
- /* @__PURE__ */ r(
3653
+ function Zs({ draft: e, onChange: a }) {
3654
+ var h, d;
3655
+ const r = e.mode === "sql" ? "unknown" : Ot((h = e.field) == null ? void 0 : h.dataType), n = (d = e.presentation) == null ? void 0 : d.temporal, i = n ? n.mode === "style" ? n.dateStyle : n.mode === "pattern" ? "pattern" : "auto" : "auto", o = (n == null ? void 0 : n.mode) === "pattern" ? Lr(n.pattern) : null, l = (c) => a({ ...e, presentation: c && Object.keys(c).length ? c : void 0 });
3656
+ return /* @__PURE__ */ s(U, { children: [
3657
+ r === "date" || r === "unknown" ? /* @__PURE__ */ s(se, { label: "Dates read as", hint: "A chip can change this for itself.", children: [
3658
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3659
+ /* @__PURE__ */ s(
3655
3660
  we,
3656
3661
  {
3657
3662
  value: i,
3658
- onValueChange: (d) => l({
3663
+ onValueChange: (c) => l({
3659
3664
  ...e.presentation,
3660
- temporal: d === "auto" ? void 0 : d === "pattern" ? { mode: "pattern", dialect: "semaphor_tokens", pattern: (n == null ? void 0 : n.mode) === "pattern" ? n.pattern : "MMM D, YYYY" } : { mode: "style", dateStyle: d }
3665
+ temporal: c === "auto" ? void 0 : c === "pattern" ? { mode: "pattern", dialect: "semaphor_tokens", pattern: (n == null ? void 0 : n.mode) === "pattern" ? n.pattern : "MMM D, YYYY" } : { mode: "style", dateStyle: c }
3661
3666
  }),
3662
3667
  children: [
3663
3668
  /* @__PURE__ */ t(Se, { size: "xs", className: "w-44", "aria-label": "Date style", children: /* @__PURE__ */ t(ke, {}) }),
3664
- /* @__PURE__ */ t(De, { children: Ys.map((d) => /* @__PURE__ */ t(fe, { value: d.value, children: d.label }, d.value)) })
3669
+ /* @__PURE__ */ t(De, { children: Xs.map((c) => /* @__PURE__ */ t(fe, { value: c.value, children: c.label }, c.value)) })
3665
3670
  ]
3666
3671
  }
3667
3672
  ),
@@ -3670,7 +3675,7 @@ function Xs({ draft: e, onChange: a }) {
3670
3675
  {
3671
3676
  size: "xs",
3672
3677
  value: n.pattern,
3673
- onChange: (d) => l({ ...e.presentation, temporal: { mode: "pattern", dialect: "semaphor_tokens", pattern: d.target.value } }),
3678
+ onChange: (c) => l({ ...e.presentation, temporal: { mode: "pattern", dialect: "semaphor_tokens", pattern: c.target.value } }),
3674
3679
  className: "w-40 font-mono",
3675
3680
  "aria-label": "Date pattern"
3676
3681
  }
@@ -3678,7 +3683,7 @@ function Xs({ draft: e, onChange: a }) {
3678
3683
  ] }),
3679
3684
  o ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-destructive", children: o }) : null
3680
3685
  ] }) : null,
3681
- s === "number" || s === "unknown" ? /* @__PURE__ */ t(se, { label: "Numbers read as", hint: "A chip can change any of these for itself.", children: /* @__PURE__ */ t(In, { value: e.presentation, onChange: l }) }) : null,
3686
+ r === "number" || r === "unknown" ? /* @__PURE__ */ t(se, { label: "Numbers read as", hint: "A chip can change any of these for itself.", children: /* @__PURE__ */ t(Tn, { value: e.presentation, onChange: l }) }) : null,
3682
3687
  /* @__PURE__ */ t(
3683
3688
  se,
3684
3689
  {
@@ -3689,8 +3694,8 @@ function Xs({ draft: e, onChange: a }) {
3689
3694
  {
3690
3695
  size: "xs",
3691
3696
  value: e.emptyText ?? "",
3692
- maxLength: vr,
3693
- onChange: (d) => a({ ...e, emptyText: d.target.value || void 0 }),
3697
+ maxLength: yr,
3698
+ onChange: (c) => a({ ...e, emptyText: c.target.value || void 0 }),
3694
3699
  placeholder: "Show nothing",
3695
3700
  className: "w-72",
3696
3701
  "aria-label": "Empty text"
@@ -3700,24 +3705,24 @@ function Xs({ draft: e, onChange: a }) {
3700
3705
  )
3701
3706
  ] });
3702
3707
  }
3703
- function Zs({
3708
+ function Js({
3704
3709
  draft: e,
3705
3710
  draftVariable: a,
3706
- draftDashboard: s,
3711
+ draftDashboard: r,
3707
3712
  blocker: n,
3708
3713
  selectedSheetId: i
3709
3714
  }) {
3710
3715
  var S;
3711
- const o = s.sheets ?? [], l = Y(() => Is(s, a.id), [s, a.id]), [u, c] = E(void 0), d = (l ? u : void 0) ?? i ?? ((S = o[0]) == null ? void 0 : S.id), h = o.find((v) => v.id === d), p = w((v) => d ? v.documentSectionRuntimeBySheetId[d] : void 0), m = !!(h && Ke(h)), f = Y(
3712
- () => d ? m ? p ? { kind: "document", sheetId: d, runtime: p } : void 0 : { kind: "sheet", sheetId: d } : void 0,
3713
- [m, p, d]
3714
- ), g = Y(() => n || !f ? [] : [a], [n, a, f]), N = Tn({
3715
- dashboard: s,
3716
- place: f ?? { kind: "sheet", sheetId: d ?? "" },
3716
+ const o = r.sheets ?? [], l = Y(() => Ts(r, a.id), [r, a.id]), [h, d] = E(void 0), c = (l ? h : void 0) ?? i ?? ((S = o[0]) == null ? void 0 : S.id), u = o.find((v) => v.id === c), p = N((v) => c ? v.documentSectionRuntimeBySheetId[c] : void 0), m = !!(u && Ke(u)), f = Y(
3717
+ () => c ? m ? p ? { kind: "document", sheetId: c, runtime: p } : void 0 : { kind: "sheet", sheetId: c } : void 0,
3718
+ [m, p, c]
3719
+ ), g = Y(() => n || !f ? [] : [a], [n, a, f]), C = Ln({
3720
+ dashboard: r,
3721
+ place: f ?? { kind: "sheet", sheetId: c ?? "" },
3717
3722
  purpose: "preview",
3718
3723
  variables: g
3719
- }).byId.get(a.id), k = Ln(), V = Vn(), P = Y(
3720
- () => yr({ preferences: k, calendar: V }),
3724
+ }).byId.get(a.id), k = Vn(), V = Pn(), P = Y(
3725
+ () => Nr({ preferences: k, calendar: V }),
3721
3726
  [V, k]
3722
3727
  );
3723
3728
  let D, O = "", b = null;
@@ -3725,27 +3730,27 @@ function Zs({
3725
3730
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: e.mode === "sql" ? "Write the SQL to see a value." : "Choose a source and a field to see a value." });
3726
3731
  else if (!f)
3727
3732
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Open this Document to preview here." });
3728
- else if (!N || N.status === "loading")
3733
+ else if (!C || C.status === "loading")
3729
3734
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Loading…" });
3730
3735
  else {
3731
- const v = Js(a, N, P);
3736
+ const v = ei(a, C, P);
3732
3737
  if (D = v.body, O = v.meta, v.unavailable) {
3733
- const T = (h == null ? void 0 : h.title) || "this tab";
3734
- b = /* @__PURE__ */ r("p", { className: "mt-1.5 flex gap-1.5 text-[11px] leading-4 text-amber-700 dark:text-amber-400", children: [
3738
+ const T = (u == null ? void 0 : u.title) || "this tab";
3739
+ b = /* @__PURE__ */ s("p", { className: "mt-1.5 flex gap-1.5 text-[11px] leading-4 text-amber-700 dark:text-amber-400", children: [
3735
3740
  /* @__PURE__ */ t(ya, { className: "mt-px h-3 w-3 shrink-0", "aria-hidden": !0 }),
3736
- /* @__PURE__ */ r("span", { children: [
3741
+ /* @__PURE__ */ s("span", { children: [
3737
3742
  "No change on ",
3738
3743
  T,
3739
3744
  ". ",
3740
- Pn(v.unavailable, "variable")
3745
+ Bn(v.unavailable, "variable")
3741
3746
  ] })
3742
3747
  ] });
3743
3748
  }
3744
3749
  }
3745
- return /* @__PURE__ */ r("div", { className: "shrink-0 border-t border-border/60 bg-muted/30 px-4 py-2.5", "data-testid": "variable-preview", children: [
3746
- /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
3750
+ return /* @__PURE__ */ s("div", { className: "shrink-0 border-t border-border/60 bg-muted/30 px-4 py-2.5", "data-testid": "variable-preview", children: [
3751
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
3747
3752
  /* @__PURE__ */ t("span", { className: Mt, children: l ? "Preview on" : "Preview" }),
3748
- l ? /* @__PURE__ */ r(we, { value: d ?? "", onValueChange: c, disabled: !!n, children: [
3753
+ l ? /* @__PURE__ */ s(we, { value: c ?? "", onValueChange: d, disabled: !!n, children: [
3749
3754
  /* @__PURE__ */ t(Se, { size: "xs", className: "h-6 w-auto gap-1.5 px-2 text-[12px]", "aria-label": "Preview place", children: /* @__PURE__ */ t(ke, {}) }),
3750
3755
  /* @__PURE__ */ t(De, { children: o.map((v) => /* @__PURE__ */ t(fe, { value: v.id, children: v.title || v.id }, v.id)) })
3751
3756
  ] }) : null,
@@ -3755,19 +3760,19 @@ function Zs({
3755
3760
  b
3756
3761
  ] });
3757
3762
  }
3758
- function Js(e, a, s) {
3759
- const n = (h) => /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: h }), i = (h) => /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5 text-[12px] text-amber-700 dark:text-amber-400", children: [
3763
+ function ei(e, a, r) {
3764
+ const n = (u) => /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: u }), i = (u) => /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1.5 text-[12px] text-amber-700 dark:text-amber-400", children: [
3760
3765
  /* @__PURE__ */ t(ya, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
3761
3766
  " ",
3762
- h
3763
- ] }), o = (h) => h === void 0 ? "" : h === "beyondCap" ? `more than ${st} match` : `${h} ${h === 1 ? "match" : "matches"}`, l = "filterReach" in a ? a.filterReach : [], u = l.filter((h) => h.status === "applied").length, c = l.length - u, d = l.length ? ` · ${u} ${u === 1 ? "filter" : "filters"} applied${c ? `, ${c} skipped` : ""}` : "";
3767
+ u
3768
+ ] }), o = (u) => u === void 0 ? "" : u === "beyondCap" ? `more than ${st} match` : `${u} ${u === 1 ? "match" : "matches"}`, l = "filterReach" in a ? a.filterReach : [], h = l.filter((u) => u.status === "applied").length, d = l.length - h, c = l.length ? ` · ${h} ${h === 1 ? "filter" : "filters"} applied${d ? `, ${d} skipped` : ""}` : "";
3764
3769
  switch (a.status) {
3765
3770
  case "answered": {
3766
- const h = Br(e, Object.keys(a.parts))[0], p = h ? a.parts[h] : void 0, m = p && Gt(p, e.presentation, s) || "(empty)", f = `${o(a.matched)}${d}`.replace(/^ · /, ""), g = wr(e, a, s);
3771
+ const u = _r(e, Object.keys(a.parts))[0], p = u ? a.parts[u] : void 0, m = p && Gt(p, e.presentation, r) || "(empty)", f = `${o(a.matched)}${c}`.replace(/^ · /, ""), g = Sr(e, a, r);
3767
3772
  return g && typeof g == "object" && "unavailable" in g ? { body: n(m), meta: f, unavailable: g.unavailable } : g === "noPrevious" ? { body: n(m), meta: `${f} · Nothing in the period before to compare with.`.replace(/^ · /, "") } : g ? {
3768
- body: /* @__PURE__ */ r(U, { children: [
3773
+ body: /* @__PURE__ */ s(U, { children: [
3769
3774
  n(g.value),
3770
- /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: [
3775
+ /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
3771
3776
  " · was ",
3772
3777
  g.previous,
3773
3778
  " · "
@@ -3778,16 +3783,16 @@ function Js(e, a, s) {
3778
3783
  } : { body: n(m), meta: f };
3779
3784
  }
3780
3785
  case "listed": {
3781
- const h = a.items.map((m) => Gt(m, e.presentation, s)), p = a.more === "beyondCap" ? " and more" : a.more ? ` and ${a.more} more` : "";
3782
- return { body: n(`${h.join(e.get.kind === "list" ? e.get.separator ?? ", " : ", ")}${p}`), meta: `${o(a.matched)}${d}` };
3786
+ const u = a.items.map((m) => Gt(m, e.presentation, r)), p = a.more === "beyondCap" ? " and more" : a.more ? ` and ${a.more} more` : "";
3787
+ return { body: n(`${u.join(e.get.kind === "list" ? e.get.separator ?? ", " : ", ")}${p}`), meta: `${o(a.matched)}${c}` };
3783
3788
  }
3784
3789
  case "none":
3785
3790
  return a.why === "moreThanOne" ? {
3786
3791
  body: i(`More than one matches${a.matched !== void 0 ? ` (${a.matched === "beyondCap" ? `${st}+` : a.matched})` : ""}. Readers see nothing.`),
3787
3792
  meta: "Keep a selection on a filter, add a condition, or choose First or List."
3788
- } : { body: /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "No rows match." }), meta: d.slice(3) };
3793
+ } : { body: /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "No rows match." }), meta: c.slice(3) };
3789
3794
  case "held":
3790
- return { body: /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: [
3795
+ return { body: /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
3791
3796
  "Waiting for ",
3792
3797
  a.missingRequired.join(", "),
3793
3798
  "."
@@ -3800,26 +3805,26 @@ function Js(e, a, s) {
3800
3805
  return { body: null, meta: "" };
3801
3806
  }
3802
3807
  }
3803
- function no() {
3804
- const e = w((l) => l.variableEditor), a = w((l) => l.dashboard.variables), s = w((l) => l.actions.closeVariableEditor), n = et(!1), i = (e == null ? void 0 : e.kind) === "edit" ? a == null ? void 0 : a.find((l) => l.id === e.variableId) : void 0;
3805
- return !(e && (e.kind === "new" || i)) ? null : /* @__PURE__ */ r(Le, { modal: !1, open: !0, onOpenChange: (l) => !l && s(), children: [
3808
+ function ro() {
3809
+ const e = N((l) => l.variableEditor), a = N((l) => l.dashboard.variables), r = N((l) => l.actions.closeVariableEditor), n = et(!1), i = (e == null ? void 0 : e.kind) === "edit" ? a == null ? void 0 : a.find((l) => l.id === e.variableId) : void 0;
3810
+ return !(e && (e.kind === "new" || i)) ? null : /* @__PURE__ */ s(Le, { modal: !1, open: !0, onOpenChange: (l) => !l && r(), children: [
3806
3811
  /* @__PURE__ */ t("div", { className: "pointer-events-none fixed inset-0 z-40 bg-zinc-950/40 backdrop-blur-sm" }),
3807
- /* @__PURE__ */ r(
3812
+ /* @__PURE__ */ s(
3808
3813
  Ve,
3809
3814
  {
3810
3815
  className: "w-auto max-w-none gap-0 overflow-hidden p-0 [&>button:last-child]:hidden",
3811
3816
  onInteractOutside: (l) => l.preventDefault(),
3812
3817
  onEscapeKeyDown: (l) => {
3813
- n.current ? l.preventDefault() : s();
3818
+ n.current ? l.preventDefault() : r();
3814
3819
  },
3815
3820
  children: [
3816
3821
  /* @__PURE__ */ t(Pe, { className: "sr-only", children: "Variable from data" }),
3817
3822
  /* @__PURE__ */ t(ut, { className: "sr-only", children: "Define a value from your data to show in text." }),
3818
3823
  /* @__PURE__ */ t(
3819
- Qs,
3824
+ Ks,
3820
3825
  {
3821
3826
  variable: i,
3822
- onClose: s,
3827
+ onClose: r,
3823
3828
  onHoldEscape: (l) => {
3824
3829
  n.current = l;
3825
3830
  }
@@ -3831,40 +3836,40 @@ function no() {
3831
3836
  )
3832
3837
  ] });
3833
3838
  }
3834
- function ei({
3839
+ function ti({
3835
3840
  disabled: e,
3836
3841
  briefingCount: a,
3837
- className: s,
3842
+ className: r,
3838
3843
  onClick: n
3839
3844
  }) {
3840
3845
  const i = typeof a == "number" && a > 0;
3841
- return /* @__PURE__ */ r(
3846
+ return /* @__PURE__ */ s(
3842
3847
  L,
3843
3848
  {
3844
3849
  type: "button",
3845
3850
  size: "xs",
3846
3851
  variant: "outline",
3847
3852
  disabled: e,
3848
- className: Z("gap-1.5", s),
3853
+ className: Z("gap-1.5", r),
3849
3854
  onClick: n,
3850
3855
  "aria-label": "Reports & briefings",
3851
3856
  children: [
3852
- /* @__PURE__ */ t(Gr, { className: "h-3.5 w-3.5" }),
3857
+ /* @__PURE__ */ t(Hr, { className: "h-3.5 w-3.5" }),
3853
3858
  "Reports & briefings",
3854
3859
  i ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
3855
3860
  ]
3856
3861
  }
3857
3862
  );
3858
3863
  }
3859
- const ti = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ia = "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", Je = "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";
3860
- function ai(e) {
3864
+ const ai = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ia = "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", Je = "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";
3865
+ function ni(e) {
3861
3866
  return e === "dashboard" ? "This dashboard" : "Project";
3862
3867
  }
3863
- function ni(e) {
3868
+ function ri(e) {
3864
3869
  if (!e) return "Never";
3865
3870
  const a = new Date(e);
3866
3871
  if (Number.isNaN(a.getTime())) return "Unknown";
3867
- const s = Date.now() - a.getTime(), n = Math.round(s / 6e4);
3872
+ const r = Date.now() - a.getTime(), n = Math.round(r / 6e4);
3868
3873
  if (n < 1) return "now";
3869
3874
  if (n < 60) return `${n}m ago`;
3870
3875
  const i = Math.round(n / 60);
@@ -3874,13 +3879,13 @@ function ni(e) {
3874
3879
  const l = Math.round(o / 7);
3875
3880
  return l < 5 ? `${l}w ago` : `${Math.round(o / 30)}mo ago`;
3876
3881
  }
3877
- function ri(e) {
3878
- return e.scheduleExpr ? jr(
3882
+ function si(e) {
3883
+ return e.scheduleExpr ? qr(
3879
3884
  e.scheduleExpr,
3880
3885
  e.timezone || "UTC"
3881
3886
  ) ?? "Invalid schedule" : "On demand";
3882
3887
  }
3883
- function si(e) {
3888
+ function ii(e) {
3884
3889
  if (e.lastRunStatus) {
3885
3890
  const a = e.lastRunStatus.toString().toUpperCase();
3886
3891
  return a === "SUCCESS" ? "Last run completed." : a === "FAILED" ? "Last run failed." : `Last run ${e.lastRunStatus.toString().toLowerCase()}`;
@@ -3890,10 +3895,10 @@ function si(e) {
3890
3895
  function Ta(e) {
3891
3896
  return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
3892
3897
  }
3893
- function ii(e) {
3898
+ function oi(e) {
3894
3899
  return e.source.type === "dashboard" ? "This dashboard" : "Project";
3895
3900
  }
3896
- function oi({
3901
+ function li({
3897
3902
  activeView: e,
3898
3903
  onChange: a
3899
3904
  }) {
@@ -3903,59 +3908,59 @@ function oi({
3903
3908
  className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
3904
3909
  role: "tablist",
3905
3910
  "aria-label": "Briefing source view",
3906
- children: ["dashboard", "project"].map((s) => {
3907
- const n = e === s;
3911
+ children: ["dashboard", "project"].map((r) => {
3912
+ const n = e === r;
3908
3913
  return /* @__PURE__ */ t(
3909
3914
  "button",
3910
3915
  {
3911
3916
  type: "button",
3912
3917
  role: "tab",
3913
3918
  "aria-selected": n,
3914
- onClick: () => a(s),
3919
+ onClick: () => a(r),
3915
3920
  className: Z(
3916
3921
  "h-6 rounded-[3px] px-2 text-[11px] transition-colors",
3917
3922
  n ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
3918
3923
  ),
3919
- children: ai(s)
3924
+ children: ni(r)
3920
3925
  },
3921
- s
3926
+ r
3922
3927
  );
3923
3928
  })
3924
3929
  }
3925
3930
  );
3926
3931
  }
3927
- function li({
3932
+ function di({
3928
3933
  briefings: e,
3929
3934
  dashboardLabel: a,
3930
- sourceView: s,
3935
+ sourceView: r,
3931
3936
  error: n,
3932
3937
  loading: i,
3933
3938
  onSourceViewChange: o,
3934
3939
  onClose: l,
3935
- onEdit: u,
3936
- onNew: c,
3937
- canCreate: d,
3938
- canCreateScheduledReport: h,
3940
+ onEdit: h,
3941
+ onNew: d,
3942
+ canCreate: c,
3943
+ canCreateScheduledReport: u,
3939
3944
  analyticalBriefingsEnabled: p,
3940
3945
  onRunNow: m,
3941
3946
  onTogglePause: f,
3942
3947
  onDelete: g,
3943
3948
  selectingId: y,
3944
- busyId: N,
3949
+ busyId: C,
3945
3950
  manageBriefingsHref: k,
3946
3951
  contentKind: V,
3947
3952
  hideHeader: P = !1
3948
3953
  }) {
3949
- const D = e.length, O = e.filter((F) => F.status === "ACTIVE").length, b = V === "reports" ? D === 1 ? "report" : "reports" : V === "briefings" ? D === 1 ? "briefing" : "briefings" : D === 1 ? "item" : "items", S = e.find((F) => F.hasActiveRun) ?? null, v = V ?? "reports & briefings", T = s === "dashboard" ? a : `Project ${v}`;
3950
- return /* @__PURE__ */ r(
3954
+ const D = e.length, O = e.filter((F) => F.status === "ACTIVE").length, b = V === "reports" ? D === 1 ? "report" : "reports" : V === "briefings" ? D === 1 ? "briefing" : "briefings" : D === 1 ? "item" : "items", S = e.find((F) => F.hasActiveRun) ?? null, v = V ?? "reports & briefings", T = r === "dashboard" ? a : `Project ${v}`;
3955
+ return /* @__PURE__ */ s(
3951
3956
  "section",
3952
3957
  {
3953
3958
  "aria-label": `Dashboard ${v.replace("&", "and")}`,
3954
3959
  className: "flex h-full min-h-0 flex-col bg-background text-foreground",
3955
3960
  children: [
3956
- P ? null : /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
3957
- /* @__PURE__ */ r("div", { className: "min-w-0", children: [
3958
- /* @__PURE__ */ t("div", { className: ti, children: v }),
3961
+ P ? null : /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
3962
+ /* @__PURE__ */ s("div", { className: "min-w-0", children: [
3963
+ /* @__PURE__ */ t("div", { className: ai, children: v }),
3959
3964
  /* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: T })
3960
3965
  ] }),
3961
3966
  /* @__PURE__ */ t(
@@ -3969,37 +3974,37 @@ function li({
3969
3974
  }
3970
3975
  )
3971
3976
  ] }),
3972
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
3973
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-3", children: [
3977
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
3978
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3", children: [
3974
3979
  /* @__PURE__ */ t(
3975
- oi,
3980
+ li,
3976
3981
  {
3977
- activeView: s,
3982
+ activeView: r,
3978
3983
  onChange: o
3979
3984
  }
3980
3985
  ),
3981
- /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && D === 0 ? /* @__PURE__ */ r("span", { children: [
3986
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && D === 0 ? /* @__PURE__ */ s("span", { children: [
3982
3987
  "Loading ",
3983
3988
  v,
3984
3989
  "…"
3985
- ] }) : D === 0 ? /* @__PURE__ */ r("span", { children: [
3990
+ ] }) : D === 0 ? /* @__PURE__ */ s("span", { children: [
3986
3991
  "No ",
3987
3992
  v,
3988
3993
  " yet"
3989
- ] }) : /* @__PURE__ */ r(U, { children: [
3990
- /* @__PURE__ */ r("span", { className: "font-medium text-foreground/80", children: [
3994
+ ] }) : /* @__PURE__ */ s(U, { children: [
3995
+ /* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
3991
3996
  D,
3992
3997
  " ",
3993
3998
  b
3994
3999
  ] }),
3995
4000
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
3996
- /* @__PURE__ */ r("span", { children: [
4001
+ /* @__PURE__ */ s("span", { children: [
3997
4002
  O,
3998
4003
  " active"
3999
4004
  ] })
4000
4005
  ] }) })
4001
4006
  ] }),
4002
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
4007
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
4003
4008
  i ? (
4004
4009
  // Auto-refresh on open; surface a quiet spinner near the count
4005
4010
  // when a manual reload is in flight, but don't show a separate
@@ -4007,35 +4012,35 @@ function li({
4007
4012
  // case without crowding the toolbar.
4008
4013
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
4009
4014
  ) : null,
4010
- D > 0 && d ? p && h ? /* @__PURE__ */ r(je, { children: [
4011
- /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Je, children: [
4015
+ D > 0 && c ? p && u ? /* @__PURE__ */ s(je, { children: [
4016
+ /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ s("button", { className: Je, children: [
4012
4017
  /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
4013
4018
  " New"
4014
4019
  ] }) }),
4015
- /* @__PURE__ */ r(We, { align: "end", children: [
4016
- /* @__PURE__ */ t(re, { onClick: () => c("scheduled_report"), children: "Schedule a report" }),
4020
+ /* @__PURE__ */ s(We, { align: "end", children: [
4021
+ /* @__PURE__ */ t(re, { onClick: () => d("scheduled_report"), children: "Schedule a report" }),
4017
4022
  /* @__PURE__ */ t(
4018
4023
  re,
4019
4024
  {
4020
- onClick: () => c("analytical_briefing"),
4025
+ onClick: () => d("analytical_briefing"),
4021
4026
  children: "Create analytical briefing"
4022
4027
  }
4023
4028
  )
4024
4029
  ] })
4025
- ] }) : h ? /* @__PURE__ */ r(
4030
+ ] }) : u ? /* @__PURE__ */ s(
4026
4031
  "button",
4027
4032
  {
4028
- onClick: () => c("scheduled_report"),
4033
+ onClick: () => d("scheduled_report"),
4029
4034
  className: Je,
4030
4035
  children: [
4031
4036
  /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
4032
4037
  " Schedule report"
4033
4038
  ]
4034
4039
  }
4035
- ) : p ? /* @__PURE__ */ r(
4040
+ ) : p ? /* @__PURE__ */ s(
4036
4041
  "button",
4037
4042
  {
4038
- onClick: () => c("analytical_briefing"),
4043
+ onClick: () => d("analytical_briefing"),
4039
4044
  className: Je,
4040
4045
  children: [
4041
4046
  /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
@@ -4045,31 +4050,31 @@ function li({
4045
4050
  ) : null : null
4046
4051
  ] })
4047
4052
  ] }),
4048
- S ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
4053
+ S ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
4049
4054
  /* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
4050
4055
  /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: S.name }),
4051
4056
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4052
4057
  /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Ta(S) })
4053
4058
  ] }) : null,
4054
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: [
4059
+ /* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto", children: [
4055
4060
  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,
4056
4061
  !i && e.length === 0 && !n ? /* @__PURE__ */ t(
4057
- di,
4062
+ ci,
4058
4063
  {
4059
- onNew: c,
4060
- canCreate: d,
4061
- canCreateScheduledReport: h,
4064
+ onNew: d,
4065
+ canCreate: c,
4066
+ canCreateScheduledReport: u,
4062
4067
  analyticalBriefingsEnabled: p,
4063
4068
  contentKind: V
4064
4069
  }
4065
4070
  ) : null,
4066
4071
  e.map((F) => /* @__PURE__ */ t(
4067
- ui,
4072
+ hi,
4068
4073
  {
4069
4074
  briefing: F,
4070
4075
  isOpening: y === F.id,
4071
- isBusy: N === F.id,
4072
- onOpen: () => u(F.id),
4076
+ isBusy: C === F.id,
4077
+ onOpen: () => h(F.id),
4073
4078
  onRunNow: () => m(F),
4074
4079
  onTogglePause: () => f(F),
4075
4080
  onDelete: () => g(F)
@@ -4077,14 +4082,14 @@ function li({
4077
4082
  F.id
4078
4083
  ))
4079
4084
  ] }),
4080
- k ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ r(
4085
+ k ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ s(
4081
4086
  "a",
4082
4087
  {
4083
4088
  href: k,
4084
4089
  className: Z(Ia, "h-6 px-1 text-[11px]"),
4085
4090
  children: [
4086
4091
  "Manage all reports & briefings",
4087
- /* @__PURE__ */ t(Wr, { className: "h-3 w-3" })
4092
+ /* @__PURE__ */ t(Qr, { className: "h-3 w-3" })
4088
4093
  ]
4089
4094
  }
4090
4095
  ) }) : null
@@ -4092,10 +4097,10 @@ function li({
4092
4097
  }
4093
4098
  );
4094
4099
  }
4095
- function di({
4100
+ function ci({
4096
4101
  onNew: e,
4097
4102
  canCreate: a,
4098
- canCreateScheduledReport: s,
4103
+ canCreateScheduledReport: r,
4099
4104
  analyticalBriefingsEnabled: n,
4100
4105
  contentKind: i
4101
4106
  }) {
@@ -4106,12 +4111,12 @@ function di({
4106
4111
  title: "No briefings yet",
4107
4112
  description: "Create an analytical briefing to monitor this dashboard and brief your team."
4108
4113
  } : null;
4109
- return /* @__PURE__ */ r("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
4110
- /* @__PURE__ */ t(ci, { className: "mb-5 h-[88px] w-[112px] text-border" }),
4114
+ return /* @__PURE__ */ s("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
4115
+ /* @__PURE__ */ t(ui, { className: "mb-5 h-[88px] w-[112px] text-border" }),
4111
4116
  /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: (o == null ? void 0 : o.title) ?? "Have an analyst brief your team" }),
4112
4117
  /* @__PURE__ */ t("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (o == null ? void 0 : o.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
4113
- a ? /* @__PURE__ */ r("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
4114
- s ? /* @__PURE__ */ r(
4118
+ a ? /* @__PURE__ */ s("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
4119
+ r ? /* @__PURE__ */ s(
4115
4120
  "button",
4116
4121
  {
4117
4122
  onClick: () => e("scheduled_report"),
@@ -4133,8 +4138,8 @@ function di({
4133
4138
  ] }) : null
4134
4139
  ] });
4135
4140
  }
4136
- function ci({ className: e }) {
4137
- return /* @__PURE__ */ r(
4141
+ function ui({ className: e }) {
4142
+ return /* @__PURE__ */ s(
4138
4143
  "svg",
4139
4144
  {
4140
4145
  viewBox: "0 0 112 88",
@@ -4310,25 +4315,25 @@ function ci({ className: e }) {
4310
4315
  }
4311
4316
  );
4312
4317
  }
4313
- function ui({
4318
+ function hi({
4314
4319
  briefing: e,
4315
4320
  isOpening: a,
4316
- isBusy: s,
4321
+ isBusy: r,
4317
4322
  onOpen: n,
4318
4323
  onRunNow: i,
4319
4324
  onTogglePause: o,
4320
4325
  onDelete: l
4321
4326
  }) {
4322
- const u = e.status === "PAUSED", c = e.hasActiveRun, d = si(e), h = ni(e.lastRunAt), p = e.lastRunStatus, m = pe(e), f = p === "SUCCESS" ? Xe.success.dot : p === "FAILED" ? Xe.danger.dot : p ? Xe.warning.dot : Xe.neutral.dot;
4323
- return /* @__PURE__ */ r(
4327
+ const h = e.status === "PAUSED", d = e.hasActiveRun, c = ii(e), u = ri(e.lastRunAt), p = e.lastRunStatus, m = pe(e), f = p === "SUCCESS" ? Xe.success.dot : p === "FAILED" ? Xe.danger.dot : p ? Xe.warning.dot : Xe.neutral.dot;
4328
+ return /* @__PURE__ */ s(
4324
4329
  "div",
4325
4330
  {
4326
4331
  className: Z(
4327
4332
  "group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
4328
- u && "opacity-70"
4333
+ h && "opacity-70"
4329
4334
  ),
4330
4335
  children: [
4331
- /* @__PURE__ */ r(
4336
+ /* @__PURE__ */ s(
4332
4337
  "div",
4333
4338
  {
4334
4339
  role: "button",
@@ -4339,27 +4344,27 @@ function ui({
4339
4344
  },
4340
4345
  className: "cursor-pointer pr-8",
4341
4346
  children: [
4342
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
4347
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
4343
4348
  /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
4344
- u ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
4349
+ h ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
4345
4350
  ] }),
4346
- /* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
4351
+ /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
4347
4352
  /* @__PURE__ */ t("span", { children: m.typeLabel }),
4348
4353
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4349
- /* @__PURE__ */ t("span", { children: ii(e) }),
4354
+ /* @__PURE__ */ t("span", { children: oi(e) }),
4350
4355
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4351
- /* @__PURE__ */ t(Bn, { className: "h-3 w-3" }),
4352
- /* @__PURE__ */ t("span", { className: "truncate", children: ri(e) }),
4353
- e.lastRunAt ? /* @__PURE__ */ r(U, { children: [
4356
+ /* @__PURE__ */ t(_n, { className: "h-3 w-3" }),
4357
+ /* @__PURE__ */ t("span", { className: "truncate", children: si(e) }),
4358
+ e.lastRunAt ? /* @__PURE__ */ s(U, { children: [
4354
4359
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4355
- /* @__PURE__ */ r("span", { children: [
4360
+ /* @__PURE__ */ s("span", { children: [
4356
4361
  "Last run ",
4357
- h
4362
+ u
4358
4363
  ] })
4359
4364
  ] }) : null
4360
4365
  ] }),
4361
- d || c ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
4362
- c ? /* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
4366
+ c || d ? /* @__PURE__ */ s("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
4367
+ d ? /* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
4363
4368
  "span",
4364
4369
  {
4365
4370
  className: Z(
@@ -4368,12 +4373,12 @@ function ui({
4368
4373
  )
4369
4374
  }
4370
4375
  ),
4371
- /* @__PURE__ */ t("span", { className: "truncate", children: c ? Ta(e) : d })
4376
+ /* @__PURE__ */ t("span", { className: "truncate", children: d ? Ta(e) : c })
4372
4377
  ] }) : null
4373
4378
  ]
4374
4379
  }
4375
4380
  ),
4376
- /* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: s ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r(je, { children: [
4381
+ /* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: r ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ s(je, { children: [
4377
4382
  /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
4378
4383
  "button",
4379
4384
  {
@@ -4384,20 +4389,20 @@ function ui({
4384
4389
  children: /* @__PURE__ */ t(ha, { className: "h-3.5 w-3.5" })
4385
4390
  }
4386
4391
  ) }),
4387
- /* @__PURE__ */ r(We, { align: "end", className: "w-44", children: [
4388
- /* @__PURE__ */ r(re, { onClick: n, children: [
4392
+ /* @__PURE__ */ s(We, { align: "end", className: "w-44", children: [
4393
+ /* @__PURE__ */ s(re, { onClick: n, children: [
4389
4394
  /* @__PURE__ */ t(Vt, { className: "h-3.5 w-3.5" }),
4390
4395
  "Edit ",
4391
4396
  m.noun
4392
4397
  ] }),
4393
- /* @__PURE__ */ r(
4398
+ /* @__PURE__ */ s(
4394
4399
  re,
4395
4400
  {
4396
4401
  onClick: (g) => {
4397
4402
  g.preventDefault(), i();
4398
4403
  },
4399
4404
  children: [
4400
- /* @__PURE__ */ t(_n, { className: "h-3.5 w-3.5" }),
4405
+ /* @__PURE__ */ t(On, { className: "h-3.5 w-3.5" }),
4401
4406
  "Run now"
4402
4407
  ]
4403
4408
  }
@@ -4408,17 +4413,17 @@ function ui({
4408
4413
  onClick: (g) => {
4409
4414
  g.preventDefault(), o();
4410
4415
  },
4411
- children: u ? /* @__PURE__ */ r(U, { children: [
4412
- /* @__PURE__ */ t(On, { className: "h-3.5 w-3.5" }),
4413
- "Resume"
4414
- ] }) : /* @__PURE__ */ r(U, { children: [
4416
+ children: h ? /* @__PURE__ */ s(U, { children: [
4415
4417
  /* @__PURE__ */ t(zn, { className: "h-3.5 w-3.5" }),
4418
+ "Resume"
4419
+ ] }) : /* @__PURE__ */ s(U, { children: [
4420
+ /* @__PURE__ */ t(Rn, { className: "h-3.5 w-3.5" }),
4416
4421
  "Pause"
4417
4422
  ] })
4418
4423
  }
4419
4424
  ) : null,
4420
4425
  /* @__PURE__ */ t(at, {}),
4421
- /* @__PURE__ */ r(
4426
+ /* @__PURE__ */ s(
4422
4427
  re,
4423
4428
  {
4424
4429
  onClick: (g) => {
@@ -4438,19 +4443,19 @@ function ui({
4438
4443
  }
4439
4444
  );
4440
4445
  }
4441
- function hi(e) {
4446
+ function mi(e) {
4442
4447
  return (e == null ? void 0 : e.trim()) || "This dashboard";
4443
4448
  }
4444
- function mi(e) {
4449
+ function pi(e) {
4445
4450
  return e === "This dashboard" ? "Watch this dashboard" : `Watch ${e}`;
4446
4451
  }
4447
- function pi(e, a, s) {
4452
+ function fi(e, a, r) {
4448
4453
  return a !== "dashboard" ? e : e.filter(
4449
- (n) => n.source.type === "dashboard" && n.source.dashboardId === s
4454
+ (n) => n.source.type === "dashboard" && n.source.dashboardId === r
4450
4455
  );
4451
4456
  }
4452
- async function fi(e) {
4453
- const s = [];
4457
+ async function gi(e) {
4458
+ const r = [];
4454
4459
  let n = 1, i = 0, o = Number.POSITIVE_INFINITY;
4455
4460
  for (; i < o; ) {
4456
4461
  const l = await e.apiClient.listBriefings(
@@ -4458,53 +4463,53 @@ async function fi(e) {
4458
4463
  e.token,
4459
4464
  { scope: "organization", page: n, pageSize: 100 }
4460
4465
  );
4461
- if (s.push(...l.briefings), i += l.briefings.length, o = l.total, l.briefings.length === 0 || i >= o) break;
4466
+ if (r.push(...l.briefings), i += l.briefings.length, o = l.total, l.briefings.length === 0 || i >= o) break;
4462
4467
  n += 1;
4463
4468
  }
4464
- return s;
4469
+ return r;
4465
4470
  }
4466
- const gi = {
4467
- listBriefings: Kn,
4468
- getBriefing: Qn,
4469
- pauseBriefing: Wn,
4470
- resumeBriefing: qn,
4471
- deleteBriefing: jn,
4472
- runBriefingNow: $n
4471
+ const bi = {
4472
+ listBriefings: Gn,
4473
+ getBriefing: Kn,
4474
+ pauseBriefing: Qn,
4475
+ resumeBriefing: Wn,
4476
+ deleteBriefing: qn,
4477
+ runBriefingNow: jn
4473
4478
  };
4474
- function ro(e) {
4475
- return /* @__PURE__ */ t(Rn, { authToken: e.token ? { accessToken: e.token } : void 0, children: /* @__PURE__ */ t(Mn, { children: /* @__PURE__ */ t(bi, { ...e }) }) });
4479
+ function so(e) {
4480
+ return /* @__PURE__ */ t(Mn, { authToken: e.token ? { accessToken: e.token } : void 0, children: /* @__PURE__ */ t(Un, { children: /* @__PURE__ */ t(xi, { ...e }) }) });
4476
4481
  }
4477
- function bi({
4482
+ function xi({
4478
4483
  dashboardId: e,
4479
4484
  dashboardTitle: a,
4480
- apiServiceUrl: s,
4485
+ apiServiceUrl: r,
4481
4486
  token: n,
4482
4487
  disabled: i,
4483
4488
  className: o,
4484
4489
  manageBriefingsHref: l,
4485
- open: u,
4486
- onOpenChange: c,
4487
- hideTrigger: d = !1,
4488
- workflowIntent: h,
4490
+ open: h,
4491
+ onOpenChange: d,
4492
+ hideTrigger: c = !1,
4493
+ workflowIntent: u,
4489
4494
  openRun: p,
4490
4495
  client: m
4491
4496
  }) {
4492
- const { authToken: f, tokenProps: g } = $e(), y = Un(), N = !h || y.canCreate && (h === "scheduled_report" || y.analyticalBriefingsEnabled), [k, V] = E(!1), P = u ?? k, D = (A) => {
4493
- u === void 0 && V(A), c == null || c(A);
4497
+ const { authToken: f, tokenProps: g } = $e(), y = $n(), C = !u || y.canCreate && (u === "scheduled_report" || y.analyticalBriefingsEnabled), [k, V] = E(!1), P = h ?? k, D = (A) => {
4498
+ h === void 0 && V(A), d == null || d(A);
4494
4499
  }, [O, b] = E(
4495
- h ? "author" : "list"
4500
+ u ? "author" : "list"
4496
4501
  ), [S, v] = E(
4497
- h ?? "analytical_briefing"
4502
+ u ?? "analytical_briefing"
4498
4503
  ), [T, F] = E("dashboard"), [G, B] = E(
4499
4504
  []
4500
- ), [Q, X] = E(null), _ = h && !N && !Q ? "list" : O, [te, J] = E(!1), [H, I] = E(null), [ae, j] = E(null), [R, ne] = E(
4505
+ ), [Q, X] = E(null), _ = u && !C && !Q ? "list" : O, [te, J] = E(!1), [H, I] = E(null), [ae, j] = E(null), [R, ne] = E(
4501
4506
  null
4502
4507
  ), [ue, he] = E(null), ye = et(null), x = et(P);
4503
4508
  Ee(() => {
4504
4509
  const A = P && !x.current;
4505
- x.current = P, !(!A || !h) && (X(null), F("dashboard"), v(h), b("author"), he(null));
4506
- }, [P, h]);
4507
- const M = Lt(), $ = s ?? (g == null ? void 0 : g.apiServiceUrl), K = n ?? (f == null ? void 0 : f.accessToken), le = Y(() => ({ ...gi, ...m }), [m]), [_e, ht] = E(null);
4510
+ x.current = P, !(!A || !u) && (X(null), F("dashboard"), v(u), b("author"), he(null));
4511
+ }, [P, u]);
4512
+ const M = Lt(), $ = r ?? (g == null ? void 0 : g.apiServiceUrl), K = n ?? (f == null ? void 0 : f.accessToken), le = Y(() => ({ ...bi, ...m }), [m]), [_e, ht] = E(null);
4508
4513
  Ee(() => {
4509
4514
  if (!p || !$ || !K) return;
4510
4515
  let A = !0;
@@ -4516,27 +4521,27 @@ function bi({
4516
4521
  A = !1;
4517
4522
  };
4518
4523
  }, [p, $, K, le]);
4519
- const Fe = hi(a), Ge = Y(() => {
4520
- const A = pi(
4524
+ const Fe = mi(a), Ge = Y(() => {
4525
+ const A = fi(
4521
4526
  G,
4522
4527
  T,
4523
4528
  e
4524
4529
  );
4525
- if (!h)
4530
+ if (!u)
4526
4531
  return A;
4527
- const W = h === "scheduled_report" ? "report" : "briefing";
4532
+ const W = u === "scheduled_report" ? "report" : "briefing";
4528
4533
  return A.filter(
4529
4534
  (He) => pe(He).noun === W
4530
4535
  );
4531
- }, [e, G, T, h]), mt = Y(() => T === "dashboard" ? {
4536
+ }, [e, G, T, u]), mt = Y(() => T === "dashboard" ? {
4532
4537
  source: { type: "dashboard", dashboardId: e },
4533
4538
  label: Fe,
4534
- detail: mi(Fe)
4539
+ detail: pi(Fe)
4535
4540
  } : {
4536
4541
  source: { type: "project" },
4537
4542
  label: "This project",
4538
4543
  detail: "Use any data in this project."
4539
- }, [e, Fe, T]), Oe = !!($ && K), ze = qr({
4544
+ }, [e, Fe, T]), Oe = !!($ && K), ze = Wr({
4540
4545
  canCreate: y.canCreate,
4541
4546
  analyticalBriefingsEnabled: y.analyticalBriefingsEnabled,
4542
4547
  scheduledReportAvailable: T === "dashboard"
@@ -4545,7 +4550,7 @@ function bi({
4545
4550
  J(!0), he(null);
4546
4551
  try {
4547
4552
  B(
4548
- await fi({
4553
+ await gi({
4549
4554
  apiClient: le,
4550
4555
  apiServiceUrl: $,
4551
4556
  token: K
@@ -4565,7 +4570,7 @@ function bi({
4565
4570
  }, [Oe, _, ce, P]);
4566
4571
  const Re = () => {
4567
4572
  X(null), F("dashboard"), b("list"), D(!0);
4568
- }, C = (A) => {
4573
+ }, w = (A) => {
4569
4574
  X(null), v(A), b("author");
4570
4575
  }, q = async (A) => {
4571
4576
  if (!(!$ || !K)) {
@@ -4593,7 +4598,7 @@ function bi({
4593
4598
  $,
4594
4599
  K,
4595
4600
  A.id,
4596
- { requestId: xi() }
4601
+ { requestId: vi() }
4597
4602
  );
4598
4603
  M.track({ kind: "briefing", id: W.run.id, title: A.name, briefingId: A.id }), ce();
4599
4604
  } catch (W) {
@@ -4648,9 +4653,9 @@ function bi({
4648
4653
  j(null);
4649
4654
  }
4650
4655
  }, La = Ge.length;
4651
- return y.surfaceVisible ? /* @__PURE__ */ r(Gn, { open: P, onOpenChange: D, children: [
4652
- d ? null : /* @__PURE__ */ t(
4653
- ei,
4656
+ return y.surfaceVisible ? /* @__PURE__ */ s(Hn, { open: P, onOpenChange: D, children: [
4657
+ c ? null : /* @__PURE__ */ t(
4658
+ ti,
4654
4659
  {
4655
4660
  disabled: i || !Oe,
4656
4661
  briefingCount: La,
@@ -4658,8 +4663,8 @@ function bi({
4658
4663
  onClick: Re
4659
4664
  }
4660
4665
  ),
4661
- /* @__PURE__ */ r(
4662
- Hn,
4666
+ /* @__PURE__ */ s(
4667
+ Yn,
4663
4668
  {
4664
4669
  ref: ye,
4665
4670
  side: "right",
@@ -4670,17 +4675,17 @@ function bi({
4670
4675
  A.preventDefault(), (W = ye.current) == null || W.focus({ preventScroll: !0 });
4671
4676
  },
4672
4677
  children: [
4673
- /* @__PURE__ */ r(Yn, { className: "sr-only", children: [
4674
- /* @__PURE__ */ t(Xn, { children: "Reports & briefings" }),
4675
- /* @__PURE__ */ t(Zn, { children: "Manage reports and briefings for this dashboard." })
4678
+ /* @__PURE__ */ s(Xn, { className: "sr-only", children: [
4679
+ /* @__PURE__ */ t(Zn, { children: "Reports & briefings" }),
4680
+ /* @__PURE__ */ t(Jn, { children: "Manage reports and briefings for this dashboard." })
4676
4681
  ] }),
4677
- h ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
4678
- /* @__PURE__ */ r(
4682
+ u ? /* @__PURE__ */ s("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
4683
+ /* @__PURE__ */ s(
4679
4684
  "div",
4680
4685
  {
4681
4686
  className: "flex items-center gap-5",
4682
4687
  role: "tablist",
4683
- "aria-label": h === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
4688
+ "aria-label": u === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
4684
4689
  children: [
4685
4690
  /* @__PURE__ */ t(
4686
4691
  "button",
@@ -4688,16 +4693,16 @@ function bi({
4688
4693
  type: "button",
4689
4694
  role: "tab",
4690
4695
  "aria-selected": _ === "author",
4691
- disabled: !N,
4696
+ disabled: !C,
4692
4697
  className: Z(
4693
4698
  "-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
4694
4699
  _ === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
4695
- !N && "cursor-not-allowed opacity-50"
4700
+ !C && "cursor-not-allowed opacity-50"
4696
4701
  ),
4697
4702
  onClick: () => {
4698
- N && (X(null), v(h), F("dashboard"), b("author"));
4703
+ C && (X(null), v(u), F("dashboard"), b("author"));
4699
4704
  },
4700
- children: Q ? `Edit ${pe(Q).noun}` : h === "scheduled_report" ? "Schedule report" : "Create briefing"
4705
+ children: Q ? `Edit ${pe(Q).noun}` : u === "scheduled_report" ? "Schedule report" : "Create briefing"
4701
4706
  }
4702
4707
  ),
4703
4708
  /* @__PURE__ */ t(
@@ -4711,7 +4716,7 @@ function bi({
4711
4716
  _ === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
4712
4717
  ),
4713
4718
  onClick: () => b("list"),
4714
- children: h === "scheduled_report" ? "Manage reports" : "Manage briefings"
4719
+ children: u === "scheduled_report" ? "Manage reports" : "Manage briefings"
4715
4720
  }
4716
4721
  )
4717
4722
  ]
@@ -4723,13 +4728,13 @@ function bi({
4723
4728
  type: "button",
4724
4729
  onClick: () => D(!1),
4725
4730
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
4726
- "aria-label": h === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
4731
+ "aria-label": u === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
4727
4732
  children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
4728
4733
  }
4729
4734
  )
4730
4735
  ] }) : null,
4731
4736
  _ === "list" ? /* @__PURE__ */ t(
4732
- li,
4737
+ di,
4733
4738
  {
4734
4739
  briefings: Ge,
4735
4740
  dashboardLabel: Fe,
@@ -4741,8 +4746,8 @@ function bi({
4741
4746
  onEdit: (A) => {
4742
4747
  q(A);
4743
4748
  },
4744
- onNew: C,
4745
- canCreate: !h && ze.length > 0,
4749
+ onNew: w,
4750
+ canCreate: !u && ze.length > 0,
4746
4751
  canCreateScheduledReport: ze.includes(
4747
4752
  "scheduled_report"
4748
4753
  ),
@@ -4759,11 +4764,11 @@ function bi({
4759
4764
  selectingId: H,
4760
4765
  busyId: ae,
4761
4766
  manageBriefingsHref: l,
4762
- contentKind: h === "scheduled_report" ? "reports" : h === "analytical_briefing" ? "briefings" : void 0,
4763
- hideHeader: !!h
4767
+ contentKind: u === "scheduled_report" ? "reports" : u === "analytical_briefing" ? "briefings" : void 0,
4768
+ hideHeader: !!u
4764
4769
  }
4765
4770
  ) : /* @__PURE__ */ t(
4766
- Jn,
4771
+ er,
4767
4772
  {
4768
4773
  apiServiceUrl: $,
4769
4774
  token: K,
@@ -4772,9 +4777,9 @@ function bi({
4772
4777
  intent: S,
4773
4778
  sourceContext: Q ? void 0 : mt,
4774
4779
  title: Q ? `Edit ${pe(Q).noun}` : S === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
4775
- hideHeader: !!h,
4780
+ hideHeader: !!u,
4776
4781
  className: "h-full min-h-0 max-w-none border-0 shadow-none",
4777
- onBack: h ? void 0 : () => b("list"),
4782
+ onBack: u ? void 0 : () => b("list"),
4778
4783
  onCancel: () => D(!1),
4779
4784
  onDeleted: () => {
4780
4785
  const A = Q ? pe(Q).noun : "briefing";
@@ -4800,23 +4805,23 @@ function bi({
4800
4805
  onOpenChange: (A) => {
4801
4806
  A || ne(null);
4802
4807
  },
4803
- children: /* @__PURE__ */ r(St, { children: [
4804
- /* @__PURE__ */ r(kt, { children: [
4805
- /* @__PURE__ */ r(Dt, { children: [
4808
+ children: /* @__PURE__ */ s(St, { children: [
4809
+ /* @__PURE__ */ s(kt, { children: [
4810
+ /* @__PURE__ */ s(Dt, { children: [
4806
4811
  "Delete",
4807
4812
  " ",
4808
4813
  R ? pe(R).noun : "briefing",
4809
4814
  "?"
4810
4815
  ] }),
4811
- /* @__PURE__ */ r(At, { children: [
4816
+ /* @__PURE__ */ s(At, { children: [
4812
4817
  "This permanently deletes ",
4813
4818
  /* @__PURE__ */ t("strong", { children: R == null ? void 0 : R.name }),
4814
4819
  ". Recipients will stop receiving it."
4815
4820
  ] })
4816
4821
  ] }),
4817
- /* @__PURE__ */ r(Ft, { children: [
4822
+ /* @__PURE__ */ s(Ft, { children: [
4818
4823
  /* @__PURE__ */ t(Et, { children: "Cancel" }),
4819
- /* @__PURE__ */ r(
4824
+ /* @__PURE__ */ s(
4820
4825
  ua,
4821
4826
  {
4822
4827
  className: "bg-destructive/90 hover:bg-destructive",
@@ -4834,28 +4839,28 @@ function bi({
4834
4839
  )
4835
4840
  ] }) : null;
4836
4841
  }
4837
- function xi() {
4842
+ function vi() {
4838
4843
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
4839
4844
  }
4840
4845
  export {
4841
- Qi as A,
4842
- Hi as D,
4843
- Gi as S,
4844
- Xi as U,
4845
- ji as V,
4846
- ei as W,
4847
- Wi as a,
4848
- Ki as b,
4849
- Yi as c,
4850
- Ji as d,
4851
- fs as e,
4852
- bs as f,
4853
- Cs as g,
4854
- eo as h,
4855
- Zi as i,
4856
- ao as j,
4857
- to as k,
4858
- no as l,
4859
- ro as m,
4860
- qi as u
4846
+ Ki as A,
4847
+ Yi as D,
4848
+ Hi as S,
4849
+ Zi as U,
4850
+ qi as V,
4851
+ ti as W,
4852
+ Qi as a,
4853
+ Gi as b,
4854
+ Xi as c,
4855
+ eo as d,
4856
+ gs as e,
4857
+ xs as f,
4858
+ ws as g,
4859
+ to as h,
4860
+ Ji as i,
4861
+ no as j,
4862
+ ao as k,
4863
+ ro as l,
4864
+ so as m,
4865
+ Wi as u
4861
4866
  };