react-semaphor 0.1.586 → 0.1.587

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 (35) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/briefings/index.js +1 -1
  3. package/dist/chunks/{assistant-chat-BU5gchFy.js → assistant-chat-pfJK-T0b.js} +5 -5
  4. package/dist/chunks/{bookmark-impact-ZPSGncK6.js → bookmark-impact-BSpGQL1M.js} +1 -1
  5. package/dist/chunks/{card-filter-builder-HELJWA4D.js → card-filter-builder-C8PbhHjq.js} +3 -3
  6. package/dist/chunks/{dashboard-BXP-ZxSY.js → dashboard-CVj1oMoW.js} +1 -1
  7. package/dist/chunks/{dashboard-briefing-launcher-BGj42whr.js → dashboard-briefing-launcher-TqA58rKz.js} +6 -6
  8. package/dist/chunks/{dashboard-controls-zvbRp6D2.js → dashboard-controls-DQ8FsxAz.js} +7 -7
  9. package/dist/chunks/{dashboard-json-CykexgqL.js → dashboard-json-DM88pmk2.js} +1 -1
  10. package/dist/chunks/dates-5z3b9Loo.js +136 -0
  11. package/dist/chunks/{edit-dashboard-visual-C82JNxbt.js → edit-dashboard-visual-BpRnU_6G.js} +1946 -1920
  12. package/dist/chunks/{filter-reach-copy-ZERaFKsN.js → filter-reach-copy-0Xp97cLk.js} +31 -31
  13. package/dist/chunks/{index-otMIColV.js → index-D_QSeVKy.js} +1 -1
  14. package/dist/chunks/{report-preferences-dialog-B-CoyS1x.js → report-preferences-dialog-CXKmWyLm.js} +7 -7
  15. package/dist/chunks/{resolve-dashboard-input-context-BTTdKXH0.js → resolve-dashboard-input-context-zEXuitoF.js} +2089 -2076
  16. package/dist/chunks/{saved-dashboard-context-B-rosN4W.js → saved-dashboard-context-Cll5LipJ.js} +2 -2
  17. package/dist/chunks/{semaphor-ready-indicator-Cy1n_04D.js → semaphor-ready-indicator-Bnj3H0Dm.js} +15160 -15091
  18. package/dist/chunks/{shelf-drop-preview-context-Bmz54WYm.js → shelf-drop-preview-context-B8rmn6BD.js} +2 -2
  19. package/dist/chunks/{stored-dashboard-rDJ8sw6J.js → stored-dashboard-CURqJgoa.js} +1 -1
  20. package/dist/chunks/{variable-draft-DvngkRMl.js → variable-draft-DIv-9y6Q.js} +2 -2
  21. package/dist/dashboard/index.js +1 -1
  22. package/dist/dashboard-authoring/index.js +1202 -1191
  23. package/dist/index.js +11 -11
  24. package/dist/surfboard/index.js +1 -1
  25. package/dist/types/lib/types/explorer-types.d.ts +11 -4
  26. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +10 -3
  27. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  28. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +5 -2
  29. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +5 -2
  30. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  31. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  32. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +12 -12
  33. package/dist/types/shared/dashboard-authoring/kpi-trend-rule.d.ts +74 -0
  34. package/package.json +1 -1
  35. package/dist/chunks/dates-CaqZtq01.js +0 -92
@@ -1,35 +1,35 @@
1
1
  var _s = Object.defineProperty;
2
2
  var Cs = (e, a, t) => a in e ? _s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
3
  var lt = (e, a, t) => Cs(e, typeof a != "symbol" ? a + "" : a, t);
4
- import { _ as $s, $ as ws, a0 as xs, a1 as Ss, a2 as ks, a3 as qa, a4 as Ie, a5 as Ts, a6 as he, a7 as $e, a8 as la, a9 as ot, aa as Na, ab as Q, ac as G, ad as Ee, ae as Rs, af as As, ag as Ft, ah as Fs, ai as Ds, aj as Os, ak as Es, al as qs, am as Ns, an as Pa, ao as Ps, ap as Ls, aq as Ms, ar as Bs, as as Vs, at as js, au as Ks, av as ca, aw as La, ax as ua, ay as we, az as be, aA as qe, aB as Ws, aC as Us, aD as Gs, o as Xe, aE as Qs, aF as Hs, aG as _t, aH as Ze, aI as zs, aJ as Ys, aK as Ma, aL as Dt, aM as Ct, aN as Js, aO as Xs, aP as Zs, aQ as ie, aR as Ba, aS as Va, aT as ct, aU as eo, aV as to, aW as fa, aX as $t, aY as ao, aZ as ma, a_ as so, a$ as ha, b0 as pa, b1 as et, b2 as ga, b3 as Fe, b4 as oo, b5 as He, m as no, b6 as ja, b7 as io, b8 as ro, b9 as lo, ba as Ka, a as co, bb as uo, bc as fo, bd as mo, be as ho, bf as po, bg as go, bh as bo, bi as yo, bj as vo, bk as Io, bl as _o, bm as ba, bn as Co, bo as $o, bp as wo, bq as xo, br as So, bs as ko, bt as To, bu as Ro, bv as Ao, bw as Fo, bx as Do, by as Oo } from "../chunks/resolve-dashboard-input-context-BTTdKXH0.js";
5
- import { dF as Vr, bQ as jr, dh as Kr, di as Wr, dx as Ur, dw as Gr, dr as Qr, eB as Hr, dy as zr, dz as Yr, d$ as Jr, cX as Xr, cY as Zr, cZ as ed, cU as td, cV as ad, cW as sd, cQ as od, cR as nd, cT as id, cS as rd, c_ as dd, dV as ld, dj as cd, cc as ud, e4 as fd, e5 as md, cb as hd, db as pd, dH as gd, cl as bd, eD as yd, eF as vd, c2 as Id, dY as _d, dK as Cd, e6 as $d, f3 as wd, fe as xd, f7 as Sd, du as kd, dv as Td, ci as Rd, eO as Ad, eM as Fd, eN as Dd, bM as Od, e_ as Ed, dJ as qd, co as Nd, dQ as Pd, ch as Ld, fi as Md, fj as Bd, eq as Vd, dI as jd, eR as Kd, fn as Wd, cF as Ud, f8 as Gd, dq as Qd, cj as Hd, ee as zd, ef as Yd, c$ as Jd, cG as Xd, dX as Zd, bG as el, e0 as tl, eo as al, dM as sl, fs as ol, eS as nl, bH as il, bP as rl, e9 as dl, cA as ll, fl as cl, er as ul, dP as fl, ep as ml, d_ as hl, da as pl, d9 as gl, cg as bl, dW as yl, b_ as vl, c4 as Il, dU as _l, cJ as Cl, cL as $l, cx as wl, bE as xl, f9 as Sl, fd as kl, cp as Tl, e3 as Rl, e1 as Al, ek as Fl, bI as Dl, es as Ol, e$ as El, dD as ql, dE as Nl, fo as Pl, fp as Ll, fr as Ml, cK as Bl, b$ as Vl, c0 as jl, c1 as Kl, ck as Wl, cm as Ul, fk as Gl, ey as Ql, de as Hl, f as zl, cP as Yl, c9 as Jl, cu as Xl, b as Zl, cM as ec, df as tc, bS as ac, bT as sc, dO as oc, c8 as nc, eb as ic, cq as rc, bz as dc, cd as lc, ds as cc, bW as uc, dC as fc, c3 as mc, d5 as hc, eP as pc, fq as gc, bN as bc, d7 as yc, ec as vc, d8 as Ic, eg as _c, eH as Cc, eG as $c, dR as wc, cC as xc, ct as Sc, cv as kc, l as Tc, cw as Rc, ew as Ac, dA as Fc, dN as Dc, bA as Oc, bB as Ec, bC as qc, bJ as Nc, f5 as Pc, f0 as Lc, dG as Mc, f1 as Bc, cz as Vc, ce as jc, cI as Kc, dB as Wc, ev as Uc, dc as Gc, dd as Qc, bR as Hc, fm as zc, dL as Yc, et as Jc, dg as Xc, eL as Zc, eJ as eu, J as tu, f4 as au, c7 as su, fa as ou, fb as nu, dn as iu, cO as ru, bV as du, e2 as lu, dZ as cu, bD as uu, cD as fu, cE as mu, cf as hu, d1 as pu, bZ as gu, c5 as bu, c6 as yu, dk as vu, dl as Iu, ca as _u, bK as Cu, bY as $u, d3 as wu, eE as xu, eA as Su, fc as ku, d4 as Tu, d2 as Ru, ff as Au, bU as Fu, eC as Du, cB as Ou, ez as Eu, cN as qu, ed as Nu, eQ as Pu, dm as Lu, cy as Mu, dt as Bu, bF as Vu, bX as ju, dS as Ku, eK as Wu, ea as Uu, cH as Gu, d6 as Qu, bO as Hu, dT as zu, fg as Yu, e8 as Ju, e7 as Xu, ex as Zu, eI as ef, cn as tf, cs as af, bL as sf, f6 as of, f2 as nf, fh as rf, d0 as df, eu as lf, en as cf, dp as uf, em as ff, eU as mf, ej as hf, el as pf, cr as gf, eh as bf, ei as yf, eT as vf, eV as If, eW as _f, eX as Cf, eY as $f, eZ as wf } from "../chunks/resolve-dashboard-input-context-BTTdKXH0.js";
6
- import { K as Eo, L as Wa, G as Ua, M as qo, N as No, O as Ot, P as Ga, Q as Qa, A as xe, R as Po, S as Lo, H as Mo, T as Bo } from "../chunks/bookmark-state-CL4WEpgB.js";
7
- import { ae as Sf, ay as kf, Y as Tf, Z as Rf, a8 as Af, ac as Ff, a9 as Df, aa as Of, ab as Ef, af as qf, aw as Nf, aq as Pf, D as Lf, au as Mf, F as Bf, a1 as Vf, I as jf, ax as Kf, a4 as Wf, a5 as Uf, as as Gf, ad as Qf, a2 as Hf, ao as zf, at as Yf, av as Jf, ap as Xf, ar as Zf, a0 as em, _ as tm, ah as am, am as sm, W as om, X as nm, U as im, a3 as rm, an as dm, az as lm, ai as cm, ag as um, aj as fm, ak as mm, al as hm, a7 as pm, a6 as gm, $ as bm } from "../chunks/bookmark-state-CL4WEpgB.js";
8
- import { L as vm, G as Im, H as _m, g as Cm, F as $m, q as wm, A as xm, D as Sm, u as km, v as Tm, E as Rm, C as Am, s as Fm, t as Dm, p as Om, B as Em, I as qm, w as Nm, y as Pm, x as Lm, z as Mm } from "../chunks/stored-dashboard-rDJ8sw6J.js";
4
+ import { _ as $s, $ as ws, a0 as xs, a1 as Ss, a2 as ks, a3 as qa, a4 as Ie, a5 as Ts, a6 as he, a7 as $e, a8 as la, a9 as ot, aa as Na, ab as Q, ac as U, ad as Ee, ae as Rs, af as As, ag as Ft, ah as Fs, ai as Ds, aj as Os, ak as Es, al as qs, am as Ns, an as Pa, ao as Ps, ap as Ls, aq as Ms, ar as Bs, as as Vs, at as Ks, au as js, av as ca, aw as La, ax as ua, ay as we, az as be, aA as qe, aB as Ws, aC as Gs, aD as Us, o as Xe, aE as Qs, aF as Hs, aG as _t, aH as Ze, aI as zs, aJ as Ys, aK as Ma, aL as Dt, aM as Ct, aN as Js, aO as Xs, aP as Zs, aQ as ie, aR as Ba, aS as Va, aT as ct, aU as eo, aV as to, aW as fa, aX as $t, aY as ao, aZ as ma, a_ as so, a$ as ha, b0 as pa, b1 as et, b2 as ga, b3 as Fe, b4 as oo, b5 as He, m as no, b6 as Ka, b7 as io, b8 as ro, b9 as lo, ba as ja, a as co, bb as uo, bc as fo, bd as mo, be as ho, bf as po, bg as go, bh as bo, bi as yo, bj as vo, bk as Io, bl as _o, bm as ba, bn as Co, bo as $o, bp as wo, bq as xo, br as So, bs as ko, bt as To, bu as Ro, bv as Ao, bw as Fo, bx as Do, by as Oo } from "../chunks/resolve-dashboard-input-context-zEXuitoF.js";
5
+ import { dF as Vr, bQ as Kr, dh as jr, di as Wr, dx as Gr, dw as Ur, dr as Qr, eB as Hr, dy as zr, dz as Yr, d$ as Jr, cX as Xr, cY as Zr, cZ as ed, cU as td, cV as ad, cW as sd, cQ as od, cR as nd, cT as id, cS as rd, c_ as dd, dV as ld, dj as cd, cc as ud, e4 as fd, e5 as md, cb as hd, db as pd, dH as gd, cl as bd, eD as yd, c2 as vd, dY as Id, dK as _d, e6 as Cd, f2 as $d, fd as wd, f6 as xd, du as Sd, dv as kd, ci as Td, eN as Rd, eL as Ad, eM as Fd, bM as Dd, eZ as Od, dJ as Ed, co as qd, dQ as Nd, ch as Pd, fh as Ld, fi as Md, eq as Bd, dI as Vd, eQ as Kd, fm as jd, cF as Wd, f7 as Gd, dq as Ud, cj as Qd, ee as Hd, ef as zd, c$ as Yd, cG as Jd, dX as Xd, bG as Zd, e0 as el, eo as tl, dM as al, fr as sl, eR as ol, bH as nl, bP as il, e9 as rl, cA as dl, fk as ll, er as cl, dP as ul, ep as fl, d_ as ml, da as hl, d9 as pl, cg as gl, dW as bl, b_ as yl, c4 as vl, dU as Il, cJ as _l, cL as Cl, cx as $l, bE as wl, f8 as xl, fc as Sl, cp as kl, e3 as Tl, e1 as Rl, ek as Al, bI as Fl, es as Dl, e_ as Ol, dD as El, dE as ql, fn as Nl, fo as Pl, fq as Ll, cK as Ml, b$ as Bl, c0 as Vl, c1 as Kl, ck as jl, cm as Wl, fj as Gl, ey as Ul, de as Ql, f as Hl, cP as zl, c9 as Yl, cu as Jl, b as Xl, cM as Zl, df as ec, bS as tc, bT as ac, dO as sc, c8 as oc, eb as nc, cq as ic, bz as rc, cd as dc, ds as lc, bW as cc, dC as uc, c3 as fc, d5 as mc, eO as hc, fp as pc, bN as gc, d7 as bc, ec as yc, d8 as vc, eg as Ic, eG as _c, eF as Cc, dR as $c, cC as wc, ct as xc, cv as Sc, l as kc, cw as Tc, ew as Rc, dA as Ac, dN as Fc, bA as Dc, bB as Oc, bC as Ec, bJ as qc, f4 as Nc, e$ as Pc, dG as Lc, f0 as Mc, cz as Bc, ce as Vc, cI as Kc, dB as jc, ev as Wc, dc as Gc, dd as Uc, bR as Qc, fl as Hc, dL as zc, et as Yc, dg as Jc, eK as Xc, eI as Zc, J as eu, f3 as tu, c7 as au, f9 as su, fa as ou, dn as nu, cO as iu, bV as ru, e2 as du, dZ as lu, bD as cu, cD as uu, cE as fu, cf as mu, d1 as hu, bZ as pu, c5 as gu, c6 as bu, dk as yu, dl as vu, ca as Iu, bK as _u, bY as Cu, d3 as $u, eE as wu, eA as xu, fb as Su, d4 as ku, d2 as Tu, fe as Ru, bU as Au, eC as Fu, cB as Du, ez as Ou, cN as Eu, ed as qu, eP as Nu, dm as Pu, cy as Lu, dt as Mu, bF as Bu, bX as Vu, dS as Ku, eJ as ju, ea as Wu, cH as Gu, d6 as Uu, bO as Qu, dT as Hu, ff as zu, e8 as Yu, e7 as Ju, ex as Xu, eH as Zu, cn as ef, cs as tf, bL as af, f5 as sf, f1 as of, fg as nf, d0 as rf, eu as df, en as lf, dp as cf, em as uf, eT as ff, ej as mf, el as hf, cr as pf, eh as gf, ei as bf, eS as yf, eU as vf, eV as If, eW as _f, eX as Cf, eY as $f } from "../chunks/resolve-dashboard-input-context-zEXuitoF.js";
6
+ import { K as Eo, L as Wa, G as Ga, M as qo, N as No, O as Ot, P as Ua, Q as Qa, A as xe, R as Po, S as Lo, H as Mo, T as Bo } from "../chunks/bookmark-state-CL4WEpgB.js";
7
+ import { ae as xf, ay as Sf, Y as kf, Z as Tf, a8 as Rf, ac as Af, a9 as Ff, aa as Df, ab as Of, af as Ef, aw as qf, aq as Nf, D as Pf, au as Lf, F as Mf, a1 as Bf, I as Vf, ax as Kf, a4 as jf, a5 as Wf, as as Gf, ad as Uf, a2 as Qf, ao as Hf, at as zf, av as Yf, ap as Jf, ar as Xf, a0 as Zf, _ as em, ah as tm, am, W as sm, X as om, U as nm, a3 as im, an as rm, az as dm, ai as lm, ag as cm, aj as um, ak as fm, al as mm, a7 as hm, a6 as pm, $ as gm } from "../chunks/bookmark-state-CL4WEpgB.js";
8
+ import { L as ym, G as vm, H as Im, g as _m, F as Cm, q as $m, A as wm, D as xm, u as Sm, v as km, E as Tm, C as Rm, s as Am, t as Fm, p as Dm, B as Om, I as Em, w as qm, y as Nm, x as Pm, z as Lm } from "../chunks/stored-dashboard-CURqJgoa.js";
9
9
  import { r as Vo, ac as ya } from "../chunks/pivot-result-contract-expectations-Bx_BCu-7.js";
10
- import { aO as Vm, aN as jm, aJ as Km, aM as Wm, aP as Um, aD as Gm } from "../chunks/pivot-result-contract-expectations-Bx_BCu-7.js";
11
- import { f as jo, w as Ko, D as va, a as Wo } from "../chunks/metric-comparison-ZmurmEIs.js";
12
- import { p as Uo } from "../chunks/report-runtime-context-NlOXwyRB.js";
13
- import { r as Ha, D as Ia, f as Go, h as za, i as Qo, j as Ho, k as zo, e as wt, l as Yo, v as Jo } from "../chunks/filter-reach-copy-ZERaFKsN.js";
14
- import { N as Hm, $ as zm, S as Ym, n as Jm, q as Xm, u as Zm, t as eh, F as th, B as ah, m as sh, p as oh, I as nh, K as ih, a1 as rh, L as dh, M as lh, _ as ch, a0 as uh, C as fh, X as mh, E as hh, w as ph, x as gh, z as bh, o as yh, y as vh, R as Ih, O as _h, a2 as Ch, Z as $h, Y as wh, J as xh, G as Sh, H as kh, U as Th, T as Rh, Q as Ah, V as Fh, P as Dh, s as Oh, W as Eh, A as qh } from "../chunks/filter-reach-copy-ZERaFKsN.js";
10
+ import { aO as Bm, aN as Vm, aJ as Km, aM as jm, aP as Wm, aD as Gm } from "../chunks/pivot-result-contract-expectations-Bx_BCu-7.js";
11
+ import { f as Ko, w as jo, D as va, a as Wo } from "../chunks/metric-comparison-ZmurmEIs.js";
12
+ import { p as Go } from "../chunks/report-runtime-context-NlOXwyRB.js";
13
+ import { r as Ha, D as Ia, h as Uo, i as za, j as Qo, k as Ho, l as zo, f as wt, m as Yo, v as Jo } from "../chunks/filter-reach-copy-0Xp97cLk.js";
14
+ import { N as Qm, $ as Hm, S as zm, o as Ym, t as Jm, w as Xm, u as Zm, G as eh, C as th, n as ah, q as sh, J as oh, d as nh, a1 as ih, L as rh, M as dh, _ as lh, a0 as ch, E as uh, X as fh, F as mh, x as hh, y as ph, A as gh, p as bh, z as yh, R as vh, O as Ih, a2 as _h, Z as Ch, Y as $h, K as wh, H as xh, I as Sh, U as kh, T as Th, Q as Rh, V as Ah, P as Fh, s as Dh, W as Oh, B as Eh } from "../chunks/filter-reach-copy-0Xp97cLk.js";
15
15
  import { a7 as Ya, r as Ja, aN as Xo, a_ as Ne, aL as Zo, aQ as en, aK as tn, aE as an, aM as sn, a5 as on } from "../chunks/validators-CJ8Jh0E8.js";
16
16
  import "../chunks/schema-C9NPiIru.js";
17
- import { i as Xa, C as je, D as nn, e as rn, b as dn } from "../chunks/edit-9df1zOWe.js";
17
+ import { i as Xa, C as Ke, D as nn, e as rn, b as dn } from "../chunks/edit-9df1zOWe.js";
18
18
  import "../chunks/matrix-operation-contract-BM5TveR3.js";
19
19
  import { A as Le, B as ze, z as ln, f as cn, y as Et, t as Me, e as un } from "../chunks/analytics-base-schemas-BaIQrEzX.js";
20
20
  import { A as _a, E as fn } from "../chunks/matrix-analytical-definition-DOVSFFuf.js";
21
21
  import "zod";
22
22
  import "../value-format-preferences/index.js";
23
- import { C as Ph, a as Lh, S as Mh } from "../chunks/pickers-DkqmtnTL.js";
23
+ import { C as Nh, a as Ph, S as Lh } from "../chunks/pickers-DkqmtnTL.js";
24
24
  import { r as mn } from "../chunks/index-CV_Kzou0.js";
25
25
  import "../chunks/context-BTLBjQNh.js";
26
- import { v as Ye, a as hn, i as Ca, o as ut, d as pn, b as gn, c as bn } from "../chunks/variable-draft-DvngkRMl.js";
27
- import { S as Vh, f as jh, g as Kh, e as Wh, n as Uh } from "../chunks/variable-draft-DvngkRMl.js";
28
- import { r as Qh, a as Hh } from "../chunks/dates-CaqZtq01.js";
29
- import { b as Yh, d as Jh } from "../chunks/bookmark-impact-ZPSGncK6.js";
26
+ import { v as Ye, a as hn, i as Ca, o as ut, d as pn, b as gn, c as bn } from "../chunks/variable-draft-DIv-9y6Q.js";
27
+ import { S as Bh, f as Vh, g as Kh, e as jh, n as Wh } from "../chunks/variable-draft-DIv-9y6Q.js";
28
+ import { K as Uh, b as Qh, a as Hh, c as zh, d as Yh, e as Jh, r as Xh, f as Zh } from "../chunks/dates-5z3b9Loo.js";
29
+ import { b as tp, d as ap } from "../chunks/bookmark-impact-BSpGQL1M.js";
30
30
  import { r as ye, b as yn, s as vn, a as In } from "../chunks/resolver-DG_tfEpt.js";
31
31
  import { n as _n, r as Cn } from "../chunks/index-BVKzKl5d.js";
