react-semaphor 0.1.434 → 0.1.436

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 (29) hide show
  1. package/dist/chunks/{dashboard-yWFfL8DR.js → dashboard-DB97Qehi.js} +15660 -15642
  2. package/dist/chunks/{dashboard-briefing-launcher-Btxf_WwP.js → dashboard-briefing-launcher-BBUSizLQ.js} +752 -740
  3. package/dist/chunks/dashboard-briefing-launcher-C8_pyleA.js +31 -0
  4. package/dist/chunks/dashboard-controls-D8ob37pk.js +36 -0
  5. package/dist/chunks/{dashboard-controls-QDvheX2S.js → dashboard-controls-c1BKqObc.js} +883 -873
  6. package/dist/chunks/{dashboard-json-Cy30BkTb.js → dashboard-json-5z_cenUT.js} +1 -1
  7. package/dist/chunks/{dashboard-json-Cjeju9_w.js → dashboard-json-CkTVRqge.js} +1 -1
  8. package/dist/chunks/{dashboard-czW777OP.js → dashboard-nvGHASLa.js} +187 -187
  9. package/dist/chunks/{edit-dashboard-visual-B9K3RbmG.js → edit-dashboard-visual-MCDuE3GS.js} +2 -2
  10. package/dist/chunks/{edit-dashboard-visual-CZ_VwF0R.js → edit-dashboard-visual-q4YYssFo.js} +1 -1
  11. package/dist/chunks/{report-preferences-dialog-DQoLS75q.js → report-preferences-dialog-CZhv1HKW.js} +1 -1
  12. package/dist/chunks/{report-preferences-dialog-CLVxbcNw.js → report-preferences-dialog-DGbUoySN.js} +1 -1
  13. package/dist/chunks/{use-create-flow-overlay-state-C7q1RJRX.js → use-create-flow-overlay-state-CK3794Xa.js} +1 -1
  14. package/dist/chunks/{use-create-flow-overlay-state-DDW51h9w.js → use-create-flow-overlay-state-i0V_ZEiS.js} +1 -1
  15. package/dist/dashboard/index.cjs +1 -1
  16. package/dist/dashboard/index.js +1 -1
  17. package/dist/data-app-builder/index.cjs +1 -1
  18. package/dist/data-app-builder/index.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/surfboard/index.cjs +1 -1
  22. package/dist/surfboard/index.js +2 -2
  23. package/dist/types/dashboard.d.ts +2 -0
  24. package/dist/types/main.d.ts +2 -0
  25. package/dist/types/surfboard.d.ts +2 -0
  26. package/dist/types/types.d.ts +2 -0
  27. package/package.json +1 -1
  28. package/dist/chunks/dashboard-briefing-launcher-BFbnlzAS.js +0 -31
  29. package/dist/chunks/dashboard-controls-B1EJzIqs.js +0 -36
@@ -1,13 +1,13 @@
1
1
  import { jsx as e, jsxs as n, Fragment as Se } from "react/jsx-runtime";
2
2
  import * as zc from "react";
3
3
  import tn, { useState as K, useEffect as Ce, useRef as Ee, useCallback as Ie, useMemo as ce, useContext as wr, Suspense as $c } from "react";
4
- import { d0 as Ri, aH as Fn, aI as Rn, aJ as Pn, aK as Ln, aL as Xn, aF as ms, bm as Et, bq as jt, d1 as Pi, d2 as is, aG as et, d3 as Li, d4 as os, b4 as Ia, aZ as bt, ci as Sr, b2 as ta, br as na, bn as wt, d5 as hs, d6 as Tr, d7 as Vi, d8 as Bi, d9 as qc, da as jc, db as Kc, b8 as vs, dc as Uc, dd as Gc, de as cr, df as cs, az as zn, an as _i, dg as Hc, dh as Qc, di as zi, dj as $i, dk as Wc, dl as Jc, dm as Yc, dn as Xc, bg as $n, bh as Nn, bi as Cn, bj as ja, bk as nn, bl as Yn, dp as dr, dq as Zc, ca as wa, dr as qi, aN as sn, aO as ft, ds as ed, dt as ji, cJ as gn, cQ as Ki, du as kr, dv as td, dw as Ui, dx as nd, dy as Gi, dz as ad, dA as sd, dB as rd, aD as Hi, dC as ld, dD as id, dE as od, dF as cd, dG as dd, dH as ud, dI as zs, dJ as md, dK as zl, dL as hd, dM as $l, dN as pd, dO as fd, cf as aa, cg as sa, ch as ra, b$ as mt, dP as Da, b5 as Qi, bv as Wt, bx as Jt, dQ as Ir, bM as Dr, aM as Er, dR as gd, dS as xd, dT as Ar, dU as bd, dV as Wi, dW as Ji, dX as Yi, dY as Xi, dZ as Ht, d_ as yd, d$ as vd, e0 as Nd, e1 as Cd, e2 as Zi, e3 as eo, r as to, e4 as no, e5 as wd, e6 as Sd, e7 as Td, e8 as Ea, M as kd, e9 as Id, ea as Dd, eb as ql, ec as Ed, E as Ns, e as Or, ed as Ad, ee as Mr, bE as Od, ef as jl, I as gt, eg as Md, eh as Fd, ei as ao, ej as so, ek as Rd, el as Fr, em as Rr, en as ro, eo as lo, ep as Kl, eq as Ka, er as Pd, es as Ld, et as Vd, eu as Bd, ev as _d, ew as ps, ex as zd, ey as $d, ez as io, eA as oo, eB as qd, eC as jd, ct as Kd, eD as Ud, eE as co, eF as Gd, eG as Hd, cu as Cs, eH as ws, bF as Aa, bG as Qt, eI as mn, eJ as Pr, eK as Vn, eL as Bn, eM as xn, eN as Zn, eO as Qd, eP as Wd, eQ as Jd, eR as Yd, eS as Xd, eT as Zd, eU as eu, eV as tu, eW as Ul, bw as an, eX as nu, eY as uo, eZ as au, e_ as su, e$ as mo, f0 as ru, f1 as lu, f2 as iu, f3 as ou, f4 as $s, f5 as cu, f6 as du, f7 as Ss, f8 as uu, f9 as mu, fa as ho, fb as hu, fc as pu, fd as fu, fe as gu, ff as xu, fg as ur, fh as bu, fi as yu, fj as mr, fk as vu, fl as Nu, fm as Cu, fn as wu, fo as Gl, b3 as hr, a$ as bn, aP as Su, aQ as Tu, aS as ku, aT as Iu, aU as Du, aV as Eu, aW as Au, aX as Ou, aY as Mu, c1 as Fu, fp as Oa, fq as Ma, fr as Fa, ck as Lr, cl as Ru, b1 as Pu, fs as Lu, ft as Vu, fu as Bu, fv as Ts, fw as it, fx as ot, fy as ct, fz as _u, fA as zu, fB as po, fC as fo, fD as go, fE as $u, fF as qu, fG as pr, fH as ju, fI as Ku, fJ as Uu, fK as Gu, fL as Hu, fM as Qu, fN as Wu, fO as Ju, fP as Yu, fQ as Xu, fR as Zu, fS as em, fT as Dn, fU as va, fV as tm, fW as Hl, fX as nm, fY as am, fZ as qs, f_ as Ql, f$ as sm, g0 as rm, g1 as lm, g2 as im, g3 as om, aB as Vr, aC as Ra, g4 as js, g5 as xo, b6 as cm, g6 as fs, g7 as dm, g8 as bo, g9 as yo, ga as um, gb as mm, ar as hm, gc as as, gd as pm, ge as Wl, gf as fm, gg as gm, gh as Jl, gi as xm, gj as bm, gk as ym, gl as vm, gm as Nm, aR as vo, gn as Cm, go as wm, gp as Sm, gq as Tm, gr as km, gs as Im, gt as Dm, gu as Em, gv as No, gw as Am, gx as Om, gy as ks, cK as Is, gz as Co, gA as Mm, gB as Fm, gC as wo, gD as Rm, gE as Pm, gF as Ds, gG as Ks, gH as Lm, gI as Vm, gJ as Bm, gK as _m, gL as ea, gM as Yl, gN as So, gO as zm, cw as $m, gP as To, gQ as ko, gR as ds, gS as Io, gT as Do, gU as qm, gV as Xl, gW as jm, gX as Km, gY as us, gZ as Um, g_ as Br, g$ as Gm, h0 as gs, h as Pa, i as La, k as Va, j as Ba, l as _a, m as za, h1 as Hm, h2 as $a, h3 as hn, h4 as fr, h5 as gr, h6 as qa, h7 as Eo, h8 as Qm, h9 as Us, ha as Gs, hb as Wm, hc as Hs, hd as Jm, he as Zl, hf as ei, cS as Ym, hg as Xm, cT as Zm, cV as eh, cW as th, av as nh, hh as ah, hi as sh, hj as rh, cm as lh, cn as ih, co as oh, b_ as Es, hk as As, hl as ti, hm as Ao, cM as Qs, hn as ch, ho as dh, hp as uh, F as mh, bp as hh, hq as ph, hr as fh } from "./dashboard-yWFfL8DR.js";
4
+ import { d0 as Ri, aH as Fn, aI as Rn, aJ as Pn, aK as Ln, aL as Xn, aF as ms, bm as Et, bq as jt, d1 as Pi, d2 as is, aG as et, d3 as Li, d4 as os, b4 as Ia, aZ as bt, ci as Sr, b2 as ta, br as na, bn as wt, d5 as hs, d6 as Tr, d7 as Vi, d8 as Bi, d9 as qc, da as jc, db as Kc, b8 as vs, dc as Uc, dd as Gc, de as cr, df as cs, az as zn, an as _i, dg as Hc, dh as Qc, di as zi, dj as $i, dk as Wc, dl as Jc, dm as Yc, dn as Xc, bg as $n, bh as Nn, bi as Cn, bj as ja, bk as nn, bl as Yn, dp as dr, dq as Zc, ca as wa, dr as qi, aN as sn, aO as ft, ds as ed, dt as ji, cJ as gn, cQ as Ki, du as kr, dv as td, dw as Ui, dx as nd, dy as Gi, dz as ad, dA as sd, dB as rd, aD as Hi, dC as ld, dD as id, dE as od, dF as cd, dG as dd, dH as ud, dI as zs, dJ as md, dK as zl, dL as hd, dM as $l, dN as pd, dO as fd, cf as aa, cg as sa, ch as ra, b$ as mt, dP as Da, b5 as Qi, bv as Wt, bx as Jt, dQ as Ir, bM as Dr, aM as Er, dR as gd, dS as xd, dT as Ar, dU as bd, dV as Wi, dW as Ji, dX as Yi, dY as Xi, dZ as Ht, d_ as yd, d$ as vd, e0 as Nd, e1 as Cd, e2 as Zi, e3 as eo, r as to, e4 as no, e5 as wd, e6 as Sd, e7 as Td, e8 as Ea, M as kd, e9 as Id, ea as Dd, eb as ql, ec as Ed, E as Ns, e as Or, ed as Ad, ee as Mr, bE as Od, ef as jl, I as gt, eg as Md, eh as Fd, ei as ao, ej as so, ek as Rd, el as Fr, em as Rr, en as ro, eo as lo, ep as Kl, eq as Ka, er as Pd, es as Ld, et as Vd, eu as Bd, ev as _d, ew as ps, ex as zd, ey as $d, ez as io, eA as oo, eB as qd, eC as jd, ct as Kd, eD as Ud, eE as co, eF as Gd, eG as Hd, cu as Cs, eH as ws, bF as Aa, bG as Qt, eI as mn, eJ as Pr, eK as Vn, eL as Bn, eM as xn, eN as Zn, eO as Qd, eP as Wd, eQ as Jd, eR as Yd, eS as Xd, eT as Zd, eU as eu, eV as tu, eW as Ul, bw as an, eX as nu, eY as uo, eZ as au, e_ as su, e$ as mo, f0 as ru, f1 as lu, f2 as iu, f3 as ou, f4 as $s, f5 as cu, f6 as du, f7 as Ss, f8 as uu, f9 as mu, fa as ho, fb as hu, fc as pu, fd as fu, fe as gu, ff as xu, fg as ur, fh as bu, fi as yu, fj as mr, fk as vu, fl as Nu, fm as Cu, fn as wu, fo as Gl, b3 as hr, a$ as bn, aP as Su, aQ as Tu, aS as ku, aT as Iu, aU as Du, aV as Eu, aW as Au, aX as Ou, aY as Mu, c1 as Fu, fp as Oa, fq as Ma, fr as Fa, ck as Lr, cl as Ru, b1 as Pu, fs as Lu, ft as Vu, fu as Bu, fv as Ts, fw as it, fx as ot, fy as ct, fz as _u, fA as zu, fB as po, fC as fo, fD as go, fE as $u, fF as qu, fG as pr, fH as ju, fI as Ku, fJ as Uu, fK as Gu, fL as Hu, fM as Qu, fN as Wu, fO as Ju, fP as Yu, fQ as Xu, fR as Zu, fS as em, fT as Dn, fU as va, fV as tm, fW as Hl, fX as nm, fY as am, fZ as qs, f_ as Ql, f$ as sm, g0 as rm, g1 as lm, g2 as im, g3 as om, aB as Vr, aC as Ra, g4 as js, g5 as xo, b6 as cm, g6 as fs, g7 as dm, g8 as bo, g9 as yo, ga as um, gb as mm, ar as hm, gc as as, gd as pm, ge as Wl, gf as fm, gg as gm, gh as Jl, gi as xm, gj as bm, gk as ym, gl as vm, gm as Nm, aR as vo, gn as Cm, go as wm, gp as Sm, gq as Tm, gr as km, gs as Im, gt as Dm, gu as Em, gv as No, gw as Am, gx as Om, gy as ks, cK as Is, gz as Co, gA as Mm, gB as Fm, gC as wo, gD as Rm, gE as Pm, gF as Ds, gG as Ks, gH as Lm, gI as Vm, gJ as Bm, gK as _m, gL as ea, gM as Yl, gN as So, gO as zm, cw as $m, gP as To, gQ as ko, gR as ds, gS as Io, gT as Do, gU as qm, gV as Xl, gW as jm, gX as Km, gY as us, gZ as Um, g_ as Br, g$ as Gm, h0 as gs, h as Pa, i as La, k as Va, j as Ba, l as _a, m as za, h1 as Hm, h2 as $a, h3 as hn, h4 as fr, h5 as gr, h6 as qa, h7 as Eo, h8 as Qm, h9 as Us, ha as Gs, hb as Wm, hc as Hs, hd as Jm, he as Zl, hf as ei, cS as Ym, hg as Xm, cT as Zm, cV as eh, cW as th, av as nh, hh as ah, hi as sh, hj as rh, cm as lh, cn as ih, co as oh, b_ as Es, hk as As, hl as ti, hm as Ao, cM as Qs, hn as ch, ho as dh, hp as uh, F as mh, bp as hh, hq as ph, hr as fh } from "./dashboard-DB97Qehi.js";
5
5
  import { c as Ue, C as Ft, X as tt } from "./index-xHCrHprY.js";
6
6
  import { D as Ne, B as ee, N as xs, H as Ua, c as J, aN as gh, O as q, _ as ne, $ as ae, a0 as se, a1 as re, a2 as j, E as P, Y as At, Q as Bt, V as Ot, W as Mt, P as Rt, a as Lt, b as Pt, C as yn, aO as xh, aG as Sa, aP as _r, aQ as Oo, aD as zr, aB as bh, Z as Pe, aR as yh, L as vn, u as ye, d as wn, aS as $r, X as rn, A as Mo, T as Ga, F as Ha, G as Yt, I as On, M as Os, S as _n, i as vh, aH as Mn, aT as Nh, aU as Ch, aV as Fo, af as wh, aJ as Sh, aW as Th, aX as kh, aY as ni, aZ as Ih, a_ as Dh, a$ as Eh, b0 as Ah, b1 as Oh, b2 as Mh, b3 as ai, b4 as Fh, b5 as si, R as xr, b6 as la, b7 as Rh, a3 as Ke, b8 as Ph, b9 as qr, ba as br, bb as Ro, bc as pn, bd as ss, be as Po, bf as Lh, bg as Lo, bh as Vh, bi as Bh, bj as Vt, bk as _h, K as Vo, bl as ht, bm as Bo, w as ri, bn as zh, bo as $h, bp as qh, bq as jh, br as Kh, bs as Uh, bt as Gh, bu as Hh, bv as Qh, bw as Wh, bx as Jh, by as Yh, bz as Xh, bA as li, bB as Zh, bC as ep, bD as tp, bE as np, J as Ms, a6 as ap } from "./code-editor-C8zzmSgt.js";
7
7
  import "./analyze-result-contract-CfOBEwaC.js";
8
8
  import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as yr } from "../value-format-preferences/index.js";
9
9
  import { C as Kt, E as vr, S as Fs, M as sp, a as rp } from "./search-DHZCro8B.js";
10
- import { f as lp, g as yt, r as _o, h as Qa, i as zo, V as $o, e as ip, C as op } from "./use-create-flow-overlay-state-DDW51h9w.js";
10
+ import { f as lp, g as yt, r as _o, h as Qa, i as zo, V as $o, e as ip, C as op } from "./use-create-flow-overlay-state-i0V_ZEiS.js";
11
11
  import { h as ia } from "./card-config-utils-BYZ5MJOh.js";
12
12
  import { createPortal as cp } from "react-dom";
13
13
  import "./index-If0wlXGi.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),n=require("./dashboard-czW777OP.js"),ae=require("./index-jSrCwPQz.js"),t=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");const Es=require("../value-format-preferences/index.cjs"),Ue=require("./search-Dcud9ajy.js"),ke=require("./use-create-flow-overlay-state-C7q1RJRX.js"),Lt=require("./card-config-utils-15sRtebL.js"),er=require("react-dom");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("../briefings/index.cjs");const ta=require("./numeric-presentation-Dlb-Dk4c.js"),In=require("./metric-comparison-DVy3fll_.js"),tr=require("./palette-C0yjT5Tv.js"),sr=require("./common-types-C73-Ud1-.js");function nr(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}return a.default=s,Object.freeze(a)}const ar=nr(v);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),n=require("./dashboard-nvGHASLa.js"),ae=require("./index-jSrCwPQz.js"),t=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");const Es=require("../value-format-preferences/index.cjs"),Ue=require("./search-Dcud9ajy.js"),ke=require("./use-create-flow-overlay-state-CK3794Xa.js"),Lt=require("./card-config-utils-15sRtebL.js"),er=require("react-dom");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("../briefings/index.cjs");const ta=require("./numeric-presentation-Dlb-Dk4c.js"),In=require("./metric-comparison-DVy3fll_.js"),tr=require("./palette-C0yjT5Tv.js"),sr=require("./common-types-C73-Ud1-.js");function nr(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}return a.default=s,Object.freeze(a)}const ar=nr(v);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
2
2
  import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
3
- import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-yWFfL8DR.js";
3
+ import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-DB97Qehi.js";
4
4
  import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-C8zzmSgt.js";
5
5
  import { parseCalendarPreferencesResponse as xe } from "../report-runtime-context/index.js";