32
- import { e as Zh } from "../chunks/brand-BoUV0iHF.js";
32
+ import { e as op } from "../chunks/brand-BoUV0iHF.js";
33
33
  const Sr = [
34
34
  "cardType",
35
35
  "sql",
@@ -67,13 +67,13 @@ function qt(e) {
67
67
  function ve(e) {
68
68
  return !e || typeof e != "object" || Array.isArray(e) ? {} : { ...e };
69
69
  }
70
- function Ke(e) {
70
+ function je(e) {
71
71
  return typeof e == "string" ? e : "";
72
72
  }
73
73
  function $n(e, a = {}) {
74
74
  const t = ve(e), s = qt(a), o = {};
75
75
  if (t.calendarContext !== void 0) {
76
- const i = Uo(t.calendarContext);
76
+ const i = Go(t.calendarContext);
77
77
  if (!i.ok)
78
78
  throw new ce(
79
79
  `${s}calendarContext: ${i.issues.map((d) => d.message).join("; ")}`,
@@ -90,14 +90,14 @@ function $n(e, a = {}) {
90
90
  n.issues
91
91
  );
92
92
  if (t.resolvedPrimaryDateField && (o.resolvedPrimaryDateField = t.resolvedPrimaryDateField), t.globalDateComparison !== void 0) {
93
- const i = jo(t.globalDateComparison);
93
+ const i = Ko(t.globalDateComparison);
94
94
  if (!i.ok)
95
95
  throw new ce(
96
96
  `${s}Invalid globalDateComparison: ${i.errors.map((d) => `${d.path}: ${d.message}`).join("; ")}`,
97
97
  "globalDateComparison",
98
98
  i.errors
99
99
  );
100
- o.globalDateComparison = Ko(
100
+ o.globalDateComparison = jo(
101
101
  t.globalDateComparison
102
102
  );
103
103
  }
@@ -136,30 +136,30 @@ function Tr(e, a = {}) {
136
136
  return o;
137
137
  }
138
138
  function Rr(e, a = {}) {
139
- const t = ve(e), s = qt(a), o = (w) => new ce(`${s}${w} is required`, w), n = Ke(t.connection_id).trim();
139
+ const t = ve(e), s = qt(a), o = (x) => new ce(`${s}${x} is required`, x), n = je(t.connection_id).trim();
140
140
  if (!n) throw o("connection_id");
141
- const i = Ke(t.cardType).trim();
141
+ const i = je(t.cardType).trim();
142
142
  if (!i) throw o("cardType");
143
143
  const d = t.resultOwner;
144
144
  if (d !== "config" && d !== "freeform" && d !== "none")
145
145
  throw o("resultOwner");
146
- const l = ve(t.cardConfig), c = Ke(t.sql), h = Ke(t.python), p = !!a.configOptional || Object.keys(l).length > 0;
146
+ const l = ve(t.cardConfig), c = je(t.sql), h = je(t.python), p = !!a.configOptional || Object.keys(l).length > 0;
147
147
  if (d === "config" && !p) throw o("cardConfig");
148
148
  if (d === "freeform" && !c.trim()) throw o("sql");
149
- const I = xs({
149
+ const v = xs({
150
150
  hasExecutableConfig: p,
151
151
  sql: c,
152
152
  normalizedPython: h
153
153
  });
154
- if (d !== I)
154
+ if (d !== v)
155
155
  throw new ce(
156
- `${s}resultOwner must match the normalized execution owner "${I}"`,
156
+ `${s}resultOwner must match the normalized execution owner "${v}"`,
157
157
  "resultOwner"
158
158
  );
159
159
  if (d === "none") throw o("cardConfig");
160
- const v = ve(t.cardDataSource);
161
- if (Object.keys(v).length === 0) throw o("cardDataSource");
162
- const x = Ss({
160
+ const y = ve(t.cardDataSource);
161
+ if (Object.keys(y).length === 0) throw o("cardDataSource");
162
+ const S = Ss({
163
163
  controlValues: t.controlValues,
164
164
  controlDefinitions: t.controlDefinitions,
165
165
  cardControlDefinitions: t.cardControlDefinitions,
@@ -172,12 +172,12 @@ function Rr(e, a = {}) {
172
172
  python: h,
173
173
  resultOwner: d,
174
174
  cardConfig: l,
175
- cardDataSource: v,
175
+ cardDataSource: y,
176
176
  active_filters: Array.isArray(t.active_filters) ? t.active_filters : [],
177
- controlValues: x.controlValues,
178
- controlDefinitions: x.controlDefinitions,
179
- cardControlDefinitions: x.cardControlDefinitions,
180
- controlBindings: x.controlBindings,
177
+ controlValues: S.controlValues,
178
+ controlDefinitions: S.controlDefinitions,
179
+ cardControlDefinitions: S.cardControlDefinitions,
180
+ controlBindings: S.controlBindings,
181
181
  ...$n(t, a),
182
182
  ...typeof t.sqlRowLimit == "number" && Number.isInteger(t.sqlRowLimit) && t.sqlRowLimit > 0 ? { sqlRowLimit: t.sqlRowLimit } : {}
183
183
  };
@@ -193,12 +193,12 @@ function Ar(e) {
193
193
  const h = n(["chart", "options", "borderRadius"]);
194
194
  typeof h == "number" && (i.barCorners = De("barCorners", h, a));
195
195
  for (const p of Za) {
196
- const I = p === "light" ? ye(s, ["canvasTheme"]) : n(["canvasTheme"]), v = kn(I, a);
197
- v !== void 0 && (i.canvas = { ...i.canvas, [p]: v });
198
- const x = Sn(s, o, p);
199
- if (x) {
200
- const w = x.filter(Xa).map((E) => E.toLowerCase());
201
- w.length < x.length && a.push({ field: "chartColors", kind: "dropped_colour", detail: `${p}: ${x.length - w.length} colours that aren't hex` }), w.length >= je.min && (i.chartColors = { ...i.chartColors, [p]: w.slice(0, je.max) }), w.length > je.max && a.push({ field: "chartColors", kind: "clamped", detail: `${p}: kept the first ${je.max} colours` });
196
+ const v = p === "light" ? ye(s, ["canvasTheme"]) : n(["canvasTheme"]), y = kn(v, a);
197
+ y !== void 0 && (i.canvas = { ...i.canvas, [p]: y });
198
+ const S = Sn(s, o, p);
199
+ if (S) {
200
+ const x = S.filter(Xa).map((E) => E.toLowerCase());
201
+ x.length < S.length && a.push({ field: "chartColors", kind: "dropped_colour", detail: `${p}: ${S.length - x.length} colours that aren't hex` }), x.length >= Ke.min && (i.chartColors = { ...i.chartColors, [p]: x.slice(0, Ke.max) }), x.length > Ke.max && a.push({ field: "chartColors", kind: "clamped", detail: `${p}: kept the first ${Ke.max} colours` });
202
202
  }
203
203
  }
204
204
  return { style: xn(i, e.organizationAppearance, a), notes: a };
@@ -213,8 +213,8 @@ function xn(e, a, t) {
213
213
  const h = wn.includes(n) && ye(Cn(a, l), i) !== void 0, p = JSON.stringify(ye(s.schemes[l], i)) === JSON.stringify(c);
214
214
  if (!(!h && !p))
215
215
  if ((d || l === "light") && t.push({ field: n, kind: h ? "brand_wins" : "equal_to_inherited", detail: d ? l : `${JSON.stringify(c)}` }), d) {
216
- const I = { ...o[n] };
217
- delete I[l], Object.keys(I).length > 0 ? o[n] = I : delete o[n];
216
+ const v = { ...o[n] };
217
+ delete v[l], Object.keys(v).length > 0 ? o[n] = v : delete o[n];
218
218
  } else l === "light" && delete o[n];
219
219
  }
220
220
  }
@@ -292,11 +292,11 @@ function An(e, a, t = {}) {
292
292
  }
293
293
  for (const l of s.reachedCards({ inputId: a.id })) {
294
294
  const c = $e(a, l.card, t), h = c.reach, p = () => {
295
- const I = he(l.card);
295
+ const v = he(l.card);
296
296
  return {
297
297
  cardId: l.cardId,
298
298
  title: l.card.title ?? "",
299
- ...(I == null ? void 0 : I.kind) === "semantic" ? { datasetName: I.datasetName } : {}
299
+ ...(v == null ? void 0 : v.kind) === "semantic" ? { datasetName: v.datasetName } : {}
300
300
  };
301
301
  };
302
302
  switch (h) {
@@ -322,15 +322,15 @@ function An(e, a, t = {}) {
322
322
  he(l.card) && i.notReached.push({ ...p(), ...c.reason ? { reason: c.reason } : {} });
323
323
  break;
324
324
  default: {
325
- const I = h;
326
- throw new Error(`Unhandled filter reach ${String(I)}`);
325
+ const v = h;
326
+ throw new Error(`Unhandled filter reach ${String(v)}`);
327
327
  }
328
328
  }
329
329
  }
330
330
  for (const l of s.reachedVariables({ inputId: a.id })) {
331
- const c = Ua(e, l.variableId);
331
+ const c = Ga(e, l.variableId);
332
332
  if ((c == null ? void 0 : c.kind) !== "variable") continue;
333
- const h = $e(a, c.card, t), p = he(c.card), I = { cardId: c.id, title: c.variable.name, ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {} };
333
+ const h = $e(a, c.card, t), p = he(c.card), v = { cardId: c.id, title: c.variable.name, ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {} };
334
334
  switch (h.reach) {
335
335
  case "bound":
336
336
  case "automatic":
@@ -343,7 +343,7 @@ function An(e, a, t = {}) {
343
343
  (i.blocked ?? (i.blocked = [])).push({ cardId: c.id, title: c.variable.name, reason: h.reach });
344
344
  break;
345
345
  case "relationship":
346
- (i.relationshipPending ?? (i.relationshipPending = [])).push(I);
346
+ (i.relationshipPending ?? (i.relationshipPending = [])).push(v);
347
347
  break;
348
348
  case "sqlTemplate":
349
349
  (i.sqlPending ?? (i.sqlPending = [])).push({ cardId: c.id, title: c.variable.name });
@@ -351,7 +351,7 @@ function An(e, a, t = {}) {
351
351
  case "excluded":
352
352
  break;
353
353
  case "notApplicable":
354
- i.notReached.push({ ...I, ...h.reason ? { reason: h.reason } : {} });
354
+ i.notReached.push({ ...v, ...h.reason ? { reason: h.reason } : {} });
355
355
  break;
356
356
  }
357
357
  }
@@ -370,7 +370,7 @@ function Fn(e, a) {
370
370
  };
371
371
  }
372
372
  if (t.kind !== "sheets") return;
373
- const s = [...Ot(e).values()].filter((n) => Ga(a, n));
373
+ const s = [...Ot(e).values()].filter((n) => Ua(a, n));
374
374
  return {
375
375
  sheetIds: s.filter((n) => n.sheetKind === "dashboard").map((n) => n.sheetId),
376
376
  // Document sheets it names stay through a change of sheets (`withUnstatedScopeParts`).
@@ -381,13 +381,13 @@ function es(e, a) {
381
381
  return e ?? { tz: "UTC", weekStart: 1, anchor: { iso: a ?? "1970-01-01T00:00:00.000Z" } };
382
382
  }
383
383
  function ts(e, a, t, s) {
384
- var E, _, S;
385
- const { input: o } = a, n = An(e, o, s), i = (y, D) => ({
384
+ var E, C, k;
385
+ const { input: o } = a, n = An(e, o, s), i = (b, D) => ({
386
386
  filterId: o.id,
387
387
  label: o.label,
388
388
  editable: !1,
389
389
  kind: D,
390
- notEditable: { reason: y, message: Rn[y] },
390
+ notEditable: { reason: b, message: Rn[b] },
391
391
  reaches: n.reaches,
392
392
  excluded: n.excluded,
393
393
  ...n.blocked ? { blocked: n.blocked } : {},
@@ -395,16 +395,16 @@ function ts(e, a, t, s) {
395
395
  ...n.sqlPending ? { sqlPending: n.sqlPending } : {}
396
396
  });
397
397
  if (o.filter.kind === "global-date") return i("global_date", "global_date");
398
- const d = ks(o.filter).filter((y) => y.kind === "semantic");
398
+ const d = ks(o.filter).filter((b) => b.kind === "semantic");
399
399
  if (d.length !== 1 || d[0].kind !== "semantic") return i("not_semantic", "field");
400
400
  const l = Fn(e, o);
401
401
  if (!l || a.origin !== "embeddedInput") return i("scope_not_expressible", "field");
402
- const c = ((E = o.filter.fieldMeta) == null ? void 0 : E.name) ?? ((_ = o.filter.column) == null ? void 0 : _.split(".").pop()) ?? "", h = Ha({
402
+ const c = ((E = o.filter.fieldMeta) == null ? void 0 : E.name) ?? ((C = o.filter.column) == null ? void 0 : C.split(".").pop()) ?? "", h = Ha({
403
403
  dashboard: e,
404
404
  target: { kind: "dashboardInput", input: o, scope: {} },
405
405
  calendar: es(t, void 0)
406
- }).value, p = Ya(o.filter.dataType), I = p || (S = h == null ? void 0 : h.values) == null ? void 0 : S.filter((y) => ["string", "number", "boolean"].includes(typeof y)), v = Ja(h && "relativeMeta" in h ? h.relativeMeta : void 0), x = p ? v : void 0, w = x ? Xo(
407
- x,
406
+ }).value, p = Ya(o.filter.dataType), v = p || (k = h == null ? void 0 : h.values) == null ? void 0 : k.filter((b) => ["string", "number", "boolean"].includes(typeof b)), y = Ja(h && "relativeMeta" in h ? h.relativeMeta : void 0), S = p ? y : void 0, x = S ? Xo(
407
+ S,
408
408
  { use: "filterDefault", columnHasTime: qa(o.filter) === "datetime" },
409
409
  "defaultPeriod"
410
410
  ) : void 0;
@@ -416,9 +416,9 @@ function ts(e, a, t, s) {
416
416
  datasetName: d[0].datasetName,
417
417
  field: c,
418
418
  selection: o.filter.type === "single" ? "single" : "multiple",
419
- ...I != null && I.length ? { defaultValues: I } : {},
420
- ...x ? { defaultPeriod: x } : {},
421
- ...w ? { defaultPeriodReadOnly: w } : {},
419
+ ...v != null && v.length ? { defaultValues: v } : {},
420
+ ...S ? { defaultPeriod: S } : {},
421
+ ...x ? { defaultPeriodReadOnly: x } : {},
422
422
  ...p ? { datePicker: o.filter.dateSelectionMode === "day" ? "day" : o.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
423
423
  ...l,
424
424
  ...n
@@ -470,7 +470,7 @@ function On(e, a, t) {
470
470
  const n = ss(o.field, os(e)), i = n ? t[Nt(n)] : void 0;
471
471
  return i ? ot(i, o.field.name, n.datasetName) : void 0;
472
472
  }
473
- const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "axes", "comparisonDisplay", "inheritComparison", "band", "seeRecords"], En = {
473
+ const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "axes", "comparisonDisplay", "inheritComparison", "trend", "trendGrain", "seeRecords"], En = {
474
474
  orientation: "orientation",
475
475
  stack: "stacking",
476
476
  donut: "donut hole",
@@ -480,7 +480,8 @@ const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "
480
480
  axes: "axes",
481
481
  comparisonDisplay: "comparison display",
482
482
  inheritComparison: "dashboard comparison",
483
- band: "band under its value",
483
+ trend: "trend under its value",
484
+ trendGrain: "trend grain",
484
485
  seeRecords: "records to see"
485
486
  }, qn = { x: "xAxisConfig", y: "yAxisConfig" }, gt = { x: "horizontal", y: "vertical" };
486
487
  function Nn(e) {
@@ -492,69 +493,73 @@ function Pn(e, a, t) {
492
493
  return Object.keys(s).length ? { op: "card.update", cardId: e.cardRef, ...s } : void 0;
493
494
  }
494
495
  function Ln(e, a, t, s, o) {
495
- var v, x, w, E, _, S, y, D, $, N;
496
- const n = xt.filter((g) => t[g] !== void 0);
496
+ var y, S, x, E, C, k, b, D, w, N, _;
497
+ const n = xt.filter((I) => t[I] !== void 0);
497
498
  if (!n.length) return {};
498
- const i = xt.filter((g) => a.settings.has(g)), d = n.filter((g) => !a.settings.has(g));
499
- for (const g of d)
499
+ const i = xt.filter((I) => a.settings.has(I)), d = n.filter((I) => !a.settings.has(I));
500
+ for (const I of d)
500
501
  o.push(
501
502
  Q("setting_not_for_card", {
502
- message: `${G(e.title)} is ${Nn(a)}, which has no ${En[g]}.`,
503
- path: `${s.path}.${g}`,
504
- fix: i.length ? `Leave out ${g}; this card takes ${i.join(", ")}.` : `Leave out ${g}.`,
503
+ message: `${U(e.title)} is ${Nn(a)}, which has no ${En[I]}.`,
504
+ path: `${s.path}.${I}`,
505
+ fix: i.length ? `Leave out ${I}; this card takes ${i.join(", ")}.` : `Leave out ${I}.`,
505
506
  allowed: i,
506
507
  suggestedChange: Pn(s, t, d)
507
508
  })
508
509
  );
509
510
  if (d.length) return {};
510
- const l = {}, c = ((v = Ee(e)) == null ? void 0 : v.properties) ?? {}, h = {
511
+ const l = {}, c = ((y = Ee(e)) == null ? void 0 : y.properties) ?? {}, h = {
511
512
  ...c,
512
513
  ...t.orientation !== void 0 ? { orientation: t.orientation } : {},
513
514
  ...t.stack !== void 0 ? { stack: t.stack } : {},
514
515
  ...t.donut !== void 0 ? { donut: t.donut } : {}
515
516
  };
516
- ["orientation", "stack", "donut"].some((g) => h[g] !== c[g]) && (l.variant = Rs(a.type, h));
517
- const p = l.variant ? As(e, l.variant) : e, I = Ft(p);
517
+ ["orientation", "stack", "donut"].some((I) => h[I] !== c[I]) && (l.variant = Rs(a.type, h));
518
+ const p = l.variant ? As(e, l.variant) : e, v = Ft(p);
518
519
  if (t.totals) {
519
- const g = Fs(e, a, t.totals, ((x = I.totals) == null ? void 0 : x.row) ?? !1, s, o);
520
- g && (l.totals = g);
520
+ const I = Fs(e, a, t.totals, ((S = v.totals) == null ? void 0 : S.row) ?? !1, s, o);
521
+ I && (l.totals = I);
521
522
  }
522
523
  if (t.dataLabels) {
523
- const g = {};
524
- t.dataLabels.show !== Ds(p) && (g.show = t.dataLabels.show);
525
- const k = t.dataLabels.format;
526
- if (k === null && ((w = I.dataLabels) != null && w.format) && (g.format = null), k) {
527
- const T = Mn(e, a, k, `${s.path}.dataLabels.format`, o);
528
- T && !Ne(T, (E = I.dataLabels) == null ? void 0 : E.format) && (g.format = T);
524
+ const I = {};
525
+ t.dataLabels.show !== Ds(p) && (I.show = t.dataLabels.show);
526
+ const R = t.dataLabels.format;
527
+ if (R === null && ((x = v.dataLabels) != null && x.format) && (I.format = null), R) {
528
+ const P = Mn(e, a, R, `${s.path}.dataLabels.format`, o);
529
+ P && !Ne(P, (E = v.dataLabels) == null ? void 0 : E.format) && (I.format = P);
529
530
  }
530
- Object.keys(g).length && (l.dataLabels = g);
531
+ Object.keys(I).length && (l.dataLabels = I);
531
532
  }
532
533
  if (t.legend) {
533
- const g = {};
534
- t.legend.show !== ((_ = I.legend) == null ? void 0 : _.show) && (g.show = t.legend.show), t.legend.position !== void 0 && t.legend.position !== ((S = I.legend) == null ? void 0 : S.position) && (g.position = t.legend.position), Object.keys(g).length && (l.legend = g);
534
+ const I = {};
535
+ t.legend.show !== ((C = v.legend) == null ? void 0 : C.show) && (I.show = t.legend.show), t.legend.position !== void 0 && t.legend.position !== ((k = v.legend) == null ? void 0 : k.position) && (I.position = t.legend.position), Object.keys(I).length && (l.legend = I);
535
536
  }
536
537
  if (t.axes) {
537
- const g = Os(p.type, p.preferences), k = {};
538
- for (const T of ["x", "y"]) {
539
- const L = t.axes[T];
540
- if (!L) continue;
541
- const V = Bn(e, T, L, ((y = I.axes) == null ? void 0 : y[T]) ?? {}, T === g, `${s.path}.axes.${T}`, o);
542
- V && (k[qn[T]] = V);
538
+ const I = Os(p.type, p.preferences), R = {};
539
+ for (const P of ["x", "y"]) {
540
+ const V = t.axes[P];
541
+ if (!V) continue;
542
+ const K = Bn(e, P, V, ((b = v.axes) == null ? void 0 : b[P]) ?? {}, P === I, `${s.path}.axes.${P}`, o);
543
+ K && (R[qn[P]] = K);
543
544
  }
544
- Object.keys(k).length && (l.axes = k);
545
+ Object.keys(R).length && (l.axes = R);
545
546
  }
546
547
  if (t.comparisonDisplay) {
547
- const g = (D = e.preferences) == null ? void 0 : D.comparisonPresentation, k = {}, { show: T, mode: L, precision: V } = t.comparisonDisplay;
548
- T !== void 0 && T !== ((g == null ? void 0 : g.showComparison) ?? !0) && (k.show = T), L !== void 0 && L !== ((g == null ? void 0 : g.displayMode) ?? "difference") && (k.mode = L), V !== void 0 && V !== ((g == null ? void 0 : g.precision) ?? null) && (k.precision = V), Object.keys(k).length && (l.comparisonDisplay = k);
549
- }
550
- return t.inheritComparison !== void 0 && t.inheritComparison !== ((($ = e.preferences) == null ? void 0 : $.inheritGlobalComparison) !== !1) && (l.inheritComparison = t.inheritComparison), t.seeRecords !== void 0 && t.seeRecords !== (e.seeRecords !== !1) && (l.seeRecords = t.seeRecords), t.band !== void 0 && (t.band === "trend" && !Es(e.config) ? o.push(
551
- Q("value_invalid", {
552
- message: `${G(e.title)} has no Trend By date, so it has no trend to show.`,
553
- path: `${s.path}.band`,
554
- fix: "Add a Trend By date to show a trend: a dateField with a timeGrain in its query.",
555
- allowed: ["automatic", "none"]
556
- })
557
- ) : t.band !== (((N = e.config) == null ? void 0 : N.kpiBand) ?? "automatic") && (l.band = t.band === "automatic" ? null : t.band)), l;
548
+ const I = (D = e.preferences) == null ? void 0 : D.comparisonPresentation, R = {}, { show: P, mode: V, precision: K } = t.comparisonDisplay;
549
+ P !== void 0 && P !== ((I == null ? void 0 : I.showComparison) ?? !0) && (R.show = P), V !== void 0 && V !== ((I == null ? void 0 : I.displayMode) ?? "difference") && (R.mode = V), K !== void 0 && K !== ((I == null ? void 0 : I.precision) ?? null) && (R.precision = K), Object.keys(R).length && (l.comparisonDisplay = R);
550
+ }
551
+ if (t.inheritComparison !== void 0 && t.inheritComparison !== (((w = e.preferences) == null ? void 0 : w.inheritGlobalComparison) !== !1) && (l.inheritComparison = t.inheritComparison), t.seeRecords !== void 0 && t.seeRecords !== (e.seeRecords !== !1) && (l.seeRecords = t.seeRecords), t.trend !== void 0 && t.trend !== (((N = e.config) == null ? void 0 : N.kpiBand) === "trend") && (l.trend = t.trend), t.trendGrain !== void 0) {
552
+ const I = Es(e.config);
553
+ I ? o.push(
554
+ Q("value_invalid", {
555
+ message: `${U(e.title)} draws its trend by its Trend By${I.granularity ? `, by ${I.granularity}` : ""}, so it takes no grain of its own.`,
556
+ path: `${s.path}.trendGrain`,
557
+ fix: "Change the Trend By's timeGrain in its query, or remove the Trend By to set a grain here.",
558
+ allowed: []
559
+ })
560
+ ) : t.trendGrain !== (((_ = e.config) == null ? void 0 : _.kpiTrendGrain) ?? "automatic") && (l.trendGrain = t.trendGrain === "automatic" ? null : t.trendGrain);
561
+ }
562
+ return l;
558
563
  }
559
564
  function Mn(e, a, t, s, o) {
560
565
  const n = String(t.type), i = Ns("cartesian", "number"), d = Le(n), l = d == null ? void 0 : d.safeParse(t);
@@ -562,7 +567,7 @@ function Mn(e, a, t, s, o) {
562
567
  const h = l && !l.success ? l.error.issues[0] : void 0;
563
568
  o.push(
564
569
  Q("format_invalid", {
565
- message: i.includes(n) ? `That format for the values on ${G(e.title)} isn't valid: ${(h == null ? void 0 : h.message) ?? "invalid"}.` : `The values on ${G(e.title)} are numbers, so they can't take a ${n.replace("_", " ")} format.`,
570
+ message: i.includes(n) ? `That format for the values on ${U(e.title)} isn't valid: ${(h == null ? void 0 : h.message) ?? "invalid"}.` : `The values on ${U(e.title)} are numbers, so they can't take a ${n.replace("_", " ")} format.`,
566
571
  path: s,
567
572
  fix: "Send a whole number, currency, percent, scientific or duration format.",
568
573
  allowed: i.includes(n) ? ze(n) : [...i]
@@ -572,7 +577,7 @@ function Mn(e, a, t, s, o) {
572
577
  }
573
578
  const c = Pa({ surface: a.type === "pie" ? "pie" : "cartesian", value: "number", rawValueKinds: [] }, l.data);
574
579
  if (!c.ok) {
575
- o.push(Q("format_invalid", { message: `${G(e.title)} can't draw that format on its values: ${c.reason}.`, path: s }));
580
+ o.push(Q("format_invalid", { message: `${U(e.title)} can't draw that format on its values: ${c.reason}.`, path: s }));
576
581
  return;
577
582
  }
578
583
  return l.data;
@@ -585,7 +590,7 @@ function Bn(e, a, t, s, o, n, i) {
585
590
  const c = gt[a === "x" ? "y" : "x"];
586
591
  i.push(
587
592
  Q("setting_not_for_card", {
588
- message: `${G(e.title)}'s ${gt[a]} axis lists categories; set a range on its ${c} axis.`,
593
+ message: `${U(e.title)}'s ${gt[a]} axis lists categories; set a range on its ${c} axis.`,
589
594
  path: `${n}.${l[0]}`,
590
595
  allowed: ["title"]
591
596
  })
@@ -594,20 +599,20 @@ function Bn(e, a, t, s, o, n, i) {
594
599
  }
595
600
  if (o) {
596
601
  for (const p of ["min", "max"]) {
597
- const I = t[p];
598
- if (I !== void 0) {
599
- if (I !== null && !Number.isFinite(I)) {
602
+ const v = t[p];
603
+ if (v !== void 0) {
604
+ if (v !== null && !Number.isFinite(v)) {
600
605
  i.push(Q("value_invalid", { message: `An axis ${p} must be a number.`, path: `${n}.${p}` }));
601
606
  return;
602
607
  }
603
- (I ?? void 0) !== s[p] && (d[p] = I);
608
+ (v ?? void 0) !== s[p] && (d[p] = v);
604
609
  }
605
610
  }
606
611
  const c = t.min !== void 0 ? t.min : s.min, h = t.max !== void 0 ? t.max : s.max;
607
612
  if (typeof c == "number" && typeof h == "number" && c > h) {
608
613
  i.push(
609
614
  Q("value_invalid", {
610
- message: `The ${gt[a]} axis of ${G(e.title)} can't start at ${c} and end at ${h}.`,
615
+ message: `The ${gt[a]} axis of ${U(e.title)} can't start at ${c} and end at ${h}.`,
611
616
  path: n,
612
617
  fix: "Send a min no greater than the max."
613
618
  })
@@ -620,7 +625,7 @@ function Bn(e, a, t, s, o, n, i) {
620
625
  function $a(e, a, t, s, o) {
621
626
  const n = o === "date" && s.role === "dimension";
622
627
  return Q("setting_not_for_card", {
623
- message: o === "text" ? `${a} on ${G(e.title)} shows its text as it is; text formats apply on a Matrix only.` : o === "category" ? `${a} labels the categories of ${G(e.title)}, which a chart shows as the query returns them; format it on a table or a Matrix.` : `${G(e.title)} shows ${a}, ${is(s)}, without a format of its own; this card type doesn't apply one.`,
628
+ message: o === "text" ? `${a} on ${U(e.title)} shows its text as it is; text formats apply on a Matrix only.` : o === "category" ? `${a} labels the categories of ${U(e.title)}, which a chart shows as the query returns them; format it on a table or a Matrix.` : `${U(e.title)} shows ${a}, ${is(s)}, without a format of its own; this card type doesn't apply one.`,
624
629
  path: t,
625
630
  ...n ? { fix: `Group ${a} by day, week, month, quarter or year to format its dates.` } : {}
626
631
  });
@@ -640,7 +645,7 @@ function Vn(e, a, t) {
640
645
  function We(e, a, t) {
641
646
  return { op: "card.update", cardId: e.cardRef, columns: { [a]: { format: t } } };
642
647
  }
643
- function jn(e, a, t, s, o, n, i) {
648
+ function Kn(e, a, t, s, o, n, i) {
644
649
  var c;
645
650
  const d = o.label;
646
651
  if (d === void 0 || d === t.label) return;
@@ -648,7 +653,7 @@ function jn(e, a, t, s, o, n, i) {
648
653
  if (!a.settings.has("columns.label") || !t.labelKey) {
649
654
  i.push(
650
655
  Q("setting_not_for_card", {
651
- message: a.sql ? `${G(e.title)}'s column ${s} takes its header from the query; rename it in the SQL.` : `${s} on ${G(e.title)} takes no header of its own.`,
656
+ message: a.sql ? `${U(e.title)}'s column ${s} takes its header from the query; rename it in the SQL.` : `${s} on ${U(e.title)} takes no header of its own.`,
652
657
  path: l,
653
658
  allowed: ["hidden", "width", "format"].filter((h) => h !== "hidden" || a.settings.has("columns.hidden")),
654
659
  suggestedChange: St(n, s, o, "label")
@@ -666,85 +671,85 @@ function jn(e, a, t, s, o, n, i) {
666
671
  }
667
672
  return { key: t.labelKey, label: d };
668
673
  }
669
- function Kn(e, a, t, s, o, n, i) {
670
- var g, k;
674
+ function jn(e, a, t, s, o, n, i) {
675
+ var _, I;
671
676
  const d = `${Se(n.path, s)}.format`;
672
677
  if (!a.settings.has("columns.format")) {
673
- i.push(Q("setting_not_for_card", { message: `${G(e.title)} takes no column formats.`, path: d }));
678
+ i.push(Q("setting_not_for_card", { message: `${U(e.title)} takes no column formats.`, path: d }));
674
679
  return;
675
680
  }
676
- const l = t.ref, c = ((g = n.modelFormats) == null ? void 0 : g.status) === "read" ? n.modelFormats.formats : void 0, h = l.kind === "matrixLevel" ? c == null ? void 0 : c[l.levelId] : l.kind === "matrixMeasure" ? c == null ? void 0 : c[l.measureId] : void 0, p = Vo({
681
+ const l = t.ref, c = ((_ = n.modelFormats) == null ? void 0 : _.status) === "read" ? n.modelFormats.formats : void 0, h = l.kind === "matrixLevel" ? c == null ? void 0 : c[l.levelId] : l.kind === "matrixMeasure" ? c == null ? void 0 : c[l.measureId] : void 0, p = Vo({
677
682
  card: e,
678
683
  column: l,
679
684
  ...c ? { modelFormats: c } : {},
680
685
  ...h ? { catalogFormat: h } : {}
681
- }), I = p.source === "override" ? p.format : void 0;
682
- if (o === null) return I ? null : void 0;
683
- if (I && Ne(o, I)) return;
684
- const v = js(e, a, t, n.sqlResultColumns), x = v.value, w = Ks(v);
685
- if (w.length === 0) {
686
- i.push($a(e, s, d, t, x));
686
+ }), v = p.source === "override" ? p.format : void 0;
687
+ if (o === null) return v ? null : void 0;
688
+ if (v && Ne(o, v)) return;
689
+ const y = Ks(e, a, t, n.sqlResultColumns), S = y.value, x = js(y);
690
+ if (x.length === 0) {
691
+ i.push($a(e, s, d, t, S));
687
692
  return;
688
693
  }
689
694
  const E = !("type" in o) || o.type === void 0;
690
695
  if (E && !p.format) {
691
- const T = w[0];
696
+ const R = x[0];
692
697
  i.push(
693
698
  Q("format_invalid", {
694
699
  // Unavailable is not "none": say which, so the agent knows the column may have a model format (ledger P2-20).
695
- message: ((k = n.modelFormats) == null ? void 0 : k.status) === "unavailable" ? `${s} on ${G(e.title)} may follow its model's format, which couldn't be read; state the whole format with its type.` : `${s} on ${G(e.title)} has no format to change; state the whole format with its type.`,
700
+ message: ((I = n.modelFormats) == null ? void 0 : I.status) === "unavailable" ? `${s} on ${U(e.title)} may follow its model's format, which couldn't be read; state the whole format with its type.` : `${s} on ${U(e.title)} has no format to change; state the whole format with its type.`,
696
701
  path: d,
697
702
  fix: "Add `type` to the format.",
698
- allowed: ze(T),
699
- suggestedChange: We(n, s, { type: T, ...o })
703
+ allowed: ze(R),
704
+ suggestedChange: We(n, s, { type: R, ...o })
700
705
  })
701
706
  );
702
707
  return;
703
708
  }
704
- const _ = E ? { ...p.format, ...o } : o, S = String(_.type);
705
- if (!w.includes(S)) {
709
+ const C = E ? { ...p.format, ...o } : o, k = String(C.type);
710
+ if (!x.includes(k)) {
706
711
  i.push(
707
- S === "string" ? $a(e, s, `${d}.type`, t, "text") : Q("format_invalid", {
708
- message: x === "result" ? `${s} on ${G(e.title)} comes straight from the query, so it can't take a ${S.replace("_", " ")} format.` : `${s} on ${G(e.title)} is ${is(t)}, so it can't take a ${S.replace("_", " ")} format.`,
712
+ k === "string" ? $a(e, s, `${d}.type`, t, "text") : Q("format_invalid", {
713
+ message: S === "result" ? `${s} on ${U(e.title)} comes straight from the query, so it can't take a ${k.replace("_", " ")} format.` : `${s} on ${U(e.title)} is ${is(t)}, so it can't take a ${k.replace("_", " ")} format.`,
709
714
  path: `${d}.type`,
710
- allowed: [...w]
715
+ allowed: [...x]
711
716
  })
712
717
  );
713
718
  return;
714
719
  }
715
- const y = Le(S), D = y == null ? void 0 : y.safeParse(_);
716
- if (!y || !(D != null && D.success)) {
717
- const T = D && !D.success ? D.error.issues[0] : void 0;
720
+ const b = Le(k), D = b == null ? void 0 : b.safeParse(C);
721
+ if (!b || !(D != null && D.success)) {
722
+ const R = D && !D.success ? D.error.issues[0] : void 0;
718
723
  i.push(
719
724
  Q("format_invalid", {
720
- message: y ? (T == null ? void 0 : T.code) === "unrecognized_keys" ? `A ${S} format has no ${T.keys.join(", ")}.` : `That format for ${s} isn't valid: ${(T == null ? void 0 : T.message) ?? "invalid"}.` : `${JSON.stringify(S)} isn't a format type.`,
725
+ message: b ? (R == null ? void 0 : R.code) === "unrecognized_keys" ? `A ${k} format has no ${R.keys.join(", ")}.` : `That format for ${s} isn't valid: ${(R == null ? void 0 : R.message) ?? "invalid"}.` : `${JSON.stringify(k)} isn't a format type.`,
721
726
  path: d,
722
- fix: Qn(S),
723
- allowed: y ? ze(S) : [...ln],
727
+ fix: Qn(k),
728
+ allowed: b ? ze(k) : [...ln],
724
729
  ...p.format ? { suggestedChange: We(n, s, p.format) } : {}
725
730
  })
726
731
  );
727
732
  return;
728
733
  }
729
- const $ = D.data;
730
- if ($.type === "temporal_bucket" && t.granularity && !ya($, t.granularity).ok) {
731
- const L = cn.filter(
734
+ const w = D.data;
735
+ if (w.type === "temporal_bucket" && t.granularity && !ya(w, t.granularity).ok) {
736
+ const P = cn.filter(
732
737
  (V) => ya({ presentation: { mode: "preset", preset: V } }, t.granularity).ok
733
738
  );
734
739
  i.push(
735
740
  Q("date_finer_than_grain", {
736
- message: `${s} on ${G(e.title)} is grouped by ${t.granularity}, which that date format doesn't fit.`,
741
+ message: `${s} on ${U(e.title)} is grouped by ${t.granularity}, which that date format doesn't fit.`,
737
742
  path: d,
738
- allowed: L,
739
- suggestedChange: We(n, s, { type: "temporal_bucket", presentation: { mode: "preset", preset: L[0] ?? "short" } })
743
+ allowed: P,
744
+ suggestedChange: We(n, s, { type: "temporal_bucket", presentation: { mode: "preset", preset: P[0] ?? "short" } })
740
745
  })
741
746
  );
742
747
  return;
743
748
  }
744
- if ($.type === "date") {
745
- const T = o, L = p.format ?? {}, V = Object.keys(T).filter((K) => !ca.includes(K) && !Ne(T[K], L[K]));
749
+ if (w.type === "date") {
750
+ const R = o, P = p.format ?? {}, V = Object.keys(R).filter((K) => !ca.includes(K) && !Ne(R[K], P[K]));
746
751
  if (V.length) {
747
- const K = Object.fromEntries(Object.entries($).filter(([B]) => !V.includes(B)));
752
+ const K = Object.fromEntries(Object.entries(w).filter(([B]) => !V.includes(B)));
748
753
  i.push(
749
754
  Q("format_invalid", {
750
755
  message: `A date format set here takes a pattern or a preset; it doesn't set ${V.join(", ")}.`,
@@ -757,29 +762,29 @@ function Kn(e, a, t, s, o, n, i) {
757
762
  return;
758
763
  }
759
764
  }
760
- const N = Pa(v, $);
765
+ const N = Pa(y, w);
761
766
  if (!N.ok) {
762
767
  i.push(
763
768
  Q("format_invalid", {
764
- message: `${G(e.title)} can't draw that format on ${s}: ${N.reason}.`,
769
+ message: `${U(e.title)} can't draw that format on ${s}: ${N.reason}.`,
765
770
  path: d,
766
771
  fix: "Change the format to one the column can show.",
767
- allowed: ze(S)
772
+ allowed: ze(k)
768
773
  })
769
774
  );
770
775
  return;
771
776
  }
772
- return I && Ne(I, $) ? void 0 : $;
777
+ return v && Ne(v, w) ? void 0 : w;
773
778
  }
774
779
  function Wn(e, a, t, s, o, n, i) {
775
- var w, E;
780
+ var x, E;
776
781
  const d = o.polarity;
777
782
  if (d === void 0) return;
778
783
  const l = `${Se(n.path, s)}.polarity`, c = t.ref;
779
784
  if (!(a.settings.has("columns.polarity") && (c.kind === "sqlKpiValue" || c.kind === "field" && t.role === "measure"))) {
780
785
  i.push(
781
786
  Q("setting_not_for_card", {
782
- message: t.role === "measure" || t.role === "value" ? `${G(e.title)} shows no comparison, so ${s} has no favorable direction.` : `${s} on ${G(e.title)} isn't a measure, so it has no favorable direction.`,
787
+ message: t.role === "measure" || t.role === "value" ? `${U(e.title)} shows no comparison, so ${s} has no favorable direction.` : `${s} on ${U(e.title)} isn't a measure, so it has no favorable direction.`,
783
788
  path: l,
784
789
  fix: "Leave out polarity.",
785
790
  suggestedChange: St(n, s, o, "polarity")
@@ -787,98 +792,98 @@ function Wn(e, a, t, s, o, n, i) {
787
792
  );
788
793
  return;
789
794
  }
790
- const p = c.kind === "field" ? (E = (w = e.config) == null ? void 0 : w.metricColumns) == null ? void 0 : E.find((_) => _.id === c.fieldId) : void 0, I = c.kind === "sqlKpiValue" ? La(e) : void 0, v = c.kind === "sqlKpiValue" ? (I == null ? void 0 : I.source) === "sql" && I.polarity !== va ? I.polarity : void 0 : p == null ? void 0 : p.comparisonPolarity, x = p == null ? void 0 : p.semanticComparisonPolarity;
791
- if (d === null) return v ? null : void 0;
792
- if (x && d !== x) {
795
+ const p = c.kind === "field" ? (E = (x = e.config) == null ? void 0 : x.metricColumns) == null ? void 0 : E.find((C) => C.id === c.fieldId) : void 0, v = c.kind === "sqlKpiValue" ? La(e) : void 0, y = c.kind === "sqlKpiValue" ? (v == null ? void 0 : v.source) === "sql" && v.polarity !== va ? v.polarity : void 0 : p == null ? void 0 : p.comparisonPolarity, S = p == null ? void 0 : p.semanticComparisonPolarity;
796
+ if (d === null) return y ? null : void 0;
797
+ if (S && d !== S) {
793
798
  i.push(
794
799
  Q("polarity_set_by_model", {
795
- message: `The model says ${s} is ${x.replace(/_/g, " ")}; a card can't say otherwise.`,
800
+ message: `The model says ${s} is ${S.replace(/_/g, " ")}; a card can't say otherwise.`,
796
801
  path: l,
797
802
  fix: "Change it in the model, or leave polarity out.",
798
- allowed: [x],
803
+ allowed: [S],
799
804
  suggestedChange: St(n, s, o, "polarity")
800
805
  })
801
806
  );
802
807
  return;
803
808
  }
804
- return d === (x ?? v ?? va) ? void 0 : d;
809
+ return d === (S ?? y ?? va) ? void 0 : d;
805
810
  }
806
- function Un(e, a, t, s, o, n, i, d) {
807
- var h, p, I;
811
+ function Gn(e, a, t, s, o, n, i, d) {
812
+ var h, p, v;
808
813
  if (o.hidden === void 0 && o.width === void 0) return {};
809
814
  const l = Se(i.path, s);
810
815
  if (!a.settings.has("columns.hidden") || t.resultKey === void 0) {
811
- const v = a.pivoted && t.role === "measure";
816
+ const y = a.pivoted && t.role === "measure";
812
817
  return d.push(
813
818
  Q("setting_not_for_card", {
814
- message: v ? `${s} on ${G(e.title)} has a column for each pivot value; hide or size them in the editor.` : `${G(e.title)} has no hidden columns or column widths; those are for tables.`,
819
+ message: y ? `${s} on ${U(e.title)} has a column for each pivot value; hide or size them in the editor.` : `${U(e.title)} has no hidden columns or column widths; those are for tables.`,
815
820
  path: `${l}.${o.hidden !== void 0 ? "hidden" : "width"}`,
816
- allowed: v ? ["label", "format"] : ["label", "format"].filter((x) => a.settings.has(`columns.${x}`)),
821
+ allowed: y ? ["label", "format"] : ["label", "format"].filter((S) => a.settings.has(`columns.${S}`)),
817
822
  suggestedChange: Vn(i, s, o)
818
823
  })
819
824
  ), {};
820
825
  }
821
826
  const c = {};
822
827
  if (o.hidden !== void 0 && o.hidden !== ((n == null ? void 0 : n.hidden) === !0) && (c.hidden = o.hidden), o.width !== void 0 && o.width !== ((n == null ? void 0 : n.width) ?? null)) {
823
- const { minSize: v, maxSize: x } = Vs((I = (p = (h = e.preferences) == null ? void 0 : h.tablePrefs) == null ? void 0 : p.columnSettingsMap) == null ? void 0 : I[t.resultKey]);
824
- o.width !== null && (!Number.isFinite(o.width) || o.width < v || o.width > x) ? d.push(
828
+ const { minSize: y, maxSize: S } = Vs((v = (p = (h = e.preferences) == null ? void 0 : h.tablePrefs) == null ? void 0 : p.columnSettingsMap) == null ? void 0 : v[t.resultKey]);
829
+ o.width !== null && (!Number.isFinite(o.width) || o.width < y || o.width > S) ? d.push(
825
830
  Q("value_invalid", {
826
- message: `${s} on ${G(e.title)} can be ${v} to ${x} pixels wide.`,
831
+ message: `${s} on ${U(e.title)} can be ${y} to ${S} pixels wide.`,
827
832
  path: `${l}.width`,
828
- fix: `Send a width from ${v} to ${x} pixels, or null for automatic.`
833
+ fix: `Send a width from ${y} to ${S} pixels, or null for automatic.`
829
834
  })
830
835
  ) : c.width = o.width;
831
836
  }
832
837
  return c;
833
838
  }
834
- function Gn(e, a, t) {
835
- var E, _, S, y;
836
- const { columns: s = {}, ...o } = a.settings ?? {}, n = [], i = xt.some((D) => o[D] !== void 0), d = !!((_ = (E = a.highlights) == null ? void 0 : E.add) != null && _.length || (y = (S = a.highlights) == null ? void 0 : S.remove) != null && y.length);
839
+ function Un(e, a, t) {
840
+ var E, C, k, b;
841
+ const { columns: s = {}, ...o } = a.settings ?? {}, n = [], i = xt.some((D) => o[D] !== void 0), d = !!((C = (E = a.highlights) == null ? void 0 : E.add) != null && C.length || (b = (k = a.highlights) == null ? void 0 : k.remove) != null && b.length);
837
842
  if (!Object.keys(s).length && !i && !d) return { ok: !0, labels: [], settings: null, warnings: [] };
838
843
  const l = Ps(e);
839
844
  if (!l)
840
845
  return {
841
846
  ok: !1,
842
- problems: [Q("setting_not_for_card", { message: `${G(e.title)} takes no card settings through this tool.`, path: t.path })]
847
+ problems: [Q("setting_not_for_card", { message: `${U(e.title)} takes no card settings through this tool.`, path: t.path })]
843
848
  };
844
- const c = Ln(e, l, o, t, n), h = Ls(e, l, t.sqlResultColumns), p = d ? Ms(e, l, h, a.highlights, t, n) : void 0, I = Ft(e), v = [], x = [];
845
- for (const [D, $] of Object.entries(s)) {
846
- const N = Bs(h, D, { path: Se(t.path, D), cardTitle: G(e.title) });
849
+ const c = Ln(e, l, o, t, n), h = Ls(e, l, t.sqlResultColumns), p = d ? Ms(e, l, h, a.highlights, t, n) : void 0, v = Ft(e), y = [], S = [];
850
+ for (const [D, w] of Object.entries(s)) {
851
+ const N = Bs(h, D, { path: Se(t.path, D), cardTitle: U(e.title) });
847
852
  if (!N.ok) {
848
853
  n.push(N.problem);
849
854
  continue;
850
855
  }
851
- const g = N.column;
852
- if (g.sqlName === "inferred") {
856
+ const _ = N.column;
857
+ if (_.sqlName === "inferred") {
853
858
  n.push(
854
859
  Q("columns_unavailable", {
855
- message: `${G(e.title)}'s columns weren't read from its query, so ${D} can't be checked.`,
860
+ message: `${U(e.title)}'s columns weren't read from its query, so ${D} can't be checked.`,
856
861
  path: Se(t.path, D),
857
862
  fix: "Check that the card runs and returns rows, then propose again."
858
863
  })
859
864
  );
860
865
  continue;
861
866
  }
862
- const k = jn(e, l, g, D, $, t, n);
863
- k && v.push(k);
864
- const T = Un(e, l, g, D, $, I.columns[g.name], t, n), L = $.format !== void 0 ? Kn(e, l, g, D, $.format, t, n) : void 0, V = Wn(e, l, g, D, $, t, n), K = {
865
- column: g.ref,
866
- ...T,
867
- ...L !== void 0 ? { format: L } : {},
867
+ const I = Kn(e, l, _, D, w, t, n);
868
+ I && y.push(I);
869
+ const R = Gn(e, l, _, D, w, v.columns[_.name], t, n), P = w.format !== void 0 ? jn(e, l, _, D, w.format, t, n) : void 0, V = Wn(e, l, _, D, w, t, n), K = {
870
+ column: _.ref,
871
+ ...R,
872
+ ...P !== void 0 ? { format: P } : {},
868
873
  ...V !== void 0 ? { polarity: V } : {}
869
874
  };
870
- Object.keys(K).length > 1 && x.push(K);
875
+ Object.keys(K).length > 1 && S.push(K);
871
876
  }
872
877
  if (n.length) return { ok: !1, problems: n };
873
- const w = { ...c, ...x.length ? { columns: x } : {}, ...p ? { highlights: p } : {} };
874
- return { ok: !0, labels: v, settings: Object.keys(w).length ? w : null, warnings: [] };
878
+ const x = { ...c, ...S.length ? { columns: S } : {}, ...p ? { highlights: p } : {} };
879
+ return { ok: !0, labels: y, settings: Object.keys(x).length ? x : null, warnings: [] };
875
880
  }
876
881
  function Qn(e) {
877
882
  const a = Le(e), t = a && a === Le("number") ? ua.number : e === "temporal_bucket" || e === "date" ? ua[e] : void 0;
878
883
  return t ? `Send a stored format: ${t}.` : "Send the format in the stored shape the outline shows.";
879
884
  }
880
885
  function Hn(e, a, t, s, o) {
881
- var _, S, y, D, $, N;
886
+ var C, k, b, D, w, N;
882
887
  const n = we(e, { sql: !0, calculations: !1 });
883
888
  if (!n.editable) return [n.message];
884
889
  const i = n.query, d = a;
@@ -892,43 +897,43 @@ function Hn(e, a, t, s, o) {
892
897
  config: s.config
893
898
  }, { sql: !0, calculations: !1 }) : void 0;
894
899
  if (l && !l.editable) return ["the compiled query"];
895
- const c = l != null && l.editable ? l.query : void 0, h = String(d.datasetName ?? ""), p = [], I = (g) => be(g, h), v = (g, k, T) => {
896
- const L = k ?? [], V = T ?? [];
897
- (L.length !== V.length || L.some((K, B) => I(K) !== I(V[B]))) && p.push(g);
900
+ const c = l != null && l.editable ? l.query : void 0, h = String(d.datasetName ?? ""), p = [], v = (_) => be(_, h), y = (_, I, R) => {
901
+ const P = I ?? [], V = R ?? [];
902
+ (P.length !== V.length || P.some((K, B) => v(K) !== v(V[B]))) && p.push(_);
898
903
  };
899
- for (const g of ["domainId", "datasetName"]) d[g] !== i[g] && p.push(g);
900
- if (v("measures", d.measures, i.measures), v("columns", d.columns, i.columns), t || n.matrix) {
901
- const g = (T) => new Set(((T == null ? void 0 : T.columns) ?? []).map(I)), k = (T, L) => (T ?? []).filter((V) => !g(L).has(I(V)));
902
- v("dimensions", k(d.dimensions, t), k(i.dimensions, n.matrix)), v("matrix.columns", t == null ? void 0 : t.columns, (_ = n.matrix) == null ? void 0 : _.columns);
904
+ for (const _ of ["domainId", "datasetName"]) d[_] !== i[_] && p.push(_);
905
+ if (y("measures", d.measures, i.measures), y("columns", d.columns, i.columns), t || n.matrix) {
906
+ const _ = (R) => new Set(((R == null ? void 0 : R.columns) ?? []).map(v)), I = (R, P) => (R ?? []).filter((V) => !_(P).has(v(V)));
907
+ y("dimensions", I(d.dimensions, t), I(i.dimensions, n.matrix)), y("matrix.columns", t == null ? void 0 : t.columns, (C = n.matrix) == null ? void 0 : C.columns);
903
908
  } else
904
- v("dimensions", d.dimensions, i.dimensions);
905
- const x = d.timeWindow !== void 0 && !d.timeGrain, w = x && i.timeWindow === void 0 ? void 0 : x && d.dateField === void 0 ? c == null ? void 0 : c.dateField : d.dateField;
906
- w !== void 0 && (i.dateField === void 0 || I(w) !== I(i.dateField)) && p.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && p.push("timeGrain");
907
- const E = (S = e.config) != null && S.matrix ? e.config.matrix.spec.measures.map((g) => g.kind === "aggregate" ? { aggregate: g.aggregate } : {}) : ((y = e.config) == null ? void 0 : y.metricColumns) ?? [];
908
- (d.measures ?? []).forEach((g, k) => {
909
- const T = g && typeof g == "object" ? g.aggregate : void 0;
910
- T && _a(E[k] ?? {}) !== T && p.push(`the aggregate of measures[${k}]`);
909
+ y("dimensions", d.dimensions, i.dimensions);
910
+ const S = d.timeWindow !== void 0 && !d.timeGrain, x = S && i.timeWindow === void 0 ? void 0 : S && d.dateField === void 0 ? c == null ? void 0 : c.dateField : d.dateField;
911
+ x !== void 0 && (i.dateField === void 0 || v(x) !== v(i.dateField)) && p.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && p.push("timeGrain");
912
+ const E = (k = e.config) != null && k.matrix ? e.config.matrix.spec.measures.map((_) => _.kind === "aggregate" ? { aggregate: _.aggregate } : {}) : ((b = e.config) == null ? void 0 : b.metricColumns) ?? [];
913
+ (d.measures ?? []).forEach((_, I) => {
914
+ const R = _ && typeof _ == "object" ? _.aggregate : void 0;
915
+ R && _a(E[I] ?? {}) !== R && p.push(`the aggregate of measures[${I}]`);
911
916
  });
912
- for (const { key: g, label: k } of qe(a))
913
- Ws(e, g) !== k && p.push(`the label "${k}"`);
917
+ for (const { key: _, label: I } of qe(a))
918
+ Ws(e, _) !== I && p.push(`the label "${I}"`);
914
919
  if (!o || o.aspects.includes("filters")) {
915
- const g = d.filters ?? [];
916
- let k = i.filters ?? [];
917
- const T = d.timeWindow, L = i.timeWindow, V = (K, B) => {
920
+ const _ = d.filters ?? [];
921
+ let I = i.filters ?? [];
922
+ const R = d.timeWindow, P = i.timeWindow, V = (K, B) => {
918
923
  const se = (oe) => JSON.stringify((oe ?? []).map(String));
919
- return I(K.field) === I(B.field) && K.operator === B.operator && (K.scope ?? "row") === (B.scope ?? "row") && (typeof K.field == "object" ? K.field.aggregate : void 0) === (typeof B.field == "object" ? B.field.aggregate : void 0) && (K.values === void 0 || se(K.values) === se(B.values));
924
+ return v(K.field) === v(B.field) && K.operator === B.operator && (K.scope ?? "row") === (B.scope ?? "row") && (typeof K.field == "object" ? K.field.aggregate : void 0) === (typeof B.field == "object" ? B.field.aggregate : void 0) && (K.values === void 0 || se(K.values) === se(B.values));
920
925
  };
921
- if (T && !L) {
926
+ if (R && !P) {
922
927
  const K = ((c == null ? void 0 : c.filters) ?? []).filter(
923
- (B) => !(c != null && c.timeWindow) && !g.some((se) => V(se, B))
928
+ (B) => !(c != null && c.timeWindow) && !_.some((se) => V(se, B))
924
929
  );
925
- (!K.length || K.some((B) => !k.some((se) => V(B, se)))) && p.push("timeWindow"), k = k.filter((B) => !K.some((se) => V(se, B)));
926
- } else T ? Zo(d.timeWindow, i.timeWindow) || p.push("timeWindow") : L && p.push("timeWindow");
927
- (g.length !== k.length || g.some((K, B) => !V(K, k[B]))) && p.push("filters");
930
+ (!K.length || K.some((B) => !I.some((se) => V(B, se)))) && p.push("timeWindow"), I = I.filter((B) => !K.some((se) => V(se, B)));
931
+ } else R ? Zo(d.timeWindow, i.timeWindow) || p.push("timeWindow") : P && p.push("timeWindow");
932
+ (_.length !== I.length || _.some((K, B) => !V(K, I[B]))) && p.push("filters");
928
933
  }
929
934
  if (d.orderBy !== void 0) {
930
- const g = d.orderBy, k = ($ = (D = e.config) == null ? void 0 : D.sortByColumns) == null ? void 0 : $[0], T = k && Us(e.config ?? {}, k), L = g.field && typeof g.field == "object" ? g.field.aggregate : void 0;
931
- (!k || !T || k.direction !== g.direction || I(g.field) !== Gs(T.name, Na(T)) || L !== void 0 && _a(T) !== L) && p.push("orderBy");
935
+ const _ = d.orderBy, I = (w = (D = e.config) == null ? void 0 : D.sortByColumns) == null ? void 0 : w[0], R = I && Gs(e.config ?? {}, I), P = _.field && typeof _.field == "object" ? _.field.aggregate : void 0;
936
+ (!I || !R || I.direction !== _.direction || v(_.field) !== Us(R.name, Na(R)) || P !== void 0 && _a(R) !== P) && p.push("orderBy");
932
937
  }
933
938
  return d.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== d.limit && p.push("limit"), p;
934
939
  }
@@ -978,7 +983,7 @@ function cs(e, a) {
978
983
  }));
979
984
  }
980
985
  async function wa(e, a, t) {
981
- var y, D;
986
+ var b, D;
982
987
  const { problem: s, need: o, services: n } = t, { path: i, query: d } = e, l = ds(e.get), c = {
983
988
  id: e.id,
984
989
  name: e.name,
@@ -994,7 +999,7 @@ async function wa(e, a, t) {
994
999
  message: "A SQL variable takes the only row or the first row of its result.",
995
1000
  path: `${i}.get`,
996
1001
  fix: 'Send get: "only" or "first", or write the aggregate or the list in the SQL itself.'
997
- }), S(Ye({ ...c, mode: "sql", connectionId: d.connectionId, sql: d.sql, get: l.kind }, a));
1002
+ }), k(Ye({ ...c, mode: "sql", connectionId: d.connectionId, sql: d.sql, get: l.kind }, a));
998
1003
  const h = await n.loadCardSource({ domainId: d.domainId, datasetName: d.datasetName });
999
1004
  h != null && h.dataSource || s({
1000
1005
  code: "variable_source_unreachable",
@@ -1003,82 +1008,82 @@ async function wa(e, a, t) {
1003
1008
  fix: "List the domain's datasets with semaphor_list_datasets and name one of them."
1004
1009
  });
1005
1010
  const p = h.fields;
1006
- for (const $ of Ma({ ...d, measures: d.measures ?? [] })) s({ ...$, path: `${i}.${$.path}` });
1007
- const I = ($, N) => {
1008
- const g = Ct($), k = Js($, d.datasetName);
1009
- k.toLowerCase() !== d.datasetName.toLowerCase() && s({
1011
+ for (const w of Ma({ ...d, measures: d.measures ?? [] })) s({ ...w, path: `${i}.${w.path}` });
1012
+ const v = (w, N) => {
1013
+ const _ = Ct(w), I = Js(w, d.datasetName);
1014
+ I.toLowerCase() !== d.datasetName.toLowerCase() && s({
1010
1015
  code: "field_not_found",
1011
- message: `A variable reads one dataset: "${g}" names ${k}, not ${d.datasetName}.`,
1016
+ message: `A variable reads one dataset: "${_}" names ${I}, not ${d.datasetName}.`,
1012
1017
  path: N,
1013
- fix: `Name a field of ${d.datasetName}, or set datasetName to ${k} and read its field.`
1018
+ fix: `Name a field of ${d.datasetName}, or set datasetName to ${I} and read its field.`
1014
1019
  });
1015
- const T = ot(p, g, d.datasetName);
1016
- return T || s({
1020
+ const R = ot(p, _, d.datasetName);
1021
+ return R || s({
1017
1022
  code: "field_not_found",
1018
- message: `"${g}" isn't a field of ${d.datasetName}.`,
1023
+ message: `"${_}" isn't a field of ${d.datasetName}.`,
1019
1024
  path: N,
1020
1025
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1021
- details: { available: p.slice(0, 20).map((L) => L.name) }
1022
- }), T;
1023
- }, v = d.measures ?? [], x = d.dimensions ?? [], w = {
1026
+ details: { available: p.slice(0, 20).map((P) => P.name) }
1027
+ }), R;
1028
+ }, y = d.measures ?? [], S = d.dimensions ?? [], x = {
1024
1029
  ...c,
1025
1030
  mode: "data",
1026
1031
  dataSource: h.dataSource,
1027
1032
  connectionId: h.connectionId,
1028
1033
  get: "only",
1029
- ...(y = d.filters) != null && y.length ? { conditions: await Jn(d, n, i, t.refuseAll) } : {}
1034
+ ...(b = d.filters) != null && b.length ? { conditions: await Jn(d, n, i, t.refuseAll) } : {}
1030
1035
  };
1031
1036
  if (l.kind === "aggregate") {
1032
- (v.length !== 1 || x.length) && s({
1037
+ (y.length !== 1 || S.length) && s({
1033
1038
  code: "invalid_change",
1034
1039
  message: "An aggregate reads one measure and no dimension.",
1035
1040
  path: `${i}.query`,
1036
1041
  fix: `Send measures: [{ name, aggregate }] alone; for one field's value use get: "only", "first" or "list" with dimensions: [field].`
1037
1042
  }), d.orderBy && s({ code: "invalid_change", message: "An aggregate is one value, so it has no order.", path: `${i}.query.orderBy`, fix: "Leave out orderBy." });
1038
- const $ = I(v[0], `${i}.query.measures[0]`), N = typeof v[0] == "string" ? void 0 : v[0].aggregate, g = hn($).filter((L) => Ca(L.value)), k = N ?? (ut($) ? "calculation" : pn($));
1039
- if (!Ca(k) || !g.some((L) => L.value === k)) {
1040
- const L = g.map((V) => V.value);
1043
+ const w = v(y[0], `${i}.query.measures[0]`), N = typeof y[0] == "string" ? void 0 : y[0].aggregate, _ = hn(w).filter((P) => Ca(P.value)), I = N ?? (ut(w) ? "calculation" : pn(w));
1044
+ if (!Ca(I) || !_.some((P) => P.value === I)) {
1045
+ const P = _.map((V) => V.value);
1041
1046
  s({
1042
1047
  code: "invalid_change",
1043
- message: N ? `${N} isn't an aggregate ${$.label || $.name} takes.` : `${$.label || $.name} needs its aggregate.`,
1048
+ message: N ? `${N} isn't an aggregate ${w.label || w.name} takes.` : `${w.label || w.name} needs its aggregate.`,
1044
1049
  path: `${i}.query.measures[0]`,
1045
- fix: ut($) ? `${$.label || $.name} aggregates itself: send it without an aggregate.` : `Send { name: "${$.name}", aggregate } with one of: ${L.join(", ")}.`,
1046
- allowed: L
1050
+ fix: ut(w) ? `${w.label || w.name} aggregates itself: send it without an aggregate.` : `Send { name: "${w.name}", aggregate } with one of: ${P.join(", ")}.`,
1051
+ allowed: P
1047
1052
  });
1048
1053
  }
1049
- const T = Yn(v[0], { ...w, field: $, get: k }, `${i}.query.measures[0].comparison`, s);
1050
- return S(Ye({ ...w, field: $, get: k, ...T ? { comparison: T } : {} }, a));
1054
+ const R = Yn(y[0], { ...x, field: w, get: I }, `${i}.query.measures[0].comparison`, s);
1055
+ return k(Ye({ ...x, field: w, get: I, ...R ? { comparison: R } : {} }, a));
1051
1056
  }
1052
- (x.length !== 1 || v.length) && s({
1057
+ (S.length !== 1 || y.length) && s({
1053
1058
  code: "invalid_change",
1054
1059
  message: `The ${l.kind === "only" ? "only value" : l.kind === "first" ? "first value" : "list"} reads one dimension; a measure's one value is get: "aggregate".`,
1055
1060
  path: `${i}.query`,
1056
1061
  fix: "Send dimensions: [field] and no measures; order the first value or the list with orderBy."
1057
1062
  });
1058
- const E = I(x[0], `${i}.query.dimensions[0]`);
1063
+ const E = v(S[0], `${i}.query.dimensions[0]`);
1059
1064
  ut(E) && s({
1060
1065
  code: "invalid_change",
1061
1066
  message: `${E.label || E.name} is an aggregate calculation, so it has one value, not rows.`,
1062
1067
  path: `${i}.query.dimensions[0]`,
1063
1068
  fix: `Send get: "aggregate" with measures: ["${E.name}"].`
1064
1069
  }), l.kind === "only" && d.orderBy && s({ code: "invalid_change", message: "The only value has no order: it shows when exactly one row matches.", path: `${i}.query.orderBy`, fix: 'Leave out orderBy, or send get: "first" to take the first by this order.' });
1065
- let _;
1070
+ let C;
1066
1071
  if (d.orderBy && l.kind !== "only") {
1067
- const $ = d.orderBy.field;
1068
- typeof $ != "string" && $.aggregate && s({
1072
+ const w = d.orderBy.field;
1073
+ typeof w != "string" && w.aggregate && s({
1069
1074
  code: "invalid_change",
1070
1075
  message: "The order names a field, not an aggregate: the first value is ordered by the latest (desc) or earliest (asc) of that field per value.",
1071
1076
  path: `${i}.query.orderBy.field`,
1072
1077
  fix: 'Send orderBy: { field: "<field>", direction }.'
1073
- }), _ = I($, `${i}.query.orderBy.field`);
1078
+ }), C = v(w, `${i}.query.orderBy.field`);
1074
1079
  }
1075
- return S(
1080
+ return k(
1076
1081
  Ye(
1077
1082
  {
1078
- ...w,
1083
+ ...x,
1079
1084
  field: E,
1080
1085
  get: l.kind,
1081
- ..._ ? { sortField: _ } : {},
1086
+ ...C ? { sortField: C } : {},
1082
1087
  sortDirection: ((D = d.orderBy) == null ? void 0 : D.direction) ?? "asc",
1083
1088
  ...l.kind === "list" && l.limit ? { listLimit: l.limit } : {},
1084
1089
  ...l.kind === "list" && l.separator !== void 0 ? { listSeparator: l.separator } : {}
@@ -1086,9 +1091,9 @@ async function wa(e, a, t) {
1086
1091
  a
1087
1092
  )
1088
1093
  );
1089
- function S($) {
1090
- const N = { ...$, name: e.name }, g = Dt(N, a);
1091
- return g.length && t.refuseAll(cs(g, i)), N;
1094
+ function k(w) {
1095
+ const N = { ...w, name: e.name }, _ = Dt(N, a);
1096
+ return _.length && t.refuseAll(cs(_, i)), N;
1092
1097
  }
1093
1098
  }
1094
1099
  function Yn(e, a, t, s) {
@@ -1156,47 +1161,47 @@ function ei(e, a, t, s, o) {
1156
1161
  const i = t.document, d = e.target;
1157
1162
  let l, c;
1158
1163
  if ("sectionId" in d) {
1159
- const w = i.sections.find((E) => E.id === d.sectionId);
1160
- w || n({ code: "invalid_change", message: `No section ${d.sectionId} on "${t.title}".`, path: `${s}.target.sectionId`, fix: "Use a section id from the outline's textSections." }), w.type !== "text" && n({ code: "invalid_change", message: `Section ${d.sectionId} is a ${w.type} section, not text.`, path: `${s}.target.sectionId`, fix: "Name one of the outline's textSections." }), l = w.content, c = w.style;
1164
+ const x = i.sections.find((E) => E.id === d.sectionId);
1165
+ x || n({ code: "invalid_change", message: `No section ${d.sectionId} on "${t.title}".`, path: `${s}.target.sectionId`, fix: "Use a section id from the outline's textSections." }), x.type !== "text" && n({ code: "invalid_change", message: `Section ${d.sectionId} is a ${x.type} section, not text.`, path: `${s}.target.sectionId`, fix: "Name one of the outline's textSections." }), l = x.content, c = x.style;
1161
1166
  } else {
1162
- const { region: w, role: E } = d;
1163
- Ia[w].includes(E) || n({
1167
+ const { region: x, role: E } = d;
1168
+ Ia[x].includes(E) || n({
1164
1169
  code: "invalid_change",
1165
- message: `The ${w} has ${w === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${E} line.`,
1170
+ message: `The ${x} has ${x === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${E} line.`,
1166
1171
  path: `${s}.target.role`,
1167
- fix: `Send role: ${Ia[w].map((S) => `"${S}"`).join(" or ")}.`
1172
+ fix: `Send role: ${Ia[x].map((k) => `"${k}"`).join(" or ")}.`
1168
1173
  }), e.style !== void 0 && !Qs(E) && n({
1169
1174
  code: "invalid_change",
1170
1175
  message: `The footer's ${E === "pageInfo" ? "page info" : E} line has no size or alignment; only the header's title and metadata lines and text sections do.`,
1171
1176
  path: `${s}.style`,
1172
1177
  fix: "Leave style out for a footer line."
1173
1178
  });
1174
- const _ = i[w] ? Go(i[w].blocks, E) : void 0;
1175
- l = (_ == null ? void 0 : _.content) ?? [], c = _ == null ? void 0 : _.style;
1179
+ const C = i[x] ? Uo(i[x].blocks, E) : void 0;
1180
+ l = (C == null ? void 0 : C.content) ?? [], c = C == null ? void 0 : C.style;
1176
1181
  }
1177
- const h = e.style !== void 0 ? Hs(e.style) : void 0, p = !h || Object.entries(h).every(([w, E]) => (c == null ? void 0 : c[w]) === E);
1178
- let I;
1182
+ const h = e.style !== void 0 ? Hs(e.style) : void 0, p = !h || Object.entries(h).every(([x, E]) => (c == null ? void 0 : c[x]) === E);
1183
+ let v;
1179
1184
  if (e.text !== void 0) {
1180
- const w = { kind: "document", sheetId: t.id }, E = { catalog: _t({ dashboard: a, place: w }), inputs: a.inputs, variables: a.variables }, _ = JSON.stringify(Ze(l, E));
1181
- if (JSON.stringify(zs(e.text)) !== _) {
1182
- const S = Ys(e.text, l, { dashboard: a, place: w, path: `${s}.text`, links: !0 });
1183
- S.ok || o.refuseAll(S.problems);
1184
- const y = S.content;
1185
- JSON.stringify(Ze(y, E)) !== _ && (I = y);
1185
+ const x = { kind: "document", sheetId: t.id }, E = { catalog: _t({ dashboard: a, place: x }), inputs: a.inputs, variables: a.variables }, C = JSON.stringify(Ze(l, E));
1186
+ if (JSON.stringify(zs(e.text)) !== C) {
1187
+ const k = Ys(e.text, l, { dashboard: a, place: x, path: `${s}.text`, links: !0 });
1188
+ k.ok || o.refuseAll(k.problems);
1189
+ const b = k.content;
1190
+ JSON.stringify(Ze(b, E)) !== C && (v = b);
1186
1191
  }
1187
1192
  }
1188
- const v = {
1189
- ...I !== void 0 ? { content: I } : {},
1193
+ const y = {
1194
+ ...v !== void 0 ? { content: v } : {},
1190
1195
  ...h !== void 0 && !p ? { style: h } : {}
1191
1196
  };
1192
- return { edit: "sectionId" in d ? { type: "updateText", sectionId: d.sectionId, ...v } : { type: "updateRegionText", region: d.region, role: d.role, ...v }, unchanged: I === void 0 && p };
1197
+ return { edit: "sectionId" in d ? { type: "updateText", sectionId: d.sectionId, ...y } : { type: "updateRegionText", region: d.region, role: d.role, ...y }, unchanged: v === void 0 && p };
1193
1198
  }
1194
1199
  class me extends Error {
1195
1200
  }
1196
1201
  const xa = "A text card takes title, description and text.", bt = (e) => e.cards.some((a) => {
1197
1202
  var t, s;
1198
1203
  return ((t = a.customCardPreferences) == null ? void 0 : t.visualType) === "multiple" || !!((s = a.customCardPreferences) != null && s.dataInputCardIds);
1199
- }), Tt = (e) => (e ?? "").trim().toLowerCase(), tt = oo, Sa = { measures: lo, records: ro, sql: io }, Ue = {
1204
+ }), Tt = (e) => (e ?? "").trim().toLowerCase(), tt = oo, Sa = { measures: lo, records: ro, sql: io }, Ge = {
1200
1205
  measures: "a measures query (measures, with optional dimensions)",
1201
1206
  records: "a records query (columns)",
1202
1207
  sql: "a SQL query"
@@ -1209,88 +1214,88 @@ async function Fr(e, a, t) {
1209
1214
  return fs(e, a, t, { limit: ti });
1210
1215
  }
1211
1216
  async function fs(e, a, t, s) {
1212
- var Gt, Qt, Ht, zt, Yt, Jt, Xt, Zt, ea, ta, aa, sa, oa, na, ia, ra;
1213
- const o = [], n = [], i = [], d = [], l = /* @__PURE__ */ new Set(), c = [], h = /* @__PURE__ */ new Map(), p = { calendar: t.calendar }, I = t.relationshipReach ? { relationshipReach: t.relationshipReach } : {};
1214
- let v = e, x, w = 0, E = 0;
1215
- const { limit: _ } = s;
1216
- if (a.length > _.max)
1217
+ var Ut, Qt, Ht, zt, Yt, Jt, Xt, Zt, ea, ta, aa, sa, oa, na, ia, ra;
1218
+ const o = [], n = [], i = [], d = [], l = /* @__PURE__ */ new Set(), c = [], h = /* @__PURE__ */ new Map(), p = { calendar: t.calendar }, v = t.relationshipReach ? { relationshipReach: t.relationshipReach } : {};
1219
+ let y = e, S, x = 0, E = 0;
1220
+ const { limit: C } = s;
1221
+ if (a.length > C.max)
1217
1222
  return {
1218
1223
  ok: !1,
1219
1224
  problems: [
1220
1225
  {
1221
1226
  code: "too_many_changes",
1222
- message: `${_.what} takes at most ${_.max} changes; this one has ${a.length}.`,
1227
+ message: `${C.what} takes at most ${C.max} changes; this one has ${a.length}.`,
1223
1228
  path: "changes",
1224
- fix: _.fix
1229
+ fix: C.fix
1225
1230
  }
1226
1231
  ]
1227
1232
  };
1228
- const S = [];
1233
+ const k = [];
1229
1234
  if (a.forEach((m, r) => {
1230
1235
  const f = Zs.safeParse(m);
1231
1236
  if (f.success) {
1232
- S.push(f.data);
1237
+ k.push(f.data);
1233
1238
  return;
1234
1239
  }
1235
1240
  for (const u of f.error.issues) {
1236
- const b = en(u.message);
1241
+ const g = en(u.message);
1237
1242
  o.push({
1238
1243
  code: "invalid_change",
1239
- message: (b == null ? void 0 : b.message) ?? u.message,
1244
+ message: (g == null ? void 0 : g.message) ?? u.message,
1240
1245
  path: us(`changes[${r}]`, u),
1241
- fix: (b == null ? void 0 : b.fix) ?? "Send the change in the shape the tool schema gives."
1246
+ fix: (g == null ? void 0 : g.fix) ?? "Send the change in the shape the tool schema gives."
1242
1247
  });
1243
1248
  }
1244
1249
  }), o.length) return { ok: !1, problems: o };
1245
- const y = (m) => {
1250
+ const b = (m) => {
1246
1251
  throw o.push(m), new me();
1247
1252
  }, D = (m) => {
1248
- t.capabilities.sql || y({
1253
+ t.capabilities.sql || b({
1249
1254
  code: "capability_required",
1250
1255
  message: "This change creates, reads or changes a SQL card or variable, which needs SQL access.",
1251
1256
  path: m,
1252
1257
  fix: "Use a measures or records query (a semantic dataset for a variable), or ask an administrator for SQL access."
1253
1258
  }), l.add("sql");
1254
- }, $ = (m, r) => {
1255
- const f = wt(v, [m], p);
1256
- f.ok ? (v = f.dashboard, i.push(m)) : y({ code: "invalid_change", message: f.failedAt.message, path: r, ...f.failedAt.fix ? { fix: f.failedAt.fix } : {} });
1259
+ }, w = (m, r) => {
1260
+ const f = wt(y, [m], p);
1261
+ f.ok ? (y = f.dashboard, i.push(m)) : b({ code: "invalid_change", message: f.failedAt.message, path: r, ...f.failedAt.fix ? { fix: f.failedAt.fix } : {} });
1257
1262
  }, N = async (m) => {
1258
1263
  var X, Y, j, ne, fe;
1259
- const { cardId: r, index: f, path: u } = m, { settings: b = {}, highlights: C } = m.request, O = b.columns && Object.keys(b.columns).length ? b.columns : void 0, A = Object.entries(b).some(([H, de]) => H !== "columns" && de !== void 0), F = !!((X = C == null ? void 0 : C.add) != null && X.length);
1260
- if (!O && !A && !F && !((Y = C == null ? void 0 : C.remove) != null && Y.length)) return null;
1261
- const R = ie(v, r).card, P = Object.values(O ?? {}).some((H) => H.label === null), q = Object.values(O ?? {}).some((H) => H.format !== void 0 && H.format !== null), M = {};
1262
- if (P && !((j = R.sql) != null && j.trim()))
1263
- for (const H of Dn(R)) {
1264
+ const { cardId: r, index: f, path: u } = m, { settings: g = {}, highlights: $ } = m.request, O = g.columns && Object.keys(g.columns).length ? g.columns : void 0, A = Object.entries(g).some(([H, de]) => H !== "columns" && de !== void 0), F = !!((X = $ == null ? void 0 : $.add) != null && X.length);
1265
+ if (!O && !A && !F && !((Y = $ == null ? void 0 : $.remove) != null && Y.length)) return null;
1266
+ const T = ie(y, r).card, L = Object.values(O ?? {}).some((H) => H.label === null), q = Object.values(O ?? {}).some((H) => H.format !== void 0 && H.format !== null), M = {};
1267
+ if (L && !((j = T.sql) != null && j.trim()))
1268
+ for (const H of Dn(T)) {
1264
1269
  const de = await t.loadCardSource(H);
1265
1270
  de && (M[Nt(H)] = de.fields);
1266
1271
  }
1267
- let U;
1268
- if (q && !((ne = R.sql) != null && ne.trim())) {
1269
- const H = t.readModelFormats ? await t.readModelFormats({ card: R }) : null;
1270
- U = H ? { status: "read", formats: H } : { status: "unavailable" };
1272
+ let G;
1273
+ if (q && !((ne = T.sql) != null && ne.trim())) {
1274
+ const H = t.readModelFormats ? await t.readModelFormats({ card: T }) : null;
1275
+ G = H ? { status: "read", formats: H } : { status: "unavailable" };
1271
1276
  }
1272
1277
  let z;
1273
- if ((O || F) && ((fe = R.sql) != null && fe.trim()) && R.type !== "kpi") {
1274
- const H = t.readSqlResultColumns ? await t.readSqlResultColumns({ cardId: r, dashboard: v }) : null;
1275
- H || y({
1278
+ if ((O || F) && ((fe = T.sql) != null && fe.trim()) && T.type !== "kpi") {
1279
+ const H = t.readSqlResultColumns ? await t.readSqlResultColumns({ cardId: r, dashboard: y }) : null;
1280
+ H || b({
1276
1281
  code: "columns_unavailable",
1277
- message: O ? `"${R.title || "Untitled"}" couldn't be run to read its columns, so their names can't be checked.` : `"${R.title || "Untitled"}" couldn't be run to read its columns, so the highlight's column can't be checked.`,
1282
+ message: O ? `"${T.title || "Untitled"}" couldn't be run to read its columns, so their names can't be checked.` : `"${T.title || "Untitled"}" couldn't be run to read its columns, so the highlight's column can't be checked.`,
1278
1283
  path: O ? `${u}.columns` : `${u}.column`,
1279
1284
  fix: "Check that the card runs and returns rows, then propose again."
1280
1285
  }), z = H;
1281
1286
  }
1282
- const W = Gn(
1283
- R,
1287
+ const W = Un(
1288
+ T,
1284
1289
  {
1285
- settings: { ...b, ...O ? { columns: O } : { columns: void 0 } },
1286
- ...C ? { highlights: C } : {}
1290
+ settings: { ...g, ...O ? { columns: O } : { columns: void 0 } },
1291
+ ...$ ? { highlights: $ } : {}
1287
1292
  },
1288
1293
  {
1289
1294
  path: u,
1290
1295
  cardRef: m.cardRef,
1291
1296
  catalogs: M,
1292
1297
  newId: t.newId,
1293
- ...U ? { modelFormats: U } : {},
1298
+ ...G ? { modelFormats: G } : {},
1294
1299
  ...z ? { sqlResultColumns: z } : {}
1295
1300
  }
1296
1301
  );
@@ -1298,20 +1303,20 @@ async function fs(e, a, t, s) {
1298
1303
  throw o.push(...W.problems), new me();
1299
1304
  for (const H of W.labels) {
1300
1305
  const de = m.queryLabels.find((Ae) => He(Ae.key, H.key) && Ae.label !== H.label);
1301
- de && y({
1306
+ de && b({
1302
1307
  code: "value_invalid",
1303
- message: `Two labels are stated for one column of "${R.title || "Untitled"}": "${de.label}" in the query and "${H.label}" in columns.`,
1308
+ message: `Two labels are stated for one column of "${T.title || "Untitled"}": "${de.label}" in the query and "${H.label}" in columns.`,
1304
1309
  path: `${u}.columns`,
1305
1310
  fix: "State the label once."
1306
1311
  });
1307
1312
  }
1308
- return n.push(...W.warnings), W.labels.length && pa(R, W.labels).changed.length && $({ op: "card.update", cardId: r, update: { kind: "relabel", labels: W.labels }, changeIndex: f }, `${u}.columns`), W.settings && $({ op: "card.update", cardId: r, update: { kind: "settings", settings: W.settings }, changeIndex: f }, O ? `${u}.columns` : u), W.settings;
1309
- }, g = (m, r) => {
1310
- var b;
1311
- const f = ie(v, m);
1312
- f || y({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${r}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1313
+ return n.push(...W.warnings), W.labels.length && pa(T, W.labels).changed.length && w({ op: "card.update", cardId: r, update: { kind: "relabel", labels: W.labels }, changeIndex: f }, `${u}.columns`), W.settings && w({ op: "card.update", cardId: r, update: { kind: "settings", settings: W.settings }, changeIndex: f }, O ? `${u}.columns` : u), W.settings;
1314
+ }, _ = (m, r) => {
1315
+ var g;
1316
+ const f = ie(y, m);
1317
+ f || b({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${r}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1313
1318
  const u = we(f.card, { sql: !0 });
1314
- return ((b = u.source) == null ? void 0 : b.kind) === "sql" && D(`${r}.cardId`), u.editable || y({
1319
+ return ((g = u.source) == null ? void 0 : g.kind) === "sql" && D(`${r}.cardId`), u.editable || b({
1315
1320
  code: "card_not_editable",
1316
1321
  message: u.message,
1317
1322
  path: `${r}.cardId`,
@@ -1323,23 +1328,23 @@ async function fs(e, a, t, s) {
1323
1328
  path: r,
1324
1329
  details: { cardIds: [m] }
1325
1330
  }), { card: f.card, read: u };
1326
- }, k = /* @__PURE__ */ new Map(), T = (m, r, f) => {
1327
- var b;
1328
- const u = Ka("metric", ((b = m.config) == null ? void 0 : b.metricColumns) ?? []);
1329
- return r.map(({ index: C, calculations: O }) => ({
1331
+ }, I = /* @__PURE__ */ new Map(), R = (m, r, f) => {
1332
+ var g;
1333
+ const u = ja("metric", ((g = m.config) == null ? void 0 : g.metricColumns) ?? []);
1334
+ return r.map(({ index: $, calculations: O }) => ({
1330
1335
  ...O,
1331
- measure: u[C] ?? { role: "metric", field: "", ordinal: C },
1332
- path: `${f}.query.measures[${C}]`
1336
+ measure: u[$] ?? { role: "metric", field: "", ordinal: $ },
1337
+ path: `${f}.query.measures[${$}]`
1333
1338
  }));
1334
- }, L = async (m) => {
1335
- const r = ie(v, m.cardId).card, f = T(r, m.stated, m.path), u = f.some((O) => {
1339
+ }, P = async (m) => {
1340
+ const r = ie(y, m.cardId).card, f = R(r, m.stated, m.path), u = f.some((O) => {
1336
1341
  var A, F;
1337
1342
  return ((A = O.comparison) == null ? void 0 : A.kind) === "previous_period" || ((F = O.comparison) == null ? void 0 : F.kind) === "previous_year";
1338
- }), b = u && t.readComparisonDates ? await t.readComparisonDates({ card: r, dashboard: v }) : ka(r), C = fa({ card: r, stated: f, context: { path: m.path, cardRef: m.cardRef, dates: b } });
1339
- if (!C.ok)
1340
- throw o.push(...C.problems), new me();
1341
- return n.push(...C.warnings), u && k.set(m.cardId, m.path), C.update ? ($(
1342
- { op: "card.update", cardId: m.cardId, update: { kind: "calculations", calculations: C.update }, changeIndex: m.index },
1343
+ }), g = u && t.readComparisonDates ? await t.readComparisonDates({ card: r, dashboard: y }) : ka(r), $ = fa({ card: r, stated: f, context: { path: m.path, cardRef: m.cardRef, dates: g } });
1344
+ if (!$.ok)
1345
+ throw o.push(...$.problems), new me();
1346
+ return n.push(...$.warnings), u && I.set(m.cardId, m.path), $.update ? (w(
1347
+ { op: "card.update", cardId: m.cardId, update: { kind: "calculations", calculations: $.update }, changeIndex: m.index },
1343
1348
  `${m.path}.query`
1344
1349
  ), !0) : !1;
1345
1350
  }, V = (m) => ({
@@ -1353,63 +1358,64 @@ async function fs(e, a, t, s) {
1353
1358
  axes: m.axes,
1354
1359
  comparisonDisplay: m.comparisonDisplay,
1355
1360
  inheritComparison: m.inheritComparison,
1356
- band: m.band,
1361
+ trend: m.trend,
1362
+ trendGrain: m.trendGrain,
1357
1363
  seeRecords: m.seeRecords
1358
- }), K = (m) => Object.entries(V(m)).filter(([, r]) => r !== void 0).map(([r]) => r), B = (m) => (o.push(...m.slice(0, -1)), y(m[m.length - 1])), se = (m, r, f, u) => {
1359
- const { card: b } = r, C = [...m.type ? ["type"] : [], ...m.query ? ["query"] : [], ...m.matrix ? ["matrix"] : [], ...K(m)];
1360
- C.length && y({
1364
+ }), K = (m) => Object.entries(V(m)).filter(([, r]) => r !== void 0).map(([r]) => r), B = (m) => (o.push(...m.slice(0, -1)), b(m[m.length - 1])), se = (m, r, f, u) => {
1365
+ const { card: g } = r, $ = [...m.type ? ["type"] : [], ...m.query ? ["query"] : [], ...m.matrix ? ["matrix"] : [], ...K(m)];
1366
+ $.length && b({
1361
1367
  code: "invalid_change",
1362
- message: `"${b.title}" is a text card, so it takes no ${et(C)}.`,
1368
+ message: `"${g.title}" is a text card, so it takes no ${et($)}.`,
1363
1369
  path: u,
1364
1370
  fix: "Change a card to or from text in the editor, or add a new card and remove this one."
1365
1371
  });
1366
- const O = ja(b, { inputs: v.inputs, variables: v.variables });
1367
- O.editable || y({ code: "card_not_editable", message: O.message, path: `${u}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "text" } });
1372
+ const O = Ka(g, { inputs: y.inputs, variables: y.variables });
1373
+ O.editable || b({ code: "card_not_editable", message: O.message, path: `${u}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "text" } });
1368
1374
  const A = O.editable && (O.form === "legacy_html" || O.form === "legacy_runs");
1369
- A && m.description !== void 0 && m.text === void 0 && y({
1375
+ A && m.description !== void 0 && m.text === void 0 && b({
1370
1376
  code: "invalid_change",
1371
- message: `"${b.title}" keeps its words in its description, so a description change would replace them.`,
1377
+ message: `"${g.title}" keeps its words in its description, so a description change would replace them.`,
1372
1378
  path: `${u}.description`,
1373
1379
  fix: "Send the words in text with it: they are stored as rich text, and the description becomes the subtitle."
1374
- }), d.push({ ref: m.cardId, kind: "card", id: b.id, title: m.title ?? b.title ?? "", changeIndex: f });
1375
- let F = !1, R = !1;
1380
+ }), d.push({ ref: m.cardId, kind: "card", id: g.id, title: m.title ?? g.title ?? "", changeIndex: f });
1381
+ let F = !1, T = !1;
1376
1382
  if (m.text !== void 0) {
1377
1383
  const M = ga({
1378
1384
  text: m.text,
1379
- card: b,
1385
+ card: g,
1380
1386
  // Any variable the catalog offers where the card sits (DV-D13).
1381
- context: { dashboard: v, place: { kind: "sheet", sheetId: r.sheet.id, cardId: b.id } },
1387
+ context: { dashboard: y, place: { kind: "sheet", sheetId: r.sheet.id, cardId: g.id } },
1382
1388
  path: `${u}.text`,
1383
1389
  storeAsRichText: A && m.description !== void 0
1384
1390
  });
1385
- M.ok || B(M.problems), M.ok && !M.unchanged && ($({ op: "card.update", cardId: b.id, update: { kind: "text", richContent: M.richContent, clearsLegacy: M.clearsLegacy }, changeIndex: f }, u), F = !0, R = M.clearsLegacy);
1391
+ M.ok || B(M.problems), M.ok && !M.unchanged && (w({ op: "card.update", cardId: g.id, update: { kind: "text", richContent: M.richContent, clearsLegacy: M.clearsLegacy }, changeIndex: f }, u), F = !0, T = M.clearsLegacy);
1386
1392
  }
1387
- const P = m.title !== void 0 && m.title !== b.title, q = m.description !== void 0 && (A ? R : (m.description ?? void 0) !== (b.description ?? void 0));
1388
- (P || q) && ($(
1393
+ const L = m.title !== void 0 && m.title !== g.title, q = m.description !== void 0 && (A ? T : (m.description ?? void 0) !== (g.description ?? void 0));
1394
+ (L || q) && (w(
1389
1395
  {
1390
1396
  op: "card.update",
1391
- cardId: b.id,
1392
- update: { kind: "rename", ...P ? { title: m.title } : {}, ...q ? { description: m.description } : {} },
1397
+ cardId: g.id,
1398
+ update: { kind: "rename", ...L ? { title: m.title } : {}, ...q ? { description: m.description } : {} },
1393
1399
  changeIndex: f
1394
1400
  },
1395
1401
  u
1396
1402
  ), F = !0), F && r.frame.visualId && n.push({
1397
1403
  code: "detaches_linked_visual",
1398
- message: `"${b.title}" will stop following its library visual and become local to this dashboard.`,
1404
+ message: `"${g.title}" will stop following its library visual and become local to this dashboard.`,
1399
1405
  path: u,
1400
- details: { cardIds: [b.id] }
1406
+ details: { cardIds: [g.id] }
1401
1407
  });
1402
1408
  }, oe = (m, r) => {
1403
1409
  if (m.startsWith("$")) {
1404
1410
  const f = h.get(m);
1405
- return (!f || f.kind !== "card") && y({
1411
+ return (!f || f.kind !== "card") && b({
1406
1412
  code: "handle_unknown",
1407
1413
  message: `${m} isn't a card handle defined earlier in this list.`,
1408
1414
  path: r,
1409
1415
  fix: "Define the handle with an earlier card.add, or use the card id from the outline."
1410
1416
  }), f.id;
1411
1417
  }
1412
- return xe(v).some((f) => f.cardId === m) || y({
1418
+ return xe(y).some((f) => f.cardId === m) || b({
1413
1419
  code: "card_not_found",
1414
1420
  message: `There's no card ${m} on this dashboard.`,
1415
1421
  path: r,
@@ -1418,197 +1424,197 @@ async function fs(e, a, t, s) {
1418
1424
  }, te = (m, r) => {
1419
1425
  if (m.startsWith("$")) {
1420
1426
  const u = h.get(m);
1421
- return (!u || u.kind !== "filter") && y({
1427
+ return (!u || u.kind !== "filter") && b({
1422
1428
  code: "handle_unknown",
1423
1429
  message: `${m} isn't a filter handle defined earlier in this list.`,
1424
1430
  path: r,
1425
1431
  fix: "Define the handle with an earlier filter.add, or use the filter id from the outline."
1426
1432
  }), u.id;
1427
1433
  }
1428
- return (Array.isArray(v.inputs) ? v.inputs : []).some((u) => u.id === m && u.kind === "filter") || y({
1434
+ return (Array.isArray(y.inputs) ? y.inputs : []).some((u) => u.id === m && u.kind === "filter") || b({
1429
1435
  code: "filter_not_found",
1430
1436
  message: `There's no filter ${m} on this dashboard.`,
1431
1437
  path: r,
1432
1438
  fix: "Read the outline again and use its filter ids."
1433
1439
  }), m;
1434
1440
  }, Bt = (m, r) => {
1435
- const f = m.startsWith("$") ? void 0 : Je(v, m);
1441
+ const f = m.startsWith("$") ? void 0 : Je(y, m);
1436
1442
  return f ? f.id : oe(m, r);
1437
- }, Te = { services: t, problem: y, refuseAll: B, need: D }, nt = () => (v.sheets ?? []).filter((m) => !Xe(m)), Be = () => nt().map((m) => ({ sheetId: m.id, title: m.title ?? "" })), it = (m, r, f) => {
1443
+ }, Te = { services: t, problem: b, refuseAll: B, need: D }, nt = () => (y.sheets ?? []).filter((m) => !Xe(m)), Be = () => nt().map((m) => ({ sheetId: m.id, title: m.title ?? "" })), it = (m, r, f) => {
1438
1444
  let u = m;
1439
1445
  if (m.startsWith("$")) {
1440
- const C = h.get(m);
1441
- (!C || C.kind !== "sheet") && y({
1446
+ const $ = h.get(m);
1447
+ (!$ || $.kind !== "sheet") && b({
1442
1448
  code: "handle_unknown",
1443
1449
  message: `${m} isn't a sheet handle defined earlier in this list.`,
1444
1450
  path: r,
1445
1451
  fix: "Define the handle with an earlier sheet.add, or use the sheet id from the outline."
1446
- }), u = C.id;
1452
+ }), u = $.id;
1447
1453
  }
1448
- const b = (v.sheets ?? []).find((C) => C.id === u);
1449
- return b || y({ code: "sheet_not_found", message: `There's no sheet ${u} on this dashboard.`, path: r, fix: "Read the outline again and use its sheet ids.", details: { sheets: Be() } }), f.grid && Xe(b) && y({ code: "sheet_not_a_grid", message: `"${b.title}" is a Document sheet.`, path: r, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: Be() } }), b;
1450
- }, Re = (m, r) => it(m, r, { grid: !0 }), Vt = (m, r) => m.map((f, u) => Re(f, `${r}.sheetIds[${u}]`).id), jt = (m, r, f, u) => {
1454
+ const g = (y.sheets ?? []).find(($) => $.id === u);
1455
+ return g || b({ code: "sheet_not_found", message: `There's no sheet ${u} on this dashboard.`, path: r, fix: "Read the outline again and use its sheet ids.", details: { sheets: Be() } }), f.grid && Xe(g) && b({ code: "sheet_not_a_grid", message: `"${g.title}" is a Document sheet.`, path: r, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: Be() } }), g;
1456
+ }, Re = (m, r) => it(m, r, { grid: !0 }), Vt = (m, r) => m.map((f, u) => Re(f, `${r}.sheetIds[${u}]`).id), Kt = (m, r, f, u) => {
1451
1457
  var A;
1452
- for (const F of Ma(r, f)) y({ ...F, path: `${u}.${F.path}` });
1453
- const b = Fe[m], C = tt(r), O = r.dateField;
1454
- if (O && typeof O != "string" && O.label && !r.timeGrain && y({
1458
+ for (const F of Ma(r, f)) b({ ...F, path: `${u}.${F.path}` });
1459
+ const g = Fe[m], $ = tt(r), O = r.dateField;
1460
+ if (O && typeof O != "string" && O.label && !r.timeGrain && b({
1455
1461
  code: "invalid_change",
1456
1462
  message: "A label names a column, and the date field is a column only when the card groups by it.",
1457
1463
  path: `${u}.query.dateField.label`,
1458
1464
  fix: "Send timeGrain to group by the date, or leave the label out."
1459
- }), !b.forms.includes(C)) {
1460
- const F = Object.keys(Fe).filter((R) => Fe[R].forms.includes(C));
1461
- y({
1465
+ }), !g.forms.includes($)) {
1466
+ const F = Object.keys(Fe).filter((T) => Fe[T].forms.includes($));
1467
+ b({
1462
1468
  code: "type_not_supported",
1463
- message: `A ${m.replace(/_/g, " ")} card takes ${b.forms.map((R) => Ue[R]).join(" or ")}, not ${Ue[C]}.`,
1469
+ message: `A ${m.replace(/_/g, " ")} card takes ${g.forms.map((T) => Ge[T]).join(" or ")}, not ${Ge[$]}.`,
1464
1470
  path: `${u}.query`,
1465
- fix: `Send ${b.forms.map((R) => Ue[R]).join(" or ")}, or use a type this query fits: ${F.join(", ")}.`
1471
+ fix: `Send ${g.forms.map((T) => Ge[T]).join(" or ")}, or use a type this query fits: ${F.join(", ")}.`
1466
1472
  });
1467
1473
  }
1468
- if (C === "measures") {
1469
- const F = r, R = F.measures.length;
1470
- b.measures && (R < b.measures.min || b.measures.max !== void 0 && R > b.measures.max) && y({
1474
+ if ($ === "measures") {
1475
+ const F = r, T = F.measures.length;
1476
+ g.measures && (T < g.measures.min || g.measures.max !== void 0 && T > g.measures.max) && b({
1471
1477
  code: "type_not_supported",
1472
- message: `A ${m.replace(/_/g, " ")} card shows exactly ${b.measures.max} measure.`,
1478
+ message: `A ${m.replace(/_/g, " ")} card shows exactly ${g.measures.max} measure.`,
1473
1479
  path: `${u}.query.measures`,
1474
1480
  fix: "Send one measure, or use a table or chart for several."
1475
- }), !b.dimensions && ((A = F.dimensions) != null && A.length) && y({
1481
+ }), !g.dimensions && ((A = F.dimensions) != null && A.length) && b({
1476
1482
  code: "type_not_supported",
1477
1483
  message: `A ${m.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1478
1484
  path: `${u}.query.dimensions`,
1479
1485
  fix: "Remove the dimensions, or use a table or chart."
1480
- }), m === "matrix" && (F.orderBy || F.limit) && y({
1486
+ }), m === "matrix" && (F.orderBy || F.limit) && b({
1481
1487
  code: "type_not_supported",
1482
1488
  message: "A Matrix's sorting and top N are set in the editor.",
1483
1489
  path: `${u}.query`,
1484
1490
  fix: "Leave out orderBy and limit for a Matrix."
1485
1491
  });
1486
1492
  }
1487
- if (b.matrixColumns && !f && y({
1493
+ if (g.matrixColumns && !f && b({
1488
1494
  code: "type_not_supported",
1489
1495
  message: "A Matrix needs matrix.columns: the query fields that run across the top.",
1490
1496
  path: `${u}.matrix`,
1491
1497
  fix: "Send matrix: { columns: [...] } naming dimensions or the date field of the query (an empty list puts nothing across the top)."
1492
- }), !b.matrixColumns && f && y({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${u}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), f && C === "measures") {
1493
- const F = r, R = F.datasetName, P = [...F.dimensions ?? [], ...F.timeGrain && F.dateField ? [F.dateField] : []];
1494
- P.length && f.columns.length >= P.length && P.every((M) => f.columns.some((U) => be(U, R) === be(M, R))) && y({
1498
+ }), !g.matrixColumns && f && b({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${u}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), f && $ === "measures") {
1499
+ const F = r, T = F.datasetName, L = [...F.dimensions ?? [], ...F.timeGrain && F.dateField ? [F.dateField] : []];
1500
+ L.length && f.columns.length >= L.length && L.every((M) => f.columns.some((G) => be(G, T) === be(M, T))) && b({
1495
1501
  code: "type_not_supported",
1496
1502
  message: "A Matrix needs at least one field down the side.",
1497
1503
  path: `${u}.matrix.columns`,
1498
1504
  fix: "Leave one dimension or the date field out of matrix.columns."
1499
1505
  });
1500
- const q = new Set([...F.dimensions ?? [], ...F.dateField ? [F.dateField] : []].map((M) => be(M, R)));
1501
- f.columns.forEach((M, U) => {
1502
- q.has(be(M, R)) || y({
1506
+ const q = new Set([...F.dimensions ?? [], ...F.dateField ? [F.dateField] : []].map((M) => be(M, T)));
1507
+ f.columns.forEach((M, G) => {
1508
+ q.has(be(M, T)) || b({
1503
1509
  code: "type_not_supported",
1504
1510
  message: `"${Ct(M)}" isn't one of the query's dimensions or its date field.`,
1505
- path: `${u}.matrix.columns[${U}]`,
1511
+ path: `${u}.matrix.columns[${G}]`,
1506
1512
  fix: "Name dimensions or the date field of the query in matrix.columns."
1507
1513
  });
1508
1514
  });
1509
1515
  }
1510
- }, Kt = (m, r) => y({
1516
+ }, jt = (m, r) => b({
1511
1517
  code: m.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1512
1518
  message: m.message,
1513
1519
  path: `${r}.query`,
1514
1520
  fix: m.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1515
1521
  details: { reason: "not_expressible", ..."parts" in m ? { parts: m.parts } : {} }
1516
- }), Wt = (m, r, f, u, b, C, O) => {
1517
- const A = Hn(m, r, f, C, O);
1522
+ }), Wt = (m, r, f, u, g, $, O) => {
1523
+ const A = Hn(m, r, f, $, O);
1518
1524
  if (!A.length) return;
1519
1525
  const F = r;
1520
1526
  if (A.length === 1 && A[0] === "dateField" && F.dateField && !F.timeGrain && !F.timeWindow) {
1521
- y({
1527
+ b({
1522
1528
  code: "value_invalid",
1523
- message: `A dateField on its own doesn't change "${b}": it needs timeGrain to group by the date (a KPI's Trend By) or a timeWindow to filter by it.`,
1529
+ message: `A dateField on its own doesn't change "${g}": it needs timeGrain to group by the date (a KPI's Trend By) or a timeWindow to filter by it.`,
1524
1530
  path: `${u}.query.dateField`,
1525
1531
  fix: 'Add timeGrain (for example "month") or a timeWindow, or leave out dateField.'
1526
1532
  });
1527
1533
  return;
1528
1534
  }
1529
- const R = A.join(", ");
1530
- y({
1535
+ const T = A.join(", ");
1536
+ b({
1531
1537
  code: "card_not_editable",
1532
- message: O ? `As changed, "${b}" wouldn't hold ${R} as asked, so make this change in the editor.` : `"${b}" can't be built holding ${R} as asked.`,
1538
+ message: O ? `As changed, "${g}" wouldn't hold ${T} as asked, so make this change in the editor.` : `"${g}" can't be built holding ${T} as asked.`,
1533
1539
  path: `${u}.query`,
1534
- fix: O ? "Tell the user to make this change in the editor." : `Leave out ${R}; the rest of the card can be added.`,
1535
- details: { reason: "not_expressible", detail: `doesn't hold: ${R}` }
1540
+ fix: O ? "Tell the user to make this change in the editor." : `Leave out ${T}; the rest of the card can be added.`,
1541
+ details: { reason: "not_expressible", detail: `doesn't hold: ${T}` }
1536
1542
  });
1537
- }, Ut = async (m, r, f, u, b = !1) => {
1538
- const C = ct(m);
1543
+ }, Gt = async (m, r, f, u, g = !1) => {
1544
+ const $ = ct(m);
1539
1545
  if ("sql" in r)
1540
- return D(`${u}.query`), { type: C, source: { kind: "sql", connectionId: r.connectionId, sql: r.sql } };
1541
- const O = C === "matrixTable" || C === "detailTable" ? "table" : C, A = await t.compileCardQuery({ query: r, chartType: O });
1546
+ return D(`${u}.query`), { type: $, source: { kind: "sql", connectionId: r.connectionId, sql: r.sql } };
1547
+ const O = $ === "matrixTable" || $ === "detailTable" ? "table" : $, A = await t.compileCardQuery({ query: r, chartType: O });
1542
1548
  if (!A.ok)
1543
1549
  throw o.push(...A.problems.map((q) => ({ ...q, path: q.path ? `${u}.query.${q.path}` : `${u}.query` }))), new me();
1544
1550
  n.push(...A.warnings.map((q) => ({ ...q, path: q.path ?? `${u}.query` })));
1545
- const F = !b && "timeWindow" in r && r.timeWindow ? ci(A.part.config) : void 0;
1546
- F && "timeWindow" in r && r.timeWindow && hs(r.timeWindow, { use: "cardFilter", columnHasTime: uo(F) }, `${u}.query.timeWindow`, y);
1547
- let R = { ...A.part, type: C };
1548
- const P = R.config ?? {};
1549
- if (C === "detailTable") {
1550
- const q = fo(mo("table", "detailTable", P)) ?? {};
1551
- R = { ...R, config: si(q) };
1551
+ const F = !g && "timeWindow" in r && r.timeWindow ? ci(A.part.config) : void 0;
1552
+ F && "timeWindow" in r && r.timeWindow && hs(r.timeWindow, { use: "cardFilter", columnHasTime: uo(F) }, `${u}.query.timeWindow`, b);
1553
+ let T = { ...A.part, type: $ };
1554
+ const L = T.config ?? {};
1555
+ if ($ === "detailTable") {
1556
+ const q = fo(mo("table", "detailTable", L)) ?? {};
1557
+ T = { ...T, config: si(q) };
1552
1558
  }
1553
- return C === "matrixTable" && (R = await vs(R, P, r, f, u)), oi(R, qe(r));
1554
- }, vs = async (m, r, f, u, b) => {
1559
+ return $ === "matrixTable" && (T = await vs(T, L, r, f, u)), oi(T, qe(r));
1560
+ }, vs = async (m, r, f, u, g) => {
1555
1561
  var q;
1556
- const C = await t.loadCardSource({ domainId: f.domainId, datasetName: f.datasetName });
1557
- if (C || y({ code: "field_not_found", message: `The dataset "${f.datasetName}" isn't available.`, path: `${b}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), m.source.kind !== "semantic") throw new me();
1558
- const O = { id: "scratch", title: "", type: "table", dataSource: m.source.dataSource, config: r }, A = po(O, "matrixTable", { catalog: C.fields, createId: t.newId }), F = A.status === "changed" ? (q = A.card.config) == null ? void 0 : q.matrix : void 0;
1559
- (A.status !== "changed" || A.leftOut.length || !F) && y({
1562
+ const $ = await t.loadCardSource({ domainId: f.domainId, datasetName: f.datasetName });
1563
+ if ($ || b({ code: "field_not_found", message: `The dataset "${f.datasetName}" isn't available.`, path: `${g}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), m.source.kind !== "semantic") throw new me();
1564
+ const O = { id: "scratch", title: "", type: "table", dataSource: m.source.dataSource, config: r }, A = po(O, "matrixTable", { catalog: $.fields, createId: t.newId }), F = A.status === "changed" ? (q = A.card.config) == null ? void 0 : q.matrix : void 0;
1565
+ (A.status !== "changed" || A.leftOut.length || !F) && b({
1560
1566
  code: "type_not_supported",
1561
1567
  message: A.status === "changed" && A.leftOut.length ? `These fields can't run in a Matrix: ${A.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1562
- path: `${b}.query`,
1568
+ path: `${g}.query`,
1563
1569
  fix: "Use plain dataset fields for a Matrix, or use a table."
1564
1570
  });
1565
- let R = F;
1566
- const P = f.datasetName;
1567
- for (const [M, U] of u.columns.entries()) {
1568
- const z = [...R.spec.rows, ...R.spec.columns].find(
1569
- (W) => go(W.field) === be(U, P)
1571
+ let T = F;
1572
+ const L = f.datasetName;
1573
+ for (const [M, G] of u.columns.entries()) {
1574
+ const z = [...T.spec.rows, ...T.spec.columns].find(
1575
+ (W) => go(W.field) === be(G, L)
1570
1576
  );
1571
- z || y({ code: "type_not_supported", message: `"${Ct(U)}" isn't a level of this Matrix.`, path: `${b}.matrix.columns[${M}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), R = bo(R, yo(R.spec, z.id, "columns")).config;
1577
+ z || b({ code: "type_not_supported", message: `"${Ct(G)}" isn't a level of this Matrix.`, path: `${g}.matrix.columns[${M}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), T = bo(T, yo(T.spec, z.id, "columns")).config;
1572
1578
  }
1573
- return { ...m, config: { matrix: R } };
1579
+ return { ...m, config: { matrix: T } };
1574
1580
  }, rt = /* @__PURE__ */ new Map(), dt = /* @__PURE__ */ new Map();
1575
- for (const [m, r] of S.entries()) {
1581
+ for (const [m, r] of k.entries()) {
1576
1582
  const f = `changes[${m}]`;
1577
1583
  try {
1578
1584
  switch (r.op) {
1579
1585
  case "card.add": {
1580
1586
  const u = r.position && typeof r.position == "object" ? (() => {
1581
- const Y = oe(r.position.after, `${f}.position.after`), j = xe(v).find(
1587
+ const Y = oe(r.position.after, `${f}.position.after`), j = xe(y).find(
1582
1588
  (ne) => ne.cardId === Y && ne.kind === "frameCard"
1583
1589
  );
1584
- return !j || j.kind !== "frameCard" ? y({
1590
+ return !j || j.kind !== "frameCard" ? b({
1585
1591
  code: "card_not_found",
1586
1592
  message: `${r.position.after} isn't a card on a grid sheet.`,
1587
1593
  path: `${f}.position.after`,
1588
1594
  fix: "Use a cardId from semaphor_get_dashboard_details on the same sheet, or a handle from this proposal."
1589
- }) : (r.sheetId && Re(r.sheetId, `${f}.sheetId`).id !== j.sheetId && y({
1595
+ }) : (r.sheetId && Re(r.sheetId, `${f}.sheetId`).id !== j.sheetId && b({
1590
1596
  code: "invalid_change",
1591
1597
  message: `position.after names a card on another sheet than ${r.sheetId}.`,
1592
1598
  path: `${f}.position.after`,
1593
1599
  fix: "Leave out sheetId, or name the card's sheet."
1594
1600
  }), { sheetId: j.sheetId, frameId: j.frameId });
1595
- })() : void 0, b = u ? Re(u.sheetId, `${f}.position.after`) : r.sheetId ? Re(r.sheetId, `${f}.sheetId`) : (() => {
1601
+ })() : void 0, g = u ? Re(u.sheetId, `${f}.position.after`) : r.sheetId ? Re(r.sheetId, `${f}.sheetId`) : (() => {
1596
1602
  const Y = nt();
1597
- return Y.length !== 1 && y({
1603
+ return Y.length !== 1 && b({
1598
1604
  code: Y.length ? "sheet_required" : "sheet_not_a_grid",
1599
1605
  message: Y.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
1600
1606
  path: `${f}.sheetId`,
1601
1607
  fix: Y.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1602
1608
  details: { sheets: Be() }
1603
1609
  }), Y[0];
1604
- })(), C = u ? { after: u.frameId } : typeof r.position == "string" ? r.position : void 0, O = C || r.width ? { ...C ? { position: C } : {}, ...r.width ? { width: r.width } : {} } : void 0, A = (Y) => {
1605
- const j = r.handle ?? `$card_${++w}`;
1606
- return h.has(j) && y({ code: "invalid_change", message: `The handle ${j} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(j, { kind: "card", id: Y.id, title: r.title }), d.push({ ref: j, kind: "card", id: Y.id, title: r.title, changeIndex: m }), j;
1610
+ })(), $ = u ? { after: u.frameId } : typeof r.position == "string" ? r.position : void 0, O = $ || r.width ? { ...$ ? { position: $ } : {}, ...r.width ? { width: r.width } : {} } : void 0, A = (Y) => {
1611
+ const j = r.handle ?? `$card_${++x}`;
1612
+ return h.has(j) && b({ code: "invalid_change", message: `The handle ${j} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(j, { kind: "card", id: Y.id, title: r.title }), d.push({ ref: j, kind: "card", id: Y.id, title: r.title, changeIndex: m }), j;
1607
1613
  };
1608
1614
  if (r.type === "text") {
1609
1615
  const Y = [...r.query ? ["query"] : [], ...r.matrix ? ["matrix"] : [], ...K(r)];
1610
- Y.length && y({ code: "invalid_change", message: `A text card takes no ${et(Y)}.`, path: f, fix: xa }), r.text === void 0 && y({ code: "invalid_change", message: "A text card needs its words in text.", path: `${f}.text`, fix: xa });
1611
- const j = ga({ text: r.text, context: { dashboard: v, place: { kind: "sheet", sheetId: b.id } }, path: `${f}.text` });
1616
+ Y.length && b({ code: "invalid_change", message: `A text card takes no ${et(Y)}.`, path: f, fix: xa }), r.text === void 0 && b({ code: "invalid_change", message: "A text card needs its words in text.", path: `${f}.text`, fix: xa });
1617
+ const j = ga({ text: r.text, context: { dashboard: y, place: { kind: "sheet", sheetId: g.id } }, path: `${f}.text` });
1612
1618
  j.ok || B(j.problems);
1613
1619
  const ne = Ho({
1614
1620
  id: t.newId(),
@@ -1616,84 +1622,84 @@ async function fs(e, a, t, s) {
1616
1622
  ...r.description ? { description: r.description } : {},
1617
1623
  richContent: j.ok && !j.unchanged ? j.richContent : { version: 1, blocks: [{ type: "paragraph", children: [] }] }
1618
1624
  });
1619
- $({ op: "card.add", sheetId: b.id, frame: { id: t.newId(), cards: [ne], activeCardId: ne.id }, ...O ? { placement: O } : {}, changeIndex: m }, f), A(ne);
1625
+ w({ op: "card.add", sheetId: g.id, frame: { id: t.newId(), cards: [ne], activeCardId: ne.id }, ...O ? { placement: O } : {}, changeIndex: m }, f), A(ne);
1620
1626
  break;
1621
1627
  }
1622
- (r.text !== void 0 || !r.query) && y({
1628
+ (r.text !== void 0 || !r.query) && b({
1623
1629
  code: "invalid_change",
1624
1630
  message: r.text !== void 0 ? `A ${r.type} card takes a query, not text.` : `A ${r.type} card needs a query.`,
1625
1631
  path: r.text !== void 0 ? `${f}.text` : `${f}.query`,
1626
1632
  fix: "Send query; text is for type text."
1627
1633
  });
1628
- const F = yt(r.query), R = F.query, P = r.type;
1629
- jt(P, R, r.matrix, f);
1630
- const q = await Ut(P, R, r.matrix, f), M = {
1634
+ const F = yt(r.query), T = F.query, L = r.type;
1635
+ Kt(L, T, r.matrix, f);
1636
+ const q = await Gt(L, T, r.matrix, f), M = {
1631
1637
  ...zo({ id: t.newId(), title: r.title, ...r.description ? { description: r.description } : {} }),
1632
1638
  type: q.type
1633
- }, U = ha(M, q);
1634
- U.ok || y({ code: "invalid_change", message: U.message, path: f });
1635
- const z = U.ok ? U.card : M;
1636
- Wt(z, R, r.matrix, f, r.title, q);
1639
+ }, G = ha(M, q);
1640
+ G.ok || b({ code: "invalid_change", message: G.message, path: f });
1641
+ const z = G.ok ? G.card : M;
1642
+ Wt(z, T, r.matrix, f, r.title, q);
1637
1643
  const W = { id: t.newId(), cards: [z], activeCardId: z.id };
1638
- $({ op: "card.add", sheetId: b.id, frame: W, ...O ? { placement: O } : {}, changeIndex: m }, f);
1644
+ w({ op: "card.add", sheetId: g.id, frame: W, ...O ? { placement: O } : {}, changeIndex: m }, f);
1639
1645
  const X = A(z);
1640
- c.push(z.id), await L({ cardId: z.id, cardRef: X, stated: F.calculations, index: m, path: f }), await N({
1646
+ c.push(z.id), await P({ cardId: z.id, cardRef: X, stated: F.calculations, index: m, path: f }), await N({
1641
1647
  cardId: z.id,
1642
1648
  cardRef: X,
1643
1649
  request: { settings: V(r) },
1644
- queryLabels: "sql" in R ? [] : qe(R),
1650
+ queryLabels: "sql" in T ? [] : qe(T),
1645
1651
  index: m,
1646
1652
  path: f
1647
1653
  });
1648
1654
  break;
1649
1655
  }
1650
1656
  case "card.update": {
1651
- const u = oe(r.cardId, `${f}.cardId`), b = ie(v, u);
1652
- if ((b == null ? void 0 : b.card.type) === "text") {
1653
- se(r, b, m, f);
1657
+ const u = oe(r.cardId, `${f}.cardId`), g = ie(y, u);
1658
+ if ((g == null ? void 0 : g.card.type) === "text") {
1659
+ se(r, g, m, f);
1654
1660
  break;
1655
1661
  }
1656
- r.text !== void 0 && y({ code: "invalid_change", message: `"${(b == null ? void 0 : b.card.title) ?? u}" isn't a text card, so it takes no text.`, path: `${f}.text`, fix: "Change its query; text is for text cards." });
1657
- const { card: C, read: O } = g(u, f);
1662
+ r.text !== void 0 && b({ code: "invalid_change", message: `"${(g == null ? void 0 : g.card.title) ?? u}" isn't a text card, so it takes no text.`, path: `${f}.text`, fix: "Change its query; text is for text cards." });
1663
+ const { card: $, read: O } = _(u, f);
1658
1664
  let A = !1, F = [];
1659
- const R = r.type && r.type !== ((Gt = Ee(C)) == null ? void 0 : Gt.type) ? ct(r.type) : void 0;
1660
- if (R && R !== C.type) {
1661
- const q = O.editable ? O.source : void 0, M = eo(C, R), U = M && q && q.kind === "semantic" ? (Qt = await t.loadCardSource({ domainId: q.domainId, datasetName: q.datasetName })) == null ? void 0 : Qt.fields : void 0, z = [], W = to(C, R, {
1662
- ...U ? { catalog: U } : {},
1663
- ...M && !U ? { catalogLoading: !0 } : {},
1665
+ const T = r.type && r.type !== ((Ut = Ee($)) == null ? void 0 : Ut.type) ? ct(r.type) : void 0;
1666
+ if (T && T !== $.type) {
1667
+ const q = O.editable ? O.source : void 0, M = eo($, T), G = M && q && q.kind === "semantic" ? (Qt = await t.loadCardSource({ domainId: q.domainId, datasetName: q.datasetName })) == null ? void 0 : Qt.fields : void 0, z = [], W = to($, T, {
1668
+ ...G ? { catalog: G } : {},
1669
+ ...M && !G ? { catalogLoading: !0 } : {},
1664
1670
  createId: () => {
1665
1671
  const X = t.newId();
1666
1672
  return z.push(X), X;
1667
1673
  }
1668
1674
  });
1669
- if (W.status === "refused" && y({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${f}.type`, fix: "Send a complete query with the type change." }), W.status === "changed") {
1675
+ if (W.status === "refused" && b({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${f}.type`, fix: "Send a complete query with the type change." }), W.status === "changed") {
1670
1676
  const X = [...W.leftOut, ...W.droppedPreferences];
1671
1677
  X.length && n.push({
1672
1678
  code: "type_change_drops",
1673
- message: `Changing "${C.title}" to ${r.type.replace(/_/g, " ")} leaves out ${X.join(", ")}.`,
1679
+ message: `Changing "${$.title}" to ${r.type.replace(/_/g, " ")} leaves out ${X.join(", ")}.`,
1674
1680
  path: `${f}.type`,
1675
1681
  details: { dropped: X }
1676
- }), $(
1677
- { op: "card.update", cardId: u, update: { kind: "retype", type: R, ...U ? { catalog: U } : {}, newIds: z }, changeIndex: m },
1682
+ }), w(
1683
+ { op: "card.update", cardId: u, update: { kind: "retype", type: T, ...G ? { catalog: G } : {}, newIds: z }, changeIndex: m },
1678
1684
  `${f}.type`
1679
1685
  ), A = !0;
1680
1686
  }
1681
1687
  }
1682
- const P = r.query ? yt(r.query) : void 0;
1688
+ const L = r.query ? yt(r.query) : void 0;
1683
1689
  if (r.query || r.matrix) {
1684
- const q = ie(v, u).card, M = we(q, { sql: !0, calculations: !1 }), U = M.editable ? yt(M.query).query : void 0, z = U, W = di(z, (P == null ? void 0 : P.query) ?? {}, `${f}.query`, (le) => {
1685
- if (le.code === "query_form_mismatch" && (P != null && P.calculations.length)) {
1686
- const pe = T(q, P.calculations, f), Ce = fa({ card: q, stated: pe, context: { path: f, cardRef: r.cardId, dates: ka(q) } });
1690
+ const q = ie(y, u).card, M = we(q, { sql: !0, calculations: !1 }), G = M.editable ? yt(M.query).query : void 0, z = G, W = di(z, (L == null ? void 0 : L.query) ?? {}, `${f}.query`, (le) => {
1691
+ if (le.code === "query_form_mismatch" && (L != null && L.calculations.length)) {
1692
+ const pe = R(q, L.calculations, f), Ce = fa({ card: q, stated: pe, context: { path: f, cardRef: r.cardId, dates: ka(q) } });
1687
1693
  if (!Ce.ok)
1688
1694
  throw o.push(...Ce.problems), new me();
1689
1695
  }
1690
- return y(le);
1696
+ return b(le);
1691
1697
  });
1692
- F = ri((P == null ? void 0 : P.query) ?? {}, W);
1698
+ F = ri((L == null ? void 0 : L.query) ?? {}, W);
1693
1699
  const X = ((Ht = Ee(q)) == null ? void 0 : Ht.type) ?? $t(q.type), Y = r.matrix ?? (M.editable ? M.matrix : void 0);
1694
- jt(X, W, Y, f);
1695
- const j = M.editable && U ? ao(U, W, M.matrix, Y) : void 0, ne = !j || j.aspects.length > 0, fe = j && !("sql" in W) ? qe(W).filter((le) => !ma(j, le.key.role)) : [], H = so(q, j, fe.map((le) => le.key.role));
1696
- H && Kt(H, f);
1700
+ Kt(X, W, Y, f);
1701
+ const j = M.editable && G ? ao(G, W, M.matrix, Y) : void 0, ne = !j || j.aspects.length > 0, fe = j && !("sql" in W) ? qe(W).filter((le) => !ma(j, le.key.role)) : [], H = so(q, j, fe.map((le) => le.key.role));
1702
+ H && jt(H, f);
1697
1703
  let de = W;
1698
1704
  if (j && !("sql" in W) && W.orderBy && !j.aspects.includes("order") && ["metric", "group_by", "detail"].some((le) => ma(j, le))) {
1699
1705
  const { orderBy: le, ...pe } = W;
@@ -1701,10 +1707,10 @@ async function fs(e, a, t, s) {
1701
1707
  }
1702
1708
  let Ae;
1703
1709
  if (ne) {
1704
- const le = !!(z && ms(z, (P == null ? void 0 : P.query) ?? {}) && (j != null && j.keptWindow)), pe = await Ut(X, de, Y, f, le), Ce = pe.type === ct(X) ? { ...pe, type: q.type } : pe;
1710
+ const le = !!(z && ms(z, (L == null ? void 0 : L.query) ?? {}) && (j != null && j.keptWindow)), pe = await Gt(X, de, Y, f, le), Ce = pe.type === ct(X) ? { ...pe, type: q.type } : pe;
1705
1711
  Ae = Ce;
1706
1712
  const da = j ? { ...Ce, change: j } : Ce, ge = ha(q, da);
1707
- if (ge.ok || Kt(ge, f), ge.ok && ge.droppedBindings.length && n.push({
1713
+ if (ge.ok || jt(ge, f), ge.ok && ge.droppedBindings.length && n.push({
1708
1714
  code: "control_binding_dropped",
1709
1715
  message: `"${q.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1710
1716
  path: `${f}.query`,
@@ -1719,11 +1725,11 @@ async function fs(e, a, t, s) {
1719
1725
  fix: "State a new label on the field ref if the old one no longer fits.",
1720
1726
  details: { columns: [{ label: Ve.label, field: Ve.field }] }
1721
1727
  });
1722
- $({ op: "card.update", cardId: u, update: { kind: "requery", query: da }, changeIndex: m }, `${f}.query`), A = !0;
1728
+ w({ op: "card.update", cardId: u, update: { kind: "requery", query: da }, changeIndex: m }, `${f}.query`), A = !0;
1723
1729
  }
1724
- fe.length && pa(ie(v, u).card, fe).changed.length && $({ op: "card.update", cardId: u, update: { kind: "relabel", labels: fe }, changeIndex: m }, `${f}.query`), (ne || fe.length) && Wt(ie(v, u).card, de, Y, f, q.title ?? "", Ae, j);
1730
+ fe.length && pa(ie(y, u).card, fe).changed.length && w({ op: "card.update", cardId: u, update: { kind: "relabel", labels: fe }, changeIndex: m }, `${f}.query`), (ne || fe.length) && Wt(ie(y, u).card, de, Y, f, q.title ?? "", Ae, j);
1725
1731
  }
1726
- (r.query || R) && await L({ cardId: u, cardRef: r.cardId, stated: (P == null ? void 0 : P.calculations) ?? [], index: m, path: f }) && (A = !0), (r.title !== void 0 || r.description !== void 0) && $(
1732
+ (r.query || T) && await P({ cardId: u, cardRef: r.cardId, stated: (L == null ? void 0 : L.calculations) ?? [], index: m, path: f }) && (A = !0), (r.title !== void 0 || r.description !== void 0) && w(
1727
1733
  {
1728
1734
  op: "card.update",
1729
1735
  cardId: u,
@@ -1742,180 +1748,180 @@ async function fs(e, a, t, s) {
1742
1748
  queryLabels: F,
1743
1749
  index: m,
1744
1750
  path: f
1745
- }), A && !c.includes(u) && c.push(u), d.push({ ref: r.cardId, kind: "card", id: u, title: C.title ?? "", changeIndex: m });
1751
+ }), A && !c.includes(u) && c.push(u), d.push({ ref: r.cardId, kind: "card", id: u, title: $.title ?? "", changeIndex: m });
1746
1752
  break;
1747
1753
  }
1748
1754
  case "card.remove": {
1749
- const u = oe(r.cardId, `${f}.cardId`), b = ie(v, u);
1750
- b || y({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${f}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), bt(b.frame) && b.frame.cards.length > 1 && y({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${f}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), b.frame.visualId && b.frame.cards.length > 1 && n.push({
1755
+ const u = oe(r.cardId, `${f}.cardId`), g = ie(y, u);
1756
+ g || b({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${f}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), bt(g.frame) && g.frame.cards.length > 1 && b({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${f}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), g.frame.visualId && g.frame.cards.length > 1 && n.push({
1751
1757
  code: "detaches_linked_visual",
1752
- message: `Removing "${b.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1758
+ message: `Removing "${g.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1753
1759
  path: f,
1754
- details: { cardIds: b.frame.cards.filter((C) => C.id !== u).map((C) => C.id) }
1755
- }), $({ op: "card.remove", cardId: u, changeIndex: m }, f), d.push({ ref: r.cardId, kind: "card", id: u, title: b.card.title ?? "", changeIndex: m });
1760
+ details: { cardIds: g.frame.cards.filter(($) => $.id !== u).map(($) => $.id) }
1761
+ }), w({ op: "card.remove", cardId: u, changeIndex: m }, f), d.push({ ref: r.cardId, kind: "card", id: u, title: g.card.title ?? "", changeIndex: m });
1756
1762
  break;
1757
1763
  }
1758
1764
  case "filter.add": {
1759
1765
  const u = await t.loadCardSource({ domainId: r.domainId, datasetName: r.datasetName });
1760
- u || y({ code: "field_not_found", message: `The dataset "${r.datasetName}" isn't available in this domain.`, path: `${f}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1761
- const b = ot(u.fields, r.field, r.datasetName);
1762
- b || y({
1766
+ u || b({ code: "field_not_found", message: `The dataset "${r.datasetName}" isn't available in this domain.`, path: `${f}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1767
+ const g = ot(u.fields, r.field, r.datasetName);
1768
+ g || b({
1763
1769
  code: "field_not_found",
1764
1770
  message: `"${r.field}" isn't a field of ${r.datasetName}.`,
1765
1771
  path: `${f}.field`,
1766
1772
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1767
- details: { available: u.fields.slice(0, 20).map((P) => P.name) }
1773
+ details: { available: u.fields.slice(0, 20).map((L) => L.name) }
1768
1774
  });
1769
- const C = r.sheetIds ? Vt(r.sheetIds, f) : void 0, O = Ta(C), A = Qo({
1770
- field: b,
1775
+ const $ = r.sheetIds ? Vt(r.sheetIds, f) : void 0, O = Ta($), A = Qo({
1776
+ field: g,
1771
1777
  dataSource: u.dataSource,
1772
1778
  connectionId: u.connectionId,
1773
1779
  connectionType: u.connectionType,
1774
1780
  scope: O,
1775
- dashboard: v,
1781
+ dashboard: y,
1776
1782
  createId: t.newId,
1777
1783
  label: r.label
1778
1784
  }), F = { ...A.filter };
1779
- F.dateSelectionMode || (F.type = r.selection ?? "multiple"), r.defaultValues && (F.defaultValues = r.defaultValues), r.defaultPeriod && (F.defaultDateFilter = Ra(r.defaultPeriod, b, `${f}.defaultPeriod`, y)), $({ op: "filter.add", input: { ...A, filter: F }, changeIndex: m }, f), rt.set(A.id, { sheetIds: C ?? "all", changeIndex: m }), (r.defaultValues !== void 0 || r.defaultPeriod !== void 0) && dt.set(A.id, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m });
1780
- const R = r.handle;
1781
- R && (h.has(R) && y({ code: "invalid_change", message: `The handle ${R} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(R, { kind: "filter", id: A.id, title: r.label })), d.push({ ref: R ?? A.id, kind: "filter", id: A.id, title: r.label, changeIndex: m });
1785
+ F.dateSelectionMode || (F.type = r.selection ?? "multiple"), r.defaultValues && (F.defaultValues = r.defaultValues), r.defaultPeriod && (F.defaultDateFilter = Ra(r.defaultPeriod, g, `${f}.defaultPeriod`, b)), w({ op: "filter.add", input: { ...A, filter: F }, changeIndex: m }, f), rt.set(A.id, { sheetIds: $ ?? "all", changeIndex: m }), (r.defaultValues !== void 0 || r.defaultPeriod !== void 0) && dt.set(A.id, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m });
1786
+ const T = r.handle;
1787
+ T && (h.has(T) && b({ code: "invalid_change", message: `The handle ${T} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(T, { kind: "filter", id: A.id, title: r.label })), d.push({ ref: T ?? A.id, kind: "filter", id: A.id, title: r.label, changeIndex: m });
1782
1788
  break;
1783
1789
  }
1784
1790
  case "filter.update": {
1785
- const u = te(r.filterId, `${f}.filterId`), b = Pe(v, u, void 0, I);
1786
- b != null && b.editable || y({
1791
+ const u = te(r.filterId, `${f}.filterId`), g = Pe(y, u, void 0, v);
1792
+ g != null && g.editable || b({
1787
1793
  code: "filter_not_editable",
1788
- message: b && !b.editable ? b.notEditable.message : "This filter can't be changed through the MCP.",
1794
+ message: g && !g.editable ? g.notEditable.message : "This filter can't be changed through the MCP.",
1789
1795
  path: `${f}.filterId`,
1790
1796
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1791
1797
  });
1792
- const C = (v.inputs ?? []).find((P) => P.id === u);
1793
- if ((C == null ? void 0 : C.kind) !== "filter" || !C.filter) throw new me();
1794
- const O = { ...C.filter };
1798
+ const $ = (y.inputs ?? []).find((L) => L.id === u);
1799
+ if (($ == null ? void 0 : $.kind) !== "filter" || !$.filter) throw new me();
1800
+ const O = { ...$.filter };
1795
1801
  let A = !1;
1796
1802
  r.selection && (O.type = r.selection), r.defaultValues !== void 0 && (A = !0, r.defaultValues === null ? delete O.defaultValues : O.defaultValues = r.defaultValues), r.defaultPeriod !== void 0 && (A = !0, r.defaultPeriod === null ? delete O.defaultDateFilter : O.defaultDateFilter = Ra(
1797
1803
  r.defaultPeriod,
1798
1804
  { dataType: O.dataType },
1799
1805
  `${f}.defaultPeriod`,
1800
- y
1806
+ b
1801
1807
  ));
1802
- const F = r.sheetIds === void 0 ? void 0 : r.sheetIds ? Vt(r.sheetIds, f) : "all", R = {
1808
+ const F = r.sheetIds === void 0 ? void 0 : r.sheetIds ? Vt(r.sheetIds, f) : "all", T = {
1803
1809
  ...r.label !== void 0 ? { label: r.label } : {},
1804
1810
  ...r.selection !== void 0 || A ? { definition: O } : {},
1805
1811
  // A change of sheets states the sheets; what else the scope says (the cards it leaves out,
1806
1812
  // whether it covers Document sheets) stays.
1807
1813
  ...F ? { scope: Po(
1808
- C.scope,
1814
+ $.scope,
1809
1815
  Ta(F === "all" ? void 0 : F),
1810
- new Set([...Ot(v).values()].filter((P) => P.sheetKind === "document").map((P) => P.sheetId))
1816
+ new Set([...Ot(y).values()].filter((L) => L.sheetKind === "document").map((L) => L.sheetId))
1811
1817
  ) } : {},
1812
1818
  ...A ? { values: { defaultChanged: !0, target: {} } } : {}
1813
1819
  };
1814
- $({ op: "filter.update", filterId: u, settings: R, changeIndex: m }, f), F && rt.set(u, { sheetIds: F, changeIndex: m }), A && dt.set(u, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m }), d.push({ ref: r.filterId, kind: "filter", id: u, title: C.label, changeIndex: m });
1820
+ w({ op: "filter.update", filterId: u, settings: T, changeIndex: m }, f), F && rt.set(u, { sheetIds: F, changeIndex: m }), A && dt.set(u, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m }), d.push({ ref: r.filterId, kind: "filter", id: u, title: $.label, changeIndex: m });
1815
1821
  break;
1816
1822
  }
1817
1823
  case "filter.remove": {
1818
- const u = te(r.filterId, `${f}.filterId`), b = ((zt = (v.inputs ?? []).find((C) => C.id === u)) == null ? void 0 : zt.label) ?? "";
1819
- $({ op: "filter.remove", filterId: u, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: b, changeIndex: m });
1824
+ const u = te(r.filterId, `${f}.filterId`), g = ((zt = (y.inputs ?? []).find(($) => $.id === u)) == null ? void 0 : zt.label) ?? "";
1825
+ w({ op: "filter.remove", filterId: u, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: g, changeIndex: m });
1820
1826
  break;
1821
1827
  }
1822
1828
  case "filter.bind": {
1823
- const u = te(r.filterId, `${f}.filterId`), b = Pe(v, u, void 0, I);
1824
- b != null && b.editable || y({
1829
+ const u = te(r.filterId, `${f}.filterId`), g = Pe(y, u, void 0, v);
1830
+ g != null && g.editable || b({
1825
1831
  code: "filter_not_editable",
1826
- message: b && !b.editable ? b.notEditable.message : "This filter can't be changed through the MCP.",
1832
+ message: g && !g.editable ? g.notEditable.message : "This filter can't be changed through the MCP.",
1827
1833
  path: `${f}.filterId`,
1828
1834
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1829
1835
  });
1830
- const C = Bt(r.cardId, `${f}.cardId`), O = Ua(v, C).card, A = Ie(v).findFilterInput({ inputId: u }), F = A && $e(A.input, O, I).reach === "relationshipApplied", R = await ui(O, r.field, t, `${f}.field`, y, F ? b.label : void 0);
1831
- $({ op: "filter.bind", filterId: u, cardId: C, binding: { kind: "bound", cardId: C, bindingId: t.newId(), target: R }, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: b.label, changeIndex: m });
1836
+ const $ = Bt(r.cardId, `${f}.cardId`), O = Ga(y, $).card, A = Ie(y).findFilterInput({ inputId: u }), F = A && $e(A.input, O, v).reach === "relationshipApplied", T = await ui(O, r.field, t, `${f}.field`, b, F ? g.label : void 0);
1837
+ w({ op: "filter.bind", filterId: u, cardId: $, binding: { kind: "bound", cardId: $, bindingId: t.newId(), target: T }, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: g.label, changeIndex: m });
1832
1838
  break;
1833
1839
  }
1834
1840
  case "layout.arrange": {
1835
1841
  const u = r.sheetId ? Re(r.sheetId, `${f}.sheetId`) : (() => {
1836
- const b = nt();
1837
- return b.length !== 1 && y({
1838
- code: b.length ? "sheet_required" : "sheet_not_a_grid",
1839
- message: b.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1842
+ const g = nt();
1843
+ return g.length !== 1 && b({
1844
+ code: g.length ? "sheet_required" : "sheet_not_a_grid",
1845
+ message: g.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1840
1846
  path: `${f}.sheetId`,
1841
- fix: b.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1847
+ fix: g.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1842
1848
  details: { sheets: Be() }
1843
- }), b[0];
1849
+ }), g[0];
1844
1850
  })();
1845
- $({ op: "layout.arrange", sheetId: u.id, ...r.keepOrder ? { keepOrder: !0 } : {}, changeIndex: m }, f);
1851
+ w({ op: "layout.arrange", sheetId: u.id, ...r.keepOrder ? { keepOrder: !0 } : {}, changeIndex: m }, f);
1846
1852
  break;
1847
1853
  }
1848
1854
  case "layout.tabs": {
1849
- const u = r.cardIds.map((q, M) => oe(q, `${f}.cardIds[${M}]`)), b = (q, M, U = `${f}.cardIds`) => y({ code: "layout_invalid", message: q, path: U, fix: M });
1850
- new Set(u).size !== u.length && b("Each card is named once in tabs.", "Name two or more different cards, each once.");
1851
- const C = u.map((q, M) => ie(v, q) ?? b("A Document section's card can't be a tab.", "Name cards on a grid sheet.", `${f}.cardIds[${M}]`)), O = C[0].sheet;
1852
- C.some((q) => q.sheet.id !== O.id) && b("Tabs are cards on one sheet.", "Name cards on one sheet; a card moves to another sheet in the editor."), C.some((q) => bt(q.frame) && q.frame.cards.length > 1) && b("A custom visual's inputs stay in its spot.", "Name cards that aren't a custom visual's inputs, or arrange them in the editor.");
1853
- const A = C[0].frame, F = C[0].card;
1855
+ const u = r.cardIds.map((q, M) => oe(q, `${f}.cardIds[${M}]`)), g = (q, M, G = `${f}.cardIds`) => b({ code: "layout_invalid", message: q, path: G, fix: M });
1856
+ new Set(u).size !== u.length && g("Each card is named once in tabs.", "Name two or more different cards, each once.");
1857
+ const $ = u.map((q, M) => ie(y, q) ?? g("A Document section's card can't be a tab.", "Name cards on a grid sheet.", `${f}.cardIds[${M}]`)), O = $[0].sheet;
1858
+ $.some((q) => q.sheet.id !== O.id) && g("Tabs are cards on one sheet.", "Name cards on one sheet; a card moves to another sheet in the editor."), $.some((q) => bt(q.frame) && q.frame.cards.length > 1) && g("A custom visual's inputs stay in its spot.", "Name cards that aren't a custom visual's inputs, or arrange them in the editor.");
1859
+ const A = $[0].frame, F = $[0].card;
1854
1860
  d.push({ ref: r.cardIds[0], kind: "card", id: F.id, title: F.title ?? "", changeIndex: m });
1855
- const R = Ba(A);
1856
- if (u.every((q, M) => R[M] === q)) break;
1857
- const P = [...new Map(C.map((q) => [q.frame.id, q.frame])).values()].filter((q) => q.visualId);
1858
- P.length && n.push({
1861
+ const T = Ba(A);
1862
+ if (u.every((q, M) => T[M] === q)) break;
1863
+ const L = [...new Map($.map((q) => [q.frame.id, q.frame])).values()].filter((q) => q.visualId);
1864
+ L.length && n.push({
1859
1865
  code: "detaches_linked_visual",
1860
1866
  message: "Moving these cards makes the tiles they leave or join local to this dashboard; they stop following their library visuals.",
1861
1867
  path: f,
1862
- details: { cardIds: P.flatMap((q) => q.cards.map((M) => M.id)) }
1863
- }), F.type === "kpi" && C.slice(1).some((q) => q.card.type === "text") && n.push({
1868
+ details: { cardIds: L.flatMap((q) => q.cards.map((M) => M.id)) }
1869
+ }), F.type === "kpi" && $.slice(1).some((q) => q.card.type === "text") && n.push({
1864
1870
  code: "tabs_show_as_kpi_info",
1865
1871
  message: `A text card in ${Va(F.title)}'s spot shows as the KPI's info, not as a tab.`,
1866
1872
  path: f,
1867
1873
  fix: "Put another card first if the text should be a tab of its own."
1868
- }), $({ op: "layout.tabs", sheetId: O.id, cardIds: u, changeIndex: m }, f);
1874
+ }), w({ op: "layout.tabs", sheetId: O.id, cardIds: u, changeIndex: m }, f);
1869
1875
  break;
1870
1876
  }
1871
1877
  case "layout.untab": {
1872
- const u = oe(r.cardId, `${f}.cardId`), b = ie(v, u);
1873
- if (b || y({ code: "layout_invalid", message: "A Document section's card has no spot of its own.", path: `${f}.cardId`, fix: "Name a card on a grid sheet." }), bt(b.frame) && b.frame.cards.length > 1 && y({ code: "layout_invalid", message: "A custom visual's inputs stay in its spot.", path: `${f}.cardId`, fix: "Arrange a custom visual in the editor." }), d.push({ ref: r.cardId, kind: "card", id: u, title: b.card.title ?? "", changeIndex: m }), b.frame.cards.length < 2) break;
1874
- b.frame.visualId && n.push({
1878
+ const u = oe(r.cardId, `${f}.cardId`), g = ie(y, u);
1879
+ if (g || b({ code: "layout_invalid", message: "A Document section's card has no spot of its own.", path: `${f}.cardId`, fix: "Name a card on a grid sheet." }), bt(g.frame) && g.frame.cards.length > 1 && b({ code: "layout_invalid", message: "A custom visual's inputs stay in its spot.", path: `${f}.cardId`, fix: "Arrange a custom visual in the editor." }), d.push({ ref: r.cardId, kind: "card", id: u, title: g.card.title ?? "", changeIndex: m }), g.frame.cards.length < 2) break;
1880
+ g.frame.visualId && n.push({
1875
1881
  code: "detaches_linked_visual",
1876
- message: `Taking "${b.card.title}" out of its tabs makes them local to this dashboard; they stop following their library visual.`,
1882
+ message: `Taking "${g.card.title}" out of its tabs makes them local to this dashboard; they stop following their library visual.`,
1877
1883
  path: f,
1878
- details: { cardIds: b.frame.cards.map((C) => C.id) }
1879
- }), $({ op: "layout.untab", cardId: u, newFrameId: t.newId(), changeIndex: m }, f);
1884
+ details: { cardIds: g.frame.cards.map(($) => $.id) }
1885
+ }), w({ op: "layout.untab", cardId: u, newFrameId: t.newId(), changeIndex: m }, f);
1880
1886
  break;
1881
1887
  }
1882
1888
  case "filter.exclude": {
1883
- const u = te(r.filterId, `${f}.filterId`), b = Bt(r.cardId, `${f}.cardId`), C = ((Yt = (v.inputs ?? []).find((O) => O.id === u)) == null ? void 0 : Yt.label) ?? "";
1884
- $({ op: "filter.exclude", filterId: u, cardId: b, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: C, changeIndex: m });
1889
+ const u = te(r.filterId, `${f}.filterId`), g = Bt(r.cardId, `${f}.cardId`), $ = ((Yt = (y.inputs ?? []).find((O) => O.id === u)) == null ? void 0 : Yt.label) ?? "";
1890
+ w({ op: "filter.exclude", filterId: u, cardId: g, changeIndex: m }, f), d.push({ ref: r.filterId, kind: "filter", id: u, title: $, changeIndex: m });
1885
1891
  break;
1886
1892
  }
1887
1893
  case "highlight.add":
1888
1894
  case "highlight.remove": {
1889
- const u = oe(r.cardId, `${f}.cardId`), { card: b } = g(u, f), { op: C, cardId: O, ...A } = r, F = await N({
1895
+ const u = oe(r.cardId, `${f}.cardId`), { card: g } = _(u, f), { op: $, cardId: O, ...A } = r, F = await N({
1890
1896
  cardId: u,
1891
1897
  cardRef: r.cardId,
1892
1898
  request: { highlights: r.op === "highlight.add" ? { add: [A] } : { remove: [r.ruleId] } },
1893
1899
  queryLabels: [],
1894
1900
  index: m,
1895
1901
  path: f
1896
- }), R = (Xt = (Jt = F == null ? void 0 : F.highlights) == null ? void 0 : Jt.add) == null ? void 0 : Xt[0];
1897
- d.push({ ref: r.cardId, kind: "card", id: u, title: b.title ?? "", changeIndex: m, ...R ? { ruleId: R.id } : {} });
1902
+ }), T = (Xt = (Jt = F == null ? void 0 : F.highlights) == null ? void 0 : Jt.add) == null ? void 0 : Xt[0];
1903
+ d.push({ ref: r.cardId, kind: "card", id: u, title: g.title ?? "", changeIndex: m, ...T ? { ruleId: T.id } : {} });
1898
1904
  break;
1899
1905
  }
1900
1906
  case "sheet.add": {
1901
1907
  const u = t.newId();
1902
- $({ op: "sheet.add", sheet: { id: u, title: r.title }, changeIndex: m }, f);
1903
- const b = r.handle ?? `$sheet_${++E}`;
1904
- h.has(b) && y({ code: "invalid_change", message: `The handle ${b} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(b, { kind: "sheet", id: u, title: r.title }), d.push({ ref: b, kind: "sheet", id: u, title: r.title, changeIndex: m });
1908
+ w({ op: "sheet.add", sheet: { id: u, title: r.title }, changeIndex: m }, f);
1909
+ const g = r.handle ?? `$sheet_${++E}`;
1910
+ h.has(g) && b({ code: "invalid_change", message: `The handle ${g} is defined twice.`, path: `${f}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(g, { kind: "sheet", id: u, title: r.title }), d.push({ ref: g, kind: "sheet", id: u, title: r.title, changeIndex: m });
1905
1911
  break;
1906
1912
  }
1907
1913
  case "sheet.update": {
1908
1914
  const u = it(r.sheetId, `${f}.sheetId`, { grid: !1 });
1909
- (u.title ?? "") !== r.title && $({ op: "sheet.update", sheetId: u.id, title: r.title, changeIndex: m }, f), d.push({ ref: r.sheetId, kind: "sheet", id: u.id, title: r.title, changeIndex: m });
1915
+ (u.title ?? "") !== r.title && w({ op: "sheet.update", sheetId: u.id, title: r.title, changeIndex: m }, f), d.push({ ref: r.sheetId, kind: "sheet", id: u.id, title: r.title, changeIndex: m });
1910
1916
  break;
1911
1917
  }
1912
1918
  case "dashboard.update": {
1913
- const u = r.title !== void 0 && r.title !== v.title ? r.title : void 0, b = r.description === null ? v.description ? null : void 0 : r.description !== v.description ? r.description : void 0;
1914
- (u !== void 0 || b !== void 0) && $(
1919
+ const u = r.title !== void 0 && r.title !== y.title ? r.title : void 0, g = r.description === null ? y.description ? null : void 0 : r.description !== y.description ? r.description : void 0;
1920
+ (u !== void 0 || g !== void 0) && w(
1915
1921
  {
1916
1922
  op: "dashboard.update",
1917
1923
  ...u !== void 0 ? { title: u } : {},
1918
- ...b !== void 0 ? { description: b } : {},
1924
+ ...g !== void 0 ? { description: g } : {},
1919
1925
  changeIndex: m
1920
1926
  },
1921
1927
  f
@@ -1923,19 +1929,19 @@ async function fs(e, a, t, s) {
1923
1929
  break;
1924
1930
  }
1925
1931
  case "dashboard.style": {
1926
- const { op: u, ...b } = r;
1927
- x ?? (x = t.readOrganizationAppearance ? t.readOrganizationAppearance() : Promise.resolve(null));
1928
- const { style: C, organizationAppearance: O } = za(v, await x), A = rn({ style: C, edit: b, layers: { organizationAppearance: O } });
1932
+ const { op: u, ...g } = r;
1933
+ S ?? (S = t.readOrganizationAppearance ? t.readOrganizationAppearance() : Promise.resolve(null));
1934
+ const { style: $, organizationAppearance: O } = za(y, await S), A = rn({ style: $, edit: g, layers: { organizationAppearance: O } });
1929
1935
  if (A.ok)
1930
- A.sentences.length && $({ op: "dashboard.style", style: A.style, sentences: A.sentences, changeIndex: m }, f);
1936
+ A.sentences.length && w({ op: "dashboard.style", style: A.style, sentences: A.sentences, changeIndex: m }, f);
1931
1937
  else {
1932
1938
  const { refusal: F } = A;
1933
- y({ code: F.code, message: F.message, path: F.field === "edit" ? f : `${f}.${F.field}`, fix: F.fix });
1939
+ b({ code: F.code, message: F.message, path: F.field === "edit" ? f : `${f}.${F.field}`, fix: F.fix });
1934
1940
  }
1935
1941
  break;
1936
1942
  }
1937
1943
  case "variable.add": {
1938
- Je(v, r.name) && y({ code: "variable_name_taken", message: `A variable named ${r.name} is already on this dashboard.`, path: `${f}.name`, fix: "Choose another name, or change it with variable.update." });
1944
+ Je(y, r.name) && b({ code: "variable_name_taken", message: `A variable named ${r.name} is already on this dashboard.`, path: `${f}.name`, fix: "Choose another name, or change it with variable.update." });
1939
1945
  const u = await wa(
1940
1946
  {
1941
1947
  id: t.newId(),
@@ -1947,24 +1953,24 @@ async function fs(e, a, t, s) {
1947
1953
  ...r.emptyText ? { emptyText: r.emptyText } : {},
1948
1954
  path: f
1949
1955
  },
1950
- v,
1956
+ y,
1951
1957
  Te
1952
1958
  );
1953
- $({ op: "variable.add", variable: u, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: u.id, title: u.name, changeIndex: m });
1959
+ w({ op: "variable.add", variable: u, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: u.id, title: u.name, changeIndex: m });
1954
1960
  break;
1955
1961
  }
1956
1962
  case "variable.update": {
1957
- const u = zn(v, r.name, `${f}.name`, Te), b = r.rename ?? u.name, C = {
1963
+ const u = zn(y, r.name, `${f}.name`, Te), g = r.rename ?? u.name, $ = {
1958
1964
  ...r.rename !== void 0 ? { name: r.rename } : {},
1959
1965
  ...r.label !== void 0 ? { label: r.label } : {},
1960
1966
  ...r.presentation !== void 0 ? { presentation: r.presentation } : {},
1961
1967
  ...r.emptyText !== void 0 ? { emptyText: r.emptyText } : {}
1962
- }, O = { ...v, variables: (v.variables ?? []).filter((R) => R.id !== u.id) };
1968
+ }, O = { ...y, variables: (y.variables ?? []).filter((T) => T.id !== u.id) };
1963
1969
  if (r.query) {
1964
- const R = await wa(
1970
+ const T = await wa(
1965
1971
  {
1966
1972
  id: u.id,
1967
- name: b,
1973
+ name: g,
1968
1974
  label: r.label === null ? void 0 : r.label ?? u.label,
1969
1975
  query: r.query,
1970
1976
  get: r.get ?? u.get,
@@ -1975,33 +1981,33 @@ async function fs(e, a, t, s) {
1975
1981
  O,
1976
1982
  Te
1977
1983
  );
1978
- C.query = R.query, C.get = R.get;
1984
+ $.query = T.query, $.get = T.get;
1979
1985
  } else if (r.get !== void 0) {
1980
- const R = Xn(u, r.get, O, Te, f);
1981
- C.query = R.query, C.get = R.get;
1986
+ const T = Xn(u, r.get, O, Te, f);
1987
+ $.query = T.query, $.get = T.get;
1982
1988
  }
1983
- Object.keys(C).length || y({ code: "invalid_change", message: `variable.update on ${u.name} changes nothing.`, path: f, fix: "Send rename, label, query, get, presentation or emptyText." });
1984
- const A = { ...u, ...Object.fromEntries(Object.entries(C).map(([R, P]) => [R, P ?? void 0])), id: u.id }, F = Dt(A, { ...O, variables: [...O.variables, A] });
1985
- F.length && B(cs(F, f)), $({ op: "variable.update", variableId: u.id, patch: C, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: u.id, title: b, changeIndex: m });
1989
+ Object.keys($).length || b({ code: "invalid_change", message: `variable.update on ${u.name} changes nothing.`, path: f, fix: "Send rename, label, query, get, presentation or emptyText." });
1990
+ const A = { ...u, ...Object.fromEntries(Object.entries($).map(([T, L]) => [T, L ?? void 0])), id: u.id }, F = Dt(A, { ...O, variables: [...O.variables, A] });
1991
+ F.length && B(cs(F, f)), w({ op: "variable.update", variableId: u.id, patch: $, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: u.id, title: g, changeIndex: m });
1986
1992
  break;
1987
1993
  }
1988
1994
  case "variable.remove": {
1989
- const u = Je(v, r.name);
1990
- u || y(ls(v, r.name, `${f}.name`));
1991
- const b = u, C = Zn(v, b.id);
1992
- C.places.length && y({
1995
+ const u = Je(y, r.name);
1996
+ u || b(ls(y, r.name, `${f}.name`));
1997
+ const g = u, $ = Zn(y, g.id);
1998
+ $.places.length && b({
1993
1999
  code: "variable_in_use",
1994
- message: `${b.name} is shown in ${C.words}.`,
2000
+ message: `${g.name} is shown in ${$.words}.`,
1995
2001
  path: `${f}.name`,
1996
2002
  fix: "Remove its chips first (card.update with text, or document.text.update), or ask the user whether the chips should read as missing.",
1997
- details: { places: C.places }
1998
- }), $({ op: "variable.remove", variableId: b.id, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: b.id, title: b.name, changeIndex: m });
2003
+ details: { places: $.places }
2004
+ }), w({ op: "variable.remove", variableId: g.id, changeIndex: m }, f), d.push({ ref: r.name, kind: "variable", id: g.id, title: g.name, changeIndex: m });
1999
2005
  break;
2000
2006
  }
2001
2007
  case "document.text.update": {
2002
- const u = it(r.sheetId, `${f}.sheetId`, { grid: !1 }), { edit: b, unchanged: C } = ei(r, v, u, f, Te);
2003
- if (d.push({ ref: r.sheetId, kind: "sheet", id: u.id, title: u.title ?? "", changeIndex: m }), C) break;
2004
- $({ op: "document.text", sheetId: u.id, edit: b, changeIndex: m }, f);
2008
+ const u = it(r.sheetId, `${f}.sheetId`, { grid: !1 }), { edit: g, unchanged: $ } = ei(r, y, u, f, Te);
2009
+ if (d.push({ ref: r.sheetId, kind: "sheet", id: u.id, title: u.title ?? "", changeIndex: m }), $) break;
2010
+ w({ op: "document.text", sheetId: u.id, edit: g, changeIndex: m }, f);
2005
2011
  break;
2006
2012
  }
2007
2013
  default: {
@@ -2014,7 +2020,7 @@ async function fs(e, a, t, s) {
2014
2020
  }
2015
2021
  }
2016
2022
  if (o.length) return { ok: !1, problems: o };
2017
- const ae = wt(e, i, { ...p, ...I });
2023
+ const ae = wt(e, i, { ...p, ...v });
2018
2024
  if (!ae.ok)
2019
2025
  return {
2020
2026
  ok: !1,
@@ -2030,43 +2036,43 @@ async function fs(e, a, t, s) {
2030
2036
  for (const m of c) {
2031
2037
  const r = ie(ae.dashboard, m);
2032
2038
  if (!r) continue;
2033
- const f = ((ea = i.find((O) => Pt(O) === m)) == null ? void 0 : ea.changeIndex) ?? 0, u = we(r.card, { sql: !0 }), b = ((ta = Ee(r.card)) == null ? void 0 : ta.type) ?? $t(r.card.type);
2034
- u.editable && ("sql" in u.query ? !!u.query.sql : "measures" in u.query ? u.query.measures.length > 0 : u.query.columns.length > 0) && ((aa = Fe[b]) == null ? void 0 : aa.forms.includes(tt(u.query))) || o.push({
2039
+ const f = ((ea = i.find((O) => Pt(O) === m)) == null ? void 0 : ea.changeIndex) ?? 0, u = we(r.card, { sql: !0 }), g = ((ta = Ee(r.card)) == null ? void 0 : ta.type) ?? $t(r.card.type);
2040
+ u.editable && ("sql" in u.query ? !!u.query.sql : "measures" in u.query ? u.query.measures.length > 0 : u.query.columns.length > 0) && ((aa = Fe[g]) == null ? void 0 : aa.forms.includes(tt(u.query))) || o.push({
2035
2041
  code: "type_not_supported",
2036
- message: `As changed, "${r.card.title}" would have no query a ${b.replace(/_/g, " ")} can run.`,
2042
+ message: `As changed, "${r.card.title}" would have no query a ${g.replace(/_/g, " ")} can run.`,
2037
2043
  path: `changes[${f}]`,
2038
- fix: `Send a complete query with the type change: ${((sa = Fe[b]) == null ? void 0 : sa.forms.map((O) => Ue[O]).join(" or ")) ?? "a measures query"}.`
2044
+ fix: `Send a complete query with the type change: ${((sa = Fe[g]) == null ? void 0 : sa.forms.map((O) => Ge[O]).join(" or ")) ?? "a measures query"}.`
2039
2045
  });
2040
2046
  }
2041
- if (o.push(...ni(e, ae.dashboard, i, rt, I)), o.push(...ii(ae.dashboard, dt, t.calendar)), o.length) return { ok: !1, problems: o };
2047
+ if (o.push(...ni(e, ae.dashboard, i, rt, v)), o.push(...ii(ae.dashboard, dt, t.calendar)), o.length) return { ok: !1, problems: o };
2042
2048
  for (const m of i) {
2043
2049
  if (m.op !== "filter.add" && !(m.op === "filter.update" && m.settings.scope)) continue;
2044
- const r = m.op === "filter.add" ? m.input.id : m.filterId, f = Pe(ae.dashboard, r, void 0, I);
2050
+ const r = m.op === "filter.add" ? m.input.id : m.filterId, f = Pe(ae.dashboard, r, void 0, v);
2045
2051
  if (!(f != null && f.editable)) continue;
2046
2052
  const u = async (A) => {
2047
2053
  const F = [];
2048
- for (const R of A) {
2049
- const P = R.datasetName ? await t.findRelationshipFields({
2054
+ for (const T of A) {
2055
+ const L = T.datasetName ? await t.findRelationshipFields({
2050
2056
  domainId: f.domainId,
2051
2057
  fromDataset: f.datasetName,
2052
2058
  field: f.field,
2053
- toDataset: R.datasetName
2059
+ toDataset: T.datasetName
2054
2060
  }) : [];
2055
- F.push({ ...R, suggestedFields: P });
2061
+ F.push({ ...T, suggestedFields: L });
2056
2062
  }
2057
2063
  return F;
2058
- }, b = (A) => A.map((F) => `"${F.title}"`).join(", "), C = f.notReached.filter((A) => A.reason === "sql_no_filter_reference"), O = f.notReached.filter((A) => A.reason !== "sql_no_filter_reference");
2059
- if (C.length && n.push({
2064
+ }, g = (A) => A.map((F) => `"${F.title}"`).join(", "), $ = f.notReached.filter((A) => A.reason === "sql_no_filter_reference"), O = f.notReached.filter((A) => A.reason !== "sql_no_filter_reference");
2065
+ if ($.length && n.push({
2060
2066
  code: "filter_not_reaching_cards",
2061
- message: `"${f.label}" doesn't reach ${C.length} SQL card${C.length === 1 ? "" : "s"} whose SQL doesn't use dashboard filters: ${b(C)}.`,
2067
+ message: `"${f.label}" doesn't reach ${$.length} SQL card${$.length === 1 ? "" : "s"} whose SQL doesn't use dashboard filters: ${g($)}.`,
2062
2068
  path: `changes[${m.changeIndex ?? 0}]`,
2063
2069
  fix: "To filter a SQL card, add {{ filters | where }} to its SQL (or {{ filters | and }} after an existing WHERE) with card.update, or leave it unfiltered.",
2064
- details: { cards: C }
2070
+ details: { cards: $ }
2065
2071
  }), O.length) {
2066
2072
  const A = await u(O);
2067
2073
  n.push({
2068
2074
  code: "filter_not_reaching_cards",
2069
- message: `"${f.label}" doesn't reach ${A.length} card${A.length === 1 ? "" : "s"} on its sheets: ${b(A)}.`,
2075
+ message: `"${f.label}" doesn't reach ${A.length} card${A.length === 1 ? "" : "s"} on its sheets: ${g(A)}.`,
2070
2076
  path: `changes[${m.changeIndex ?? 0}]`,
2071
2077
  fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
2072
2078
  details: { cards: A }
@@ -2074,7 +2080,7 @@ async function fs(e, a, t, s) {
2074
2080
  }
2075
2081
  if ((oa = f.sqlPending) != null && oa.length && n.push({
2076
2082
  code: "filter_reach_through_sql",
2077
- message: `"${f.label}" may reach ${f.sqlPending.length} SQL card${f.sqlPending.length === 1 ? "" : "s"} as ${f.sqlPending.length === 1 ? "its" : "their"} SQL decides: ${b(f.sqlPending)}.`,
2083
+ message: `"${f.label}" may reach ${f.sqlPending.length} SQL card${f.sqlPending.length === 1 ? "" : "s"} as ${f.sqlPending.length === 1 ? "its" : "their"} SQL decides: ${g(f.sqlPending)}.`,
2078
2084
  path: `changes[${m.changeIndex ?? 0}]`,
2079
2085
  fix: "Read the card's SQL to tell the user whether it uses this filter.",
2080
2086
  details: { cards: f.sqlPending }
@@ -2082,7 +2088,7 @@ async function fs(e, a, t, s) {
2082
2088
  const A = await u(f.relationshipPending);
2083
2089
  n.push({
2084
2090
  code: "filter_reach_through_relationships",
2085
- message: `"${f.label}" may reach ${A.length} card${A.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${b(A)}. Whether it applies is decided when each card runs.`,
2091
+ message: `"${f.label}" may reach ${A.length} card${A.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${g(A)}. Whether it applies is decided when each card runs.`,
2086
2092
  path: `changes[${m.changeIndex ?? 0}]`,
2087
2093
  fix: "Add filter.bind with one of the suggested fields to make it certain, or leave it to the relationships.",
2088
2094
  details: { cards: A }
@@ -2090,7 +2096,7 @@ async function fs(e, a, t, s) {
2090
2096
  }
2091
2097
  }
2092
2098
  if (t.readComparisonDates)
2093
- for (const [m, r] of k) {
2099
+ for (const [m, r] of I) {
2094
2100
  const f = (ia = ie(ae.dashboard, m)) == null ? void 0 : ia.card;
2095
2101
  if (!f) continue;
2096
2102
  const u = await t.readComparisonDates({ card: f, dashboard: ae.dashboard });
@@ -2101,7 +2107,7 @@ async function fs(e, a, t, s) {
2101
2107
  fix: "Add a timeWindow on that date, or a dashboard date filter that reaches the card."
2102
2108
  });
2103
2109
  }
2104
- const Is = ai(ae.dashboard, i, ae.descriptions, I);
2110
+ const Is = ai(ae.dashboard, i, ae.descriptions, v);
2105
2111
  return {
2106
2112
  ok: !0,
2107
2113
  operations: i,
@@ -2124,23 +2130,23 @@ function ai(e, a, t, s) {
2124
2130
  for (const l of o) {
2125
2131
  const c = Pt(l);
2126
2132
  if (!c || l.changeIndex === void 0) continue;
2127
- const h = n.filter((_) => _.reaches.includes(c)).map((_) => _.label), p = (_) => n.filter(
2128
- (S) => {
2129
- var y;
2130
- return "notReached" in S && ((y = S.notReached) == null ? void 0 : y.some((D) => D.cardId === c && D.reason === "sql_no_filter_reference" === _));
2133
+ const h = n.filter((C) => C.reaches.includes(c)).map((C) => C.label), p = (C) => n.filter(
2134
+ (k) => {
2135
+ var b;
2136
+ return "notReached" in k && ((b = k.notReached) == null ? void 0 : b.some((D) => D.cardId === c && D.reason === "sql_no_filter_reference" === C));
2131
2137
  }
2132
- ).map((S) => S.label), I = p(!1), v = p(!0), x = n.filter((_) => {
2133
- var S;
2134
- return (S = _.relationshipPending) == null ? void 0 : S.some((y) => y.cardId === c);
2135
- }).map((_) => _.label), w = n.filter((_) => {
2136
- var S;
2137
- return (S = _.sqlPending) == null ? void 0 : S.some((y) => y.cardId === c);
2138
- }).map((_) => _.label), E = [
2138
+ ).map((k) => k.label), v = p(!1), y = p(!0), S = n.filter((C) => {
2139
+ var k;
2140
+ return (k = C.relationshipPending) == null ? void 0 : k.some((b) => b.cardId === c);
2141
+ }).map((C) => C.label), x = n.filter((C) => {
2142
+ var k;
2143
+ return (k = C.sqlPending) == null ? void 0 : k.some((b) => b.cardId === c);
2144
+ }).map((C) => C.label), E = [
2139
2145
  ...h.length ? [`The dashboard's ${i(h)} filter${h.length === 1 ? " applies" : "s apply"} to it.`] : [],
2140
- ...I.length ? [`${i(I)} ${I.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
2141
- ...v.length ? [`${i(v)} ${v.length === 1 ? "doesn't" : "don't"} reach it: its SQL doesn't use dashboard filters.`] : [],
2142
- ...x.length ? [`${i(x)} may reach it through the domain's relationships.`] : [],
2143
- ...w.length ? [`${i(w)} may apply through its SQL.`] : []
2146
+ ...v.length ? [`${i(v)} ${v.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
2147
+ ...y.length ? [`${i(y)} ${y.length === 1 ? "doesn't" : "don't"} reach it: its SQL doesn't use dashboard filters.`] : [],
2148
+ ...S.length ? [`${i(S)} may reach it through the domain's relationships.`] : [],
2149
+ ...x.length ? [`${i(x)} may apply through its SQL.`] : []
2144
2150
  ];
2145
2151
  E.length && d.set(l.changeIndex, E.join(" "));
2146
2152
  }
@@ -2166,13 +2172,13 @@ function oi(e, a) {
2166
2172
  const n = t.matrix, i = vo(n), d = [...n.spec.rows, ...n.spec.columns], l = { ...n.presentation.levelLabels }, c = { ...n.presentation.measureLabels };
2167
2173
  for (const { key: h, label: p } of a) {
2168
2174
  if (h.role === "metric") {
2169
- const I = i.measures.findIndex((v) => He(v, h));
2170
- if (I < 0) continue;
2171
- c[n.spec.measures[I].id] = p;
2175
+ const v = i.measures.findIndex((y) => He(y, h));
2176
+ if (v < 0) continue;
2177
+ c[n.spec.measures[v].id] = p;
2172
2178
  } else {
2173
- const I = i.levels.findIndex((v) => He(v, h));
2174
- if (I < 0) continue;
2175
- l[d[I].id] = p;
2179
+ const v = i.levels.findIndex((y) => He(y, h));
2180
+ if (v < 0) continue;
2181
+ l[d[v].id] = p;
2176
2182
  }
2177
2183
  s.push(h);
2178
2184
  }
@@ -2180,63 +2186,63 @@ function oi(e, a) {
2180
2186
  }
2181
2187
  const o = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
2182
2188
  for (const { key: n, label: i } of a) {
2183
- const d = [...t[o[n.role]] ?? []], l = Ka(n.role, d).findIndex((c) => He(c, n));
2189
+ const d = [...t[o[n.role]] ?? []], l = ja(n.role, d).findIndex((c) => He(c, n));
2184
2190
  l < 0 || (d[l] = fn(d[l], i), t[o[n.role]] = d, s.push(n));
2185
2191
  }
2186
2192
  return { ...e, config: t, statedLabels: s };
2187
2193
  }
2188
2194
  function ni(e, a, t, s, o) {
2189
2195
  var E;
2190
- const n = [], i = new Map(xe(a).map((_) => [_.cardId, _])), d = Ot(a), l = Ie(a), c = (_) => {
2191
- var S, y;
2192
- return ((y = (S = a.sheets) == null ? void 0 : S.find((D) => D.id === _)) == null ? void 0 : y.title) ?? _;
2193
- }, h = (_, S) => {
2194
- var y;
2195
- return ((y = [...t].reverse().find((D) => Pt(D) === S || "filterId" in D && D.filterId === _)) == null ? void 0 : y.changeIndex) ?? 0;
2196
- }, p = (_, S) => {
2197
- const y = l.findFilterInput({ inputId: _ }).input, D = i.get(S), $ = `"${D.card.title ?? ""}"`, N = `"${y.label}"`;
2196
+ const n = [], i = new Map(xe(a).map((C) => [C.cardId, C])), d = Ot(a), l = Ie(a), c = (C) => {
2197
+ var k, b;
2198
+ return ((b = (k = a.sheets) == null ? void 0 : k.find((D) => D.id === C)) == null ? void 0 : b.title) ?? C;
2199
+ }, h = (C, k) => {
2200
+ var b;
2201
+ return ((b = [...t].reverse().find((D) => Pt(D) === k || "filterId" in D && D.filterId === C)) == null ? void 0 : b.changeIndex) ?? 0;
2202
+ }, p = (C, k) => {
2203
+ const b = l.findFilterInput({ inputId: C }).input, D = i.get(k), w = `"${D.card.title ?? ""}"`, N = `"${b.label}"`;
2198
2204
  if (D.kind === "documentSectionCard")
2199
2205
  return {
2200
2206
  reason: "document_section",
2201
- message: `${$} is in a Document section, which takes only the filters its Document sheet shows.`,
2207
+ message: `${w} is in a Document section, which takes only the filters its Document sheet shows.`,
2202
2208
  fix: "Tell the user to change where the filter shows in the editor."
2203
2209
  };
2204
- const g = d.get(D.sheetId);
2205
- if (g && !Ga(y, g))
2210
+ const _ = d.get(D.sheetId);
2211
+ if (_ && !Ua(b, _))
2206
2212
  return {
2207
2213
  reason: "outside_sheets",
2208
- message: `${N} isn't shown on "${c(D.sheetId)}", so it can't filter ${$}.`,
2214
+ message: `${N} isn't shown on "${c(D.sheetId)}", so it can't filter ${w}.`,
2209
2215
  fix: "Show it on that sheet first with filter.update sheetIds (null for every sheet), in the same proposal."
2210
2216
  };
2211
- const k = Io(y, D.card);
2212
- switch (k.status) {
2217
+ const I = Io(b, D.card);
2218
+ switch (I.status) {
2213
2219
  case "incompatible":
2214
- return { reason: "incompatible_field", message: `${$} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2220
+ return { reason: "incompatible_field", message: `${w} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2215
2221
  case "stale":
2216
2222
  return {
2217
2223
  reason: "field_not_on_card",
2218
- message: `${$} doesn't have the field ${N} is bound to.`,
2224
+ message: `${w} doesn't have the field ${N} is bound to.`,
2219
2225
  fix: "Bind a field the card has (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2220
2226
  };
2221
2227
  case "ambiguous":
2222
2228
  return {
2223
2229
  reason: "ambiguous_field",
2224
- message: `${$} has more than one field ${N} could filter.`,
2230
+ message: `${w} has more than one field ${N} could filter.`,
2225
2231
  fix: "Bind the field it should use (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2226
2232
  };
2227
2233
  case "relationship": {
2228
- const T = $e(y, D.card, o);
2229
- return T.reach === "blocked" ? {
2234
+ const R = $e(b, D.card, o);
2235
+ return R.reach === "blocked" ? {
2230
2236
  reason: "relationship_route_changed",
2231
- message: `The relationships ${$} used for ${N} changed in the domain.`,
2237
+ message: `The relationships ${w} used for ${N} changed in the domain.`,
2232
2238
  fix: "Tell the user to choose the relationship again in the filter's Cards tab."
2233
- } : T.reason === "relationship_ambiguous" ? {
2239
+ } : R.reason === "relationship_ambiguous" ? {
2234
2240
  reason: "relationship_ambiguous",
2235
- message: `${N} connects to ${$} through more than one path.`,
2241
+ message: `${N} connects to ${w} through more than one path.`,
2236
2242
  fix: "Tell the user to choose a path in the filter's Cards tab, or bind a field the card has (filter.bind)."
2237
2243
  } : {
2238
2244
  reason: "relationship_pending",
2239
- message: `${N} may reach ${$} through the domain's relationships; whether it applies is decided when the card runs.`,
2245
+ message: `${N} may reach ${w} through the domain's relationships; whether it applies is decided when the card runs.`,
2240
2246
  fix: "Bind a field the card has (filter.bind) to make it certain, or leave it to the relationships."
2241
2247
  };
2242
2248
  }
@@ -2247,59 +2253,59 @@ function ni(e, a, t, s, o) {
2247
2253
  case "automatic":
2248
2254
  case "passthrough":
2249
2255
  case "notApplicable":
2250
- return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${$}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2256
+ return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${w}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2251
2257
  default: {
2252
- const T = k;
2253
- throw new Error(`Unhandled filter card target ${String(T.status)}`);
2258
+ const R = I;
2259
+ throw new Error(`Unhandled filter card target ${String(R.status)}`);
2254
2260
  }
2255
2261
  }
2256
- }, I = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
2257
- for (const _ of t)
2258
- (_.op === "filter.bind" || _.op === "filter.exclude") && v.set(`${_.filterId}|${_.cardId}`, _);
2259
- for (const _ of v.values()) {
2260
- const S = Pe(a, _.filterId, void 0, o), y = i.get(_.cardId);
2261
- if (!S || !y) continue;
2262
- const D = S.reaches.includes(_.cardId);
2263
- if (_.op === "filter.bind" ? D : !D) continue;
2264
- I.add(`${_.filterId}|${_.cardId}`);
2265
- const $ = _.op === "filter.bind" ? p(_.filterId, _.cardId) : { reason: "filter_settings_override", message: `"${S.label}" would still filter "${y.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2262
+ }, v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Map();
2263
+ for (const C of t)
2264
+ (C.op === "filter.bind" || C.op === "filter.exclude") && y.set(`${C.filterId}|${C.cardId}`, C);
2265
+ for (const C of y.values()) {
2266
+ const k = Pe(a, C.filterId, void 0, o), b = i.get(C.cardId);
2267
+ if (!k || !b) continue;
2268
+ const D = k.reaches.includes(C.cardId);
2269
+ if (C.op === "filter.bind" ? D : !D) continue;
2270
+ v.add(`${C.filterId}|${C.cardId}`);
2271
+ const w = C.op === "filter.bind" ? p(C.filterId, C.cardId) : { reason: "filter_settings_override", message: `"${k.label}" would still filter "${b.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2266
2272
  n.push({
2267
2273
  code: "filter_not_editable",
2268
- message: $.message,
2269
- path: `changes[${_.changeIndex ?? 0}]`,
2270
- fix: $.fix,
2271
- details: { reason: $.reason, cardId: _.cardId }
2274
+ message: w.message,
2275
+ path: `changes[${C.changeIndex ?? 0}]`,
2276
+ fix: w.fix,
2277
+ details: { reason: w.reason, cardId: C.cardId }
2272
2278
  });
2273
2279
  }
2274
- for (const [_, S] of s) {
2275
- const y = Pe(a, _, void 0, o);
2276
- if (!y) continue;
2277
- const D = y.editable && ((E = y.exceptSheetIds) == null ? void 0 : E.some((g) => {
2278
- var k;
2279
- return ((k = d.get(g)) == null ? void 0 : k.sheetKind) === "dashboard";
2280
- })), $ = y.editable && !D ? y.sheetIds : void 0, N = S.sheetIds === "all" ? "all" : [...S.sheetIds].sort();
2281
- Ne($ === "all" || !$ ? $ : [...$].sort(), N) || n.push({
2280
+ for (const [C, k] of s) {
2281
+ const b = Pe(a, C, void 0, o);
2282
+ if (!b) continue;
2283
+ const D = b.editable && ((E = b.exceptSheetIds) == null ? void 0 : E.some((_) => {
2284
+ var I;
2285
+ return ((I = d.get(_)) == null ? void 0 : I.sheetKind) === "dashboard";
2286
+ })), w = b.editable && !D ? b.sheetIds : void 0, N = k.sheetIds === "all" ? "all" : [...k.sheetIds].sort();
2287
+ Ne(w === "all" || !w ? w : [...w].sort(), N) || n.push({
2282
2288
  code: "filter_not_editable",
2283
- message: `"${y.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2284
- path: `changes[${S.changeIndex}].sheetIds`,
2289
+ message: `"${b.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2290
+ path: `changes[${k.changeIndex}].sheetIds`,
2285
2291
  fix: "Tell the user to change the filter's sheets in the editor.",
2286
- details: { reason: "filter_settings_override", ...$ ? { sheetIds: $ } : {} }
2292
+ details: { reason: "filter_settings_override", ...w ? { sheetIds: w } : {} }
2287
2293
  });
2288
2294
  }
2289
- const x = Ie(e), w = (_) => _ === "blocked" || _ === "ambiguous";
2290
- for (const _ of l.inputs) {
2291
- const S = _.input.id;
2292
- for (const y of l.reachedCards({ inputId: S })) {
2293
- if (I.has(`${S}|${y.cardId}`) || !w($e(_.input, y.card, o).reach)) continue;
2294
- const D = x.findFilterInput({ inputId: S }), $ = D && x.reachedCards({ inputId: S }).find((g) => g.cardId === y.cardId);
2295
- if (D && $ && w($e(D.input, $.card, o).reach)) continue;
2296
- const N = p(S, y.cardId);
2295
+ const S = Ie(e), x = (C) => C === "blocked" || C === "ambiguous";
2296
+ for (const C of l.inputs) {
2297
+ const k = C.input.id;
2298
+ for (const b of l.reachedCards({ inputId: k })) {
2299
+ if (v.has(`${k}|${b.cardId}`) || !x($e(C.input, b.card, o).reach)) continue;
2300
+ const D = S.findFilterInput({ inputId: k }), w = D && S.reachedCards({ inputId: k }).find((_) => _.cardId === b.cardId);
2301
+ if (D && w && x($e(D.input, w.card, o).reach)) continue;
2302
+ const N = p(k, b.cardId);
2297
2303
  n.push({
2298
2304
  code: "invalid_change",
2299
- message: `${N.message} The card would stop showing data while "${_.input.label}" has a value.`,
2300
- path: `changes[${h(S, y.cardId)}]`,
2305
+ message: `${N.message} The card would stop showing data while "${C.input.label}" has a value.`,
2306
+ path: `changes[${h(k, b.cardId)}]`,
2301
2307
  fix: N.fix,
2302
- details: { reason: N.reason, filterId: S, cardId: y.cardId }
2308
+ details: { reason: N.reason, filterId: k, cardId: b.cardId }
2303
2309
  });
2304
2310
  }
2305
2311
  }
@@ -2310,22 +2316,22 @@ function ii(e, a, t) {
2310
2316
  for (const [n, i] of a) {
2311
2317
  const d = o.findFilterInput({ inputId: n });
2312
2318
  if (!d) continue;
2313
- const l = Ha({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: t }).value, c = d.input.filter.dateSelectionMode, h = c === "day" ? "its date picker takes one day" : c === "months" ? "its month picker takes one whole month" : void 0, p = (I, v) => s.push({
2319
+ const l = Ha({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: t }).value, c = d.input.filter.dateSelectionMode, h = c === "day" ? "its date picker takes one day" : c === "months" ? "its month picker takes one whole month" : void 0, p = (v, y) => s.push({
2314
2320
  code: "filter_not_editable",
2315
- message: I,
2321
+ message: v,
2316
2322
  path: `changes[${i.changeIndex}]`,
2317
- fix: v,
2323
+ fix: y,
2318
2324
  details: { reason: "default_not_applied", ...c ? { datePicker: c } : {} }
2319
2325
  });
2320
2326
  if (i.period) {
2321
- const I = Ja(l && "relativeMeta" in l ? l.relativeMeta : void 0);
2322
- (!I || tn(i.period) || !an(I, i.period)) && p(
2327
+ const v = Ja(l && "relativeMeta" in l ? l.relativeMeta : void 0);
2328
+ (!v || tn(i.period) || !an(v, i.period)) && p(
2323
2329
  `"${d.input.label}" wouldn't load with that default${h ? `: ${h}` : ""}.`,
2324
2330
  h ? "Ask for a default the picker can take, or tell the user to make it a date range in the editor." : "Tell the user to change the filter's default in the editor."
2325
2331
  );
2326
2332
  } else if (i.values) {
2327
- const I = (v) => JSON.stringify((v ?? []).map(String).sort());
2328
- (!l || I(l.values) !== I(i.values)) && p(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2333
+ const v = (y) => JSON.stringify((y ?? []).map(String).sort());
2334
+ (!l || v(l.values) !== v(i.values)) && p(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2329
2335
  } else
2330
2336
  (Ya(d.input.filter.dataType) ? i.period === null : i.values === null) && l && p(`"${d.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2331
2337
  }
@@ -2358,8 +2364,8 @@ function ri(e, a) {
2358
2364
  function di(e, a, t, s) {
2359
2365
  const o = Object.fromEntries(Object.entries(a).filter(([, p]) => p != null)), n = tt(o), i = tt(e), d = (p) => Sa[p].safeParse(o);
2360
2366
  if (!e || n && n !== i) {
2361
- const p = n ?? i, I = p ? d(p) : void 0;
2362
- return I != null && I.success ? I.data : s({
2367
+ const p = n ?? i, v = p ? d(p) : void 0;
2368
+ return v != null && v.success ? v.data : s({
2363
2369
  code: e ? "query_form_mismatch" : "type_not_supported",
2364
2370
  message: e ? "This patch changes the query's form (measures, records or SQL) without a complete query." : "This card's current query can't be patched; send a complete query.",
2365
2371
  path: t,
@@ -2367,8 +2373,8 @@ function di(e, a, t, s) {
2367
2373
  });
2368
2374
  }
2369
2375
  const l = { ...e };
2370
- for (const [p, I] of Object.entries(a))
2371
- I !== void 0 && (I === null ? delete l[p] : l[p] = I);
2376
+ for (const [p, v] of Object.entries(a))
2377
+ v !== void 0 && (v === null ? delete l[p] : l[p] = v);
2372
2378
  const c = ms(e, a);
2373
2379
  c && delete l.timeWindow;
2374
2380
  const h = Sa[i].safeParse(l);
@@ -2410,7 +2416,7 @@ function ci(e) {
2410
2416
  return (s = (t = (a = e == null ? void 0 : e.filters) == null ? void 0 : a.conditions) == null ? void 0 : t.find((o) => o.relativeMeta)) == null ? void 0 : s.field;
2411
2417
  }
2412
2418
  async function ui(e, a, t, s, o, n) {
2413
- const i = no(e), d = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((w) => w.source) : [], l = he(e), c = typeof a == "string" ? (l == null ? void 0 : l.kind) === "semantic" ? l.datasetName : void 0 : a.datasetName, h = d.find((w) => w.kind === "semantic" && Tt(w.datasetName) === Tt(c));
2419
+ const i = no(e), d = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((x) => x.source) : [], l = he(e), c = typeof a == "string" ? (l == null ? void 0 : l.kind) === "semantic" ? l.datasetName : void 0 : a.datasetName, h = d.find((x) => x.kind === "semantic" && Tt(x.datasetName) === Tt(c));
2414
2420
  if ((!h || h.kind !== "semantic") && n)
2415
2421
  return o({
2416
2422
  code: "field_not_found",
@@ -2425,13 +2431,13 @@ async function ui(e, a, t, s, o, n) {
2425
2431
  path: s,
2426
2432
  fix: "Name a field of the card's own dataset, or { name, datasetName } for a dataset its query joins."
2427
2433
  });
2428
- const p = await t.loadCardSource({ domainId: h.domainId, datasetName: h.datasetName }), I = typeof a == "string" ? a : a.name, v = p ? ot(p.fields, I, h.datasetName) : void 0, x = v ? Yo(h, { column_name: v.name, data_type: v.dataType, ...v.sourceField ? { sourceField: v.sourceField } : {} }) : void 0;
2429
- return x || o({
2434
+ const p = await t.loadCardSource({ domainId: h.domainId, datasetName: h.datasetName }), v = typeof a == "string" ? a : a.name, y = p ? ot(p.fields, v, h.datasetName) : void 0, S = y ? Yo(h, { column_name: y.name, data_type: y.dataType, ...y.sourceField ? { sourceField: y.sourceField } : {} }) : void 0;
2435
+ return S || o({
2430
2436
  code: "field_not_found",
2431
- message: `"${I}" isn't a field of ${h.datasetName}.`,
2437
+ message: `"${v}" isn't a field of ${h.datasetName}.`,
2432
2438
  path: s,
2433
2439
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
2434
- details: { available: ((p == null ? void 0 : p.fields) ?? []).slice(0, 20).map((w) => w.name) }
2440
+ details: { available: ((p == null ? void 0 : p.fields) ?? []).slice(0, 20).map((x) => x.name) }
2435
2441
  });
2436
2442
  }
2437
2443
  const fi = {
@@ -2494,59 +2500,59 @@ function pi(e) {
2494
2500
  }
2495
2501
  const gi = 50;
2496
2502
  function Or(e, a) {
2497
- var $, N;
2498
- const t = ($ = a.sheetIds) != null && $.length ? new Set(a.sheetIds) : void 0, s = (N = a.cardIds) != null && N.length ? new Set(a.cardIds) : void 0, o = (e.sheets ?? []).filter((g) => !t || t.has(g.id)), n = xe(e).filter(
2499
- (g) => (!t || t.has(g.sheetId)) && (!s || s.has(g.cardId))
2503
+ var w, N;
2504
+ const t = (w = a.sheetIds) != null && w.length ? new Set(a.sheetIds) : void 0, s = (N = a.cardIds) != null && N.length ? new Set(a.cardIds) : void 0, o = (e.sheets ?? []).filter((_) => !t || t.has(_.id)), n = xe(e).filter(
2505
+ (_) => (!t || t.has(_.sheetId)) && (!s || s.has(_.cardId))
2500
2506
  ), i = n.length > (a.maxQueryCards ?? gi), d = new Map(
2501
- (e.sheets ?? []).flatMap((g) => (g.frames ?? []).map((k) => [k.id, k]))
2502
- ), l = /* @__PURE__ */ new Map(), c = (g) => {
2503
- (g == null ? void 0 : g.kind) === "semantic" && l.set(`${g.domainId}|${g.datasetName}`, { domainId: g.domainId, datasetName: g.datasetName });
2507
+ (e.sheets ?? []).flatMap((_) => (_.frames ?? []).map((I) => [I.id, I]))
2508
+ ), l = /* @__PURE__ */ new Map(), c = (_) => {
2509
+ (_ == null ? void 0 : _.kind) === "semantic" && l.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2504
2510
  }, h = new Map(
2505
- (e.sheets ?? []).map((g) => [g.id, _t({ dashboard: e, place: { kind: g.kind === "document" ? "document" : "sheet", sheetId: g.id } })])
2506
- ), p = (g) => ({ catalog: g, inputs: e.inputs, variables: e.variables }), I = (g) => p(h.get(g)), v = /* @__PURE__ */ new Map(), x = (g, k) => {
2507
- if (g.kind === "document") return I(g.id);
2508
- const T = _t({ dashboard: e, place: { kind: "sheet", sheetId: g.id, cardId: k } });
2509
- return v.set(`${g.id}:${k}`, T), p(T);
2510
- }, w = o.map((g) => ({
2511
- sheetId: g.id,
2512
- title: g.title ?? "",
2513
- kind: g.kind === "document" ? "document" : "dashboard",
2514
- ...g.kind === "document" ? yi(g, I(g.id)) : { layout: _i(g) },
2515
- cards: n.filter((k) => k.sheetId === g.id).map((k) => {
2511
+ (e.sheets ?? []).map((_) => [_.id, _t({ dashboard: e, place: { kind: _.kind === "document" ? "document" : "sheet", sheetId: _.id } })])
2512
+ ), p = (_) => ({ catalog: _, inputs: e.inputs, variables: e.variables }), v = (_) => p(h.get(_)), y = /* @__PURE__ */ new Map(), S = (_, I) => {
2513
+ if (_.kind === "document") return v(_.id);
2514
+ const R = _t({ dashboard: e, place: { kind: "sheet", sheetId: _.id, cardId: I } });
2515
+ return y.set(`${_.id}:${I}`, R), p(R);
2516
+ }, x = o.map((_) => ({
2517
+ sheetId: _.id,
2518
+ title: _.title ?? "",
2519
+ kind: _.kind === "document" ? "document" : "dashboard",
2520
+ ..._.kind === "document" ? yi(_, v(_.id)) : { layout: _i(_) },
2521
+ cards: n.filter((I) => I.sheetId === _.id).map((I) => {
2516
2522
  var oe;
2517
- const T = k.card, L = k.kind === "frameCard" ? (oe = d.get(k.frameId)) == null ? void 0 : oe.visualId : void 0, V = L ? { linkedVisualId: L } : {}, K = { cardId: k.cardId, title: T.title ?? "" };
2518
- if (k.kind !== "frameCard") {
2519
- const te = he(T);
2523
+ const R = I.card, P = I.kind === "frameCard" ? (oe = d.get(I.frameId)) == null ? void 0 : oe.visualId : void 0, V = P ? { linkedVisualId: P } : {}, K = { cardId: I.cardId, title: R.title ?? "" };
2524
+ if (I.kind !== "frameCard") {
2525
+ const te = he(R);
2520
2526
  return c(te), {
2521
2527
  ...K,
2522
- ...Ge(T),
2528
+ ...Ue(R),
2523
2529
  ...te ? { source: te } : {},
2524
2530
  editable: !1,
2525
- notEditable: k.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2531
+ notEditable: I.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2526
2532
  reason: "not_expressible",
2527
2533
  message: "This card isn't in a tile, so it can't be changed through the MCP. Change it in the editor.",
2528
2534
  detail: "a card outside a tile"
2529
2535
  }
2530
2536
  };
2531
2537
  }
2532
- if (T.type === "text") {
2533
- const te = ja(T, x(g, T.id));
2534
- return te.editable ? { ...K, type: "text", ...V, editable: !0, text: te.text, ...te.editorOnly.length ? { editorOnly: te.editorOnly } : {} } : { ...K, ...Ge(T), ...V, editable: !1, notEditable: { reason: "text", message: te.message } };
2538
+ if (R.type === "text") {
2539
+ const te = Ka(R, S(_, R.id));
2540
+ return te.editable ? { ...K, type: "text", ...V, editable: !0, text: te.text, ...te.editorOnly.length ? { editorOnly: te.editorOnly } : {} } : { ...K, ...Ue(R), ...V, editable: !1, notEditable: { reason: "text", message: te.message } };
2535
2541
  }
2536
- const B = we(T, { sql: a.sql });
2542
+ const B = we(R, { sql: a.sql });
2537
2543
  if (c(B.source), !B.editable)
2538
2544
  return {
2539
2545
  ...K,
2540
- ...Ge(T),
2546
+ ...Ue(R),
2541
2547
  ...B.source ? { source: B.source } : {},
2542
2548
  ...V,
2543
2549
  editable: !1,
2544
2550
  notEditable: { reason: B.reason, message: B.message, ...B.detail ? { detail: B.detail } : {} }
2545
2551
  };
2546
- const se = i ? void 0 : Ft(T);
2552
+ const se = i ? void 0 : Ft(R);
2547
2553
  return {
2548
2554
  ...K,
2549
- ...Ge(T),
2555
+ ...Ue(R),
2550
2556
  type: B.type,
2551
2557
  source: B.source,
2552
2558
  ...V,
@@ -2562,27 +2568,27 @@ function Or(e, a) {
2562
2568
  })), E = as(e, es(a.calendar, a.updatedAt), {
2563
2569
  ...a.relationshipReach ? { relationshipReach: a.relationshipReach } : {}
2564
2570
  });
2565
- for (const g of E)
2566
- g.editable && l.set(`${g.domainId}|${g.datasetName}`, { domainId: g.domainId, datasetName: g.datasetName });
2567
- const _ = vi(e, a, new Map([...h, ...v]));
2568
- for (const g of e.variables ?? []) {
2569
- const k = kt(g);
2570
- (k == null ? void 0 : k.kind) === "semantic" && l.set(`${k.domainId}|${k.datasetName}`, { domainId: k.domainId, datasetName: k.datasetName });
2571
- }
2572
- const S = (e.variables ?? []).filter((g) => {
2573
- var k;
2574
- return ((k = kt(g)) == null ? void 0 : k.kind) === "physical";
2575
- }).map((g) => g.name), y = (e.sheets ?? []).some(
2576
- (g) => {
2577
- var k;
2578
- return (k = g.document) == null ? void 0 : k.sections.some((T) => {
2579
- var L, V;
2580
- return T.type === "text" && (((L = T.style) == null ? void 0 : L.fontWeight) || ((V = T.style) == null ? void 0 : V.color));
2571
+ for (const _ of E)
2572
+ _.editable && l.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2573
+ const C = vi(e, a, new Map([...h, ...y]));
2574
+ for (const _ of e.variables ?? []) {
2575
+ const I = kt(_);
2576
+ (I == null ? void 0 : I.kind) === "semantic" && l.set(`${I.domainId}|${I.datasetName}`, { domainId: I.domainId, datasetName: I.datasetName });
2577
+ }
2578
+ const k = (e.variables ?? []).filter((_) => {
2579
+ var I;
2580
+ return ((I = kt(_)) == null ? void 0 : I.kind) === "physical";
2581
+ }).map((_) => _.name), b = (e.sheets ?? []).some(
2582
+ (_) => {
2583
+ var I;
2584
+ return (I = _.document) == null ? void 0 : I.sections.some((R) => {
2585
+ var P, V;
2586
+ return R.type === "text" && (((P = R.style) == null ? void 0 : P.fontWeight) || ((V = R.style) == null ? void 0 : V.color));
2581
2587
  });
2582
2588
  }
2583
2589
  ), D = [
2584
- ...S.length ? [`a variable on a table or view source (${S.join(", ")}): changed in the editor`] : [],
2585
- ...y ? ["a Document text section's weight or color: changed in the editor"] : [],
2590
+ ...k.length ? [`a variable on a table or view source (${k.join(", ")}): changed in the editor`] : [],
2591
+ ...b ? ["a Document text section's weight or color: changed in the editor"] : [],
2586
2592
  // No change creates a calculated field (DV-D13, ledger AR-27): the parity backlog names it.
2587
2593
  "creating a calculated field: use one the domain has, or a SQL variable",
2588
2594
  // No change writes click to filter yet; agent click authoring is the next
@@ -2597,9 +2603,9 @@ function Or(e, a) {
2597
2603
  updatedAt: a.updatedAt,
2598
2604
  access: a.access,
2599
2605
  datasets: [...l.values()],
2600
- sheets: w,
2606
+ sheets: x,
2601
2607
  filters: E,
2602
- variables: _,
2608
+ variables: C,
2603
2609
  style: bi(e, a),
2604
2610
  editorOnly: D,
2605
2611
  ...i ? { truncated: !0 } : {}
@@ -2656,14 +2662,14 @@ function vi(e, a, t) {
2656
2662
  usedIn: o((h) => h.source === "documentMeta" && h.key === c.reportKey),
2657
2663
  editable: !1
2658
2664
  })), l = (e.variables ?? []).map((c) => {
2659
- const h = rs(c, { sql: a.sql }), p = Dt(c, e)[0], I = Co(c.presentation);
2665
+ const h = rs(c, { sql: a.sql }), p = Dt(c, e)[0], v = Co(c.presentation);
2660
2666
  return {
2661
2667
  name: c.name,
2662
2668
  kind: "data",
2663
2669
  words: Jo(c),
2664
2670
  parts: Lo(c),
2665
- ...I ? { presentation: I } : {},
2666
- usedIn: o((v) => v.source === "data" && v.variableId === c.id),
2671
+ ...v ? { presentation: v } : {},
2672
+ usedIn: o((y) => y.source === "data" && y.variableId === c.id),
2667
2673
  editable: h.editable,
2668
2674
  ...h.editable ? {} : { notEditable: { reason: h.reason, message: h.message } },
2669
2675
  ...p ? { broken: `${p.message} ${p.fix}` } : {}
@@ -2676,7 +2682,7 @@ const Ii = {
2676
2682
  pageNumber: "The page number (Documents)",
2677
2683
  pageCount: "The page count (Documents)"
2678
2684
  };
2679
- function Ge(e) {
2685
+ function Ue(e) {
2680
2686
  const a = Ee(e);
2681
2687
  return a ? { type: a.type, ...a.properties } : { type: $t(e.type) };
2682
2688
  }
@@ -2722,29 +2728,29 @@ function It(e, a, t) {
2722
2728
  }
2723
2729
  function ps(e, a) {
2724
2730
  const t = [], s = e.config;
2725
- for (const x of Ci) {
2726
- const w = s == null ? void 0 : s[x];
2727
- Array.isArray(w) && w.forEach((E, _) => It(t, `${a}.config.${x}[${_}]`, E));
2731
+ for (const S of Ci) {
2732
+ const x = s == null ? void 0 : s[S];
2733
+ Array.isArray(x) && x.forEach((E, C) => It(t, `${a}.config.${S}[${C}]`, E));
2728
2734
  }
2729
2735
  const o = Z(s == null ? void 0 : s.matrix) ? s.matrix : void 0, n = Z(o == null ? void 0 : o.presentation) ? o.presentation : void 0;
2730
- for (const x of ["measureFormats", "levelFormats"]) {
2731
- const w = n == null ? void 0 : n[x];
2732
- if (Z(w)) for (const [E, _] of Object.entries(w)) Oe(t, `${a}.config.matrix.presentation.${x}.${E}`, _);
2736
+ for (const S of ["measureFormats", "levelFormats"]) {
2737
+ const x = n == null ? void 0 : n[S];
2738
+ if (Z(x)) for (const [E, C] of Object.entries(x)) Oe(t, `${a}.config.matrix.presentation.${S}.${E}`, C);
2733
2739
  }
2734
2740
  re(n, "conditionalFormatting") && t.push({ path: `${a}.config.matrix.presentation.conditionalFormatting`, field: "conditionalFormatting", replacement: Qe });
2735
2741
  const i = e.interactionConfig, d = i == null ? void 0 : i.drillHierarchies;
2736
- Array.isArray(d) && d.forEach((x, w) => {
2737
- Z(x) && (It(t, `${a}.interactionConfig.drillHierarchies[${w}].baseField`, x.baseField), Array.isArray(x.steps) && x.steps.forEach((E, _) => {
2738
- Z(E) && It(t, `${a}.interactionConfig.drillHierarchies[${w}].steps[${_}].field`, E.field);
2742
+ Array.isArray(d) && d.forEach((S, x) => {
2743
+ Z(S) && (It(t, `${a}.interactionConfig.drillHierarchies[${x}].baseField`, S.baseField), Array.isArray(S.steps) && S.steps.forEach((E, C) => {
2744
+ Z(E) && It(t, `${a}.interactionConfig.drillHierarchies[${x}].steps[${C}].field`, E.field);
2739
2745
  }));
2740
2746
  });
2741
2747
  const l = e.preferences;
2742
2748
  if (!l) return t;
2743
2749
  const c = `${a}.preferences`;
2744
2750
  if (re(l, "formatNumber")) {
2745
- const x = l.formatNumber, w = Z(x) && Object.keys(x).every((E) => E === "colorRanges");
2751
+ const S = l.formatNumber, x = Z(S) && Object.keys(S).every((E) => E === "colorRanges");
2746
2752
  t.push(
2747
- w ? { path: `${c}.formatNumber.colorRanges`, field: "colorRanges", replacement: `${Qe} (a rule on the KPI's value)` } : { path: `${c}.formatNumber`, field: "formatNumber", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }
2753
+ x ? { path: `${c}.formatNumber.colorRanges`, field: "colorRanges", replacement: `${Qe} (a rule on the KPI's value)` } : { path: `${c}.formatNumber`, field: "formatNumber", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }
2748
2754
  );
2749
2755
  }
2750
2756
  re(l, "numberAxisFormat") && t.push({ path: `${c}.numberAxisFormat`, field: "numberAxisFormat", replacement: "`valueFormat` on `preferences.yAxisConfig` (or the axis it formats)" }), re(l, "columnSettings") && t.push({ path: `${c}.columnSettings`, field: "columnSettings", replacement: "`preferences.tablePrefs.columnSettingsMap`, keyed by column" });
@@ -2752,27 +2758,27 @@ function ps(e, a) {
2752
2758
  re(h, "formatOptions") && t.push({ path: `${c}.kpiVisualOptions.formatOptions`, field: "formatOptions", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }), re(h, "queryComparisonPolarity") && t.push({ path: `${c}.kpiVisualOptions.queryComparisonPolarity`, field: "queryComparisonPolarity", replacement: "`preferences.sqlKpiValue.comparisonPolarity`" });
2753
2759
  const p = l.tablePrefs;
2754
2760
  re(p, "conditionalFormatting") && t.push({ path: `${c}.tablePrefs.conditionalFormatting`, field: "conditionalFormatting", replacement: Qe });
2755
- const I = p == null ? void 0 : p.columnSettingsMap;
2756
- if (Z(I))
2757
- for (const [x, w] of Object.entries(I)) {
2758
- if (!Z(w)) continue;
2759
- const E = `${c}.tablePrefs.columnSettingsMap.${x}`;
2760
- for (const _ of ["numberFormat", "dateFormat", "inheritMetricFormat"])
2761
- re(w, _) && t.push({ path: `${E}.${_}`, field: _, replacement: _ === "inheritMetricFormat" ? "nothing: a column follows its `format`" : wi });
2762
- re(w, "colorRanges") && t.push({ path: `${E}.colorRanges`, field: "colorRanges", replacement: Qe });
2761
+ const v = p == null ? void 0 : p.columnSettingsMap;
2762
+ if (Z(v))
2763
+ for (const [S, x] of Object.entries(v)) {
2764
+ if (!Z(x)) continue;
2765
+ const E = `${c}.tablePrefs.columnSettingsMap.${S}`;
2766
+ for (const C of ["numberFormat", "dateFormat", "inheritMetricFormat"])
2767
+ re(x, C) && t.push({ path: `${E}.${C}`, field: C, replacement: C === "inheritMetricFormat" ? "nothing: a column follows its `format`" : wi });
2768
+ re(x, "colorRanges") && t.push({ path: `${E}.colorRanges`, field: "colorRanges", replacement: Qe });
2763
2769
  }
2764
- for (const x of $i) {
2765
- const w = l[x];
2766
- if (Z(w)) {
2770
+ for (const S of $i) {
2771
+ const x = l[S];
2772
+ if (Z(x)) {
2767
2773
  for (const E of ["formatMode", "mode", "formatOptions"])
2768
- re(w, E) && t.push({ path: `${c}.${x}.${E}`, field: E, replacement: `\`preferences.${x}.valueFormat\` (absent means the column's format)` });
2769
- x === "dataLabelsConfig" && re(w, "format") && t.push({ path: `${c}.${x}.format`, field: "format", replacement: "`preferences.dataLabelsConfig.valueFormat`" }), Oe(t, `${c}.${x}.valueFormat`, w.valueFormat);
2774
+ re(x, E) && t.push({ path: `${c}.${S}.${E}`, field: E, replacement: `\`preferences.${S}.valueFormat\` (absent means the column's format)` });
2775
+ S === "dataLabelsConfig" && re(x, "format") && t.push({ path: `${c}.${S}.format`, field: "format", replacement: "`preferences.dataLabelsConfig.valueFormat`" }), Oe(t, `${c}.${S}.valueFormat`, x.valueFormat);
2770
2776
  }
2771
2777
  }
2772
- const v = l.sqlColumns;
2773
- if (Z(v))
2774
- for (const [x, w] of Object.entries(v))
2775
- Z(w) && Oe(t, `${c}.sqlColumns.${x}.format`, w.format);
2778
+ const y = l.sqlColumns;
2779
+ if (Z(y))
2780
+ for (const [S, x] of Object.entries(y))
2781
+ Z(x) && Oe(t, `${c}.sqlColumns.${S}.format`, x.format);
2776
2782
  return Z(l.sqlKpiValue) && Oe(t, `${c}.sqlKpiValue.format`, l.sqlKpiValue.format), t;
2777
2783
  }
2778
2784
  function Si(e) {
@@ -3053,52 +3059,52 @@ function Vi(e, a) {
3053
3059
  );
3054
3060
  }
3055
3061
  }
3056
- function ji(e) {
3062
+ function Ki(e) {
3057
3063
  var l;
3058
3064
  const a = (l = e.card.preferences) == null ? void 0 : l.tablePrefs, t = a == null ? void 0 : a.columnSettingsMap;
3059
3065
  if (!J(t)) return;
3060
3066
  const s = e.card, o = ys(s), n = ee(s, "pivotByColumns").length > 0, i = /* @__PURE__ */ new Map(), d = [];
3061
3067
  for (const [c, h] of Object.entries(t)) {
3062
3068
  if (!J(h)) continue;
3063
- const p = h, I = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
3069
+ const p = h, v = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
3064
3070
  if (Pi(p)) {
3065
- const v = So(p.numberFormat);
3066
- if (v && o)
3067
- Da(e, c, v, `${I}.numberFormat`);
3068
- else if (v && Rt(s)) {
3069
- const x = Fa(s, c), w = { key: c, format: v, from: `${I}.numberFormat` };
3070
- x ? i.set(x, [...i.get(x) ?? [], w]) : n ? d.push(w) : e.unconverted.push({
3071
- path: w.from,
3071
+ const y = So(p.numberFormat);
3072
+ if (y && o)
3073
+ Da(e, c, y, `${v}.numberFormat`);
3074
+ else if (y && Rt(s)) {
3075
+ const S = Fa(s, c), x = { key: c, format: y, from: `${v}.numberFormat` };
3076
+ S ? i.set(S, [...i.get(S) ?? [], x]) : n ? d.push(x) : e.unconverted.push({
3077
+ path: x.from,
3072
3078
  reason: "unmatched_column_setting",
3073
3079
  detail: `"${c}" names no card column.`
3074
3080
  });
3075
- } else v && s.type !== "matrixTable" && s.type !== "kpi" && ee(s, "metricColumns").some(
3076
- (w) => w.comparison != null
3081
+ } else y && s.type !== "matrixTable" && s.type !== "kpi" && ee(s, "metricColumns").some(
3082
+ (x) => x.comparison != null
3077
3083
  ) && e.unconverted.push({
3078
- path: `${I}.numberFormat`,
3084
+ path: `${v}.numberFormat`,
3079
3085
  reason: "chart_comparison_column_setting",
3080
3086
  detail: `"${c}" formats this chart's comparison tooltip only.`
3081
3087
  });
3082
3088
  }
3083
3089
  if (J(p.dateFormat)) {
3084
- const v = p.type === "date";
3085
- if (v && o)
3086
- Da(e, c, ko(p.dateFormat), `${I}.dateFormat`);
3087
- else if (v && Rt(s)) {
3088
- const x = Fa(s, c);
3089
- (!x || !Li(s, x)) && e.unconverted.push({
3090
- path: `${I}.dateFormat`,
3090
+ const y = p.type === "date";
3091
+ if (y && o)
3092
+ Da(e, c, ko(p.dateFormat), `${v}.dateFormat`);
3093
+ else if (y && Rt(s)) {
3094
+ const S = Fa(s, c);
3095
+ (!S || !Li(s, S)) && e.unconverted.push({
3096
+ path: `${v}.dateFormat`,
3091
3097
  reason: "config_column_date_setting",
3092
3098
  detail: `"${c}"'s download formats its dates with this setting.`
3093
3099
  });
3094
3100
  }
3095
3101
  }
3096
- for (const v of qi)
3097
- Object.prototype.hasOwnProperty.call(p, v) && (delete p[v], e.changes.push({ path: `${I}.${v}`, action: "removed" }));
3102
+ for (const y of qi)
3103
+ Object.prototype.hasOwnProperty.call(p, y) && (delete p[y], e.changes.push({ path: `${v}.${y}`, action: "removed" }));
3098
3104
  }
3099
3105
  Bi(e, i), Vi(e, d);
3100
3106
  }
3101
- function Ki(e) {
3107
+ function ji(e) {
3102
3108
  return Object.keys(e).some(
3103
3109
  (a) => a !== "enabled" && a !== "colorRanges" && e[a] !== void 0
3104
3110
  );
@@ -3106,10 +3112,10 @@ function Ki(e) {
3106
3112
  function Wi(e) {
3107
3113
  return (e == null ? void 0 : e.enabled) === !1 || (e == null ? void 0 : e.enabled) === "false";
3108
3114
  }
3109
- function Ui(e) {
3115
+ function Gi(e) {
3110
3116
  const a = e.card, t = a.preferences;
3111
3117
  if (!t) return;
3112
- const s = t.kpiVisualOptions, o = J(s == null ? void 0 : s.formatOptions) ? s.formatOptions : void 0, n = t, i = J(n.formatNumber) ? n.formatNumber : void 0, d = o ? Me(To(o)) : void 0, l = i && Ki(i) ? Me(Ro(i)) : void 0;
3118
+ const s = t.kpiVisualOptions, o = J(s == null ? void 0 : s.formatOptions) ? s.formatOptions : void 0, n = t, i = J(n.formatNumber) ? n.formatNumber : void 0, d = o ? Me(To(o)) : void 0, l = i && ji(i) ? Me(Ro(i)) : void 0;
3113
3119
  if (a.type === "kpi") {
3114
3120
  if (Wi(i) && e.unconverted.push({
3115
3121
  path: "preferences.formatNumber.enabled",
@@ -3130,7 +3136,7 @@ function Ui(e) {
3130
3136
  ee(a, "metricColumns").forEach((h) => {
3131
3137
  d ? st(e, h, d, "preferences.kpiVisualOptions.formatOptions") : l && !h.format && st(e, h, l, "preferences.formatNumber");
3132
3138
  });
3133
- Gi(e, i);
3139
+ Ui(e, i);
3134
3140
  } else if (l) {
3135
3141
  const c = ee(a, "metricColumns");
3136
3142
  ys(a) ? e.unconverted.push({
@@ -3151,7 +3157,7 @@ function Ui(e) {
3151
3157
  for (const c of ["numberAxisFormat", "columnSettings"])
3152
3158
  ke(t, [c]) && e.changes.push({ path: `preferences.${c}`, action: "removed" });
3153
3159
  }
3154
- function Gi(e, a) {
3160
+ function Ui(e, a) {
3155
3161
  var n;
3156
3162
  const t = a == null ? void 0 : a.decimalPlaces, s = e.card.preferences;
3157
3163
  if (typeof t != "number" || ((n = s.comparisonPresentation) == null ? void 0 : n.precision) !== void 0) return;
@@ -3201,7 +3207,7 @@ function Yi(e, a = {}) {
3201
3207
  ee(t.card, s).forEach((o, n) => {
3202
3208
  J(o) && Di(t, o, s, `config.${s}[${n}]`);
3203
3209
  });
3204
- return Ei(t), ji(t), Ui(t), Hi(t), zi(t), Oi(t, a), t.changes.length === 0 && t.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : t;
3210
+ return Ei(t), Ki(t), Gi(t), Hi(t), zi(t), Oi(t, a), t.changes.length === 0 && t.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : t;
3205
3211
  }
3206
3212
  const Ji = "__semaphor_unassigned_trigger__", Xi = "__NULL__";
3207
3213
  function Zi(e) {
@@ -3236,45 +3242,45 @@ function ar(e, a) {
3236
3242
  return n.length === 1 ? { ref: { kind: "field", fieldId: n[0] } } : n.length > 1 ? { reason: "ambiguous_column" } : (d = (i = e.config) == null ? void 0 : i.pivotByColumns) != null && d.length ? tr(e, a) : { reason: "no_matching_column" };
3237
3243
  }
3238
3244
  function Ea(e, a, t, s, o) {
3239
- const n = (g, k, T) => {
3240
- s.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${t}.${g}`, reference: k, reason: T });
3245
+ const n = (_, I, R) => {
3246
+ s.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${t}.${_}`, reference: I, reason: R });
3241
3247
  }, i = e.condition.columnId ?? "", d = a(i);
3242
3248
  if (!("ref" in d)) return n("condition.columnId", i, d.reason);
3243
3249
  const l = e.target.level, c = l === "row" ? e.target.applyToColumnIds : e.target.columnIds;
3244
3250
  if (l === "cell" && !(c != null && c.length) && e.enabled !== !1)
3245
3251
  return n("target.columnIds", "", "every_column");
3246
3252
  const h = [];
3247
- for (const [g, k] of (c ?? []).entries()) {
3248
- const T = a(k);
3249
- if (!("ref" in T))
3250
- return n(`target.${l === "row" ? "applyToColumnIds" : "columnIds"}[${g}]`, k, T.reason);
3251
- h.push(T.ref);
3253
+ for (const [_, I] of (c ?? []).entries()) {
3254
+ const R = a(I);
3255
+ if (!("ref" in R))
3256
+ return n(`target.${l === "row" ? "applyToColumnIds" : "columnIds"}[${_}]`, I, R.reason);
3257
+ h.push(R.ref);
3252
3258
  }
3253
3259
  const {
3254
3260
  columnIds: p,
3255
- applyToColumnIds: I,
3256
- conditionColumnId: v,
3257
- matrix: x,
3258
- rowRoles: w,
3261
+ applyToColumnIds: v,
3262
+ conditionColumnId: y,
3263
+ matrix: S,
3264
+ rowRoles: x,
3259
3265
  depth: E,
3260
- includeTotals: _,
3261
- includeSubtotals: S,
3262
- ...y
3263
- } = e.target, { columnId: D, ...$ } = e.condition, N = {
3264
- ...y,
3266
+ includeTotals: C,
3267
+ includeSubtotals: k,
3268
+ ...b
3269
+ } = e.target, { columnId: D, ...w } = e.condition, N = {
3270
+ ...b,
3265
3271
  ...h.length ? { columns: h } : {},
3266
3272
  // The Matrix scope means something only on a Matrix card.
3267
3273
  ...o ? {
3268
- ...x !== void 0 ? { matrix: x } : {},
3269
- ...w !== void 0 ? { rowRoles: w } : {},
3274
+ ...S !== void 0 ? { matrix: S } : {},
3275
+ ...x !== void 0 ? { rowRoles: x } : {},
3270
3276
  ...E !== void 0 ? { depth: E } : {},
3271
- ..._ !== void 0 ? { includeTotals: _ } : {},
3272
- ...S !== void 0 ? { includeSubtotals: S } : {}
3277
+ ...C !== void 0 ? { includeTotals: C } : {},
3278
+ ...k !== void 0 ? { includeSubtotals: k } : {}
3273
3279
  } : {}
3274
3280
  };
3275
3281
  return {
3276
3282
  ...e,
3277
- condition: { ...$, column: d.ref },
3283
+ condition: { ...w, column: d.ref },
3278
3284
  target: N
3279
3285
  };
3280
3286
  }
@@ -3287,58 +3293,58 @@ function sr(e, a) {
3287
3293
  if (!n || typeof n != "object") return [];
3288
3294
  const { start: d, end: l, color: c } = n, h = s(d), p = s(l);
3289
3295
  if (Number.isNaN(h) || Number.isNaN(p) || h > p || h === 1 / 0 || p === -1 / 0) return [];
3290
- const I = h === -1 / 0 ? void 0 : h, v = p === 1 / 0 ? void 0 : p, x = I !== void 0 && v !== void 0 ? { kind: "between", column: t, min: I, max: v, inclusive: !0 } : I !== void 0 ? { kind: "comparison", column: t, operator: "gte", value: I } : v !== void 0 ? { kind: "comparison", column: t, operator: "lte", value: v } : { kind: "blank", column: t, isBlank: !1 }, w = typeof c == "string" ? c : "";
3291
- return [{ id: `kpi-color-range-${i + 1}`, condition: x, target: { level: "cell" }, style: { textColor: w } }];
3296
+ const v = h === -1 / 0 ? void 0 : h, y = p === 1 / 0 ? void 0 : p, S = v !== void 0 && y !== void 0 ? { kind: "between", column: t, min: v, max: y, inclusive: !0 } : v !== void 0 ? { kind: "comparison", column: t, operator: "gte", value: v } : y !== void 0 ? { kind: "comparison", column: t, operator: "lte", value: y } : { kind: "blank", column: t, isBlank: !1 }, x = typeof c == "string" ? c : "";
3297
+ return [{ id: `kpi-color-range-${i + 1}`, condition: S, target: { level: "cell" }, style: { textColor: x } }];
3292
3298
  }).reverse();
3293
3299
  }
3294
3300
  function or(e) {
3295
- var h, p, I, v, x, w, E;
3296
- const a = structuredClone(e), t = [], s = [], o = [], n = (_) => {
3297
- t.some((S) => S.from.startsWith(_)) || t.push({ ruleId: "", action: "removed", from: _ });
3301
+ var h, p, v, y, S, x, E;
3302
+ const a = structuredClone(e), t = [], s = [], o = [], n = (C) => {
3303
+ t.some((k) => k.from.startsWith(C)) || t.push({ ruleId: "", action: "removed", from: C });
3298
3304
  }, i = (h = a.preferences) == null ? void 0 : h.tablePrefs;
3299
3305
  if (i && ue(i, "conditionalFormatting")) {
3300
- const _ = i.conditionalFormatting, S = "preferences.tablePrefs.conditionalFormatting", y = a.type === "table" || a.type === "detailTable";
3301
- ((_ == null ? void 0 : _.rules) ?? []).forEach((D, $) => {
3302
- var g;
3303
- if (!y || ((g = D.target) == null ? void 0 : g.matrix) !== void 0) {
3304
- t.push({ ruleId: D.id, action: "removed", from: `${S}.rules[${$}]` });
3306
+ const C = i.conditionalFormatting, k = "preferences.tablePrefs.conditionalFormatting", b = a.type === "table" || a.type === "detailTable";
3307
+ ((C == null ? void 0 : C.rules) ?? []).forEach((D, w) => {
3308
+ var _;
3309
+ if (!b || ((_ = D.target) == null ? void 0 : _.matrix) !== void 0) {
3310
+ t.push({ ruleId: D.id, action: "removed", from: `${k}.rules[${w}]` });
3305
3311
  return;
3306
3312
  }
3307
- const N = Ea(D, (k) => ar(a, k), `${S}.rules[${$}]`, s, !1);
3308
- N && (o.push(N), t.push({ ruleId: D.id, action: "moved", from: `${S}.rules[${$}]` }));
3309
- }), delete i.conditionalFormatting, s.some((D) => D.path.startsWith(S)) || n(S);
3313
+ const N = Ea(D, (I) => ar(a, I), `${k}.rules[${w}]`, s, !1);
3314
+ N && (o.push(N), t.push({ ruleId: D.id, action: "moved", from: `${k}.rules[${w}]` }));
3315
+ }), delete i.conditionalFormatting, s.some((D) => D.path.startsWith(k)) || n(k);
3310
3316
  }
3311
- const d = (I = (p = a.config) == null ? void 0 : p.matrix) == null ? void 0 : I.presentation;
3317
+ const d = (v = (p = a.config) == null ? void 0 : p.matrix) == null ? void 0 : v.presentation;
3312
3318
  if (d && ue(d, "conditionalFormatting")) {
3313
- const _ = d.conditionalFormatting, S = "config.matrix.presentation.conditionalFormatting", y = new Set((x = (v = a.config) == null ? void 0 : v.matrix) == null ? void 0 : x.spec.measures.map((D) => D.id));
3314
- ((_ == null ? void 0 : _.rules) ?? []).forEach((D, $) => {
3319
+ const C = d.conditionalFormatting, k = "config.matrix.presentation.conditionalFormatting", b = new Set((S = (y = a.config) == null ? void 0 : y.matrix) == null ? void 0 : S.spec.measures.map((D) => D.id));
3320
+ ((C == null ? void 0 : C.rules) ?? []).forEach((D, w) => {
3315
3321
  const N = Ea(
3316
3322
  D,
3317
- (g) => y.has(g) ? { ref: { kind: "matrixMeasure", measureId: g } } : { reason: "no_matching_column" },
3318
- `${S}.rules[${$}]`,
3323
+ (_) => b.has(_) ? { ref: { kind: "matrixMeasure", measureId: _ } } : { reason: "no_matching_column" },
3324
+ `${k}.rules[${w}]`,
3319
3325
  s,
3320
3326
  !0
3321
3327
  );
3322
- N && (o.push(N), t.push({ ruleId: D.id, action: "moved", from: `${S}.rules[${$}]` }));
3323
- }), delete d.conditionalFormatting, s.some((D) => D.path.startsWith(S)) || n(S);
3328
+ N && (o.push(N), t.push({ ruleId: D.id, action: "moved", from: `${k}.rules[${w}]` }));
3329
+ }), delete d.conditionalFormatting, s.some((D) => D.path.startsWith(k)) || n(k);
3324
3330
  }
3325
3331
  const l = a.preferences, c = l == null ? void 0 : l.formatNumber;
3326
3332
  if (c && ue(c, "colorRanges")) {
3327
- const _ = Array.isArray(c.colorRanges) ? c.colorRanges : [];
3333
+ const C = Array.isArray(c.colorRanges) ? c.colorRanges : [];
3328
3334
  if (a.type === "kpi") {
3329
- const S = sr(a, _);
3330
- o.push(...S), S.forEach((y) => t.push({ ruleId: y.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
3335
+ const k = sr(a, C);
3336
+ o.push(...k), k.forEach((b) => t.push({ ruleId: b.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
3331
3337
  }
3332
- delete c.colorRanges, Object.keys(c).length === 0 && delete l.formatNumber, t.some((S) => S.from === "preferences.formatNumber.colorRanges") || t.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
3338
+ delete c.colorRanges, Object.keys(c).length === 0 && delete l.formatNumber, t.some((k) => k.from === "preferences.formatNumber.colorRanges") || t.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
3333
3339
  }
3334
3340
  if (!t.length && !s.length) return { card: e, changes: [], unresolved: [] };
3335
3341
  if (o.length) {
3336
- const _ = ((E = (w = a.preferences) == null ? void 0 : w.conditionalFormatting) == null ? void 0 : E.rules) ?? [], S = new Set(_.map((y) => y.id));
3342
+ const C = ((E = (x = a.preferences) == null ? void 0 : x.conditionalFormatting) == null ? void 0 : E.rules) ?? [], k = new Set(C.map((b) => b.id));
3337
3343
  a.preferences = {
3338
3344
  ...a.preferences,
3339
3345
  conditionalFormatting: {
3340
3346
  version: 1,
3341
- rules: [..._, ...o.filter((y) => !S.has(y.id))]
3347
+ rules: [...C, ...o.filter((b) => !k.has(b.id))]
3342
3348
  }
3343
3349
  };
3344
3350
  }
@@ -3358,7 +3364,7 @@ function nr(e) {
3358
3364
  case "relabel":
3359
3365
  return !0;
3360
3366
  case "settings":
3361
- return e.update.settings.totals === void 0 && e.update.settings.inheritComparison === void 0 && e.update.settings.band !== "trend";
3367
+ return e.update.settings.totals === void 0 && e.update.settings.inheritComparison === void 0 && e.update.settings.trend !== !0 && e.update.settings.trendGrain === void 0;
3362
3368
  default:
3363
3369
  return !1;
3364
3370
  }
@@ -3368,23 +3374,23 @@ function Lr(e) {
3368
3374
  }
3369
3375
  export {
3370
3376
  Vr as AGGREGATES,
3371
- jr as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
3372
- Kr as CALCULATED_FIELDS_GROUP_ID,
3377
+ Kr as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
3378
+ jr as CALCULATED_FIELDS_GROUP_ID,
3373
3379
  Wr as CALCULATED_FIELDS_GROUP_NAME,
3374
- Ur as CARD_CONFIG_KEY_CLASSES,
3375
- Gr as CARD_KEY_CLASSES,
3380
+ Gr as CARD_CONFIG_KEY_CLASSES,
3381
+ Ur as CARD_KEY_CLASSES,
3376
3382
  ho as CARD_QUERY_CONFIG_KEYS,
3377
3383
  kr as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
3378
3384
  Sr as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
3379
- Ph as CARD_SURFACES,
3385
+ Nh as CARD_SURFACES,
3380
3386
  Qr as CARD_TYPES,
3381
3387
  Fe as CARD_TYPE_RULES,
3382
- je as CHART_COLORS_BOUNDS,
3388
+ Ke as CHART_COLORS_BOUNDS,
3383
3389
  Hr as CHIP_VALUE_COLUMN,
3384
3390
  zr as COLUMN_KEY_CLASSES,
3385
3391
  Yr as COLUMN_PRESENTATION_KEYS,
3386
3392
  Jr as COMPARISON_POLARITIES,
3387
- Sf as COMPARISON_SIGN_WORDS,
3393
+ xf as COMPARISON_SIGN_WORDS,
3388
3394
  Xr as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
3389
3395
  Zr as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
3390
3396
  ed as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
@@ -3395,16 +3401,16 @@ export {
3395
3401
  nd as CONTROL_REFERENCE_MISSING_ERROR_CODE,
3396
3402
  id as CONTROL_VALUE_INVALID_ERROR_CODE,
3397
3403
  rd as CONTROL_VALUE_MISSING_ERROR_CODE,
3398
- Lh as CORNER_STEPS,
3404
+ Ph as CORNER_STEPS,
3399
3405
  ce as CardQueryRequestError,
3400
3406
  dd as ControlResolutionError,
3401
3407
  ld as DASHBOARD_CHANGE_OPS,
3402
3408
  cd as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
3403
- kf as DASHBOARD_FILTER_OPERATIONS,
3409
+ Sf as DASHBOARD_FILTER_OPERATIONS,
3404
3410
  ud as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
3405
3411
  nn as DASHBOARD_STYLE_NUMBER_BOUNDS,
3406
- Tf as DOCUMENT_KPI_SECTION_MAX_CARDS,
3407
- Rf as DOCUMENT_KPI_SECTION_MAX_TILES,
3412
+ kf as DOCUMENT_KPI_SECTION_MAX_CARDS,
3413
+ Tf as DOCUMENT_KPI_SECTION_MAX_TILES,
3408
3414
  fd as DOMAIN_EDIT_CHANGE_OPS,
3409
3415
  md as DYNAMIC_TEXT_MESSAGE,
3410
3416
  hd as DashboardFilterMappingContractError,
@@ -3413,274 +3419,279 @@ export {
3413
3419
  ua as FORMAT_WORDS,
3414
3420
  bd as FilterModelError,
3415
3421
  yd as KPI_MEASURES_SHOWN,
3416
- vd as KPI_TREND_PERIODS,
3417
- Id as LEGACY_TABLE_CARD_TYPES,
3418
- vm as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
3422
+ Uh as KPI_TREND_GRAINS,
3423
+ Qh as KPI_TREND_MAX_POINTS,
3424
+ Hh as KPI_TREND_PERIODS,
3425
+ vd as LEGACY_TABLE_CARD_TYPES,
3426
+ ym as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
3419
3427
  ba as MAX_CREATE_CHANGES,
3420
- _d as MAX_NEXT_STEP_CHARS,
3428
+ Id as MAX_NEXT_STEP_CHARS,
3421
3429
  _o as MAX_PROPOSED_CHANGES,
3422
- Cd as MAX_QUERY_LIMIT,
3423
- $d as MAX_TEXT_WORDS,
3424
- wd as MEASURE_CALCULATION_SUMMARIES,
3425
- Hm as NEW_CARD_TYPE,
3426
- xd as NON_ADDITIVE_SUM_OF_ROWS_HINT,
3427
- Sd as PUBLIC_TRANSFORM_KIND,
3428
- kd as QUERY_ASPECTS,
3429
- Td as QUERY_CONFIG_KEY_ASPECTS,
3430
- zm as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
3431
- Rd as RESERVED_VARIABLE_NAMES,
3432
- Ad as SEE_RECORDS_CARD_TYPES,
3433
- Fd as SEE_RECORDS_LIMITS,
3434
- Dd as SEE_RECORDS_MAX_PAGE,
3435
- Ym as SEE_RECORDS_MESSAGES,
3436
- Od as SEMAPHOR_CARTESIAN_CHART_TYPES,
3437
- Ed as SETTINGS_BY_KIND,
3438
- Vh as SHELF_FIELD_KEYS,
3439
- Mh as SPACING_STEPS,
3440
- qd as TIME_GRAINS,
3441
- Nd as TOOLBAR_FILTER_REACH_FIELDS,
3442
- Af as VARIABLE_CARD_TYPE,
3443
- Ff as VARIABLE_COMPARISON_PARTS,
3444
- Pd as VARIABLE_GETS,
3445
- Df as VARIABLE_LIST_CAP,
3446
- Of as VARIABLE_LIST_SHOWN,
3447
- Ld as VARIABLE_NAME_PATTERN,
3448
- Ef as VARIABLE_VALUE_PART,
3449
- Md as WINDOW_ERROR_CODES,
3450
- Bd as WINDOW_WARNING_CODES,
3451
- Vd as acceptedColumnRefKinds,
3452
- jd as analyticsFilterSchema,
3453
- Im as applyCardReferenceRemapping,
3430
+ _d as MAX_QUERY_LIMIT,
3431
+ Cd as MAX_TEXT_WORDS,
3432
+ $d as MEASURE_CALCULATION_SUMMARIES,
3433
+ Qm as NEW_CARD_TYPE,
3434
+ wd as NON_ADDITIVE_SUM_OF_ROWS_HINT,
3435
+ xd as PUBLIC_TRANSFORM_KIND,
3436
+ Sd as QUERY_ASPECTS,
3437
+ kd as QUERY_CONFIG_KEY_ASPECTS,
3438
+ Hm as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
3439
+ Td as RESERVED_VARIABLE_NAMES,
3440
+ Rd as SEE_RECORDS_CARD_TYPES,
3441
+ Ad as SEE_RECORDS_LIMITS,
3442
+ Fd as SEE_RECORDS_MAX_PAGE,
3443
+ zm as SEE_RECORDS_MESSAGES,
3444
+ Dd as SEMAPHOR_CARTESIAN_CHART_TYPES,
3445
+ Od as SETTINGS_BY_KIND,
3446
+ Bh as SHELF_FIELD_KEYS,
3447
+ Lh as SPACING_STEPS,
3448
+ Ed as TIME_GRAINS,
3449
+ qd as TOOLBAR_FILTER_REACH_FIELDS,
3450
+ Rf as VARIABLE_CARD_TYPE,
3451
+ Af as VARIABLE_COMPARISON_PARTS,
3452
+ Nd as VARIABLE_GETS,
3453
+ Ff as VARIABLE_LIST_CAP,
3454
+ Df as VARIABLE_LIST_SHOWN,
3455
+ Pd as VARIABLE_NAME_PATTERN,
3456
+ Of as VARIABLE_VALUE_PART,
3457
+ Ld as WINDOW_ERROR_CODES,
3458
+ Md as WINDOW_WARNING_CODES,
3459
+ Bd as acceptedColumnRefKinds,
3460
+ Vd as analyticsFilterSchema,
3461
+ vm as applyCardReferenceRemapping,
3454
3462
  Kd as applyCardSettings,
3455
3463
  wt as applyDashboardOperations,
3456
- Wd as applyFilterApplicability,
3457
- Jm as applyFilterSettingsChange,
3458
- _m as applyGroupByOverride,
3459
- Ud as applyLinkedClickToFilterOverrides,
3464
+ jd as applyFilterApplicability,
3465
+ Ym as applyFilterSettingsChange,
3466
+ Im as applyGroupByOverride,
3467
+ Wd as applyLinkedClickToFilterOverrides,
3460
3468
  Gd as applyMeasureCalculations,
3461
- Qd as applyOptionDependencyOverride,
3462
- Hd as applyVariableChange,
3463
- zd as blockClause,
3464
- Yd as blockSentence,
3465
- Yh as bookmarkImpactSentence,
3466
- Xm as buildCardExportFormatOptions,
3467
- Cm as buildCardExportQueryContext,
3468
- Zm as buildCardExportRequest,
3469
- eh as buildCardExportRequestFromOptions,
3470
- th as buildColumnCatalog,
3471
- Jd as buildControlDefinitionIndex,
3469
+ Ud as applyOptionDependencyOverride,
3470
+ Qd as applyVariableChange,
3471
+ zh as automaticKpiTrendGrain,
3472
+ Hd as blockClause,
3473
+ zd as blockSentence,
3474
+ tp as bookmarkImpactSentence,
3475
+ Jm as buildCardExportFormatOptions,
3476
+ _m as buildCardExportQueryContext,
3477
+ Xm as buildCardExportRequest,
3478
+ Zm as buildCardExportRequestFromOptions,
3479
+ eh as buildColumnCatalog,
3480
+ Yd as buildControlDefinitionIndex,
3472
3481
  no as buildDashboardCardSourceIndex,
3473
- ah as buildEntityColumnGroup,
3474
- sh as buildFilterInputFromDefinition,
3482
+ th as buildEntityColumnGroup,
3483
+ ah as buildFilterInputFromDefinition,
3475
3484
  Qo as buildFilterInputFromField,
3476
- Xd as buildLinkedClickToFilterOverrides,
3477
- Zd as buildProposeChangeInputSchema,
3478
- el as buildSavedEditorCard,
3479
- oh as buildTableExportFormatOptions,
3480
- tl as calculationAddSchema,
3481
- nh as cardColumnRefForKey,
3482
- al as cardColumnRefSchema,
3485
+ Jd as buildLinkedClickToFilterOverrides,
3486
+ Xd as buildProposeChangeInputSchema,
3487
+ Zd as buildSavedEditorCard,
3488
+ sh as buildTableExportFormatOptions,
3489
+ el as calculationAddSchema,
3490
+ oh as cardColumnRefForKey,
3491
+ tl as cardColumnRefSchema,
3483
3492
  wo as cardConditionalFormattingSchema,
3484
- sl as cardQueryPatchSchema,
3485
- ol as cardReachesDatasetThroughRelationships,
3493
+ al as cardQueryPatchSchema,
3494
+ sl as cardReachesDatasetThroughRelationships,
3486
3495
  Ps as cardSettingsKind,
3487
3496
  qs as cardTypeSentenceName,
3488
- nl as carryColumnSettings,
3497
+ ol as carryColumnSettings,
3489
3498
  po as changeCardType,
3490
- il as changeMatrixEditor,
3499
+ nl as changeMatrixEditor,
3491
3500
  xo as checkConditionalRuleColumns,
3492
3501
  Dt as checkDataVariable,
3493
- rl as checkDetailDateFormat,
3502
+ il as checkDetailDateFormat,
3494
3503
  qr as checkPresentationStores,
3495
- dl as chipOverVariable,
3496
- ll as clickToFilterSettingsSchema,
3497
- cl as collectJoinPlanIdentifiers,
3504
+ rl as chipOverVariable,
3505
+ dl as clickToFilterSettingsSchema,
3506
+ ll as collectJoinPlanIdentifiers,
3498
3507
  Qa as collectVariableReferences,
3499
3508
  Na as columnDataset,
3500
3509
  go as columnFieldKey,
3501
- Ka as columnKeys,
3502
- ul as columnRefIssue,
3510
+ ja as columnKeys,
3511
+ cl as columnRefIssue,
3503
3512
  la as columnRefKey,
3504
- fl as columnSettingsInputSchema,
3505
- qf as comparisonPartPresentation,
3506
- $m as composeCardReferenceRemapping,
3507
- ml as conditionalRuleSchema,
3513
+ ul as columnSettingsInputSchema,
3514
+ Ef as comparisonPartPresentation,
3515
+ Cm as composeCardReferenceRemapping,
3516
+ fl as conditionalRuleSchema,
3508
3517
  Lr as confirmClassFor,
3509
- hl as contextChangeSchema,
3510
- pl as controlBindingExecutionSchema,
3511
- gl as controlDefinitionExecutionSchema,
3518
+ ml as contextChangeSchema,
3519
+ hl as controlBindingExecutionSchema,
3520
+ pl as controlDefinitionExecutionSchema,
3512
3521
  so as controlRefusal,
3513
3522
  Ar as convertLegacyStyle,
3514
- bl as createDashboardFilterBindingId,
3515
- Vm as createMatrixAuthoringDraft,
3516
- jm as createMatrixConfig,
3523
+ gl as createDashboardFilterBindingId,
3524
+ Bm as createMatrixAuthoringDraft,
3525
+ Vm as createMatrixConfig,
3517
3526
  zo as createNewCard,
3518
- yl as createTargetSchema,
3527
+ bl as createTargetSchema,
3519
3528
  Ho as createTextCard,
3520
- vl as dashboardCardFilterSourceInventoryContains,
3529
+ yl as dashboardCardFilterSourceInventoryContains,
3521
3530
  Zs as dashboardChangeSchema,
3522
- Il as dashboardFilterTargetMatchesLogicalValue,
3523
- Nf as dashboardFilterValueTypeForDataType,
3531
+ vl as dashboardFilterTargetMatchesLogicalValue,
3532
+ qf as dashboardFilterValueTypeForDataType,
3524
3533
  No as dashboardInputScopeIncludesDocumentSheets,
3525
3534
  Tn as dashboardStyleAsEdit,
3526
- _l as dashboardStyleChangeSchema,
3535
+ Il as dashboardStyleChangeSchema,
3527
3536
  za as dashboardStyleLayers,
3528
- Cl as decideClickToFilterCardLevel,
3529
- $l as decideClickToFilterField,
3530
- wl as defaultClickToFilterSettings,
3537
+ _l as decideClickToFilterCardLevel,
3538
+ Cl as decideClickToFilterField,
3539
+ $l as defaultClickToFilterSettings,
3531
3540
  pn as defaultVariableGet,
3532
- jh as defaultVariableName,
3533
- Jh as describeBookmarkImpact,
3534
- xl as describeDashboardFilterCardReach,
3541
+ Vh as defaultVariableName,
3542
+ ap as describeBookmarkImpact,
3543
+ wl as describeDashboardFilterCardReach,
3535
3544
  $e as describeDashboardFilterCardReachDetail,
3536
- ih as describeDateWindow,
3537
- rh as describeFilterReachEntry,
3538
- dh as describeKpiDateSection,
3539
- lh as describeKpiTileDate,
3540
- Sl as describeMeasureCalculations,
3545
+ nh as describeDateWindow,
3546
+ ih as describeFilterReachEntry,
3547
+ rh as describeKpiDateSection,
3548
+ dh as describeKpiTileDate,
3549
+ Yh as describeKpiTrendRow,
3550
+ xl as describeMeasureCalculations,
3541
3551
  ao as describeQueryChange,
3542
- ch as describeRelationshipRoute,
3543
- uh as describeRelationshipSkip,
3544
- kl as describeTableColumnTotal,
3545
- Pf as documentInputTextUsage,
3546
- Lf as doesDashboardInputApplyToTarget,
3547
- Mf as doesDashboardInputReachFilterTarget,
3548
- Bf as doesDashboardInputSurviveCarriedContext,
3549
- Tl as doesToolbarFilterReachTab,
3550
- fh as domainCalculatedFields,
3551
- Rl as domainEditChangeSchema,
3552
- Al as domainEditChangeSchemas,
3552
+ lh as describeRelationshipRoute,
3553
+ ch as describeRelationshipSkip,
3554
+ Sl as describeTableColumnTotal,
3555
+ Nf as documentInputTextUsage,
3556
+ Pf as doesDashboardInputApplyToTarget,
3557
+ Lf as doesDashboardInputReachFilterTarget,
3558
+ Mf as doesDashboardInputSurviveCarriedContext,
3559
+ kl as doesToolbarFilterReachTab,
3560
+ uh as domainCalculatedFields,
3561
+ Tl as domainEditChangeSchema,
3562
+ Rl as domainEditChangeSchemas,
3553
3563
  Kh as draftBlocker,
3554
3564
  gn as draftFromVariable,
3555
- Fl as drawsDetailDatesInBrowser,
3556
- Dl as dropMatrixEditorField,
3557
- Zh as editBrandStyle,
3565
+ Al as drawsDetailDatesInBrowser,
3566
+ Fl as dropMatrixEditorField,
3567
+ op as editBrandStyle,
3558
3568
  rn as editDashboardStyle,
3559
- Ol as evaluateConditionalRules,
3560
- El as explicitComparisonSchema,
3561
- Gs as fieldIdentityKey,
3562
- ql as fieldRef,
3563
- Nl as fieldRefSchema,
3564
- Pl as filterApplicabilityContextForCard,
3565
- mh as filterReachPreviewAnswers,
3566
- Ll as filterValueReachForCard,
3567
- Ml as filterValueSemanticDataset,
3568
- Bl as findBorrowedSelectionBinding,
3569
+ Jh as estimateKpiTrendPoints,
3570
+ Dl as evaluateConditionalRules,
3571
+ Ol as explicitComparisonSchema,
3572
+ Us as fieldIdentityKey,
3573
+ El as fieldRef,
3574
+ ql as fieldRefSchema,
3575
+ Nl as filterApplicabilityContextForCard,
3576
+ fh as filterReachPreviewAnswers,
3577
+ Pl as filterValueReachForCard,
3578
+ Ll as filterValueSemanticDataset,
3579
+ Ml as findBorrowedSelectionBinding,
3569
3580
  ot as findCatalogField,
3570
- Vl as findDashboardCardExecutableSource,
3571
- jl as findDashboardCardPinnedCatalogSource,
3572
- Ua as findDashboardFilterTarget,
3581
+ Bl as findDashboardCardExecutableSource,
3582
+ Vl as findDashboardCardPinnedCatalogSource,
3583
+ Ga as findDashboardFilterTarget,
3573
3584
  Kl as findDashboardSqlPinnedCatalogSource,
3574
3585
  ps as findRetiredCardPresentationFields,
3575
3586
  Er as findRetiredPresentationFields,
3576
- Us as findSortedColumn,
3577
- hh as flattenEntityColumns,
3578
- Wl as foldPrototypeDocumentInputs,
3579
- Ul as formatFilterModelIssues,
3587
+ Gs as findSortedColumn,
3588
+ mh as flattenEntityColumns,
3589
+ jl as foldPrototypeDocumentInputs,
3590
+ Wl as formatFilterModelIssues,
3580
3591
  ws as formatResolvedPrimaryDateFieldIssues,
3581
3592
  Gl as formatSkippedFilterWarnings,
3582
- Ql as fromEditableRules,
3583
- ph as getCalculatedFieldAggregateOverrides,
3584
- Hl as getCalculatedFieldNamespace,
3585
- gh as getCalculatedFieldParameters,
3586
- bh as getCalculatedFieldShelfOverrides,
3587
- zl as getCardDefinition,
3588
- yh as getClickContextFromTable,
3589
- Yl as getColumnCatalogFieldId,
3590
- Jl as getDashboardFilterSubscriptionHint,
3591
- Xl as getDashboardGlobalDateFilter,
3592
- Vf as getDocumentKpiSectionShapeIssues,
3593
- jf as getDocumentSectionCards,
3594
- vh as getDomainCalculatedSelectionOverrides,
3595
- Zl as getFieldAggregationOptions,
3596
- ec as getMatrixBindingTargets,
3593
+ Ul as fromEditableRules,
3594
+ hh as getCalculatedFieldAggregateOverrides,
3595
+ Ql as getCalculatedFieldNamespace,
3596
+ ph as getCalculatedFieldParameters,
3597
+ gh as getCalculatedFieldShelfOverrides,
3598
+ Hl as getCardDefinition,
3599
+ bh as getClickContextFromTable,
3600
+ zl as getColumnCatalogFieldId,
3601
+ Yl as getDashboardFilterSubscriptionHint,
3602
+ Jl as getDashboardGlobalDateFilter,
3603
+ Bf as getDocumentKpiSectionShapeIssues,
3604
+ Vf as getDocumentSectionCards,
3605
+ yh as getDomainCalculatedSelectionOverrides,
3606
+ Xl as getFieldAggregationOptions,
3607
+ Zl as getMatrixBindingTargets,
3597
3608
  Km as getMatrixLevelLabel,
3598
- Wm as getMatrixMeasureLabel,
3599
- tc as getStableDomainCalculatedFieldId,
3600
- ac as getTemporalBucketAuthoringOptions,
3601
- sc as getTemporalBucketAuthoringSelection,
3602
- oc as handleSchema,
3603
- nc as hasDashboardFilterSubscription,
3604
- Ih as hasSeeRecordsMeasureFilter,
3609
+ jm as getMatrixMeasureLabel,
3610
+ ec as getStableDomainCalculatedFieldId,
3611
+ tc as getTemporalBucketAuthoringOptions,
3612
+ ac as getTemporalBucketAuthoringSelection,
3613
+ sc as handleSchema,
3614
+ oc as hasDashboardFilterSubscription,
3615
+ vh as hasSeeRecordsMeasureFilter,
3605
3616
  ue as hasStoredKey,
3606
- ic as hasTextCardRichWords,
3607
- rc as hasToolbarFilterReachField,
3608
- wm as hostFilterValueFor,
3609
- xm as hostFilterValuesToSlots,
3610
- dc as inspectMatrixCardConfig,
3611
- Sm as isAdHocFilterValueOnTab,
3617
+ nc as hasTextCardRichWords,
3618
+ ic as hasToolbarFilterReachField,
3619
+ $m as hostFilterValueFor,
3620
+ wm as hostFilterValuesToSlots,
3621
+ rc as inspectMatrixCardConfig,
3622
+ xm as isAdHocFilterValueOnTab,
3612
3623
  Ca as isAggregateGet,
3613
- lc as isAllowedDashboardInputScopeCombination,
3614
- cc as isCardType,
3624
+ dc as isAllowedDashboardInputScopeCombination,
3625
+ lc as isCardType,
3615
3626
  Kf as isDashboardFilterOperationCompatible,
3616
- Ga as isDashboardInputOnTab,
3617
- Wf as isDashboardInputOwnedBySheet,
3618
- Uf as isDashboardInputScopeEmpty,
3627
+ Ua as isDashboardInputOnTab,
3628
+ jf as isDashboardInputOwnedBySheet,
3629
+ Wf as isDashboardInputScopeEmpty,
3619
3630
  Gf as isDashboardTargetIdTaken,
3620
- uc as isDatabaseEntityReference,
3621
- fc as isGroupedDate,
3622
- mc as isLegacyTableCard,
3623
- hc as isPresentationCurrencyBinding,
3624
- pc as isSeeRecordsCardType,
3625
- gc as isSemanticAutoJoinCard,
3626
- bc as isSemaphorCartesianChartType,
3631
+ cc as isDatabaseEntityReference,
3632
+ uc as isGroupedDate,
3633
+ fc as isLegacyTableCard,
3634
+ mc as isPresentationCurrencyBinding,
3635
+ hc as isSeeRecordsCardType,
3636
+ pc as isSemanticAutoJoinCard,
3637
+ gc as isSemaphorCartesianChartType,
3627
3638
  Oo as isSqlKpi,
3628
- yc as isStructuralControlBinding,
3629
- vc as isTextCardRichContent,
3630
- Ic as isValidControlOptionPresentation,
3631
- Qf as isVariableComparisonPart,
3632
- _c as isWhenRun,
3633
- Cc as kpiSegmentMetricId,
3634
- $c as kpiShowsTrend,
3639
+ bc as isStructuralControlBinding,
3640
+ yc as isTextCardRichContent,
3641
+ vc as isValidControlOptionPresentation,
3642
+ Uf as isVariableComparisonPart,
3643
+ Ic as isWhenRun,
3644
+ _c as kpiSegmentMetricId,
3645
+ Cc as kpiShowsTrend,
3635
3646
  Es as kpiTrendBy,
3636
- _h as kpiTrendByHint,
3647
+ Ih as kpiTrendByHint,
3637
3648
  Ws as labelAt,
3638
- wc as layoutArrangeSchema,
3639
- km as legacyTableRoutingIds,
3640
- Tm as legacyTableRoutingTarget,
3641
- xc as linkedClickToFilterOverridesSchema,
3642
- Rm as listAdHocFilterValuesOnTab,
3649
+ $c as layoutArrangeSchema,
3650
+ Sm as legacyTableRoutingIds,
3651
+ km as legacyTableRoutingTarget,
3652
+ wc as linkedClickToFilterOverridesSchema,
3653
+ Tm as listAdHocFilterValuesOnTab,
3643
3654
  xe as listDashboardCardLocations,
3644
- Sc as listDashboardFilterDefinitions,
3645
- kc as listDashboardFilterInputsOnTab,
3655
+ xc as listDashboardFilterDefinitions,
3656
+ Sc as listDashboardFilterInputsOnTab,
3646
3657
  Wa as listDashboardFilterTargets,
3647
- Hf as listDashboardInputReachKeys,
3658
+ Qf as listDashboardInputReachKeys,
3648
3659
  Eo as listDashboardInputScopeExceptedCardIds,
3649
3660
  qo as listDashboardInputScopeExceptedSheetIds,
3650
- Tc as listDashboardInputsTolerantly,
3661
+ kc as listDashboardInputsTolerantly,
3651
3662
  Ot as listDashboardTabTargets,
3652
- zf as listDataVariablePlaces,
3653
- Am as listFilterInputValueTargets,
3654
- Yf as listFilterTargetScopeTargets,
3655
- Jf as listReachedVariableTargets,
3656
- Xf as listReferencedDataVariableIds,
3657
- Rc as listStoredFilterDefinitions,
3658
- Zf as listVariableScopeTargets,
3659
- em as mapDashboardCards,
3660
- tm as mapDocumentSectionCards,
3661
- Ac as mapRuleColumns,
3662
- Fc as matchColumns,
3663
- Fm as matrixCatalogSources,
3663
+ Hf as listDataVariablePlaces,
3664
+ Rm as listFilterInputValueTargets,
3665
+ zf as listFilterTargetScopeTargets,
3666
+ Yf as listReachedVariableTargets,
3667
+ Jf as listReferencedDataVariableIds,
3668
+ Tc as listStoredFilterDefinitions,
3669
+ Xf as listVariableScopeTargets,
3670
+ Zf as mapDashboardCards,
3671
+ em as mapDocumentSectionCards,
3672
+ Rc as mapRuleColumns,
3673
+ Ac as matchColumns,
3674
+ Am as matrixCatalogSources,
3664
3675
  vo as matrixColumnKeys,
3665
- Dc as matrixColumnsSchema,
3666
- Oc as matrixDefinitionFieldRefs,
3667
- Ec as matrixDefinitionFields,
3668
- qc as matrixDefinitionSources,
3669
- Nc as matrixEditorCatalogFromFields,
3670
- Dm as matrixExecutionSources,
3671
- Pc as measureCalculationOptions,
3672
- Lc as measureComparisonSchema,
3673
- Mc as measureRefSchema,
3674
- Bc as measureTransformSchema,
3675
- Um as mergeMatrixSorts,
3676
+ Fc as matrixColumnsSchema,
3677
+ Dc as matrixDefinitionFieldRefs,
3678
+ Oc as matrixDefinitionFields,
3679
+ Ec as matrixDefinitionSources,
3680
+ qc as matrixEditorCatalogFromFields,
3681
+ Fm as matrixExecutionSources,
3682
+ Nc as measureCalculationOptions,
3683
+ Pc as measureComparisonSchema,
3684
+ Lc as measureRefSchema,
3685
+ Mc as measureTransformSchema,
3686
+ Wm as mergeMatrixSorts,
3676
3687
  lo as metricCardQuerySchema,
3677
3688
  yo as moveMatrixLevel,
3678
- Wh as newVariableDraft,
3679
- Uh as newVariableId,
3680
- Vc as normalizeClickToFilterSettings,
3681
- jc as normalizeDashboardInputs,
3689
+ jh as newVariableDraft,
3690
+ Wh as newVariableId,
3691
+ Bc as normalizeClickToFilterSettings,
3692
+ Vc as normalizeDashboardInputs,
3682
3693
  Kc as normalizeLegacyLinkedTargetOverrides,
3683
- Wc as occurrenceKeys,
3694
+ jc as occurrenceKeys,
3684
3695
  es as outlineCalendar,
3685
3696
  Or as outlineDashboard,
3686
3697
  Pe as outlineFilter,
@@ -3689,181 +3700,181 @@ export {
3689
3700
  Rr as parseCardQueryRequest,
3690
3701
  $n as parseCardQueryRequestContext,
3691
3702
  Tr as parseCardQueryRequestExtras,
3692
- Uc as parseColumnRefKey,
3693
- Ch as parseDashboardStyle,
3703
+ Wc as parseColumnRefKey,
3704
+ _h as parseDashboardStyle,
3694
3705
  Gc as parseExecutionControlBindingsShallow,
3695
3706
  Ss as parseExecutionControlContext,
3696
- Qc as parseExecutionControlContract,
3707
+ Uc as parseExecutionControlContract,
3697
3708
  pa as planCardLabels,
3698
3709
  ha as planCardRequery,
3699
- $h as pluralDatasetLabel,
3700
- Om as prepareLoadedDashboard,
3701
- Hc as previewTemporalBucketAuthoringFormat,
3702
- am as projectDataVariableToCard,
3703
- zc as pruneUnrelatedCalculatedFilters,
3710
+ Ch as pluralDatasetLabel,
3711
+ Dm as prepareLoadedDashboard,
3712
+ Qc as previewTemporalBucketAuthoringFormat,
3713
+ tm as projectDataVariableToCard,
3714
+ Hc as pruneUnrelatedCalculatedFilters,
3704
3715
  oo as queryForm,
3705
- Yc as queryMeasureSchema,
3706
- Jc as readCardConditionalRules,
3716
+ zc as queryMeasureSchema,
3717
+ Yc as readCardConditionalRules,
3707
3718
  we as readCardQuery,
3708
3719
  Ft as readCardSettings,
3709
3720
  he as readCardSource,
3710
3721
  Ee as readCardTypeProperties,
3711
- Qh as readComparisonDates,
3722
+ Xh as readComparisonDates,
3712
3723
  Ie as readDashboardFilterModel,
3713
- Hh as readDefaultComparisonDates,
3714
- Xc as readExactDomainCalculatedFieldReference,
3715
- wh as readFilterReachResponse,
3716
- Em as readFilterValueList,
3717
- xh as readKpiDateContext,
3718
- Zc as readKpiFigure,
3719
- eu as readKpiNumber,
3720
- tu as readMatrixCardConfig,
3721
- au as readMeasureCalculations,
3722
- su as readSqlFilterUse,
3723
- ou as readStoredTransform,
3724
- ja as readTextCardWords,
3724
+ Zh as readDefaultComparisonDates,
3725
+ Jc as readExactDomainCalculatedFieldReference,
3726
+ $h as readFilterReachResponse,
3727
+ Om as readFilterValueList,
3728
+ wh as readKpiDateContext,
3729
+ Xc as readKpiFigure,
3730
+ Zc as readKpiNumber,
3731
+ eu as readMatrixCardConfig,
3732
+ tu as readMeasureCalculations,
3733
+ au as readSqlFilterUse,
3734
+ su as readStoredTransform,
3735
+ Ka as readTextCardWords,
3725
3736
  Ze as readTextWords,
3726
- nu as readTransform,
3727
- sm as readVariableAnswer,
3737
+ ou as readTransform,
3738
+ am as readVariableAnswer,
3728
3739
  rs as readVariableEditability,
3729
3740
  kt as readVariableSource,
3730
3741
  Co as readablePresentation,
3731
- iu as rebindDashboardOptionDependencyInputId,
3742
+ nu as rebindDashboardOptionDependencyInputId,
3732
3743
  ma as rebuildsRole,
3733
- ru as reconcileMatrixSpecStructure,
3734
- du as reconcileTemporalBucketAuthoringFormat,
3744
+ iu as reconcileMatrixSpecStructure,
3745
+ ru as reconcileTemporalBucketAuthoringFormat,
3735
3746
  ro as recordsCardQuerySchema,
3736
3747
  Js as refDataset,
3737
3748
  be as refKey,
3738
3749
  Ct as refName,
3739
- lu as registeredDomainEditChangeSchemas,
3740
- cu as relationshipAddSchema,
3741
- uu as relationshipRouteTarget,
3742
- fu as remapClickToFilterReferences,
3743
- mu as remapLinkedClickToFilterOverrides,
3744
- hu as requireNormalizedDashboardInputs,
3745
- pu as resolveBindingControlValue,
3746
- om as resolveCanonicalDetailResultRawKey,
3747
- nm as resolveCanonicalResultOutputKey,
3750
+ du as registeredDomainEditChangeSchemas,
3751
+ lu as relationshipAddSchema,
3752
+ cu as relationshipRouteTarget,
3753
+ uu as remapClickToFilterReferences,
3754
+ fu as remapLinkedClickToFilterOverrides,
3755
+ mu as requireNormalizedDashboardInputs,
3756
+ hu as resolveBindingControlValue,
3757
+ sm as resolveCanonicalDetailResultRawKey,
3758
+ om as resolveCanonicalResultOutputKey,
3748
3759
  Mo as resolveCanonicalResultOutputKeys,
3749
- im as resolveCanonicalResultRawKey,
3750
- Sh as resolveCardColumnRef,
3751
- Gn as resolveCardSettings,
3752
- kh as resolveConditionalRules,
3760
+ nm as resolveCanonicalResultRawKey,
3761
+ xh as resolveCardColumnRef,
3762
+ Un as resolveCardSettings,
3763
+ Sh as resolveConditionalRules,
3753
3764
  Fr as resolveDashboardChanges,
3754
3765
  Dr as resolveDashboardCreate,
3755
- gu as resolveDashboardEntitySource,
3756
- bu as resolveDashboardFilterAutomaticTarget,
3757
- yu as resolveDashboardFilterInheritedTarget,
3758
- vu as resolveDashboardOptionDependencies,
3759
- Iu as resolveDashboardOptionPopulation,
3760
- _u as resolveDashboardSqlFilterTarget,
3766
+ pu as resolveDashboardEntitySource,
3767
+ gu as resolveDashboardFilterAutomaticTarget,
3768
+ bu as resolveDashboardFilterInheritedTarget,
3769
+ yu as resolveDashboardOptionDependencies,
3770
+ vu as resolveDashboardOptionPopulation,
3771
+ Iu as resolveDashboardSqlFilterTarget,
3761
3772
  dn as resolveDashboardStyle,
3762
- Cu as resolveDetailTableRawTemporalPresentation,
3763
- $u as resolveFieldSelectedSource,
3764
- wu as resolveGroupByFieldTarget,
3765
- xu as resolveKpiLayout,
3773
+ _u as resolveDetailTableRawTemporalPresentation,
3774
+ Cu as resolveFieldSelectedSource,
3775
+ $u as resolveGroupByFieldTarget,
3776
+ wu as resolveKpiLayout,
3766
3777
  La as resolveKpiShape,
3767
- Su as resolveKpiValueStyle,
3768
- qm as resolveMatrixControlBindings,
3778
+ xu as resolveKpiValueStyle,
3779
+ Em as resolveMatrixControlBindings,
3769
3780
  Gm as resolveMatrixDefinition,
3770
3781
  fa as resolveMeasureCalculations,
3771
- ku as resolveMeasureTransform,
3772
- Tu as resolveMetricFieldTarget,
3773
- Ru as resolveScalarMappedValue,
3774
- Au as resolveTableColumnTotal,
3775
- Fu as resolveTemporalBucketAuthoringFormat,
3782
+ Su as resolveMeasureTransform,
3783
+ ku as resolveMetricFieldTarget,
3784
+ Tu as resolveScalarMappedValue,
3785
+ Ru as resolveTableColumnTotal,
3786
+ Au as resolveTemporalBucketAuthoringFormat,
3776
3787
  xs as resolveTemporalResultOwner,
3777
3788
  ga as resolveTextCardWords,
3778
- Du as resolveValueStyle,
3779
- Ou as respondsToSelectionsSchema,
3780
- Eu as retainConditionalRules,
3781
- qu as retainedMatrixPath,
3782
- rm as rewriteDashboardInputScopeIds,
3783
- Nm as routeLegacyTableCard,
3784
- Pm as routeLegacyTableCards,
3785
- Lm as routeLegacyTableFrame,
3789
+ Fu as resolveValueStyle,
3790
+ Du as respondsToSelectionsSchema,
3791
+ Ou as retainConditionalRules,
3792
+ Eu as retainedMatrixPath,
3793
+ im as rewriteDashboardInputScopeIds,
3794
+ qm as routeLegacyTableCard,
3795
+ Nm as routeLegacyTableCards,
3796
+ Pm as routeLegacyTableFrame,
3786
3797
  He as sameColumnKey,
3787
- Nu as sanitizeTextCardUrl,
3788
- Th as seeRecordsAvailability,
3789
- Rh as seeRecordsCardAvailability,
3798
+ qu as sanitizeTextCardUrl,
3799
+ kh as seeRecordsAvailability,
3800
+ Th as seeRecordsCardAvailability,
3790
3801
  Pr as seeRecordsMeasureId,
3791
- Ah as seeRecordsMeasureKind,
3792
- Fh as seeRecordsReasonHidesOffer,
3793
- Pu as seeRecordsRequestSchema,
3794
- Dh as seeRecordsRowField,
3795
- Lu as selectDashboardOptionDependencyInputIds,
3796
- Mu as selectionFieldFromExplorerField,
3797
- Oh as selectionTupleFromClickContext,
3798
- Eh as setMeasureCalculations,
3799
- Bu as settableCardType,
3800
- Vu as sharedCardPreferences,
3801
- ju as sharedTableDialect,
3802
+ Rh as seeRecordsMeasureKind,
3803
+ Ah as seeRecordsReasonHidesOffer,
3804
+ Nu as seeRecordsRequestSchema,
3805
+ Fh as seeRecordsRowField,
3806
+ Pu as selectDashboardOptionDependencyInputIds,
3807
+ Lu as selectionFieldFromExplorerField,
3808
+ Dh as selectionTupleFromClickContext,
3809
+ Oh as setMeasureCalculations,
3810
+ Mu as settableCardType,
3811
+ Bu as sharedCardPreferences,
3812
+ Vu as sharedTableDialect,
3802
3813
  Ku as sheetChangeSchemas,
3803
3814
  io as sqlCardQuerySchema,
3804
- Wu as sqlKpiResultKeys,
3815
+ ju as sqlKpiResultKeys,
3805
3816
  qe as statedLabelsOf,
3806
3817
  Rs as storedCardTypeFor,
3807
- Uu as storedRunPresentation,
3808
- dm as storedTextRefs,
3818
+ Wu as storedRunPresentation,
3819
+ rm as storedTextRefs,
3809
3820
  Gu as stripInstanceTargetsForLibrarySave,
3810
- Qu as structuralControlOverride,
3821
+ Uu as structuralControlOverride,
3811
3822
  ts as summarizeFilter,
3812
- Hu as supportsCanonicalDashboardTemporalResult,
3813
- zu as tabChangeSchemas,
3814
- Yu as tableColumnTotalLabel,
3815
- Ju as textCardExcerpt,
3816
- Xu as textCardWordingClauses,
3823
+ Qu as supportsCanonicalDashboardTemporalResult,
3824
+ Hu as tabChangeSchemas,
3825
+ zu as tableColumnTotalLabel,
3826
+ Yu as textCardExcerpt,
3827
+ Ju as textCardWordingClauses,
3817
3828
  _t as textCatalogAt,
3818
3829
  ct as toChartType,
3819
- Zu as toEditableRules,
3820
- ef as toFiniteKpiNumber,
3830
+ Xu as toEditableRules,
3831
+ Zu as toFiniteKpiNumber,
3821
3832
  $t as toPublicCardType,
3822
3833
  Xs as toStoredComparison,
3823
- tf as toolbarFilterInputFields,
3824
- af as toolbarFilterScope,
3825
- sf as transformComparisonDocument,
3826
- of as transformGroupings,
3827
- nf as transformOrderSchema,
3834
+ ef as toolbarFilterInputFields,
3835
+ tf as toolbarFilterScope,
3836
+ af as transformComparisonDocument,
3837
+ sf as transformGroupings,
3838
+ of as transformOrderSchema,
3828
3839
  bo as updateMatrixConfig,
3829
3840
  Yi as upgradeCardFormats,
3830
3841
  Nr as upgradeCardPresentation,
3831
3842
  or as upgradeConditionalFormatting,
3832
- Mm as upgradeToStoredDashboard,
3833
- rf as validateAndResolveWindowTransforms,
3834
- df as validateControlValue,
3835
- lm as validateDashboardFilterValues,
3843
+ Lm as upgradeToStoredDashboard,
3844
+ nf as validateAndResolveWindowTransforms,
3845
+ rf as validateControlValue,
3846
+ dm as validateDashboardFilterValues,
3836
3847
  $s as validateResolvedPrimaryDateFieldShape,
3837
- cm as variableCardKeepsComparison,
3838
- um as variableComparison,
3848
+ lm as variableCardKeepsComparison,
3849
+ cm as variableComparison,
3839
3850
  Ye as variableFromDraft,
3840
3851
  hn as variableGetOptions,
3841
- fm as variablePartCell,
3842
- mm as variablePartType,
3852
+ um as variablePartCell,
3853
+ fm as variablePartType,
3843
3854
  Lo as variableParts,
3844
- hm as variableQueryResponseOf,
3845
- qh as variableSourceWords,
3855
+ mm as variableQueryResponseOf,
3856
+ Eh as variableSourceWords,
3846
3857
  bn as variableTakesComparison,
3847
3858
  Jo as variableWords,
3848
- lf as withCardConditionalRules,
3849
- cf as withCardConfigSqlDatePatterns,
3850
- pm as withCardExcludedFromScope,
3851
- gm as withCardIncludedInScope,
3852
- uf as withDashboardOptionDependencyOverride,
3853
- ff as withDetailSqlDatePattern,
3854
- bm as withDraftCard,
3855
- mf as withFormatOverride,
3856
- hf as withSqlDatePattern,
3859
+ df as withCardConditionalRules,
3860
+ lf as withCardConfigSqlDatePatterns,
3861
+ hm as withCardExcludedFromScope,
3862
+ pm as withCardIncludedInScope,
3863
+ cf as withDashboardOptionDependencyOverride,
3864
+ uf as withDetailSqlDatePattern,
3865
+ gm as withDraftCard,
3866
+ ff as withFormatOverride,
3867
+ mf as withSqlDatePattern,
3857
3868
  Po as withUnstatedScopeParts,
3858
- pf as withoutSqlDatePattern,
3859
- gf as withoutToolbarFilterReachFields,
3860
- bf as wordingBlocks,
3861
- yf as wordingClauses,
3862
- vf as writeColumnFormat,
3863
- If as writeColumnPolarity,
3864
- _f as writeComparisonDisplay,
3865
- Cf as writeComparisonPresentation,
3866
- $f as writeInheritComparison,
3867
- wf as writeSeeRecords,
3869
+ hf as withoutSqlDatePattern,
3870
+ pf as withoutToolbarFilterReachFields,
3871
+ gf as wordingBlocks,
3872
+ bf as wordingClauses,
3873
+ yf as writeColumnFormat,
3874
+ vf as writeColumnPolarity,
3875
+ If as writeComparisonDisplay,
3876
+ _f as writeComparisonPresentation,
3877
+ Cf as writeInheritComparison,
3878
+ $f as writeSeeRecords,
3868
3879
  Ys as writeTextWords
3869
3880
  };