6
6
  import "./index-xHCrHprY.js";
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./dashboard-czW777OP.js"),o=require("./code-editor-BSENCZwR.js"),V=require("../report-runtime-context/index.cjs");require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");const D=require("../value-format-preferences/index.cjs");function M(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=M({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>_(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const B=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},q=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:q,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:B,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./dashboard-nvGHASLa.js"),o=require("./code-editor-BSENCZwR.js"),V=require("../report-runtime-context/index.cjs");require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");const D=require("../value-format-preferences/index.cjs");function M(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=M({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>_(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const B=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},q=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:q,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:B,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
@@ -1,4 +1,4 @@
1
- "use strict";const C=require("react"),s=require("./code-editor-BSENCZwR.js"),f=require("./dashboard-czW777OP.js"),e=require("react/jsx-runtime"),ee=require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const ke=require("./save-Xdc4pnys.js"),ye=require("./search-Dcud9ajy.js");/**
1
+ "use strict";const C=require("react"),s=require("./code-editor-BSENCZwR.js"),f=require("./dashboard-nvGHASLa.js"),e=require("react/jsx-runtime"),ee=require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const ke=require("./save-Xdc4pnys.js"),ye=require("./search-Dcud9ajy.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
1
  import { useState as H, useEffect as ie, useCallback as B, useMemo as P, useRef as Se, Fragment as gt } from "react";
2
2
  import { D as de, A as _e, u as Z, E as M, a4 as yt, Q as vt, V as xt, W as Ct, c as fe, Y as St, a5 as kt, B as q, d as Nt, L as Ze, a6 as wt, a7 as Dt, a8 as Et, a9 as pe, aa as je, ab as Re, ac as ke, ad as Ne, ae as It, af as Qe, ag as Ft, ah as Vt, ai as me, aj as Tt, ak as $e, al as et, am as tt, an as rt, O as oe, Z as at, _ as we, $ as De, a0 as Ee, a1 as Ie, a2 as Fe, ao as st, ap as _t, aq as Pe, ar as At, as as We, at as Lt, au as qt, av as Ve } from "./code-editor-C8zzmSgt.js";
3
- import { b7 as Mt, az as Ot, b8 as ce, b9 as zt, ba as Ae, bb as Ut, bc as Bt, bd as jt, aG as j, be as Rt, bf as Qt, bg as nt, bh as $t, bi as Pt, bj as Wt, bk as Kt, bl as Ht, av as Yt, bm as Gt, bn as ot, bo as lt, bp as Jt, bq as Xt, br as Zt, bs as er, bt as it, bu as dt, bv as tr, bw as rr, bx as ar, by as sr, bz as nr, aZ as or, bA as lr, bB as ir } from "./dashboard-yWFfL8DR.js";
3
+ import { b7 as Mt, az as Ot, b8 as ce, b9 as zt, ba as Ae, bb as Ut, bc as Bt, bd as jt, aG as j, be as Rt, bf as Qt, bg as nt, bh as $t, bi as Pt, bj as Wt, bk as Kt, bl as Ht, av as Yt, bm as Gt, bn as ot, bo as lt, bp as Jt, bq as Xt, br as Zt, bs as er, bt as it, bu as dt, bv as tr, bw as rr, bx as ar, by as sr, bz as nr, aZ as or, bA as lr, bB as ir } from "./dashboard-DB97Qehi.js";
4
4
  import { jsx as r, jsxs as m, Fragment as ae } from "react/jsx-runtime";
5
5
  import { c as ct, X as ut, C as Ke } from "./index-xHCrHprY.js";
6
6
  import "./analyze-result-contract-CfOBEwaC.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/dashboard-czW777OP.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/dashboard-nvGHASLa.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/dashboard-yWFfL8DR.js";
1
+ import { D as o } from "../chunks/dashboard-DB97Qehi.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-ClkOI-3O.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/dashboard-czW777OP.js"),w=require("../chunks/code-editor-BSENCZwR.js"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),Q=require("../chunks/index-jSrCwPQz.js"),Cn=require("../chunks/save-Xdc4pnys.js"),tt=require("../chunks/search-Dcud9ajy.js");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Rn=Tr(p),Bn=Tr(An);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/dashboard-nvGHASLa.js"),w=require("../chunks/code-editor-BSENCZwR.js"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),Q=require("../chunks/index-jSrCwPQz.js"),Cn=require("../chunks/save-Xdc4pnys.js"),tt=require("../chunks/search-Dcud9ajy.js");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Rn=Tr(p),Bn=Tr(An);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as c, Fragment as re } from "react/jsx-runtime";
2
2
  import * as Zn from "react";
3
3
  import { useContext as qn, useState as x, useRef as oe, useMemo as ze, useEffect as W, useCallback as Ot } from "react";
4
4
  import * as Xn from "react-dom/client";
5
- import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/dashboard-yWFfL8DR.js";
5
+ import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/dashboard-DB97Qehi.js";
6
6
  import { B as H, P as it, a as lt, b as dt, _ as da, $ as ca, a0 as ua, a1 as pa, a2 as ha, L as me, R as ma, d as _t } from "../chunks/code-editor-C8zzmSgt.js";
7
7
  import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
8
8
  import { c as $e, X as Je } from "../chunks/index-xHCrHprY.js";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/dashboard-czW777OP.js"),d=require("./chunks/common-types-C73-Ud1-.js"),v=require("./chunks/report-preferences-dialog-CLVxbcNw.js"),i=require("react/jsx-runtime"),r=require("./chunks/code-editor-BSENCZwR.js"),h=require("react"),P=require("./types/index.cjs"),l=require("./chunks/dashboard-briefing-launcher-BFbnlzAS.js"),N=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-BswhsmWT.js");require("./value-format-preferences/index.cjs");const R=require("./report-runtime-context/index.cjs");require("react-dom");require("./chunks/index-Dpm_VET4.js");const B=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/index-jSrCwPQz.js");function w(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const C=w(h);function j(a){const{displayPreferences:t,cardId:o,...u}=a,n={...u,id:a.dashboardId};return i.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:i.jsxs(e.SemaphorContextProvider,{dashboardProps:n,children:[i.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:a.cardId}),i.jsx(e.UXProvider,{appearance:a.appearance,children:i.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:i.jsx(e.Container,{type:"visual",cardId:o,...n,children:i.jsx(L,{cardId:o})})})})]})})}function L({cardId:a}){const t=r.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),{card:o,frame:u}=h.useMemo(()=>{const n=t==null?void 0:t.flatMap(s=>s.frames),c=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),D=c==null?void 0:c.find(s=>(s==null?void 0:s.id)===a),E=n==null?void 0:n.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(g=>(g==null?void 0:g.id)===a)});return{card:D,frame:E}},[t,a]);return!o||!u?i.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${a}`}):i.jsx("main",{className:"flex h-full grow flex-col",children:i.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:c})=>i.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:i.jsx(e.DashboardCard,{card:o,frame:u})})})}function M(a,t,o,u){h.useEffect(()=>{a&&!o&&t&&u(e.cloneDeep(t))},[a,o,t,u])}function I({name:a,items:t,value:o,onChange:u,isLoading:n,isError:c,refetch:D,className:E,icon:s,showNone:m=!1}){const g=C.useRef(null),[b,T]=C.useState(!1),[y,S]=C.useState("100%"),x=m?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{g.current&&S(g.current.offsetWidth)},[]);function A(){var f;return n?"Loading...":c?"Error":o?(f=t==null?void 0:t.find(p=>p.id===o))==null?void 0:f.name:`Select ${a}`}function F(f,p){u(p),T(!1)}return i.jsxs(r.Popover,{open:b,onOpenChange:T,children:[i.jsx(r.PopoverTrigger,{asChild:!0,children:i.jsxs(r.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:r.cn("flex h-9 w-full justify-between",E),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[s&&i.jsx("div",{className:"mr-2",children:s}),i.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:A()})]}),i.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),i.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:i.jsxs(e.Command,{children:[i.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[i.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),i.jsx(e.IconButton,{className:"h-7",onClick:D,children:i.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),i.jsxs(e.CommandList,{children:[i.jsxs(e.CommandEmpty,{children:["No ",a==null?void 0:a.toLowerCase()," found."]}),i.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>i.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:p=>F(p,f.id),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(r.Check,{className:r.cn("size-4",o===f.id?"opacity-100":"opacity-0")}),i.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function U(a,t){h.useEffect(()=>(a&&t&&(window.__SEMAPHOR_PRINT_STATE__={...t}),()=>{a&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[a,t])}exports.BriefingAuthor=e.BriefingAuthor;exports.BriefingAuthorDialog=e.BriefingAuthorDialog;exports.BriefingUiCapabilitiesBoundary=e.BriefingUiCapabilitiesBoundary;exports.BriefingUiCapabilitiesProvider=e.BriefingUiCapabilitiesProvider;exports.BriefingsApiError=e.BriefingsApiError;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.ExportError=e.ExportError;exports.MatrixTableVisual=e.MatrixTableVisual;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.applyBriefingFormPatch=e.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=e.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=e.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=e.briefingToFormDraft;exports.cancelBriefingPreviewRun=e.cancelBriefingPreviewRun;exports.cancelBriefingRun=e.cancelBriefingRun;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createBriefing=e.createBriefing;exports.createBriefingFormDraft=e.createBriefingFormDraft;exports.createExport=e.createExport;exports.deleteBriefing=e.deleteBriefing;exports.deleteBriefingRun=e.deleteBriefingRun;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getBriefing=e.getBriefing;exports.getBriefingArtifact=e.getBriefingArtifact;exports.getBriefingEvidence=e.getBriefingEvidence;exports.getBriefingPreviewRun=e.getBriefingPreviewRun;exports.getBriefingRun=e.getBriefingRun;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listBriefingRuns=e.listBriefingRuns;exports.listBriefingTenantSummaries=e.listBriefingTenantSummaries;exports.listBriefings=e.listBriefings;exports.pauseBriefing=e.pauseBriefing;exports.polishBriefingText=e.polishBriefingText;exports.previewBriefingPlan=e.previewBriefingPlan;exports.resumeBriefing=e.resumeBriefing;exports.runBriefingNow=e.runBriefingNow;exports.runBriefingPreview=e.runBriefingPreview;exports.updateBriefing=e.updateBriefing;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useBriefingUiCapabilities=e.useBriefingUiCapabilities;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.validateBriefingFormDraft=e.validateBriefingFormDraft;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.ReportPreferencesDialog=v.ReportPreferencesDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=P.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=l.AdvancedModeToggle;exports.DashboardBriefingLauncher=l.DashboardBriefingLauncher;exports.DashboardControlsSettings=l.DashboardControlsSettings;exports.DashboardFilterControlsButton=l.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=l.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=l.DocumentControlsSettings;exports.ExportNotificationItem=l.ExportNotificationItem;exports.ExportNotificationList=l.ExportNotificationList;exports.NotificationBell=l.NotificationBell;exports.UnsavedChangesAlert=l.UnsavedChangesAlert;exports.VisualEditingControls=l.VisualEditingControls;exports.VisualsLibraryDialog=l.VisualsLibraryDialog;exports.WatchDashboardButton=l.WatchDashboardButton;exports.useExportPolling=l.useExportPolling;exports.useExportRecovery=l.useExportRecovery;exports.useDebouncedDirtyCheck=N.useDebouncedDirtyCheck;exports.DEFAULT_CALENDAR_CONTEXT=R.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=B.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=B.serializeDashboardForDirtyCheck;exports.Combobox=I;exports.Visual=j;exports.useExposePrintState=U;exports.usePristineSnapshotInitializer=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/dashboard-nvGHASLa.js"),d=require("./chunks/common-types-C73-Ud1-.js"),v=require("./chunks/report-preferences-dialog-DGbUoySN.js"),i=require("react/jsx-runtime"),r=require("./chunks/code-editor-BSENCZwR.js"),h=require("react"),P=require("./types/index.cjs"),l=require("./chunks/dashboard-briefing-launcher-C8_pyleA.js"),N=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-BswhsmWT.js");require("./value-format-preferences/index.cjs");const R=require("./report-runtime-context/index.cjs");require("react-dom");require("./chunks/index-Dpm_VET4.js");const B=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/index-jSrCwPQz.js");function w(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const C=w(h);function j(a){const{displayPreferences:t,cardId:o,...u}=a,n={...u,id:a.dashboardId};return i.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:i.jsxs(e.SemaphorContextProvider,{dashboardProps:n,children:[i.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:a.cardId}),i.jsx(e.UXProvider,{appearance:a.appearance,children:i.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:i.jsx(e.Container,{type:"visual",cardId:o,...n,children:i.jsx(L,{cardId:o})})})})]})})}function L({cardId:a}){const t=r.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),{card:o,frame:u}=h.useMemo(()=>{const n=t==null?void 0:t.flatMap(s=>s.frames),c=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),D=c==null?void 0:c.find(s=>(s==null?void 0:s.id)===a),E=n==null?void 0:n.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(g=>(g==null?void 0:g.id)===a)});return{card:D,frame:E}},[t,a]);return!o||!u?i.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${a}`}):i.jsx("main",{className:"flex h-full grow flex-col",children:i.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:c})=>i.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:i.jsx(e.DashboardCard,{card:o,frame:u})})})}function M(a,t,o,u){h.useEffect(()=>{a&&!o&&t&&u(e.cloneDeep(t))},[a,o,t,u])}function I({name:a,items:t,value:o,onChange:u,isLoading:n,isError:c,refetch:D,className:E,icon:s,showNone:m=!1}){const g=C.useRef(null),[b,T]=C.useState(!1),[y,S]=C.useState("100%"),x=m?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{g.current&&S(g.current.offsetWidth)},[]);function A(){var f;return n?"Loading...":c?"Error":o?(f=t==null?void 0:t.find(p=>p.id===o))==null?void 0:f.name:`Select ${a}`}function F(f,p){u(p),T(!1)}return i.jsxs(r.Popover,{open:b,onOpenChange:T,children:[i.jsx(r.PopoverTrigger,{asChild:!0,children:i.jsxs(r.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:r.cn("flex h-9 w-full justify-between",E),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[s&&i.jsx("div",{className:"mr-2",children:s}),i.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:A()})]}),i.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),i.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:i.jsxs(e.Command,{children:[i.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[i.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),i.jsx(e.IconButton,{className:"h-7",onClick:D,children:i.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),i.jsxs(e.CommandList,{children:[i.jsxs(e.CommandEmpty,{children:["No ",a==null?void 0:a.toLowerCase()," found."]}),i.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>i.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:p=>F(p,f.id),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(r.Check,{className:r.cn("size-4",o===f.id?"opacity-100":"opacity-0")}),i.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function U(a,t){h.useEffect(()=>(a&&t&&(window.__SEMAPHOR_PRINT_STATE__={...t}),()=>{a&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[a,t])}exports.BriefingAuthor=e.BriefingAuthor;exports.BriefingAuthorDialog=e.BriefingAuthorDialog;exports.BriefingUiCapabilitiesBoundary=e.BriefingUiCapabilitiesBoundary;exports.BriefingUiCapabilitiesProvider=e.BriefingUiCapabilitiesProvider;exports.BriefingsApiError=e.BriefingsApiError;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.ExportError=e.ExportError;exports.MatrixTableVisual=e.MatrixTableVisual;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.applyBriefingFormPatch=e.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=e.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=e.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=e.briefingToFormDraft;exports.cancelBriefingPreviewRun=e.cancelBriefingPreviewRun;exports.cancelBriefingRun=e.cancelBriefingRun;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createBriefing=e.createBriefing;exports.createBriefingFormDraft=e.createBriefingFormDraft;exports.createExport=e.createExport;exports.deleteBriefing=e.deleteBriefing;exports.deleteBriefingRun=e.deleteBriefingRun;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getBriefing=e.getBriefing;exports.getBriefingArtifact=e.getBriefingArtifact;exports.getBriefingEvidence=e.getBriefingEvidence;exports.getBriefingPreviewRun=e.getBriefingPreviewRun;exports.getBriefingRun=e.getBriefingRun;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listBriefingRuns=e.listBriefingRuns;exports.listBriefingTenantSummaries=e.listBriefingTenantSummaries;exports.listBriefings=e.listBriefings;exports.pauseBriefing=e.pauseBriefing;exports.polishBriefingText=e.polishBriefingText;exports.previewBriefingPlan=e.previewBriefingPlan;exports.resumeBriefing=e.resumeBriefing;exports.runBriefingNow=e.runBriefingNow;exports.runBriefingPreview=e.runBriefingPreview;exports.updateBriefing=e.updateBriefing;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useBriefingUiCapabilities=e.useBriefingUiCapabilities;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.validateBriefingFormDraft=e.validateBriefingFormDraft;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.ReportPreferencesDialog=v.ReportPreferencesDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=P.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=l.AdvancedModeToggle;exports.DashboardBriefingLauncher=l.DashboardBriefingLauncher;exports.DashboardControlsSettings=l.DashboardControlsSettings;exports.DashboardFilterControlsButton=l.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=l.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=l.DocumentControlsSettings;exports.ExportNotificationItem=l.ExportNotificationItem;exports.ExportNotificationList=l.ExportNotificationList;exports.NotificationBell=l.NotificationBell;exports.UnsavedChangesAlert=l.UnsavedChangesAlert;exports.VisualEditingControls=l.VisualEditingControls;exports.VisualsLibraryDialog=l.VisualsLibraryDialog;exports.WatchDashboardButton=l.WatchDashboardButton;exports.useExportPolling=l.useExportPolling;exports.useExportRecovery=l.useExportRecovery;exports.useDebouncedDirtyCheck=N.useDebouncedDirtyCheck;exports.DEFAULT_CALENDAR_CONTEXT=R.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=B.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=B.serializeDashboardForDirtyCheck;exports.Combobox=I;exports.Visual=j;exports.useExposePrintState=U;exports.usePristineSnapshotInitializer=M;
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { E as b, F as N, S, c as P, U as w, d as _, C as F, e as x, f as R, g as M, h as I, i as L, I as k, R as U, j as O, k as V, l as z, m as q } from "./chunks/dashboard-yWFfL8DR.js";
2
- import { B as pa, n as ma, o as ha, p as ga, q as Ca, r as Da, D as Ea, s as xa, t as ba, u as Ta, a as ya, v as Ba, M as va, w as Aa, x as Na, x as Sa, y as Pa, z as wa, b as _a, A as Fa, G as Ra, H as Ma, J as Ia, K as La, L as ka, N as Ua, O as Oa, P as Va, Q as za, T as qa, V as Wa, W as ja, X as Ha, Y as Qa, Z as Ga, _ as Ka, $ as Xa, a0 as Ya, a1 as $a, a2 as Ja, a3 as Za, a4 as ae, a5 as ee, a6 as se, a7 as re, a8 as oe, a9 as ie, aa as te, ab as ne, ac as le, ad as de, ae as ue, af as ce, ag as fe, ah as pe, ai as me, aj as he, ak as ge, al as Ce, am as De, an as Ee, ao as xe, ap as be, aq as Te, ar as ye, as as Be, at as ve, au as Ae, av as Ne, aw as Se, ax as Pe, ay as we } from "./chunks/dashboard-yWFfL8DR.js";
1
+ import { E as b, F as N, S, c as P, U as w, d as _, C as F, e as x, f as R, g as M, h as I, i as L, I as k, R as U, j as O, k as V, l as z, m as q } from "./chunks/dashboard-DB97Qehi.js";
2
+ import { B as pa, n as ma, o as ha, p as ga, q as Ca, r as Da, D as Ea, s as xa, t as ba, u as Ta, a as ya, v as Ba, M as va, w as Aa, x as Na, x as Sa, y as Pa, z as wa, b as _a, A as Fa, G as Ra, H as Ma, J as Ia, K as La, L as ka, N as Ua, O as Oa, P as Va, Q as za, T as qa, V as Wa, W as ja, X as Ha, Y as Qa, Z as Ga, _ as Ka, $ as Xa, a0 as Ya, a1 as $a, a2 as Ja, a3 as Za, a4 as ae, a5 as ee, a6 as se, a7 as re, a8 as oe, a9 as ie, aa as te, ab as ne, ac as le, ad as de, ae as ue, af as ce, ag as fe, ah as pe, ai as me, aj as he, ak as ge, al as Ce, am as De, an as Ee, ao as xe, ap as be, aq as Te, ar as ye, as as Be, at as ve, au as Ae, av as Ne, aw as Se, ax as Pe, ay as we } from "./chunks/dashboard-DB97Qehi.js";
3
3
  import { a as Fe, C as Re, D as Me, E as Ie, P as Le, g as ke, h as Ue, b as Oe, i as Ve, c as ze, d as qe } from "./chunks/common-types-ClkOI-3O.js";
4
- import { R as je } from "./chunks/report-preferences-dialog-DQoLS75q.js";
4
+ import { R as je } from "./chunks/report-preferences-dialog-CZhv1HKW.js";
5
5
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
6
6
  import { u as W, P as j, a as H, B as Q, c as C, b as G, d as K } from "./chunks/code-editor-C8zzmSgt.js";
7
7
  import { e as Qe, f as Ge, g as Ke, h as Xe, i as Ye, j as $e, k as Je, l as Ze, m as as, n as es, o as ss, p as rs, q as os, r as is, s as ts, t as ns, v as ls, w as ds, x as us, y as cs, z as fs, A as ps, D as ms, E as hs } from "./chunks/code-editor-C8zzmSgt.js";
8
8
  import * as p from "react";
9
9
  import { useMemo as X, useEffect as T } from "react";
10
10
  import { DEFAULT_SEMANTIC_DOMAIN_ACCESS as Cs } from "./types/index.js";
11
- import { A as Es, D as xs, a as bs, b as Ts, c as ys, d as Bs, E as vs, e as As, N as Ns, U as Ss, V as Ps, f as ws, W as _s, u as Fs, g as Rs } from "./chunks/dashboard-briefing-launcher-Btxf_WwP.js";
11
+ import { A as Es, D as xs, a as bs, b as Ts, c as ys, d as Bs, E as vs, e as As, N as Ns, U as Ss, V as Ps, f as ws, W as _s, u as Fs, g as Rs } from "./chunks/dashboard-briefing-launcher-BBUSizLQ.js";
12
12
  import { u as Is } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
13
13
  import "./chunks/analyze-result-contract-CfOBEwaC.js";
14
14
  import "./value-format-preferences/index.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-czW777OP.js"),r=require("../chunks/common-types-C73-Ud1-.js"),o=require("../chunks/report-preferences-dialog-CLVxbcNw.js");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-nvGHASLa.js"),r=require("../chunks/common-types-C73-Ud1-.js"),o=require("../chunks/report-preferences-dialog-DGbUoySN.js");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
@@ -1,6 +1,6 @@
1
- import { a, b as o } from "../chunks/dashboard-yWFfL8DR.js";
1
+ import { a, b as o } from "../chunks/dashboard-DB97Qehi.js";
2
2
  import { C as f, E } from "../chunks/common-types-ClkOI-3O.js";
3
- import { R as t } from "../chunks/report-preferences-dialog-DQoLS75q.js";
3
+ import { R as t } from "../chunks/report-preferences-dialog-CZhv1HKW.js";
4
4
  export {
5
5
  f as CONTROL_CARD_DEFAULT_VALUE,
6
6
  a as DisplayFormatPreferencesFields,
@@ -805,6 +805,8 @@ export declare type DashboardPreferences = {
805
805
  * Shows console panel for debugging
806
806
  */
807
807
  console?: boolean;
808
+ /** Enable non-persistent card editing; this is not an authorization grant. */
809
+ inspection?: boolean;
808
810
  };
809
811
  };
810
812
 
@@ -2305,6 +2305,8 @@ export declare type DashboardPreferences = {
2305
2305
  * Shows console panel for debugging
2306
2306
  */
2307
2307
  console?: boolean;
2308
+ /** Enable non-persistent card editing; this is not an authorization grant. */
2309
+ inspection?: boolean;
2308
2310
  };
2309
2311
  };
2310
2312
 
@@ -808,6 +808,8 @@ export declare type DashboardPreferences = {
808
808
  * Shows console panel for debugging
809
809
  */
810
810
  console?: boolean;
811
+ /** Enable non-persistent card editing; this is not an authorization grant. */
812
+ inspection?: boolean;
811
813
  };
812
814
  };
813
815
 
@@ -1304,6 +1304,8 @@ export declare type DashboardPreferences = {
1304
1304
  * Shows console panel for debugging
1305
1305
  */
1306
1306
  console?: boolean;
1307
+ /** Enable non-persistent card editing; this is not an authorization grant. */
1308
+ inspection?: boolean;
1307
1309
  };
1308
1310
  };
1309
1311
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.434",
8
+ "version": "0.1.436",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,31 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),x=require("react"),s=require("./dashboard-czW777OP.js"),n=require("./code-editor-BSENCZwR.js"),je=require("./layout-grid-B08pP7v6.js"),G=require("./index-jSrCwPQz.js"),_=require("./use-create-flow-overlay-state-C7q1RJRX.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const Re=require("./search-Dcud9ajy.js"),ye=require("./csv-utils-Co0WxHke.js");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("react-dom");const X=require("../briefings/index.cjs");/**
2
- * @license lucide-react v0.453.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ue=G.createLucideIcon("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
7
- * @license lucide-react v0.453.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Oe=G.createLucideIcon("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
12
- * @license lucide-react v0.453.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ze=G.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
17
- * @license lucide-react v0.453.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const we=G.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
22
- * @license lucide-react v0.453.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const _e=G.createLucideIcon("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/**
27
- * @license lucide-react v0.453.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const $e=G.createLucideIcon("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);function qe(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((t,r)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},r))})}function He({open:t,onOpenChange:r,onSubmit:l,isCreating:o}){const[a,d]=x.useState(""),[h,p]=x.useState("");x.useEffect(()=>{t||(d(""),p(""))},[t]);const c=()=>{a.trim()&&l({title:a,description:h})},u=i=>{r(i)};return e.jsx(s.Dialog,{open:t,onOpenChange:u,children:e.jsxs(s.DialogContent,{showCloseButton:!1,className:"flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-[6px] border-border/60 p-0 shadow-lg",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(je.LayoutGrid,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(s.DialogTitle,{className:"truncate text-[13px] font-medium leading-none tracking-normal",children:"New library visual"}),e.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground",children:"Visual"})]})]}),e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:()=>u(!1),"aria-label":"Close",disabled:o,children:e.jsx(G.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"space-y-3 px-4 py-3",children:[e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Create a saved visual that can be reused across dashboards."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n.Label,{htmlFor:"visual-title",className:"text-[12px]",children:"Name"}),e.jsx(n.Input,{id:"visual-title",size:"sm",placeholder:"Untitled visual",value:a,onChange:i=>d(i.target.value),disabled:o,onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),c())}})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n.Label,{htmlFor:"visual-description",className:"text-[12px]",children:"Description"}),e.jsx(n.Input,{id:"visual-description",size:"sm",placeholder:"Optional",value:h,onChange:i=>p(i.target.value),disabled:o})]})]}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5",children:[e.jsx(n.Button,{size:"xs",variant:"outline",onClick:()=>u(!1),disabled:o,children:"Cancel"}),e.jsx(n.Button,{size:"xs",onClick:c,disabled:!a.trim()||o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Creating..."]}):"Create library visual"})]})]})})}function Se(t){return t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Unknown"}function Ee(t,r){var o;const l=(o=t.ownership.createdBy)==null?void 0:o.type;return l==="tenant"||l==="organization"&&r}function Ce(t,r){var l,o;return Ee(t,r)?((l=t.ownership.createdBy)==null?void 0:l.name)||((o=t.createdByTenantUserRel)==null?void 0:o.name)||t.lastModifiedBy||"Unknown":"Organization"}function We(t,r){return Ce(t,r).split(/\s+/).filter(Boolean).slice(0,2).map(o=>o.charAt(0).toUpperCase()).join("")||"?"}function Ge(t){const r=(t||"").toLowerCase();return r.includes("table")?n.Table2:r.includes("pie")||r.includes("donut")?s.ChartPie:r.includes("line")?s.ChartLine:r.includes("bar")?n.ChartColumn:je.LayoutGrid}function Xe({visual:t}){const r=t.ownership.status==="public"?"Public":t.ownership.status==="shared"||t.ownership.sharedCount>0?"Shared":"Private";return e.jsx("span",{className:"inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground",children:r})}function Ke({open:t,onOpenChange:r}){const[l,o]=x.useState(""),[a,d]=x.useState(new Set),[h,p]=x.useState(!1),[c,u]=x.useState(null),[i,b]=x.useState(null),[m,f]=x.useState(!1),[y,j]=x.useState(null),[E,A]=x.useState(null),D=()=>{d(new Set),u(null),b(null),f(!1),j(null)},v=()=>{r(!1),D()},{selectVisual:S}=s.useManagementActions(),{handleAddLibraryVisual:k,handleEditLibraryVisual:M}=_.useVisualUtils(),{isConsoleMode:g}=s.useDashboardPreferences(),{resources:w,isLoading:L,isError:B,createResource:I,updateResource:P,deleteResourceAsync:T,duplicateResource:$,isCreating:Y,isDeleting:Z}=s.useVisualManagement(void 0,C=>{p(!1),C&&(S(C),M(C),v())}),{startUpdating:fe,stopUpdating:ie,isUpdating:ge}=s.useResourceUpdateState(),H=w,U=x.useMemo(()=>{const C=l.trim().toLowerCase();return C?H.filter(F=>{var R,Q,ee;return((R=F.title)==null?void 0:R.toLowerCase().includes(C))||((Q=F.description)==null?void 0:Q.toLowerCase().includes(C))||((ee=F.kind)==null?void 0:ee.toLowerCase().includes(C))}):H},[l,H]),K=x.useMemo(()=>H.filter(C=>a.has(C.id)),[a,H]),te=K.filter(C=>C.permissions.canDelete),se=K.filter(C=>C.permissions.canShare),le=U.length>0&&U.every(C=>a.has(C.id)),ue=U.some(C=>a.has(C.id)),re=C=>{const F=new Set(a);C(F),d(F)},ae=C=>{re(F=>{F.has(C)?F.delete(C):F.add(C)})},W=()=>{d(C=>{const F=new Set(C);return le?U.forEach(R=>F.delete(R.id)):U.forEach(R=>F.add(R.id)),F})},ce=async C=>{(await k(C)).success&&v()},O=async()=>{const C=K;if(C.length===0)return;let F=!1;for(const R of C)if(!(await k(R)).success){F=!0;break}F||v()},z=C=>{M(C),v()},J=C=>{A(C),$(C,{onSettled:()=>A(null)})},oe=()=>{if(te.length===0){s.ue.error("Select a visual you can delete");return}j(null),f(!0)},he=async()=>{const C=y?[y]:te;try{for(const F of C)await T(F.id);d(F=>{const R=new Set(F);return C.forEach(Q=>R.delete(Q.id)),R}),f(!1),j(null)}catch{}},be=()=>{if(K.length!==1){s.ue.error("Select one visual to share");return}const[C]=K;if(!C.permissions.canShare){s.ue.error("You do not have permission to share this visual");return}u(C)},de=({title:C,description:F})=>{if(!i)return;const R={};if(C!==i.title&&(R.title=C),(i.description||"")!==F&&(R.description=F),Object.keys(R).length===0){b(null);return}const Q=Object.keys(R),ee=Q.length===1?Q[0]:void 0;fe(i.id,ee),P({resourceId:i.id,data:R},{onSuccess:()=>{ie(i.id,ee),b(null)},onError:()=>{ie(i.id,ee)}})},ne=C=>{r(C),C||D()},q=y?1:te.length;return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:ne,children:e.jsxs(s.DialogContent,{showCloseButton:!1,className:"flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-[6px] border-border/60 p-0 shadow-lg",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(n.Table2,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(s.DialogTitle,{className:"truncate text-[13px] font-medium leading-none tracking-normal",children:"Visuals library"}),e.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground",children:"Add to dashboard"})]})]}),e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:()=>ne(!1),"aria-label":"Close visuals library",children:"×"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2",children:[e.jsxs("div",{className:"relative min-w-[12rem] flex-1 md:max-w-md",children:[e.jsx(Re.Search,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:l,onChange:C=>o(C.target.value),placeholder:"Search visuals...",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","aria-label":"Search visuals"})]}),e.jsxs(n.Button,{size:"xs",variant:"outline",className:"ml-auto",onClick:()=>p(!0),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"New library visual"]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:L?e.jsx("div",{className:"p-3",children:e.jsx(qe,{})}):B?e.jsx("div",{className:"flex flex-col items-center gap-2 px-4 py-12 text-center",children:e.jsx("p",{className:"text-[13px] text-destructive",children:"Failed to load visuals"})}):U.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-12 text-center",children:[e.jsx(je.LayoutGrid,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("p",{className:"text-[13px] font-medium",children:l?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:l?"Try a different search.":"Create a saved visual to add it here."})]}):e.jsx(Qe,{visuals:U,selectedIds:a,allFilteredSelected:le,someFilteredSelected:ue,onSelectAll:W,onToggleSelection:ae,onAddVisual:ce,onOpenVisual:z,onEditDetails:b,onShareVisual:u,onDeleteVisual:C=>{j(C),f(!0)},onDuplicateVisual:J,duplicatingId:E,isDeleting:Z,isConsoleMode:g})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-1.5",children:a.size>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-medium tabular-nums text-foreground",children:a.size})," ","selected"]}),e.jsx(n.Button,{size:"xs",variant:"ghost",onClick:()=>d(new Set),children:"Clear"}),e.jsxs(n.Button,{size:"xs",variant:"outline",onClick:be,disabled:K.length!==1||se.length!==1,children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsxs(n.Button,{size:"xs",variant:"outline",className:"text-destructive hover:text-destructive",onClick:oe,disabled:te.length===0,children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),"Delete ",te.length||a.size]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n.Button,{size:"xs",variant:"outline",onClick:()=>ne(!1),children:"Close"}),e.jsxs(n.Button,{size:"xs",onClick:O,disabled:a.size===0,children:[e.jsx(n.Check,{className:"h-3.5 w-3.5"}),a.size===0?"Add to dashboard":`Add ${a.size} visual${a.size===1?"":"s"}`]})]})]})]})}),e.jsx(He,{open:h,onOpenChange:p,onSubmit:I,isCreating:Y}),c&&e.jsx(s.ShareDialog,{resource:c,resourceType:s.ResourceType.VISUAL,onClose:()=>u(null)}),i&&e.jsx(s.ResourceEditDialog,{open:!!i,resourceLabel:"Visual",initialTitle:i.title||"",initialDescription:i.description||"",onClose:()=>b(null),onSave:de,isSaving:ge(i.id)}),e.jsx(s.AlertDialog,{open:m,onOpenChange:C=>{!C&&Z||(f(C),C||j(null))},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsxs(s.AlertDialogTitle,{children:["Delete ",q," visual",q===1?"":"s","?"]}),e.jsx(s.AlertDialogDescription,{children:"This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately."})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{disabled:Z,children:"Cancel"}),e.jsxs(s.AlertDialogAction,{onClick:C=>{C.preventDefault(),he()},disabled:Z||q===0,children:[Z?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),Z?"Deleting...":"Delete"]})]})]})})]})}function Qe({visuals:t,selectedIds:r,allFilteredSelected:l,someFilteredSelected:o,onSelectAll:a,onToggleSelection:d,onAddVisual:h,onOpenVisual:p,onEditDetails:c,onShareVisual:u,onDeleteVisual:i,onDuplicateVisual:b,duplicatingId:m,isDeleting:f,isConsoleMode:y}){return e.jsxs("div",{className:"min-w-[48rem]",children:[e.jsxs("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:[e.jsx(s.Checkbox,{checked:l?!0:o?"indeterminate":!1,onCheckedChange:a,"aria-label":"Select all visuals"}),e.jsx("span",{children:"Name"}),e.jsx("span",{children:"Created by"}),e.jsx("span",{children:"Updated"}),e.jsx("span",{children:"Visibility"}),e.jsx("span",{className:"text-right",children:"Shared"}),e.jsx("span",{className:"text-right",children:"Actions"})]}),t.map(j=>e.jsx(Ye,{visual:j,selected:r.has(j.id),onToggleSelection:d,onAddVisual:h,onOpenVisual:p,onEditDetails:c,onShareVisual:u,onDeleteVisual:i,onDuplicateVisual:b,duplicatingId:m,isDeleting:f,isConsoleMode:y},j.id))]})}function Ye({visual:t,selected:r,onToggleSelection:l,onAddVisual:o,onOpenVisual:a,onEditDetails:d,onShareVisual:h,onDeleteVisual:p,onDuplicateVisual:c,duplicatingId:u,isDeleting:i,isConsoleMode:b}){var y;const m=Ge(t.kind),f=()=>{o(t)};return e.jsxs("div",{className:n.cn("group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",r&&"bg-muted/70"),children:[e.jsx("div",{children:e.jsx(s.Checkbox,{checked:r,onCheckedChange:()=>l(t.id),"aria-label":`Select ${t.title||"visual"}`})}),e.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:f,"aria-label":`Add ${t.title||"visual"} to dashboard`,children:[e.jsx(m,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-foreground",title:t.title||"Untitled Visual",children:t.title||"Untitled Visual"}),((y=t.description)==null?void 0:y.trim())&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",title:t.description,children:t.description})]})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("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:We(t,b)}),e.jsx("span",{className:"truncate text-muted-foreground",children:Ce(t,b)})]}),e.jsx("span",{className:"text-muted-foreground",children:Se(t.updatedAt)}),e.jsx(Xe,{visual:t}),e.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.ownership.sharedCount>0?t.ownership.sharedCount:"—"}),e.jsx(Ze,{visual:t,onOpenVisual:a,onEditDetails:d,onShareVisual:h,onDeleteVisual:p,onDuplicateVisual:c,duplicatingId:u,isDeleting:i,isConsoleMode:b})]})}function Ze({visual:t,onOpenVisual:r,onEditDetails:l,onShareVisual:o,onDeleteVisual:a,onDuplicateVisual:d,duplicatingId:h,isDeleting:p,isConsoleMode:c}){return e.jsxs("div",{className:"flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",onClick:u=>u.stopPropagation(),children:[e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0",onClick:()=>r(t),"aria-label":"Edit visual",children:e.jsx(s.PenLine,{className:"h-3.5 w-3.5"})}),e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0","aria-label":"More actions",children:e.jsx(s.Ellipsis,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",children:[e.jsxs(s.DropdownMenuItem,{onClick:()=>r(t),children:[e.jsx(s.PenLine,{className:"h-3.5 w-3.5"}),"Edit visual"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>d(t.id),disabled:h===t.id,children:[h===t.id?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),h===t.id?"Duplicating...":"Duplicate"]}),t.permissions.canEdit&&e.jsxs(s.DropdownMenuItem,{onClick:()=>l(t),children:[e.jsx(s.PenLine,{className:"h-3.5 w-3.5"}),"Edit details"]}),t.permissions.canShare&&e.jsxs(s.DropdownMenuItem,{onClick:()=>o(t),children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),t.permissions.canDelete&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuItem,{className:"text-destructive focus:bg-destructive/10 focus:text-destructive",onClick:()=>a(t),disabled:p,children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),p?"Deleting...":"Delete"]})]}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground",children:[Ee(t,c)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(s.User,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:Ce(t,c)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(s.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:Se(t.updatedAt)})]})]})]})]})]})}function Je({open:t,onOpenChange:r,isLibraryVisual:l,currentVisualName:o,isSaving:a=!1,destinationMode:d="both",onConfirm:h}){const[p,c]=x.useState(l&&o?`Copy of ${o}`:o||""),[u,i]=x.useState("");x.useEffect(()=>{t&&(c(l&&o?`Copy of ${o}`:o||""),i(""))},[t,l,o]);const b=!!p.trim(),m=d==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:d==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},f=()=>{!b||a||h({name:p.trim(),description:u.trim()||void 0,saveToLibrary:m.saveToLibrary,saveToCurrentDashboard:m.saveToCurrentDashboard})};return e.jsx(s.Dialog,{open:t,onOpenChange:r,children:e.jsxs(s.DialogContent,{className:"sm:max-w-[500px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx("span",{children:"Save Visual As"}),m.badgeType!=="local"&&e.jsx(_.VisualBadge,{type:m.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),e.jsx(s.DialogDescription,{children:m.description})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(n.Label,{htmlFor:"name",children:"Name"}),e.jsx(n.Input,{id:"name",value:p,onChange:y=>c(y.target.value),placeholder:"Enter visual name",disabled:a})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(n.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(s.Textarea,{id:"description",value:u,onChange:y=>i(y.target.value),placeholder:"Enter visual description",rows:3,disabled:a})]})]}),e.jsxs(s.DialogFooter,{children:[e.jsx(n.Button,{variant:"outline",onClick:()=>r(!1),disabled:a,children:"Cancel"}),e.jsxs(n.Button,{onClick:f,disabled:!b||a,children:[a&&e.jsx(n.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),m.actionLabel]})]})]})})}function et(){const[t,r]=x.useState(!1),[l,o]=x.useState(!1),[a,d]=x.useState(null),[h,p]=x.useState(null),c=n.useEditorStore(g=>g.frame),u=n.useEditorStore(g=>g.card),i=s.useSelectedVisual(),b=n.useDashboardStore(g=>g.selectedSheetId),m=n.useDashboardStore(g=>g.dashboard),{getUpdatedFrame:f}=_.useVisualUtils(),{selectVisual:y}=s.useManagementActions(),{addFrame:j,setSelectedFrameId:E,setIsVisualEditing:A}=n.useDashboardActions(),D=s.useResolveExistingFrameSemanticExecutionPayload(),v=!!(c!=null&&c.visualId),S=(()=>{var g,w;return((g=c==null?void 0:c.cards)==null?void 0:g.length)===1&&((w=c.cards[0])!=null&&w.title)?c.cards[0].title:i!=null&&i.title?i.title:(u==null?void 0:u.title)||"Untitled Visual"})(),k=s.useCreateVisualWithFrame(g=>{g!=null&&g.id&&(y(g),l&&a&&h&&b&&(async()=>{try{const w={...a,id:n.v4(),visualId:g.id};j(b,w,{position:"end",semanticExecutionPayload:h}),E(w.id),o(!1),d(null),p(null),A(!1)}catch(w){console.error("Failed to promote semantic metadata for saved visual:",w),s.ue.error(w instanceof Error?w.message:"Failed to prepare semantic metadata for the saved visual")}})(),r(!1))});return{saveAsDialogOpen:t,setSaveAsDialogOpen:r,handleSaveAs:async g=>{if(!b){s.ue.error("No sheet selected");return}const w=f(),L=n.getDynamicFrameSaveIssue(w);if(L){s.ue.error(L);return}const I=w.cards.length===1?{...w,cards:w.cards.map(P=>({...P,title:g.name}))}:w;if(g.saveToLibrary){let P=null;if(g.saveToCurrentDashboard)try{P=await D(I,{previousFrame:n.findDashboardFrameById(m,I.id)})}catch($){console.error("Failed to prepare semantic metadata before saving visual:",$),s.ue.error($ instanceof Error?$.message:"Failed to prepare semantic metadata for the saved visual");return}o(g.saveToCurrentDashboard),d(I),p(P);const T={title:g.name,description:g.description,frameObject:I,isPrivate:!1};k.mutate(T)}else if(g.saveToCurrentDashboard){const P={...I,id:n.v4(),visualId:void 0};try{const T=await D(I,{previousFrame:n.findDashboardFrameById(m,I.id)});j(b,P,{position:"end",semanticExecutionPayload:T}),E(P.id),s.ue.success("Visual saved to dashboard"),r(!1),A(!1)}catch(T){console.error("Failed to save visual to dashboard:",T),s.ue.error(T instanceof Error?T.message:"Failed to prepare semantic metadata for the visual")}}},isLibraryVisual:v,currentVisualName:S,isSaving:k.isPending}}function tt(t={}){const r=n.useEditorStore(I=>I.frame),l=n.useEditorStore(I=>I.editorContext),o=s.useManagementStore(I=>I.selectedVisual),a=n.useDashboardStore(I=>I.selectedFrameId),d=n.useDashboardStore(I=>I.selectedSheetId),h=n.useDashboardStore(I=>I.dashboard),{setIsVisualEditing:p,updateFrame:c}=n.useDashboardActions(),[u,i]=x.useState(!1),[b,m]=x.useState("both"),f=s.useResolveExistingFrameSemanticExecutionPayload(),y=(l==null?void 0:l.type)==="documentSection",j=!!(r!=null&&r.visualId||o!=null&&o.id),E=!!(r!=null&&r.visualId&&a),A=j&&!E,{saveAsDialogOpen:D,setSaveAsDialogOpen:v,handleSaveAs:S,isLibraryVisual:k,currentVisualName:M,isSaving:g}=et(),{getUpdatedFrame:w}=_.useVisualUtils();if(y)return e.jsxs(e.Fragment,{children:[e.jsx(_.EditorAcceptButton,{className:"rounded-control",variant:"default"}),e.jsx(_.EditorCancelButton,{})]});const L=async()=>{if(!d){s.ue.error("No sheet selected");return}if(u)return;i(!0);const I=w(),P=n.getDynamicFrameSaveIssue(I);if(P){i(!1),s.ue.error(P);return}const T={...I,visualId:void 0},$=n.findDashboardFrameById(h,T.id);try{const Y=await f(T,{previousFrame:$});c(d,T,{semanticExecutionPayload:Y})}catch(Y){console.error("Failed to apply local semantic metadata:",Y),i(!1),s.ue.error(Y instanceof Error?Y.message:"Failed to prepare semantic metadata for this visual");return}setTimeout(()=>{i(!1),s.ue.success("Changes applied. Visual is now local to this dashboard"),p(!1)},300)},B=I=>{m(I),v(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-control",children:[!j&&e.jsx(_.EditorAcceptButton,{className:"!rounded-none",variant:"default"}),j&&A&&e.jsx(_.VisualSaveButton,{className:"!rounded-none",variant:"default"}),j&&E&&e.jsx(_.VisualSaveAndApplyButton,{className:"!rounded-none"}),e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(n.Button,{variant:"default",size:"xs",className:"w-7 !rounded-none border-l border-primary-foreground/20 px-0","aria-label":"Open visual save options",disabled:g||u,children:e.jsx(G.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",children:[E&&e.jsxs(e.Fragment,{children:[e.jsxs(s.DropdownMenuItem,{onClick:L,disabled:u,children:[e.jsx(n.Check,{className:"h-3.5 w-3.5"}),u?"Applying...":"Apply Locally"]}),e.jsx(s.DropdownMenuSeparator,{})]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>B("local"),disabled:g,children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Add to Dashboard (Local)"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>B("library"),disabled:g,children:[e.jsx(_.Library,{className:"h-3.5 w-3.5"}),"Save as Library Visual"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>B("both"),disabled:g,children:[e.jsx(_.Link2,{className:"h-3.5 w-3.5"}),"Save Copy as Linked Visual"]})]})]})]}),e.jsx(_.EditorCancelButton,{}),e.jsx(Je,{open:D,onOpenChange:I=>{g||v(I)},isLibraryVisual:k,currentVisualName:M,isSaving:g,destinationMode:b,onConfirm:S})]})}function st({className:t}){const r=n.useEditorStore(u=>u.isDevMode),l=n.useDashboardStore(u=>u.isVisualEditing),{setIsDevMode:o}=n.useEditorActions(),{config:a}=x.useContext(s.SemaphorContext).tokenProps,d=(a==null?void 0:a.showAdvancedMode)!==!1;if(!l||!d)return null;const h=r?n.SlidersHorizontal:s.CodeXml,p=r?"Drag & drop":"SQL",c=r?"Switch to drag-and-drop mode":"Switch to SQL mode";return e.jsxs("button",{type:"button","aria-label":c,title:c,onClick:()=>o(!r),className:n.cn("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",t),children:[e.jsx(h,{className:"h-3 w-3 text-muted-foreground"}),p]})}function rt({open:t,onOpenChange:r,onSave:l,onDiscard:o,isSaving:a,title:d="Unsaved changes",description:h="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:p="Cancel",discardLabel:c="Discard",saveLabel:u="Save"}){const i=b=>{!b&&a||r(b)};return e.jsx(s.AlertDialog,{open:t,onOpenChange:i,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:d}),e.jsx(s.AlertDialogDescription,{children:h})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(n.Button,{type:"button",size:"xs",onClick:o,disabled:a,variant:"ghost",className:"mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",children:c}),e.jsx(s.AlertDialogCancel,{disabled:a,children:p}),e.jsx(n.Button,{type:"button",size:"xs",onClick:l,disabled:a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(n.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):u})]})]})})}const nt=1e4,at=15e3,ot=3e4,it=3e4,lt=12e4,Ne=2*60*60*1e3;function ct(t){const r=Date.now()-t.getTime();return r<it?nt:r<lt?at:ot}function dt(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),l=s.useExportStore(m=>m.activeExports),[o,a]=x.useState(typeof document<"u"?!document.hidden:!0),d=x.useRef(null),h=x.useRef(!1),p=x.useRef(void 0),c=r==null?void 0:r.apiServiceUrl,u=t==null?void 0:t.accessToken,i=x.useCallback(()=>{const m=s.useExportStore.getState().activeExports;return Array.from(m.values()).filter(f=>s.isExportInProgress(f.status))},[]);x.useEffect(()=>{if(typeof document>"u")return;const m=()=>{a(!document.hidden)};return document.addEventListener("visibilitychange",m),()=>{document.removeEventListener("visibilitychange",m)}},[]);const b=x.useCallback(async()=>{if(!c||!u){h.current=!1;return}const m=i();if(m.length===0){h.current=!1;return}const f=Date.now(),y=m.filter(v=>f-v.startedAt.getTime()>Ne);if(y.length>0){const{updateExport:v}=s.useExportStore.getState().actions;for(const S of y)v(S.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const j=m.filter(v=>f-v.startedAt.getTime()<=Ne);if(j.length===0){h.current=!1;return}const E=await Promise.allSettled(j.map(async v=>{try{const S=await s.getExportStatus(c,u,v.id);let k;if(S.status==="completed")try{k=await s.getDownloadUrl(c,u,v.id)}catch(M){console.error(`[useExportPolling] Failed to get download URL for ${v.id}:`,M)}return{id:v.id,status:S.status,progress:S.progress,completedChunks:S.completedChunks,completedAt:S.completedAt?new Date(S.completedAt):void 0,lastUpdatedAt:new Date,fileSize:S.fileSize,error:S.error,downloadUrl:k}}catch(S){return console.error(`[useExportPolling] Failed to poll export ${v.id}:`,S),null}})),{updateExport:A}=s.useExportStore.getState().actions;for(const v of E)v.status==="fulfilled"&&v.value&&A(v.value.id,v.value);const D=i();if(D.length>0&&!document.hidden){const v=D.reduce((k,M)=>M.startedAt<k?M.startedAt:k,D[0].startedAt),S=ct(v);d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{var k;(k=p.current)==null||k.call(p)},S)}else h.current=!1},[c,u,i]);return x.useEffect(()=>{p.current=b},[b]),x.useEffect(()=>{var f;i().length>0&&o&&!h.current&&(h.current=!0,(f=p.current)==null||f.call(p))},[l,o,i]),x.useEffect(()=>{var f;const m=i();o&&m.length>0&&!h.current&&(h.current=!0,(f=p.current)==null||f.call(p))},[o,i]),x.useEffect(()=>{!o&&d.current&&(clearTimeout(d.current),d.current=null,h.current=!1)},[o]),x.useEffect(()=>()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),{isPolling:h.current,isTabVisible:o,inProgressCount:i().length}}function ut(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),l=s.useExportStore(p=>p.activeExports),{addExport:o}=s.useExportActions(),a=x.useRef(!1),d=r==null?void 0:r.apiServiceUrl,h=t==null?void 0:t.accessToken;x.useEffect(()=>{if(a.current||!d||!h)return;(async()=>{try{const{exports:c}=await s.getExports(d,h,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const u of c){if(l.has(u.id))continue;const i=u.totalChunks?Math.round(u.completedChunks/u.totalChunks*100):0;let b;if(u.status==="completed")try{b=await s.getDownloadUrl(d,h,u.id)}catch(f){console.error(`[useExportRecovery] Failed to get download URL for ${u.id}:`,f)}const m={id:u.id,status:u.status,progress:i,title:ht(u),totalRows:u.totalRows,totalChunks:u.totalChunks,completedChunks:u.completedChunks,startedAt:new Date(u.createdAt),lastUpdatedAt:new Date,completedAt:u.completedAt?new Date(u.completedAt):void 0,fileSize:u.fileSize,error:u.error,expiresAt:new Date(u.expiresAt),downloadUrl:b};o(m)}a.current=!0}catch(c){console.error("[useExportRecovery] Failed to recover exports:",c),a.current=!0}})()},[d,h,o,l])}function ht(t){return t.title?t.title:s.isExportInProgress(t.status)?"Export in progress...":t.status==="completed"?"Export completed":t.status==="failed"?"Export failed":"Export"}function ke({export:t,onRemove:r}){const l=()=>{t.downloadUrl&&window.open(t.downloadUrl,"_blank")},o=p=>{p.stopPropagation(),r==null||r(t.id)},a=()=>{switch(t.status){case"completed":return e.jsx(s.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx(ze,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(n.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},d=s.isExportInProgress(t.status),h=(()=>{switch(t.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[a(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:t.title}),t.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[t.totalRows.toLocaleString()," rows"]}),t.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:s.formatFileSize(t.fileSize)})]})]}),d&&e.jsx("div",{className:"text-xs text-muted-foreground",children:h}),t.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:t.error||"Export failed"})]})]}),e.jsx(n.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:o,"aria-label":"Remove notification",children:e.jsx(G.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[t.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:ye.formatDistanceToNow(t.startedAt,{addSuffix:!0})}),t.downloadUrl&&e.jsxs(n.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:l,children:[e.jsx(s.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),d&&e.jsxs("div",{children:[e.jsx(s.Progress,{value:t.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[t.progress,"% complete"]})]}),t.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:ye.formatDistanceToNow(t.startedAt,{addSuffix:!0})})]})]})}function Ae(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),l=s.useExportStore(j=>j.activeExports),{clearCompleted:o,removeExport:a,updateExport:d}=s.useExportActions(),[h,p]=x.useState(!1),[c,u]=x.useState(!1),i=Array.from(l.values()).sort((j,E)=>E.startedAt.getTime()-j.startedAt.getTime()),b=i.some(j=>j.status==="completed"||j.status==="failed"),m=x.useCallback(async()=>{const j=r==null?void 0:r.apiServiceUrl,E=t==null?void 0:t.accessToken;if(!(!j||!E)){p(!0);try{const A=Array.from(l.values());await Promise.all(A.map(async D=>{try{const v=await s.getExportStatus(j,E,D.id);let S;if(v.status==="completed")try{S=await s.getDownloadUrl(j,E,D.id)}catch(k){console.error(`Failed to get download URL for ${D.id}:`,k)}d(D.id,{status:v.status,progress:v.progress,completedChunks:v.completedChunks,completedAt:v.completedAt?new Date(v.completedAt):void 0,lastUpdatedAt:new Date,fileSize:v.fileSize,error:v.error,downloadUrl:S})}catch(v){console.error(`Failed to refresh export ${D.id}:`,v)}}))}finally{p(!1)}}},[l,t==null?void 0:t.accessToken,r==null?void 0:r.apiServiceUrl,d]),f=x.useCallback(async()=>{const j=r==null?void 0:r.apiServiceUrl,E=t==null?void 0:t.accessToken;if(!j||!E){o();return}u(!0);try{const A=i.filter(v=>v.status==="completed"||v.status==="failed"),D=await Promise.allSettled(A.map(async v=>(await s.cancelExport(j,E,v.id),v.id)));for(const v of D)v.status==="fulfilled"?a(v.value):console.error("Failed to delete export:",v.reason)}finally{u(!1)}},[i,r==null?void 0:r.apiServiceUrl,t==null?void 0:t.accessToken,o,a]),y=x.useCallback(async j=>{const E=r==null?void 0:r.apiServiceUrl,A=t==null?void 0:t.accessToken;if(E&&A)try{await s.cancelExport(E,A,j),a(j);return}catch(D){console.error(`Failed to cancel export ${j}:`,D)}a(j)},[r==null?void 0:r.apiServiceUrl,t==null?void 0:t.accessToken,a]);return i.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(we,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(n.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:m,disabled:h,title:"Refresh status",children:e.jsx(s.RefreshCw,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),b&&e.jsx(n.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:f,disabled:c,children:c?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:i.map(j=>e.jsx(ke,{export:j,onRemove:y},j.id))})})]})}function mt({variant:t}){const r=s.useExportStore(c=>c.activeExports),l=s.useInProgressExportsCount(),o=r.size>0,a=Array.from(r.values()).some(c=>c.status==="completed"||c.status==="failed"),h=l>0?l>9?"9+":String(l):null,p=o;return e.jsxs(n.Popover,{children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:t??"ghost",size:"xs",className:"relative w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Export notifications",children:[e.jsx(s.Bell,{className:"h-3.5 w-3.5"}),p&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${h?"-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold":"right-1 top-1 h-1.5 w-1.5"}`,children:h})]})}),e.jsx(n.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(Ae,{})})]})}function xt(t){if(t)return{renamed:t.type==="rename"?{oldId:t.oldId,newId:t.newId}:void 0,removedControlId:t.type==="remove"?t.controlId:void 0,cardBindingsById:t.type==="add"||t.type==="update"?t.cardBindingsById:void 0,affectedBindingControlIds:t.type==="add"||t.type==="update"?t.affectedBindingControlIds:void 0}}function Be({open:t,onOpenChange:r,trigger:l,showTrigger:o=!0,initialMode:a="manage"}){const d=a==="create",{forceClose:h,handleOpenChange:p,isCreateFlowActive:c,preventPassiveDismissDuringCreate:u,resolvedOpen:i,setIsCreateFlowActive:b}=_.useCreateFlowOverlayState({open:t,onOpenChange:r,initialCreateFlowActive:a==="create",dismissMode:o?"passive":"explicit-only"}),m=n.useDashboardStore(w=>w.dashboard),{setDashboardControlsModel:f}=n.useDashboardActions(),{participants:y}=s.useDashboardStructuralParticipants(n.getDashboardCards(m)),j=Array.from(new Map(y.flatMap(w=>w.fieldChoices.map(L=>{var B;return[L.value,{option:L,target:(B=w.fieldTargetMap)==null?void 0:B[L.value]}]}))).values()),E=Array.from(new Map(y.flatMap(w=>w.metricChoices.map(L=>{var B;return[L.value,{option:L,target:(B=w.metricTargetMap)==null?void 0:B[L.value]}]}))).values()),A=n.collectDashboardControlIds({...m||{},controls:[]}),D=s.buildDashboardStructuralParticipantIdsByControlId(m),v=(w,L,B)=>{f(w,L,xt(B))},S=x.useCallback(()=>{if(d){h();return}b(!1)},[d,h,b]),k=e.jsx(_.ControlDefinitionListEditor,{scope:"dashboard",controls:m.controls||[],reservedControlIds:A,defaultValues:m.defaultControlValues||{},usageByControlId:s.buildDashboardControlUsageById(m),availableFieldChoices:j,availableMetricChoices:E,structuralParticipants:y,structuralParticipantIdsByControlId:D,initialCreateFlow:a==="create",onCreateFlowActiveChange:b,onCreateFlowComplete:S,onChange:v,emptyMessage:"No dashboard controls yet."}),M=c?"Add dashboard control":"Dashboard Controls",g=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Dashboard Controls"}),e.jsx("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."})]}),k]});return o?e.jsxs(n.Popover,{open:i,onOpenChange:p,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:l||e.jsxs(n.Button,{variant:"outline",className:"h-7 px-2",size:"sm",children:[e.jsx(n.SlidersHorizontal,{className:"mr-2 h-4 w-4"}),"Controls"]})}),e.jsx(n.PopoverContent,{className:"w-[620px] max-w-[95vw] space-y-4",align:"end",onEscapeKeyDown:u,onPointerDownOutside:u,children:g})]}):e.jsx(s.Dialog,{open:i,onOpenChange:p,children:e.jsxs(s.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:u,onPointerDownOutside:u,children:[e.jsxs(s.DialogHeader,{className:c?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:M}),e.jsx(s.DialogDescription,{className:c?"sr-only":"text-[13px]",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."})]}),e.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:k})]})})}const pt=["enum","multi_enum","text","number","boolean","date"];function Ie({open:t,onOpenChange:r,initialMode:l="manage"}){var g;const o=l==="create",{forceClose:a,handleOpenChange:d,isCreateFlowActive:h,preventPassiveDismissDuringCreate:p,resolvedOpen:c,setIsCreateFlowActive:u}=_.useCreateFlowOverlayState({open:t,onOpenChange:r,initialCreateFlowActive:l==="create",dismissMode:"explicit-only"}),i=n.useDashboardStore(w=>w.dashboard),b=n.useDashboardStore(w=>w.selectedSheetId),{setDashboardInputs:m}=n.useDashboardActions(),f=(g=i.sheets)==null?void 0:g.find(w=>w.id===b),y=(f==null?void 0:f.kind)==="document"&&!!f.document,j=x.useMemo(()=>y&&(f!=null&&f.document)?s.getDocumentSheetDashboardInputs(i,f.id):[],[i,y,f==null?void 0:f.document,f==null?void 0:f.id]),E=x.useMemo(()=>j.filter(w=>w.kind==="control"),[j]),A=x.useMemo(()=>E.map(w=>w.control),[E]),D=x.useMemo(()=>gt(A),[A]),v=x.useMemo(()=>ft(i),[i]),S=x.useCallback(()=>{if(o){a();return}u(!1)},[o,a,u]),k=x.useCallback((w,L,B)=>{!y||!(f!=null&&f.document)||m(vt({allInputs:i.inputs||[],documentSheetId:f.id,currentDocumentInputs:j,nextControls:w,nextDefaultValues:L,change:B}))},[i.inputs,j,y,f,m]);if(!y||!(f!=null&&f.document))return null;const M=h?"Add document control":"Document Controls";return e.jsx(s.Dialog,{open:c,onOpenChange:d,children:e.jsxs(s.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:p,onPointerDownOutside:p,children:[e.jsxs(s.DialogHeader,{className:h?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:M}),e.jsx(s.DialogDescription,{className:h?"sr-only":"text-[13px]",children:h?"Configure and add a document-local control input.":"Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."})]}),e.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:e.jsx(_.ControlDefinitionListEditor,{scope:"dashboard",controls:A,reservedControlIds:v,defaultValues:D,usageByControlId:{},availableFieldChoices:[],availableMetricChoices:[],structuralParticipants:[],structuralParticipantIdsByControlId:{},allowedControlTypes:pt,initialCreateFlow:l==="create",onCreateFlowActiveChange:u,onCreateFlowComplete:S,onChange:k,emptyMessage:"No document controls yet."})})]})})}function ft(t){return(t.controls||[]).map(r=>r.id)}function gt(t){const r={};for(const l of t)l.defaultValue!==void 0&&(r[l.id]=l.defaultValue);return r}function bt(t,r){return r?Object.prototype.hasOwnProperty.call(r,t.id)?{...t,defaultValue:r[t.id]}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}}function vt({allInputs:t,documentSheetId:r,currentDocumentInputs:l,nextControls:o,nextDefaultValues:a,change:d}){const h=new Map(o.map(m=>[m.id,bt(m,a)])),p=(d==null?void 0:d.type)==="rename"?{oldId:d.oldId,newId:d.newId}:null,c=new Set,u=[];for(const m of l){if(m.kind!=="control"){u.push(m);continue}const f=h.get(m.control.id)||((p==null?void 0:p.oldId)===m.control.id?h.get(p.newId):void 0);if(!f)continue;c.add(f.id);const y=s.createUniqueDashboardInputVariableNameFromName(f.id,[...t,...u].filter(E=>E.id!==m.id)),j=f.id===y?f:{...f,id:y};u.push({...m,label:j.label,variableName:y,requiredAtExecution:j.requiredAtExecution,control:j})}for(const m of h.values())c.has(m.id)||u.push(s.createDashboardControlInputFromControl({control:m,existingInputs:[...t,...u],sheetId:r}));const i=new Set(l.map(m=>m.id));return[...t.filter(m=>!i.has(m.id)),...u]}function Fe({showFilters:t,onShowFiltersChange:r,pickerContent:l,settingsContent:o,size:a="default",className:d,primaryButtonClassName:h,secondaryButtonClassName:p,pickerContentClassName:c,settingsContentClassName:u}){const i=a==="toolbar",[b,m]=x.useState(!1),f=s.useSurfaceAppearance("interactive");return e.jsxs("div",{className:n.cn("relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",i?"h-8":"h-7",d),children:[e.jsxs(n.Popover,{open:t,onOpenChange:r,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"ghost",size:"xs",className:n.cn("h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",h),children:[t?e.jsx(_e,{className:"h-3.5 w-3.5"}):e.jsx(s.Filter,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(n.PopoverContent,{align:"end",sideOffset:6,className:n.cn("w-auto rounded-card border border-border/60 p-0 shadow-sm",c),style:f.contentStyle,children:l})]}),e.jsxs(n.Popover,{open:b,onOpenChange:m,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsx(n.Button,{variant:"ghost",size:"xs",className:n.cn("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",p),"aria-label":"Filter and control actions",children:e.jsx(G.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsx(n.PopoverContent,{align:"end",sideOffset:6,className:n.cn("w-auto rounded-card border border-border/60 p-0 shadow-sm",u),style:f.contentStyle,children:o(()=>m(!1))})]})]})}function jt(){_.useSyncLegacyEditorState();const t=n.useDashboardStore(c=>c.selectedSheetId),r=n.useDashboardStore(c=>c.selectedFrameId),l=n.useDashboardStore(c=>c.dashboard),o=n.useDashboardStore(c=>c.actions.getSelectedFrame),{setSelectedFrameId:a}=n.useDashboardActions(),{setCard:d}=n.useEditorActions(),h=n.useEditorStore(c=>c.card.dataSource);return x.useEffect(()=>{var u,i;let c=o();if(!c){const b=(u=l==null?void 0:l.sheets)==null?void 0:u.find(f=>f.id===t),m=(i=b==null?void 0:b.frames)==null?void 0:i[0];m&&(a(m.id),c=m)}if(c){const b=c.cards.find(m=>m.id===c.activeCardId);b&&d(b)}},[o,t,r,l,a,d]),{hasEntities:!!(h!=null&&h.selectedEntities&&h.selectedEntities.length>0)}}function Ct(){const t=n.useDashboardStore(c=>c.dashboard),r=n.useDashboardStore(c=>c.semanticExecutionPayload),l=n.useDashboardStore(c=>c.actions.addFilter),{hasEntities:o}=jt(),{isLoading:a}=s.useFilterableFields(),d=x.useMemo(()=>n.getGlobalDateFilterCoverage(t,r),[t,r]),p=!n.getGlobalDateFilter(t.filters)&&d.hasEligibleCards&&!a;return e.jsxs("div",{className:"flex h-[520px] w-[400px] flex-col",children:[p&&e.jsx("div",{className:"border-b border-border/60 p-2",children:e.jsxs("button",{type:"button",onClick:()=>l(n.createDefaultGlobalDateFilter()),title:`Applies to ${d.eligibleCardCount} of ${d.totalCardCount} date-aware cards`,className:"flex w-full items-start gap-2 rounded-[4px] 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",children:[e.jsx(Oe,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"text-[12px] font-medium text-foreground",children:"Add global date filter"}),e.jsx("span",{className:"text-[11px] leading-[1.4] text-muted-foreground",children:"One date range across all date-aware cards."})]})]})}),!o&&e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-8 text-center",children:[e.jsx(s.Database,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),e.jsx("h3",{className:"mb-1 text-[13px] font-medium text-foreground",children:"No fields configured"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Configure a data source for this card to enable filtering."})]}),o&&e.jsx("div",{className:"flex flex-1 overflow-hidden",children:e.jsx(s.FilterableFieldsPanel,{context:"filter"})})]})}const De=!1;function yt({onAddFilter:t,onAddControl:r,onManageControls:l,onDismiss:o}){const a=n.useDashboardStore(p=>p.dashboard.filterLayout),{setFilterLayout:d}=n.useDashboardActions();a!=null&&a.displayMode;const h=(a==null?void 0:a.toolbarWrap)??!1;return a==null||a.showDownloadButton,e.jsxs("div",{className:"w-[300px]",children:[e.jsxs("div",{className:"p-1",children:[e.jsx(ve,{icon:s.Filter,label:"Add filter",onClick:()=>{t(),o()}}),e.jsx(ve,{icon:n.SlidersHorizontal,label:"Add control",onClick:()=>{r(),o()}}),e.jsx(ve,{icon:s.Pencil,label:"Manage controls",onClick:()=>{l(),o()}})]}),e.jsx("div",{className:"border-t border-border/60"}),e.jsxs("div",{className:"space-y-1 p-2",children:[e.jsx("p",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Display"}),De,e.jsx(wt,{id:"filter-display-wrap",label:"Wrap to multiple lines",checked:h,onCheckedChange:p=>d({toolbarWrap:p===!0})}),De]})]})}function ve({icon:t,label:r,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 rounded-[4px] px-2 py-1.5 text-left text-[13px] text-foreground transition-colors hover:bg-muted/40",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-muted-foreground"}),r]})}function wt({id:t,label:r,checked:l,onCheckedChange:o}){return e.jsxs("div",{className:"flex items-center gap-2 rounded-[4px] px-1 py-1 transition-colors hover:bg-muted/40",children:[e.jsx(s.Checkbox,{id:t,checked:l,onCheckedChange:o}),e.jsx(n.Label,{htmlFor:t,className:"cursor-pointer text-[12px] font-normal leading-[1.3]",children:r})]})}function Nt({size:t,className:r,primaryButtonClassName:l,secondaryButtonClassName:o,pickerContentClassName:a,settingsContentClassName:d}){var M;const[h,p]=x.useState(null),c=n.useDashboardStore(g=>g.dashboard),u=n.useDashboardStore(g=>g.selectedSheetId),i=n.useDashboardStore(g=>g.showFilters),b=s.useAssistantLayoutStore(g=>g.setPanelOpen),m=n.useDashboardStore(g=>g.actions),{setDocumentInspectorTab:f,setShowFilters:y}=m,j=(M=c.sheets)==null?void 0:M.find(g=>g.id===u),E=n.isDocumentSheet(j),A=x.useCallback(g=>{window.setTimeout(()=>{p(g)},0)},[]),D=x.useCallback(g=>{if(E&&u){g&&f(u,"inputs");return}g&&b("dashboard",!1),y(g)},[E,u,f,b,y]),v=x.useCallback(()=>{D(!0)},[D]),S=x.useCallback(()=>{A("create")},[A]),k=x.useCallback(()=>{A("manage")},[A]);return e.jsxs(e.Fragment,{children:[e.jsx(Fe,{showFilters:E?!1:i,onShowFiltersChange:D,pickerContent:e.jsx(Ct,{}),settingsContent:g=>e.jsx(yt,{onAddFilter:v,onAddControl:S,onManageControls:k,onDismiss:g}),size:t,className:r,primaryButtonClassName:l,secondaryButtonClassName:o,pickerContentClassName:a,settingsContentClassName:d}),h?E?e.jsx(Ie,{open:!0,onOpenChange:g=>{g||p(null)},initialMode:h}):e.jsx(Be,{open:!0,onOpenChange:g=>{g||p(null)},showTrigger:!1,initialMode:h}):null]})}function Le({disabled:t,briefingCount:r,className:l,onClick:o}){const a=typeof r=="number"&&r>0;return e.jsxs(n.Button,{type:"button",size:"xs",variant:"outline",disabled:t,className:n.cn("gap-1.5",l),onClick:o,"aria-label":"Reports & briefings",children:[e.jsx($e,{className:"h-3.5 w-3.5"}),"Reports & briefings",a?e.jsx("span",{className:"ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70",children:r}):null]})}const Dt="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",Te="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",pe="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";function St(t){return t==="dashboard"?"This dashboard":"Project"}function Et(t){if(!t)return"Never";const r=new Date(t);if(Number.isNaN(r.getTime()))return"Unknown";const l=Date.now()-r.getTime(),o=Math.round(l/6e4);if(o<1)return"now";if(o<60)return`${o}m ago`;const a=Math.round(o/60);if(a<24)return`${a}h ago`;const d=Math.round(a/24);if(d<7)return`${d}d ago`;const h=Math.round(d/7);return h<5?`${h}w ago`:`${Math.round(d/30)}mo ago`}function kt(t){return t.scheduleExpr?X.describeBriefingSchedule(t.scheduleExpr,t.timezone||"UTC")??"Invalid schedule":"On demand"}function At(t){if(t.lastRunStatus){const r=t.lastRunStatus.toString().toUpperCase();return r==="SUCCESS"?"Last run completed.":r==="FAILED"?"Last run failed.":`Last run ${t.lastRunStatus.toString().toLowerCase()}`}return null}function Me(t){return t.hasActiveRun?"Running":t.lastRunStatus?`Last run ${t.lastRunStatus.toString().toLowerCase()}`:"Idle"}function Bt(t){return t.source.type==="dashboard"?"This dashboard":"Project"}function It({activeView:t,onChange:r}){return e.jsx("div",{className:"flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",role:"tablist","aria-label":"Briefing source view",children:["dashboard","project"].map(l=>{const o=t===l;return e.jsx("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>r(l),className:n.cn("h-6 rounded-[3px] px-2 text-[11px] transition-colors",o?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:St(l)},l)})})}function Ft({briefings:t,dashboardLabel:r,sourceView:l,error:o,loading:a,onSourceViewChange:d,onClose:h,onEdit:p,onNew:c,canCreate:u,canCreateScheduledReport:i,analyticalBriefingsEnabled:b,onRunNow:m,onTogglePause:f,onDelete:y,selectingId:j,busyId:E,manageBriefingsHref:A,contentKind:D,hideHeader:v=!1}){const S=t.length,k=t.filter(B=>B.status==="ACTIVE").length,M=D==="reports"?S===1?"report":"reports":D==="briefings"?S===1?"briefing":"briefings":S===1?"item":"items",g=t.find(B=>B.hasActiveRun)??null,w=D??"reports & briefings",L=l==="dashboard"?r:`Project ${w}`;return e.jsxs("section",{"aria-label":`Dashboard ${w.replace("&","and")}`,className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:[v?null:e.jsxs("header",{className:"flex items-start justify-between gap-3 border-b border-border px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:Dt,children:w}),e.jsx("h2",{className:"mt-0.5 truncate text-[14px] font-semibold leading-5",children:L})]}),e.jsx("button",{type:"button",onClick:h,className:"rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Close ${w.replace("&","and")} panel`,children:e.jsx(G.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(It,{activeView:l,onChange:d}),e.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:a&&S===0?e.jsxs("span",{children:["Loading ",w,"…"]}):S===0?e.jsxs("span",{children:["No ",w," yet"]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-foreground/80",children:[S," ",M]}),e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{children:[k," active"]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[a?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}):null,S>0&&u?b&&i?e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("button",{className:pe,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," New"]})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsx(s.DropdownMenuItem,{onClick:()=>c("scheduled_report"),children:"Schedule a report"}),e.jsx(s.DropdownMenuItem,{onClick:()=>c("analytical_briefing"),children:"Create analytical briefing"})]})]}):i?e.jsxs("button",{onClick:()=>c("scheduled_report"),className:pe,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," Schedule report"]}):b?e.jsxs("button",{onClick:()=>c("analytical_briefing"),className:pe,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," New briefing"]}):null:null]})]}),g?e.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]",children:[e.jsx(n.LoaderCircle,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground"}),e.jsx("span",{className:"font-medium text-foreground",children:g.name}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{className:"truncate text-muted-foreground",children:Me(g)})]}):null,e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o?e.jsx("div",{className:"m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive",children:o}):null,!a&&t.length===0&&!o?e.jsx(Lt,{onNew:c,canCreate:u,canCreateScheduledReport:i,analyticalBriefingsEnabled:b,contentKind:D}):null,t.map(B=>e.jsx(Mt,{briefing:B,isOpening:j===B.id,isBusy:E===B.id,onOpen:()=>p(B.id),onRunNow:()=>m(B),onTogglePause:()=>f(B),onDelete:()=>y(B)},B.id))]}),A?e.jsx("div",{className:"border-t border-border px-4 py-2.5",children:e.jsxs("a",{href:A,className:n.cn(Te,"h-6 px-1 text-[11px]"),children:["Manage all reports & briefings",e.jsx(Ue,{className:"h-3 w-3"})]})}):null]})}function Lt({onNew:t,canCreate:r,canCreateScheduledReport:l,analyticalBriefingsEnabled:o,contentKind:a}){const d=a==="reports"?{title:"No reports yet",description:"Schedule an emailed dashboard or visual report to see it here."}:a==="briefings"?{title:"No briefings yet",description:"Create an analytical briefing to monitor this dashboard and brief your team."}:null;return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-8 py-12 text-center",children:[e.jsx(Tt,{className:"mb-5 h-[88px] w-[112px] text-border"}),e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:(d==null?void 0:d.title)??"Have an analyst brief your team"}),e.jsx("p",{className:"mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground",children:(d==null?void 0:d.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."}),r?e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[l?e.jsxs("button",{onClick:()=>t("scheduled_report"),className:pe,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," Schedule a report"]}):null,o?e.jsx("button",{onClick:()=>t("analytical_briefing"),className:Te,children:"Create analytical briefing"}):null]}):null]})}function Tt({className:t}){return e.jsxs("svg",{viewBox:"0 0 112 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":"true",className:t,children:[e.jsx("rect",{x:"22",y:"6",width:"60",height:"72",rx:"3",stroke:"currentColor",strokeWidth:"1.25"}),e.jsx("line",{x1:"30",y1:"16",x2:"64",y2:"16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"30",y1:"21",x2:"52",y2:"21",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.5"}),e.jsx("circle",{cx:"31",cy:"32",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"32",x2:"72",y2:"32",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"31",cy:"38",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"38",x2:"68",y2:"38",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"31",cy:"44",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"44",x2:"74",y2:"44",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("rect",{x:"30",y:"64",width:"5",height:"8",rx:"0.5",fill:"currentColor",opacity:"0.55"}),e.jsx("rect",{x:"38",y:"60",width:"5",height:"12",rx:"0.5",fill:"currentColor",opacity:"0.7"}),e.jsx("rect",{x:"46",y:"56",width:"5",height:"16",rx:"0.5",fill:"currentColor",opacity:"0.85"}),e.jsx("rect",{x:"54",y:"62",width:"5",height:"10",rx:"0.5",fill:"currentColor",opacity:"0.6"}),e.jsx("rect",{x:"62",y:"58",width:"5",height:"14",rx:"0.5",fill:"currentColor",opacity:"0.75"}),e.jsx("circle",{cx:"86",cy:"62",r:"10",fill:"var(--background, white)",stroke:"currentColor",strokeWidth:"1.25"}),e.jsx("line",{x1:"93.5",y1:"69.5",x2:"100",y2:"76",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Mt({briefing:t,isOpening:r,isBusy:l,onOpen:o,onRunNow:a,onTogglePause:d,onDelete:h}){const p=t.status==="PAUSED",c=t.hasActiveRun,u=At(t),i=Et(t.lastRunAt),b=t.lastRunStatus,m=X.getBriefingPresentation(t),f=b==="SUCCESS"?s.briefingTone.success.dot:b==="FAILED"?s.briefingTone.danger.dot:b?s.briefingTone.warning.dot:s.briefingTone.neutral.dot;return e.jsxs("div",{className:n.cn("group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",p&&"opacity-70"),children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:o,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o())},className:"cursor-pointer pr-8",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:t.name}),p?e.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:"· Paused"}):null]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:m.typeLabel}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{children:Bt(t)}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx(s.Clock,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:kt(t)}),t.lastRunAt?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{children:["Last run ",i]})]}):null]}),u||c?e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80",children:[c?e.jsx(n.LoaderCircle,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground/70"}):e.jsx("span",{className:n.cn("inline-block h-1.5 w-1.5 shrink-0 rounded-full",f)}),e.jsx("span",{className:"truncate",children:c?Me(t):u})]}):null]}),e.jsx("div",{className:"absolute right-3 top-3",children:l?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground/70"}):r?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground/70"}):e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx("button",{type:"button",onClick:y=>y.stopPropagation(),className:"inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100","aria-label":`${m.noun==="report"?"Report":"Briefing"} actions`,children:e.jsx(s.Ellipsis,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-44",children:[e.jsxs(s.DropdownMenuItem,{onClick:o,children:[e.jsx(s.Pencil,{className:"h-3.5 w-3.5"}),"Edit ",m.noun]}),e.jsxs(s.DropdownMenuItem,{onClick:y=>{y.preventDefault(),a()},children:[e.jsx(s.Zap,{className:"h-3.5 w-3.5"}),"Run now"]}),t.scheduleExpr?e.jsx(s.DropdownMenuItem,{onClick:y=>{y.preventDefault(),d()},children:p?e.jsxs(e.Fragment,{children:[e.jsx(s.Play,{className:"h-3.5 w-3.5"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Pause,{className:"h-3.5 w-3.5"}),"Pause"]})}):null,e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuItem,{onClick:y=>{y.preventDefault(),h()},className:"text-destructive focus:bg-destructive/10 focus:text-destructive",children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),"Delete ",m.noun]})]})]})})]})}const Pt=2e3,Vt=20*6e4;function Rt(t){return(t==null?void 0:t.trim())||"This dashboard"}function Ut(t){return t==="This dashboard"?"Watch this dashboard":`Watch ${t}`}function Ot(t,r,l){return r!=="dashboard"?t:t.filter(o=>o.source.type==="dashboard"&&o.source.dashboardId===l)}async function zt(t){const l=[];let o=1,a=0,d=Number.POSITIVE_INFINITY;for(;a<d;){const h=await t.apiClient.listBriefings(t.apiServiceUrl,t.token,{scope:"organization",page:o,pageSize:100});if(l.push(...h.briefings),a+=h.briefings.length,d=h.total,h.briefings.length===0||a>=d)break;o+=1}return l}const _t={listBriefings:s.listBriefings,getBriefing:s.getBriefing,pauseBriefing:s.pauseBriefing,resumeBriefing:s.resumeBriefing,deleteBriefing:s.deleteBriefing,runBriefingNow:s.runBriefingNow};function $t({briefingId:t,initialRun:r,apiServiceUrl:l,token:o,onTerminal:a,onTimeout:d,onExpand:h}){const[p,c]=x.useState(r),{startRun:u}=s.useBriefingRunPolling({apiServiceUrl:l,token:o,intervalMs:Pt,timeoutMs:Vt,fetchRun:({apiServiceUrl:b,token:m,runId:f})=>s.getBriefingRun(b,m,t,f),onRun:b=>{c(b)},onTerminalRun:b=>{a(b)},onTimeout:()=>{d()}}),i=x.useRef(!1);return x.useEffect(()=>{i.current||(i.current=!0,s.isActiveBriefingRunStatus(r.status)?u(r):s.isTerminalBriefingRunStatus(r.status)&&a(r))},[r,a,u]),e.jsx(s.BackgroundRunPill,{run:p,onExpand:h})}function qt(t){return e.jsx(s.BriefingUiCapabilitiesBoundary,{children:e.jsx(Ht,{...t})})}function Ht({dashboardId:t,dashboardTitle:r,apiServiceUrl:l,token:o,disabled:a,className:d,manageBriefingsHref:h,open:p,onOpenChange:c,hideTrigger:u=!1,workflowIntent:i,client:b}){const{authToken:m,tokenProps:f}=s.useSemaphorContext(),y=s.useBriefingUiCapabilities(),j=!i||y.canCreate&&(i==="scheduled_report"||y.analyticalBriefingsEnabled),[E,A]=x.useState(!1),D=p??E,v=N=>{p===void 0&&A(N),c==null||c(N)},[S,k]=x.useState(i?"author":"list"),[M,g]=x.useState(i??"analytical_briefing"),[w,L]=x.useState("dashboard"),[B,I]=x.useState([]),[P,T]=x.useState(null),$=i&&!j&&!P?"list":S,[Y,Z]=x.useState(!1),[fe,ie]=x.useState(null),[ge,H]=x.useState(null),[U,K]=x.useState(null),[te,se]=x.useState(null),le=x.useRef(null),ue=x.useRef(D);x.useEffect(()=>{const N=D&&!ue.current;ue.current=D,!(!N||!i)&&(T(null),L("dashboard"),g(i),k("author"),se(null))},[D,i]);const[re,ae]=x.useState(null),[W,ce]=x.useState(null),O=l??(f==null?void 0:f.apiServiceUrl),z=o??(m==null?void 0:m.accessToken),J=x.useMemo(()=>({..._t,...b}),[b]),oe=Rt(r),he=x.useMemo(()=>{const N=Ot(B,w,t);if(!i)return N;const V=i==="scheduled_report"?"report":"briefing";return N.filter(me=>X.getBriefingPresentation(me).noun===V)},[t,B,w,i]),be=x.useMemo(()=>w==="dashboard"?{source:{type:"dashboard",dashboardId:t},label:oe,detail:Ut(oe)}:{source:{type:"project"},label:"This project",detail:"Use any data in this project."},[t,oe,w]),de=!!(O&&z),ne=X.getBriefingCreationIntents({canCreate:y.canCreate,analyticalBriefingsEnabled:y.analyticalBriefingsEnabled,scheduledReportAvailable:w==="dashboard"}),q=x.useCallback(async()=>{if(!(!O||!z)){Z(!0),se(null);try{I(await zt({apiClient:J,apiServiceUrl:O,token:z}))}catch(N){se(N instanceof Error?N.message:"Could not load briefings.")}finally{Z(!1)}}},[J,O,z]);x.useEffect(()=>{!D||$!=="list"||!de||q()},[de,$,q,D]);const C=()=>{T(null),L("dashboard"),k("list"),v(!0)},F=N=>{T(null),g(N),k("author")},R=async N=>{if(!(!O||!z)){ie(N),se(null);try{const V=await J.getBriefing(O,z,N);T(V.briefing),k("author")}catch(V){se(V instanceof Error?V.message:"Could not open briefing.")}finally{ie(null)}}},Q=async N=>{if(!(!O||!z)){H(N.id);try{await J.runBriefingNow(O,z,N.id,{requestId:Wt()}),q()}catch(V){s.ue.error(V instanceof Error?V.message:"Could not start the run.")}finally{H(null)}}},ee=async N=>{if(!O||!z)return;const{noun:V}=X.getBriefingPresentation(N),me=V==="report"?"Report":"Briefing";H(N.id);try{const xe=N.status==="PAUSED"?await J.resumeBriefing(O,z,N.id):await J.pauseBriefing(O,z,N.id);s.ue.success(xe.briefing.status==="PAUSED"?`${me} paused`:`${me} resumed`),q()}catch(xe){s.ue.error(xe instanceof Error?xe.message:`Could not update the ${V} status.`)}finally{H(null)}},Pe=async()=>{if(!U||!O||!z)return;const N=U;H(N.id);try{await J.deleteBriefing(O,z,N.id);const{noun:V}=X.getBriefingPresentation(N);s.ue.success(`${V==="report"?"Report":"Briefing"} deleted`),K(null),q()}catch(V){s.ue.error(V instanceof Error?V.message:"Could not delete the briefing.")}finally{H(null)}},Ve=he.length;return y.surfaceVisible?e.jsxs(s.Sheet,{open:D,onOpenChange:v,children:[u?null:e.jsx(Le,{disabled:a||!de,briefingCount:Ve,className:d,onClick:C}),e.jsxs(s.SheetContent,{ref:le,side:"right",hideClose:!0,className:"flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",onOpenAutoFocus:N=>{var V;N.preventDefault(),(V=le.current)==null||V.focus({preventScroll:!0})},children:[e.jsxs(s.SheetHeader,{className:"sr-only",children:[e.jsx(s.SheetTitle,{children:"Reports & briefings"}),e.jsx(s.SheetDescription,{children:"Manage reports and briefings for this dashboard."})]}),i?e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-5",role:"tablist","aria-label":i==="scheduled_report"?"Email report workflow":"Analytical briefing workflow",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":$==="author",disabled:!j,className:n.cn("-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",$==="author"?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground",!j&&"cursor-not-allowed opacity-50"),onClick:()=>{j&&(T(null),g(i),L("dashboard"),k("author"))},children:P?`Edit ${X.getBriefingPresentation(P).noun}`:i==="scheduled_report"?"Schedule report":"Create briefing"}),e.jsx("button",{type:"button",role:"tab","aria-selected":$==="list",className:n.cn("-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",$==="list"?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),onClick:()=>k("list"),children:i==="scheduled_report"?"Manage reports":"Manage briefings"})]}),e.jsx("button",{type:"button",onClick:()=>v(!1),className:"rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":i==="scheduled_report"?"Close email report workflow":"Close analytical briefing workflow",children:e.jsx(G.X,{className:"h-3.5 w-3.5"})})]}):null,$==="list"?e.jsx(Ft,{briefings:he,dashboardLabel:oe,sourceView:w,error:te,loading:Y,onSourceViewChange:L,onClose:()=>v(!1),onEdit:N=>{R(N)},onNew:F,canCreate:!i&&ne.length>0,canCreateScheduledReport:ne.includes("scheduled_report"),analyticalBriefingsEnabled:ne.includes("analytical_briefing"),onRunNow:N=>{Q(N)},onTogglePause:N=>{ee(N)},onDelete:N=>K(N),selectingId:fe,busyId:ge,manageBriefingsHref:h,contentKind:i==="scheduled_report"?"reports":i==="analytical_briefing"?"briefings":void 0,hideHeader:!!i}):e.jsx(s.BriefingAuthor,{apiServiceUrl:O,token:z,briefing:P,intent:M,sourceContext:P?void 0:be,title:P?`Edit ${X.getBriefingPresentation(P).noun}`:M==="scheduled_report"?"Schedule report":"Create analytical briefing",hideHeader:!!i,className:"h-full min-h-0 max-w-none border-0 shadow-none",onBack:i?void 0:()=>k("list"),onCancel:()=>v(!1),onDeleted:()=>{const N=P?X.getBriefingPresentation(P).noun:"briefing";s.ue.success(`${N==="report"?"Report":"Briefing"} deleted`),T(null),k("list"),q()},onRunStarted:()=>{},onSaved:N=>{T(N),q()},onMinimizeRun:({briefing:N,run:V})=>{ae({briefing:N,run:V}),v(!1)}})]}),re&&O&&z?e.jsx($t,{briefingId:re.briefing.id,initialRun:re.run,apiServiceUrl:O,token:z,onTerminal:N=>{ce({briefing:re.briefing,run:N}),ae(null),q()},onTimeout:()=>{ae(null),q()},onExpand:()=>{T(re.briefing),k("author"),ae(null),v(!0)}}):null,W?e.jsx("div",{className:"fixed bottom-4 right-4 z-50 w-[360px]",children:e.jsx(s.RunCompletionBanner,{title:W.run.status==="SUCCESS"?`${W.briefing.name} is ready`:`${W.briefing.name} run failed`,durationSeconds:W.run.startedAt&&W.run.completedAt?Math.max(0,Math.floor((new Date(W.run.completedAt).getTime()-new Date(W.run.startedAt).getTime())/1e3)):null,status:W.run.status==="SUCCESS"?"success":"failed",onView:()=>{T(W.briefing),k("author"),ce(null),v(!0)},onDismiss:()=>ce(null)})}):null,e.jsx(s.AlertDialog,{open:!!U,onOpenChange:N=>{N||K(null)},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsxs(s.AlertDialogTitle,{children:["Delete"," ",U?X.getBriefingPresentation(U).noun:"briefing","?"]}),e.jsxs(s.AlertDialogDescription,{children:["This permanently deletes ",e.jsx("strong",{children:U==null?void 0:U.name}),". Recipients will stop receiving it."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsxs(s.AlertDialogAction,{className:"bg-destructive/90 hover:bg-destructive",onClick:Pe,children:["Delete"," ",U?X.getBriefingPresentation(U).noun:"briefing"]})]})]})})]}):null}function Wt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}exports.AdvancedModeToggle=st;exports.DashboardBriefingLauncher=qt;exports.DashboardControlsSettings=Be;exports.DashboardFilterControlsButton=Fe;exports.DashboardFilterControlsLauncher=Nt;exports.DocumentControlsSettings=Ie;exports.ExportNotificationItem=ke;exports.ExportNotificationList=Ae;exports.NotificationBell=mt;exports.UnsavedChangesAlert=rt;exports.VisualEditingControls=tt;exports.VisualsLibraryDialog=Ke;exports.WatchDashboardButton=Le;exports.useExportPolling=dt;exports.useExportRecovery=ut;