react-semaphor 0.1.585 → 0.1.586

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 (40) hide show
  1. package/dist/analytics-protocol/index.js +102 -100
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/{assistant-chat-BdbLmAnK.js → assistant-chat-BU5gchFy.js} +6 -6
  5. package/dist/chunks/{bookmark-impact-BhT3k379.js → bookmark-impact-ZPSGncK6.js} +1 -1
  6. package/dist/chunks/{card-filter-builder-CEcKF6Fw.js → card-filter-builder-HELJWA4D.js} +165 -165
  7. package/dist/chunks/{dashboard-MPku_x1M.js → dashboard-BXP-ZxSY.js} +1 -1
  8. package/dist/chunks/{dashboard-briefing-launcher-CkFNlkr1.js → dashboard-briefing-launcher-BGj42whr.js} +7 -7
  9. package/dist/chunks/{dashboard-controls-Clt4ovXS.js → dashboard-controls-zvbRp6D2.js} +7 -7
  10. package/dist/chunks/{dashboard-json-DSmXazIg.js → dashboard-json-CykexgqL.js} +1 -1
  11. package/dist/chunks/{dates-CYZW9owO.js → dates-CaqZtq01.js} +4 -4
  12. package/dist/chunks/{edit-dashboard-visual-Dn2ECRbX.js → edit-dashboard-visual-C82JNxbt.js} +501 -501
  13. package/dist/chunks/{filter-reach-copy-CmJpPa4G.js → filter-reach-copy-ZERaFKsN.js} +880 -863
  14. package/dist/chunks/{index-0WYn6RMz.js → index-otMIColV.js} +1 -1
  15. package/dist/chunks/{matrix-analytical-definition-QjBgUYhP.js → matrix-analytical-definition-DOVSFFuf.js} +179 -169
  16. package/dist/chunks/{report-preferences-dialog-BRaeufEi.js → report-preferences-dialog-B-CoyS1x.js} +7 -7
  17. package/dist/chunks/{resolve-dashboard-input-context-Cn9jumxl.js → resolve-dashboard-input-context-BTTdKXH0.js} +10325 -10247
  18. package/dist/chunks/{saved-dashboard-context-CfqkUMzR.js → saved-dashboard-context-B-rosN4W.js} +75 -72
  19. package/dist/chunks/{semaphor-ready-indicator-D6WjdTGl.js → semaphor-ready-indicator-Cy1n_04D.js} +22649 -22461
  20. package/dist/chunks/{shelf-drop-preview-context-Bbbrr9u4.js → shelf-drop-preview-context-Bmz54WYm.js} +2 -2
  21. package/dist/chunks/{stored-dashboard-sPkTjxYf.js → stored-dashboard-rDJ8sw6J.js} +600 -595
  22. package/dist/chunks/{variable-draft-D1RotIEG.js → variable-draft-DvngkRMl.js} +3 -3
  23. package/dist/chunks/{visual-choice-JiJ-_3bi.js → visual-choice-BBPizkRo.js} +74 -72
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/dashboard-authoring/index.js +328 -320
  26. package/dist/index.js +11 -11
  27. package/dist/style.css +1 -1
  28. package/dist/surfboard/index.js +1 -1
  29. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +86 -3
  30. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +49 -27
  31. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  32. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +30 -2
  33. package/dist/types/shared/analytics-protocol/click-reach-filter-id.d.ts +9 -0
  34. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +3 -1
  35. package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
  36. package/dist/types/shared/dashboard-authoring/click-to-filter-card-decision.d.ts +102 -0
  37. package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +13 -1
  38. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  39. package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +13 -0
  40. package/package.json +2 -2
@@ -1,30 +1,30 @@
1
- import { J as Wr, K as Gr, M as Hr, N as wn, O as Yr, P as Qr, Q as Jr, R as Xr, S as Zr, T as xn, U as ei, V as Re, W as ti, X as ni, Y as ri, g as ii, k as we, Z as ai, _ as oi } from "./stored-dashboard-sPkTjxYf.js";
2
- import { gj as Tn, bv as xe, gk as si, gl as ci, gm as li, gn as di, P as X, go as Dn, bx as ui, gp as fi, gq as ct, aj as lt, gr as mi, gs as pi, gt as hi, L as dt, gu as gi, gv as yi, gw as bi, bK as vi, Q as Ii, gx as Ci, M as Fi, m as ut, gy as ft, gz as Si, gA as F, o as Me, gB as ne, gC as x, gD as wi, gE as xi, gF as Vt, gG as Ti, gH as Bt, gI as Di, aS as T, gJ as kn, b1 as Oe, gK as ki, gL as _i, gM as Mi, gN as Oi, gO as Ai, g8 as _n, cr as Mn, gP as On, gQ as An, g3 as Te, gR as qt, a4 as Z, gS as mt, gT as Ut, gU as pt, t as jt, gV as zt, ce as ht, gW as $i, gX as Pi, gY as ce, gZ as Ni, g_ as Ei, g$ as Ri, a7 as $n, cj as gt, aE as Ki, h0 as Wt, h1 as Pn, h2 as Ge, K as Li, aH as Vi, ef as Bi, h3 as qi, h4 as Ui, h5 as ji, h6 as zi, h7 as Wi, h8 as Gi, h9 as Hi, ha as Yi, hb as He, g2 as Qi, fZ as Ke, hc as Ji, hd as Xi, he as Nn, a as En, hf as Zi, hg as ea, dc as Rn, hh as Gt, cM as ta, df as Ht, de as na, en as ra, eM as ia, N as aa, eE as oa, aW as sa, f5 as ca, hi as la, hj as da, cy as Yt } from "./resolve-dashboard-input-context-Cn9jumxl.js";
3
- import { a5 as me, s as ua, d as fa, aE as ma, a2 as Kn, au as pa, r as Ye, n as ha, c as ga, j as Ln } from "./validators-CJ8Jh0E8.js";
4
- import { s as yt, P as ya, N as ba, n as Le } from "./matrix-operation-contract-BM5TveR3.js";
5
- import { a as va, C as Ia } from "./metric-comparison-ZmurmEIs.js";
6
- import { t as Qt, e as Jt } from "./analytics-base-schemas-BaIQrEzX.js";
1
+ import { J as Gr, K as Hr, M as Yr, N as xn, O as Qr, P as Xr, Q as Jr, R as Zr, S as ei, T as Tn, U as ti, V as Re, W as ni, X as ri, Y as ii, g as ai, k as we, Z as oi, _ as si } from "./stored-dashboard-rDJ8sw6J.js";
2
+ import { gn as Dn, bv as xe, go as ci, gp as li, gq as di, gr as ui, P as J, gs as kn, bx as fi, gt as mi, gu as ct, aj as lt, gv as pi, gw as hi, gx as gi, L as dt, gy as yi, gz as bi, gA as vi, bK as Ii, Q as Ci, gB as Fi, M as Si, m as ut, gC as ft, gD as wi, gE as F, o as Me, gF as ne, gG as x, gH as xi, gI as Ti, gJ as Vt, gK as Di, gL as Bt, gM as ki, aS as T, gN as _n, b1 as Oe, gO as _i, gP as Mi, gQ as Oi, gR as Ai, gS as $i, gc as Mn, cr as On, gT as An, gU as $n, g7 as Te, gV as qt, a4 as Z, gW as mt, gX as Ut, gY as pt, t as zt, gZ as jt, ce as ht, g_ as Pi, g$ as Ni, h0 as ce, h1 as Ei, h2 as Ri, h3 as Ki, a7 as Pn, cj as gt, aE as Li, h4 as Wt, h5 as Nn, h6 as Ge, K as Vi, aH as Bi, ei as qi, h7 as Ui, h8 as zi, h9 as ji, ha as Wi, hb as Gi, hc as Hi, hd as Yi, he as Qi, hf as He, g6 as Xi, g1 as Ke, hg as Ji, hh as Zi, hi as En, a as Rn, hj as ea, hk as ta, df as Kn, hl as Gt, cP as na, di as Ht, dh as ra, eq as ia, eP as aa, N as oa, eH as sa, aW as ca, f8 as la, hm as da, hn as ua, cy as Yt } from "./resolve-dashboard-input-context-BTTdKXH0.js";
3
+ import { a5 as me, s as fa, d as ma, aE as pa, a2 as Ln, au as ha, r as Ye, n as ga, c as ya, j as Vn } from "./validators-CJ8Jh0E8.js";
4
+ import { s as yt, P as ba, N as va, n as Le } from "./matrix-operation-contract-BM5TveR3.js";
5
+ import { a as Ia, C as Ca } from "./metric-comparison-ZmurmEIs.js";
6
+ import { t as Qt, e as Xt } from "./analytics-base-schemas-BaIQrEzX.js";
7
7
  import "zod";
8
- import { c as te, i as N, b1 as Ca, b2 as Fa, n as Sa, j as wa, e as Qe, g as xa, Y as A, ao as Ta, av as Da, d as ka, aq as _a, a2 as Ma, w as Oa, ad as Aa, aK as M, ag as Vn, f as $a, ae as Pa } from "./pivot-result-contract-expectations-Bx_BCu-7.js";
8
+ import { c as te, i as N, b1 as Fa, b2 as Sa, n as wa, j as xa, e as Qe, g as Ta, Y as A, ao as Da, av as ka, d as _a, aq as Ma, a2 as Oa, w as Aa, ad as $a, aK as M, ag as Bn, f as Pa, ae as Na } from "./pivot-result-contract-expectations-Bx_BCu-7.js";
9
9
  import "../value-format-preferences/index.js";
10
- import { z as Na, T as Ea, L as Ra, ag as Ka, a2 as Xt, O as Bn, A as qn, ar as La, P as Un, D as Va, a6 as Ba, a7 as qa, G as jn, Y as Ua, Z as zn, I as bt, _ as Wn, as as ja } from "./bookmark-state-CL4WEpgB.js";
11
- import { g as za } from "./pickers-DkqmtnTL.js";
12
- import { n as Wa } from "./index-BVKzKl5d.js";
13
- import { f as Ga, D as Ha, g as Ya, C as ye, i as Zt } from "./edit-9df1zOWe.js";
14
- import { D as Qa } from "./resolver-DG_tfEpt.js";
10
+ import { z as Ea, T as Ra, L as Ka, ag as La, a2 as Jt, O as qn, A as Un, ar as Va, P as zn, D as Ba, a6 as qa, a7 as Ua, G as jn, Y as za, Z as Wn, I as bt, _ as Gn, as as ja } from "./bookmark-state-CL4WEpgB.js";
11
+ import { g as Wa } from "./pickers-DkqmtnTL.js";
12
+ import { n as Ga } from "./index-BVKzKl5d.js";
13
+ import { f as Ha, D as Ya, g as Qa, C as ye, i as Zt } from "./edit-9df1zOWe.js";
14
+ import { D as Xa } from "./resolver-DG_tfEpt.js";
15
15
  import "./schema-C9NPiIru.js";
16
16
  import "./index-CV_Kzou0.js";
17
17
  import "./context-BTLBjQNh.js";
18
- import { r as Ja, J as Xa, v as Za } from "./matrix-analytical-definition-QjBgUYhP.js";
19
- import { f as eo } from "./filter-line-Cu2u1K36.js";
20
- import { i as to } from "./aggregate-measure-field-DsFXETpI.js";
21
- import { r as Je } from "./pivot-result-identity-Bvs6Uq3v.js";
22
- import { r as Gn } from "./applied-constraints-DU-wndZ7.js";
23
- function no(e, t) {
18
+ import { r as Ja, L as Za, x as eo } from "./matrix-analytical-definition-DOVSFFuf.js";
19
+ import { f as to } from "./filter-line-Cu2u1K36.js";
20
+ import { i as no } from "./aggregate-measure-field-DsFXETpI.js";
21
+ import { r as Xe } from "./pivot-result-identity-Bvs6Uq3v.js";
22
+ import { r as Hn } from "./applied-constraints-DU-wndZ7.js";
23
+ function ro(e, t) {
24
24
  if (!(typeof e != "number" || typeof t != "number"))
25
25
  return e === t ? t : void 0;
26
26
  }
27
- function z(e, t) {
27
+ function j(e, t) {
28
28
  const n = te(e, t);
29
29
  if (n) {
30
30
  if (n.type === "date")
@@ -57,7 +57,7 @@ function z(e, t) {
57
57
  type: n.type,
58
58
  locale: n.locale,
59
59
  currency: n.type === "currency" ? n.currency : void 0,
60
- decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : no(
60
+ decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : ro(
61
61
  n.minimumFractionDigits,
62
62
  n.maximumFractionDigits
63
63
  ),
@@ -74,7 +74,7 @@ function z(e, t) {
74
74
  };
75
75
  }
76
76
  }
77
- function Hn(e, t) {
77
+ function Yn(e, t) {
78
78
  const n = te(e, t);
79
79
  return (n == null ? void 0 : n.type) === "duration" ? {
80
80
  style: "duration",
@@ -91,7 +91,7 @@ function Hn(e, t) {
91
91
  } : !n || !N(n) ? void 0 : {
92
92
  style: n.type === "currency" ? "currency" : n.type === "percent" ? "percent" : n.type === "scientific" ? "scientific" : "decimal",
93
93
  currency: n.type === "currency" && n.currency || (t != null && t.preserveOmittedProperties ? void 0 : "USD"),
94
- locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Ca),
94
+ locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Fa),
95
95
  minimumFractionDigits: n.minimumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 0),
96
96
  maximumFractionDigits: n.maximumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 2),
97
97
  useGrouping: typeof n.useGrouping == "boolean" ? n.useGrouping : !0,
@@ -104,60 +104,60 @@ function Hn(e, t) {
104
104
  suffix: n.suffix
105
105
  };
106
106
  }
107
- const en = [10, 20, 50, 100, 500, 1e3], ro = 50;
108
- function io(e) {
109
- return e && e > 0 ? e : ro;
107
+ const en = [10, 20, 50, 100, 500, 1e3], io = 50;
108
+ function ao(e) {
109
+ return e && e > 0 ? e : io;
110
110
  }
111
- function Ml(e) {
112
- const t = io(e), n = [...en];
111
+ function Al(e) {
112
+ const t = ao(e), n = [...en];
113
113
  return en.includes(
114
114
  t
115
115
  ) || (n.push(t), n.sort((r, i) => r - i)), n;
116
116
  }
117
- function Ol(e) {
117
+ function $l(e) {
118
118
  var t, n;
119
- return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Tn(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
119
+ return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Dn(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
120
120
  }
121
- function ao(e, t) {
121
+ function oo(e, t) {
122
122
  var r, i, o, a;
123
123
  if (t === "table-print")
124
124
  return "disabled";
125
125
  if ((i = (r = e.preferences) == null ? void 0 : r.tablePrefs) != null && i.forceClientPagination)
126
126
  return "client";
127
- const n = Tn(e.config);
128
- return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && Wr(e) ? "server" : "client";
127
+ const n = Dn(e.config);
128
+ return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && Gr(e) ? "server" : "client";
129
129
  }
130
- const Yn = Object.freeze({}), Al = {
130
+ const Qn = Object.freeze({}), Pl = {
131
131
  access: "session-only",
132
132
  printMode: !1,
133
133
  baseline: null,
134
134
  applied: null,
135
135
  appliedBookmark: null,
136
- tableSettings: Yn,
136
+ tableSettings: Qn,
137
137
  notices: [],
138
138
  isFavorite: !1,
139
139
  fetchedAt: 0
140
140
  };
141
- function $l(e) {
141
+ function Nl(e) {
142
142
  return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
143
143
  }
144
- function oo(e) {
145
- return e.isDashboardEditing ? Yn : e.viewer.tableSettings;
144
+ function so(e) {
145
+ return e.isDashboardEditing ? Qn : e.viewer.tableSettings;
146
146
  }
147
- function so(e, t) {
148
- return oo(e)[t];
147
+ function co(e, t) {
148
+ return so(e)[t];
149
149
  }
150
- function Pl(e, t, n) {
151
- if (!(n.isEditorPreview || e.isDashboardEditing) && Na(e.dashboard, t))
152
- return { settings: so(e, t) };
150
+ function El(e, t, n) {
151
+ if (!(n.isEditorPreview || e.isDashboardEditing) && Ea(e.dashboard, t))
152
+ return { settings: co(e, t) };
153
153
  }
154
- function co(e) {
154
+ function lo(e) {
155
155
  var t;
156
- return Gr({
156
+ return Hr({
157
157
  card: e.card,
158
- paginationMode: ao(e.card) === "server" ? "server" : "client",
158
+ paginationMode: oo(e.card) === "server" ? "server" : "client",
159
159
  result: {
160
- keys: e.keys ?? Hr(e.records),
160
+ keys: e.keys ?? Yr(e.records),
161
161
  rows: e.records,
162
162
  columns: e.resultColumns,
163
163
  columnKeyMap: e.columnKeyMap,
@@ -167,14 +167,14 @@ function co(e) {
167
167
  projection: "export"
168
168
  });
169
169
  }
170
- function lo(e) {
170
+ function uo(e) {
171
171
  if (e)
172
- return z(
172
+ return j(
173
173
  te(e, { preserveOmittedProperties: !0 }),
174
174
  { preserveOmittedProperties: !0 }
175
175
  );
176
176
  }
177
- function uo(e) {
177
+ function fo(e) {
178
178
  if (e.type === "percent") {
179
179
  const { multiplyBy: t, percentValueMode: n, ...r } = e, i = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
180
180
  if (i || t === void 0)
@@ -186,7 +186,7 @@ function uo(e) {
186
186
  xe(e, { preserveOmittedProperties: !0 })
187
187
  );
188
188
  }
189
- const Ae = lo, Nl = uo, fo = () => ({
189
+ const Ae = uo, Rl = fo, mo = () => ({
190
190
  urlTemplate: "{value}",
191
191
  // Default: use cell value as-is
192
192
  labelType: "value",
@@ -200,9 +200,9 @@ const Ae = lo, Nl = uo, fo = () => ({
200
200
  inheritMetricFormat: !0,
201
201
  textAlign: "left",
202
202
  // The table's one width rule (card appearance P2-21).
203
- width: li,
204
- minWidth: ci,
205
- maxWidth: si,
203
+ width: di,
204
+ minWidth: li,
205
+ maxWidth: ci,
206
206
  textOverflow: "ellipsis",
207
207
  textWrap: "default",
208
208
  numberFormat: {
@@ -224,12 +224,12 @@ const Ae = lo, Nl = uo, fo = () => ({
224
224
  sourceTimezone: "auto"
225
225
  // Default to auto (use explicit timezone if present, otherwise assume UTC)
226
226
  },
227
- linkFormat: fo()
227
+ linkFormat: mo()
228
228
  });
229
- function El(e, t, n, r) {
229
+ function Kl(e, t, n, r) {
230
230
  return t && t !== "auto" ? t : n;
231
231
  }
232
- const Rl = (e) => !e || e === "auto" ? "local time" : {
232
+ const Ll = (e) => !e || e === "auto" ? "local time" : {
233
233
  "America/New_York": "Eastern Time",
234
234
  "America/Chicago": "Central Time",
235
235
  "America/Denver": "Mountain Time",
@@ -240,7 +240,7 @@ const Rl = (e) => !e || e === "auto" ? "local time" : {
240
240
  "Asia/Shanghai": "China Time",
241
241
  UTC: "UTC"
242
242
  }[e] || e;
243
- function Qn(e, t) {
243
+ function Xn(e, t) {
244
244
  const n = typeof e.decimalPlaces == "number", r = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : n ? e.decimalPlaces : t.min, i = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : n ? e.decimalPlaces : t.max;
245
245
  return {
246
246
  minimumFractionDigits: r,
@@ -248,7 +248,7 @@ function Qn(e, t) {
248
248
  };
249
249
  }
250
250
  function De(e, t) {
251
- const n = Qn(e, t), r = typeof e.suffix == "string" && e.suffix.length > 0;
251
+ const n = Xn(e, t), r = typeof e.suffix == "string" && e.suffix.length > 0;
252
252
  return {
253
253
  style: "decimal",
254
254
  locale: e.locale,
@@ -266,8 +266,8 @@ function De(e, t) {
266
266
  };
267
267
  }
268
268
  function It(e, t = "auto", n = {}) {
269
- if (t === "auto" && (t = yo(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
270
- const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, o = Number(e) * i, a = Fa(o, n.signDisplay), s = It(a.value === o ? e : -Number(e), t, { ...n, signDisplay: void 0 });
269
+ if (t === "auto" && (t = bo(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
270
+ const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, o = Number(e) * i, a = Sa(o, n.signDisplay), s = It(a.value === o ? e : -Number(e), t, { ...n, signDisplay: void 0 });
271
271
  if (!a.plus) return s;
272
272
  const c = n.prefix ?? "";
273
273
  return c && s.startsWith(c) ? `${c}+${s.slice(c.length)}` : `+${s}`;
@@ -276,15 +276,15 @@ function It(e, t = "auto", n = {}) {
276
276
  case "number":
277
277
  return Jn(e, n);
278
278
  case "currency":
279
- return Xn(e, n);
279
+ return Zn(e, n);
280
280
  case "percent":
281
- return mo(e, n);
282
- case "date":
283
281
  return po(e, n);
284
- case "scientific":
282
+ case "date":
285
283
  return ho(e, n);
286
- case "duration":
284
+ case "scientific":
287
285
  return go(e, n);
286
+ case "duration":
287
+ return yo(e, n);
288
288
  default:
289
289
  return String(e);
290
290
  }
@@ -304,8 +304,8 @@ function Jn(e, t = {}) {
304
304
  })
305
305
  );
306
306
  }
307
- function Xn(e, t = {}) {
308
- return xa(e, {
307
+ function Zn(e, t = {}) {
308
+ return Ta(e, {
309
309
  ...De(t, {
310
310
  min: 2,
311
311
  max: 2
@@ -314,8 +314,8 @@ function Xn(e, t = {}) {
314
314
  currency: t.currency || "USD"
315
315
  });
316
316
  }
317
- function mo(e, t = {}) {
318
- const n = Qn(t, { min: 1, max: 1 }), i = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, o = e * i;
317
+ function po(e, t = {}) {
318
+ const n = Xn(t, { min: 1, max: 1 }), i = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, o = e * i;
319
319
  return Qe(o, {
320
320
  locale: t.locale,
321
321
  minimumFractionDigits: n.minimumFractionDigits,
@@ -327,7 +327,7 @@ function mo(e, t = {}) {
327
327
  useSuffix: !1
328
328
  });
329
329
  }
330
- function po(e, t = {}) {
330
+ function ho(e, t = {}) {
331
331
  const { locale: n = "en-US" } = t;
332
332
  try {
333
333
  const r = new Date(e);
@@ -338,14 +338,14 @@ function po(e, t = {}) {
338
338
  return String(e);
339
339
  }
340
340
  }
341
- function ho(e, t = {}) {
342
- return wa(
341
+ function go(e, t = {}) {
342
+ return xa(
343
343
  e,
344
344
  De(t, { min: 2, max: 2 })
345
345
  );
346
346
  }
347
- function go(e, t = {}) {
348
- return Sa(e, {
347
+ function yo(e, t = {}) {
348
+ return wa(e, {
349
349
  inputUnit: t.durationInputUnit,
350
350
  outputStyle: t.durationDisplayStyle,
351
351
  largestUnit: t.durationLargestUnit,
@@ -356,13 +356,13 @@ function go(e, t = {}) {
356
356
  negativeInParentheses: t.negativeInParentheses
357
357
  });
358
358
  }
359
- function yo(e, t) {
359
+ function bo(e, t) {
360
360
  return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
361
361
  }
362
- function Kl(e, t = {}) {
362
+ function Vl(e, t = {}) {
363
363
  return (n) => It(n, e, t);
364
364
  }
365
- function bo({
365
+ function vo({
366
366
  number: e,
367
367
  decimalPlaces: t = 0,
368
368
  useSuffix: n = !1,
@@ -371,7 +371,7 @@ function bo({
371
371
  locale: o = "en-US"
372
372
  }) {
373
373
  if (i) {
374
- const a = Xn(e, {
374
+ const a = Zn(e, {
375
375
  currency: i,
376
376
  decimalPlaces: t,
377
377
  locale: o,
@@ -386,7 +386,7 @@ function bo({
386
386
  locale: o
387
387
  });
388
388
  }
389
- var vo = function e(t, n) {
389
+ var Io = function e(t, n) {
390
390
  if (t === n) return !0;
391
391
  if (t && n && typeof t == "object" && typeof n == "object") {
392
392
  if (t.constructor !== n.constructor) return !1;
@@ -412,13 +412,13 @@ var vo = function e(t, n) {
412
412
  }
413
413
  return t !== t && n !== n;
414
414
  };
415
- const ke = /* @__PURE__ */ za(vo);
415
+ const ke = /* @__PURE__ */ Wa(Io);
416
416
  function Ct(e, t) {
417
417
  var n;
418
418
  if (t.id)
419
419
  return (n = e.sql) != null && n.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
420
420
  }
421
- function Zn(e) {
421
+ function er(e) {
422
422
  const t = e.context.preferences;
423
423
  if (!t)
424
424
  return e.authoredFormat;
@@ -429,11 +429,11 @@ function Zn(e) {
429
429
  n ? e.context.resolveBoundCurrency(n) : void 0
430
430
  );
431
431
  }
432
- function Io(e) {
433
- const t = X(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? Yr(
432
+ function Co(e) {
433
+ const t = J(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? Qr(
434
434
  { dataType: "number", format: void 0 },
435
435
  t
436
- ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = N(r) ? Zn({
436
+ ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = N(r) ? er({
437
437
  card: e.card,
438
438
  metric: {
439
439
  id: e.columnKey
@@ -451,12 +451,12 @@ function Io(e) {
451
451
  format: i
452
452
  };
453
453
  }
454
- function Ll(e) {
454
+ function Bl(e) {
455
455
  const t = new Set(
456
- di(e.records)
456
+ ui(e.records)
457
457
  ), n = new Set(
458
458
  e.renderedMetricKeys || e.resultKeys
459
- ), r = X(e.card);
459
+ ), r = J(e.card);
460
460
  return e.resultKeys.filter(
461
461
  (i) => {
462
462
  var o;
@@ -464,19 +464,19 @@ function Ll(e) {
464
464
  }
465
465
  );
466
466
  }
467
- function Vl(e) {
467
+ function ql(e) {
468
468
  var o, a;
469
469
  const { card: t, context: n } = e;
470
- if (!(n != null && n.preferences) || !Dn(t.type))
470
+ if (!(n != null && n.preferences) || !kn(t.type))
471
471
  return t;
472
472
  const r = n.preferences, i = (o = t.sql) != null && o.trim() ? e.resultMetricKeys.map(
473
- (s) => Io({
473
+ (s) => Co({
474
474
  card: t,
475
475
  columnKey: s,
476
476
  context: n
477
477
  })
478
478
  ) : (((a = t.config) == null ? void 0 : a.metricColumns) || []).map((s) => {
479
- const c = wn(t, s), l = c.authoredFormat;
479
+ const c = xn(t, s), l = c.authoredFormat;
480
480
  if (!N(l))
481
481
  return s;
482
482
  const d = Ct(t, s), u = d ? n.resolveBoundCurrency(d) : void 0;
@@ -486,7 +486,7 @@ function Vl(e) {
486
486
  l,
487
487
  r,
488
488
  u
489
- ) : Zn({
489
+ ) : er({
490
490
  card: t,
491
491
  metric: s,
492
492
  context: n,
@@ -505,7 +505,7 @@ function Vl(e) {
505
505
  function $e(e) {
506
506
  var c;
507
507
  const { card: t, context: n, formatOptions: r } = e, i = n == null ? void 0 : n.preferences;
508
- if (!t || !i || !Dn(t.type))
508
+ if (!t || !i || !kn(t.type))
509
509
  return r;
510
510
  if (!r) {
511
511
  const l = e.metrics.filter(
@@ -513,7 +513,7 @@ function $e(e) {
513
513
  ), d = l.some(
514
514
  (u) => N(u.format)
515
515
  );
516
- return l.length < 2 || !d ? r : z(
516
+ return l.length < 2 || !d ? r : j(
517
517
  A({ type: "number" }, i),
518
518
  { preserveOmittedProperties: !0 }
519
519
  );
@@ -527,7 +527,7 @@ function $e(e) {
527
527
  if (d.length === 0)
528
528
  return r;
529
529
  if (d.length !== l.length)
530
- return z(
530
+ return j(
531
531
  A({ type: "number" }, i),
532
532
  { preserveOmittedProperties: !0 }
533
533
  );
@@ -550,7 +550,7 @@ function $e(e) {
550
550
  ];
551
551
  });
552
552
  if (a.length === 0)
553
- return z(
553
+ return j(
554
554
  A(o, i),
555
555
  { preserveOmittedProperties: !0 }
556
556
  );
@@ -564,41 +564,41 @@ function $e(e) {
564
564
  },
565
565
  i
566
566
  );
567
- return z(l, {
567
+ return j(l, {
568
568
  preserveOmittedProperties: !0
569
569
  });
570
570
  }
571
- return z(s, {
571
+ return j(s, {
572
572
  preserveOmittedProperties: !0
573
573
  });
574
574
  }
575
- function Xe(e) {
575
+ function Je(e) {
576
576
  return e ? Object.entries(e).some(([t, n]) => n == null || n === "" ? !1 : t === "type" ? n !== "auto" : !0) : !1;
577
577
  }
578
- function er(e) {
578
+ function tr(e) {
579
579
  if (e)
580
580
  return e.alias || e.label || e.name;
581
581
  }
582
582
  function Ze(e, t) {
583
583
  var r;
584
584
  return (((r = e == null ? void 0 : e.config) == null ? void 0 : r.metricColumns) || []).find((i) => {
585
- const o = er(i);
585
+ const o = tr(i);
586
586
  return t.metricId && i.id === t.metricId || t.metricAlias && o === t.metricAlias || t.metricAlias && i.alias === t.metricAlias || t.columnId && o === t.columnId || t.columnId && i.alias === t.columnId || t.columnId && i.label === t.columnId || t.columnId && i.name === t.columnId;
587
587
  });
588
588
  }
589
589
  function pe(e, t) {
590
590
  var r, i;
591
- const n = ui(e, t);
592
- if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !fi(n)))
591
+ const n = fi(e, t);
592
+ if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !mi(n)))
593
593
  return n;
594
594
  }
595
- function Co(e) {
595
+ function Fo(e) {
596
596
  return !!e && !(e != null && e.format) && me(e == null ? void 0 : e.dataType) === "number";
597
597
  }
598
- const Fo = {
598
+ const So = {
599
599
  style: "decimal"
600
600
  };
601
- function tr(e) {
601
+ function nr(e) {
602
602
  if (!e)
603
603
  return;
604
604
  const t = vt();
@@ -607,7 +607,7 @@ function tr(e) {
607
607
  ...e,
608
608
  inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
609
609
  numberFormat: {
610
- ...Fo,
610
+ ...So,
611
611
  ...e.numberFormat
612
612
  },
613
613
  dateFormat: {
@@ -620,18 +620,18 @@ function tr(e) {
620
620
  }
621
621
  };
622
622
  }
623
- function Bl(e) {
623
+ function Ul(e) {
624
624
  return Object.fromEntries(
625
625
  Object.entries(e || {}).map(([t, n]) => [
626
626
  t,
627
- tr(n)
627
+ nr(n)
628
628
  ])
629
629
  );
630
630
  }
631
631
  function be(e) {
632
632
  return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
633
633
  }
634
- function nr(e, t, n) {
634
+ function rr(e, t, n) {
635
635
  if (!be(n))
636
636
  return n;
637
637
  const r = be(e) ? e : {}, i = be(t) ? t : {}, o = {};
@@ -649,7 +649,7 @@ function nr(e, t, n) {
649
649
  }
650
650
  if (!c && ke(s, l))
651
651
  continue;
652
- const d = nr(
652
+ const d = rr(
653
653
  r[a],
654
654
  l,
655
655
  s
@@ -658,8 +658,8 @@ function nr(e, t, n) {
658
658
  }
659
659
  return o;
660
660
  }
661
- function ql(e) {
662
- let t = nr(
661
+ function zl(e) {
662
+ let t = rr(
663
663
  e.persisted,
664
664
  e.baseline,
665
665
  e.next
@@ -667,11 +667,11 @@ function ql(e) {
667
667
  if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
668
668
  const n = e.next.dateFormat.customFormat;
669
669
  if (!(n != null && n.trim()))
670
- throw new Ta(
670
+ throw new Da(
671
671
  "invalid_raw_temporal_format",
672
672
  "Custom table date formatting requires a non-empty pattern."
673
673
  );
674
- Da({
674
+ ka({
675
675
  dialect: "date_fns",
676
676
  pattern: n,
677
677
  valueKind: e.rawTemporalValueKind
@@ -697,7 +697,7 @@ function ql(e) {
697
697
  type: "date"
698
698
  } : t;
699
699
  }
700
- function So(e, t) {
700
+ function wo(e, t) {
701
701
  const n = e || vt(), r = !t;
702
702
  return {
703
703
  ...n,
@@ -715,21 +715,21 @@ function Ve(e) {
715
715
  if (e)
716
716
  return e.trim().toLowerCase();
717
717
  }
718
- const rr = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
719
- function wo(e) {
718
+ const ir = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
719
+ function xo(e) {
720
720
  const t = e == null ? void 0 : e.trim();
721
- return t ? t.replace(rr, "").trim() || t : void 0;
721
+ return t ? t.replace(ir, "").trim() || t : void 0;
722
722
  }
723
- function xo(e) {
723
+ function To(e) {
724
724
  const t = e == null ? void 0 : e.trim();
725
- return t ? rr.test(t) : !1;
725
+ return t ? ir.test(t) : !1;
726
726
  }
727
- function To(e, t) {
727
+ function Do(e, t) {
728
728
  return t.metricAlias ? e.find(
729
- (n) => va(n) === t.metricAlias
729
+ (n) => Ia(n) === t.metricAlias
730
730
  ) : t.metricId ? e.find((n) => n.id === t.metricId) : void 0;
731
731
  }
732
- function Do(e) {
732
+ function ko(e) {
733
733
  var y;
734
734
  const {
735
735
  card: t,
@@ -740,12 +740,12 @@ function Do(e) {
740
740
  metricKey: a
741
741
  } = e, s = ((y = t == null ? void 0 : t.config) == null ? void 0 : y.metricColumns) || [];
742
742
  if (r || n)
743
- return To(s, {
743
+ return Do(s, {
744
744
  metricAlias: r,
745
745
  metricId: n
746
746
  });
747
747
  const c = [a, o], l = c.some(
748
- (h) => xo(h)
748
+ (h) => To(h)
749
749
  ), d = c.filter(
750
750
  (h) => !!h
751
751
  );
@@ -757,7 +757,7 @@ function Do(e) {
757
757
  if (g)
758
758
  return g;
759
759
  }
760
- const u = d.map((h) => Ve(h)).filter((h) => !!h), f = d.map((h) => wo(h)).filter((h) => !!h);
760
+ const u = d.map((h) => Ve(h)).filter((h) => !!h), f = d.map((h) => xo(h)).filter((h) => !!h);
761
761
  for (const h of f) {
762
762
  const g = Ze(t, {
763
763
  columnId: h,
@@ -780,16 +780,16 @@ function Do(e) {
780
780
  h.alias,
781
781
  h.label,
782
782
  h.name,
783
- er(h)
783
+ tr(h)
784
784
  ].map((I) => Ve(I)).filter((I) => !!I);
785
785
  return p.some(
786
786
  (I) => g.includes(I)
787
787
  );
788
788
  });
789
789
  }
790
- function ko(e) {
790
+ function _o(e) {
791
791
  const t = te(e == null ? void 0 : e.format);
792
- return z(t);
792
+ return j(t);
793
793
  }
794
794
  function tn(e, t) {
795
795
  if (t)
@@ -803,35 +803,35 @@ function nn(e) {
803
803
  if (t)
804
804
  return JSON.stringify(t);
805
805
  }
806
- function _o(e, t) {
806
+ function Mo(e, t) {
807
807
  const n = nn(e), r = nn(t);
808
808
  return !!(n && r && n === r);
809
809
  }
810
- function Mo(e) {
810
+ function Oo(e) {
811
811
  if (e.length === 0)
812
812
  return;
813
813
  const t = e.map(
814
- (a) => ko(a)
814
+ (a) => _o(a)
815
815
  );
816
816
  if (!t.every(
817
- (a) => Xe(a)
817
+ (a) => Je(a)
818
818
  ))
819
819
  return;
820
820
  const r = t, [i] = r;
821
821
  return r.every(
822
- (a) => _o(i, a)
822
+ (a) => Mo(i, a)
823
823
  ) ? i : void 0;
824
824
  }
825
825
  function Pe(e) {
826
- if (Xe(e.overrideFormatOptions))
826
+ if (Je(e.overrideFormatOptions))
827
827
  return {
828
828
  formatOptions: e.overrideFormatOptions || void 0,
829
829
  source: "override"
830
830
  };
831
- const t = Mo(
831
+ const t = Oo(
832
832
  e.metrics || []
833
833
  );
834
- return Xe(t) ? {
834
+ return Je(t) ? {
835
835
  formatOptions: t,
836
836
  source: "metric"
837
837
  } : {
@@ -839,7 +839,7 @@ function Pe(e) {
839
839
  source: "auto"
840
840
  };
841
841
  }
842
- function ir(e) {
842
+ function ar(e) {
843
843
  var c, l, d;
844
844
  const { card: t, chartType: n, axis: r, preferences: i } = e, o = ((c = t == null ? void 0 : t.config) == null ? void 0 : c.metricColumns) || [], a = (i == null ? void 0 : i.datasetOptions) || [];
845
845
  if (!o.length)
@@ -865,7 +865,7 @@ function ir(e) {
865
865
  return n === "radar" ? r === "y" ? o : [] : r !== s ? [] : o;
866
866
  }
867
867
  function Ft(e) {
868
- const { card: t, chartType: n, axis: r, preferences: i, axisConfig: o } = e, a = ir({
868
+ const { card: t, chartType: n, axis: r, preferences: i, axisConfig: o } = e, a = ar({
869
869
  card: t,
870
870
  chartType: n,
871
871
  axis: r,
@@ -884,7 +884,7 @@ function Ft(e) {
884
884
  })
885
885
  };
886
886
  }
887
- function Oo(e) {
887
+ function Ao(e) {
888
888
  const { preferences: t, metric: n } = e, r = t == null ? void 0 : t.tooltipConfig, i = Pe({
889
889
  overrideFormatOptions: Ae(r == null ? void 0 : r.valueFormat),
890
890
  metrics: n ? [n] : []
@@ -900,13 +900,13 @@ function Oo(e) {
900
900
  };
901
901
  }
902
902
  function St(e, t, n) {
903
- return t === lt(n, e) ? mi(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
903
+ return t === lt(n, e) ? pi(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
904
904
  }
905
905
  function wt(e) {
906
906
  const { chartType: t, preferences: n } = e;
907
907
  return t === "bubble" || t === "scatter" ? "y" : lt(t, n);
908
908
  }
909
- function ar(e) {
909
+ function or(e) {
910
910
  switch (e) {
911
911
  case "pie":
912
912
  case "doughnut":
@@ -919,8 +919,8 @@ function ar(e) {
919
919
  return !0;
920
920
  }
921
921
  }
922
- function Ul(e) {
923
- const { card: t, chartType: n, preferences: r, metric: i } = e, o = Oo({
922
+ function jl(e) {
923
+ const { card: t, chartType: n, preferences: r, metric: i } = e, o = Ao({
924
924
  card: t,
925
925
  preferences: r,
926
926
  metric: i,
@@ -938,11 +938,11 @@ function Ul(e) {
938
938
  });
939
939
  return s.source === "override" ? s : o;
940
940
  }
941
- function jl(e) {
941
+ function Wl(e) {
942
942
  const { card: t, chartType: n, preferences: r, dataLabelsConfig: i } = e, o = n || (t == null ? void 0 : t.type), a = wt({
943
943
  chartType: o,
944
944
  preferences: r
945
- }), s = ir({
945
+ }), s = ar({
946
946
  card: t,
947
947
  chartType: o,
948
948
  axis: a,
@@ -959,7 +959,7 @@ function jl(e) {
959
959
  context: e.numericPresentation
960
960
  })
961
961
  };
962
- if (l.source === "override" || !ar(o))
962
+ if (l.source === "override" || !or(o))
963
963
  return l;
964
964
  const d = Ft({
965
965
  card: t,
@@ -975,7 +975,7 @@ function jl(e) {
975
975
  });
976
976
  return d.source === "override" ? d : l;
977
977
  }
978
- function Ao(e) {
978
+ function $o(e) {
979
979
  const { preferences: t, dataLabelsConfig: n, metric: r } = e, i = Pe({
980
980
  overrideFormatOptions: Ae(n == null ? void 0 : n.valueFormat),
981
981
  metrics: r ? [r] : []
@@ -990,16 +990,16 @@ function Ao(e) {
990
990
  })
991
991
  };
992
992
  }
993
- function zl(e) {
993
+ function Gl(e) {
994
994
  var a, s;
995
- const t = Do({
995
+ const t = ko({
996
996
  card: e.card,
997
997
  metricId: e.metricId,
998
998
  metricAlias: e.metricAlias,
999
999
  datasetIndex: e.datasetIndex,
1000
1000
  datasetLabel: e.datasetLabel,
1001
1001
  metricKey: e.metricKey
1002
- }), n = Ao({
1002
+ }), n = $o({
1003
1003
  card: e.card,
1004
1004
  preferences: e.preferences,
1005
1005
  dataLabelsConfig: e.dataLabelsConfig,
@@ -1009,7 +1009,7 @@ function zl(e) {
1009
1009
  if (n.source === "override")
1010
1010
  return n;
1011
1011
  const r = (a = e.card) == null ? void 0 : a.type;
1012
- if (!ar(r))
1012
+ if (!or(r))
1013
1013
  return n;
1014
1014
  let i = wt({
1015
1015
  chartType: r,
@@ -1035,15 +1035,15 @@ function zl(e) {
1035
1035
  });
1036
1036
  return o.source === "override" ? o : n;
1037
1037
  }
1038
- function Wl(e) {
1038
+ function Hl(e) {
1039
1039
  return (e == null ? void 0 : e.rawValue) === !0;
1040
1040
  }
1041
- function $o(e) {
1041
+ function Po(e) {
1042
1042
  const t = e == null ? void 0 : e.numberFormat;
1043
1043
  if (!t)
1044
1044
  return;
1045
1045
  if (t.style === "duration")
1046
- return z(ct(t), {
1046
+ return j(ct(t), {
1047
1047
  preserveOmittedProperties: !0
1048
1048
  });
1049
1049
  const n = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", r = t.minimumFractionDigits, i = t.maximumFractionDigits;
@@ -1063,8 +1063,8 @@ function $o(e) {
1063
1063
  suffix: t.suffix
1064
1064
  };
1065
1065
  }
1066
- function Po(e, t, n = !1) {
1067
- const r = n ? { preserveOmittedProperties: !0 } : void 0, i = te(e == null ? void 0 : e.format, r), o = Hn(
1066
+ function No(e, t, n = !1) {
1067
+ const r = n ? { preserveOmittedProperties: !0 } : void 0, i = te(e == null ? void 0 : e.format, r), o = Yn(
1068
1068
  i,
1069
1069
  r
1070
1070
  );
@@ -1084,7 +1084,7 @@ function Po(e, t, n = !1) {
1084
1084
  }
1085
1085
  };
1086
1086
  }
1087
- function or(e) {
1087
+ function sr(e) {
1088
1088
  var k;
1089
1089
  const {
1090
1090
  card: t,
@@ -1100,7 +1100,7 @@ function or(e) {
1100
1100
  valueFormatPreferences: u,
1101
1101
  boundCurrency: f,
1102
1102
  preserveOmittedProperties: m
1103
- } = e, p = r ?? X(t)[n], y = !((k = t == null ? void 0 : t.sql) != null && k.trim()) || Qr(p), h = y ? u : null, g = y ? f : void 0, I = i ?? tr(p);
1103
+ } = e, p = r ?? J(t)[n], y = !((k = t == null ? void 0 : t.sql) != null && k.trim()) || Xr(p), h = y ? u : null, g = y ? f : void 0, I = i ?? nr(p);
1104
1104
  if (I && I.inheritMetricFormat !== !0)
1105
1105
  return rn(
1106
1106
  I,
@@ -1114,11 +1114,11 @@ function or(e) {
1114
1114
  columnKeyMap: d,
1115
1115
  fieldId: c,
1116
1116
  fieldRole: l
1117
- }), b = Po(
1117
+ }), b = No(
1118
1118
  v,
1119
1119
  I || o,
1120
1120
  m ?? !!u
1121
- ), S = !b && h && Co(v) ? So(
1121
+ ), S = !b && h && Fo(v) ? wo(
1122
1122
  I || o,
1123
1123
  g
1124
1124
  ) : void 0;
@@ -1140,7 +1140,7 @@ function rn(e, t, n) {
1140
1140
  i,
1141
1141
  t,
1142
1142
  n
1143
- ), a = Hn(o, {
1143
+ ), a = Yn(o, {
1144
1144
  preserveOmittedProperties: !0
1145
1145
  });
1146
1146
  return a ? {
@@ -1154,16 +1154,16 @@ function rn(e, t, n) {
1154
1154
  function _e(e) {
1155
1155
  if (!e.valueFormatPreferences)
1156
1156
  return;
1157
- const t = or(e);
1157
+ const t = sr(e);
1158
1158
  if (!t || t.type !== "number")
1159
1159
  return;
1160
1160
  const n = ct(t.numberFormat, {
1161
1161
  preserveOmittedProperties: !0
1162
1162
  });
1163
- if (!(!n || !ka(n)))
1163
+ if (!(!n || !_a(n)))
1164
1164
  return n;
1165
1165
  }
1166
- function No(e) {
1166
+ function Eo(e) {
1167
1167
  var r, i;
1168
1168
  if (!e.presentation.preferences)
1169
1169
  return;
@@ -1184,7 +1184,7 @@ function No(e) {
1184
1184
  columnKeyMap: e.columnKeyMap,
1185
1185
  metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
1186
1186
  valueFormatPreferences: e.presentation.preferences
1187
- }), a = Ea(e.comparisonPrecision) ?? (N(o) ? o.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1187
+ }), a = Ra(e.comparisonPrecision) ?? (N(o) ? o.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1188
1188
  return e.comparisonValueKind === "percent_change" ? {
1189
1189
  type: "percent",
1190
1190
  locale: e.presentation.preferences.locale,
@@ -1217,10 +1217,10 @@ function No(e) {
1217
1217
  boundCurrency: n ? e.presentation.resolveBoundCurrency(n) : void 0
1218
1218
  });
1219
1219
  }
1220
- function Eo(e) {
1220
+ function Ro(e) {
1221
1221
  var s, c, l, d, u;
1222
1222
  if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
1223
- const f = e.target, m = Xr(e.card, e.matrixCatalog).find(
1223
+ const f = e.target, m = Zr(e.card, e.matrixCatalog).find(
1224
1224
  (y) => y.measureId === f.measureId
1225
1225
  ), p = m == null ? void 0 : m.canonical;
1226
1226
  return p && (p.type === "number" || p.type === "currency") ? A(
@@ -1237,7 +1237,7 @@ function Eo(e) {
1237
1237
  (y) => y.id === f
1238
1238
  )))
1239
1239
  return;
1240
- const m = Zr(e.card, {
1240
+ const m = ei(e.card, {
1241
1241
  ...f ? { column: { kind: "field", fieldId: f } } : {},
1242
1242
  resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
1243
1243
  }), p = m.authoredFormat;
@@ -1247,13 +1247,13 @@ function Eo(e) {
1247
1247
  e.boundCurrency
1248
1248
  ) : void 0;
1249
1249
  }
1250
- if (!((l = e.card.sql) != null && l.trim()) && !pi(e.card.type) && e.target.kind === "metric") {
1250
+ if (!((l = e.card.sql) != null && l.trim()) && !hi(e.card.type) && e.target.kind === "metric") {
1251
1251
  const f = e.target.metricId, m = (u = (d = e.card.config) == null ? void 0 : d.metricColumns) == null ? void 0 : u.find(
1252
1252
  (h) => h.id === f
1253
1253
  );
1254
1254
  if (!m)
1255
1255
  return;
1256
- const p = wn(
1256
+ const p = xn(
1257
1257
  e.card,
1258
1258
  m
1259
1259
  ), y = p.authoredFormat;
@@ -1263,7 +1263,7 @@ function Eo(e) {
1263
1263
  e.boundCurrency
1264
1264
  ) : void 0;
1265
1265
  }
1266
- const n = X(e.card), r = e.target.kind === "metric" ? e.target.metricId : void 0, i = e.target.kind === "column" ? [e.target.columnKey] : [
1266
+ const n = J(e.card), r = e.target.kind === "metric" ? e.target.metricId : void 0, i = e.target.kind === "column" ? [e.target.columnKey] : [
1267
1267
  ...e.resultColumnKeys || [],
1268
1268
  ...Object.keys(n),
1269
1269
  e.target.metricId
@@ -1284,9 +1284,9 @@ function Eo(e) {
1284
1284
  });
1285
1285
  return N(a) ? a : void 0;
1286
1286
  }
1287
- function Gl(e) {
1287
+ function Yl(e) {
1288
1288
  var n, r;
1289
- const t = e.persistedSettings ?? X(e.card)[e.columnId];
1289
+ const t = e.persistedSettings ?? J(e.card)[e.columnId];
1290
1290
  if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((n = e.resolvedSettings) == null ? void 0 : n.inheritMetricFormat) === !0) {
1291
1291
  const i = te(
1292
1292
  (r = pe(e.card, {
@@ -1298,20 +1298,20 @@ function Gl(e) {
1298
1298
  { preserveOmittedProperties: !0 }
1299
1299
  );
1300
1300
  if ((i == null ? void 0 : i.type) === "date" || (i == null ? void 0 : i.type) === "duration")
1301
- return z(i, {
1301
+ return j(i, {
1302
1302
  preserveOmittedProperties: !0
1303
1303
  });
1304
1304
  }
1305
- return $o(
1306
- or({
1305
+ return Po(
1306
+ sr({
1307
1307
  ...e,
1308
1308
  persistedSettings: t
1309
1309
  })
1310
1310
  );
1311
1311
  }
1312
- function Hl(e) {
1312
+ function Ql(e) {
1313
1313
  const { value: t, formatOptions: n, preferences: r } = e;
1314
- return n != null && n.type && n.type !== "auto" ? It(t, n.type, n) : bo({
1314
+ return n != null && n.type && n.type !== "auto" ? It(t, n.type, n) : vo({
1315
1315
  number: t,
1316
1316
  decimalPlaces: 0,
1317
1317
  useSuffix: !1,
@@ -1320,8 +1320,8 @@ function Hl(e) {
1320
1320
  currency: ""
1321
1321
  });
1322
1322
  }
1323
- function Ro(e) {
1324
- return hi({
1323
+ function Ko(e) {
1324
+ return gi({
1325
1325
  ...e,
1326
1326
  activation: dt({
1327
1327
  card: e.card,
@@ -1329,8 +1329,8 @@ function Ro(e) {
1329
1329
  })
1330
1330
  });
1331
1331
  }
1332
- function Yl(e) {
1333
- return gi({
1332
+ function Xl(e) {
1333
+ return yi({
1334
1334
  activation: dt({
1335
1335
  card: e.card,
1336
1336
  cardConfig: e.cardConfig
@@ -1339,8 +1339,8 @@ function Yl(e) {
1339
1339
  expectedResultOwner: e.expectedResultOwner
1340
1340
  });
1341
1341
  }
1342
- function Ko(e) {
1343
- const t = xn(e.card, e.effectiveCardConfig), n = co({
1342
+ function Lo(e) {
1343
+ const t = Tn(e.card, e.effectiveCardConfig), n = lo({
1344
1344
  card: t,
1345
1345
  records: e.rows,
1346
1346
  keys: e.rows.length === 0 ? e.resultKeys : void 0,
@@ -1357,40 +1357,40 @@ function Ko(e) {
1357
1357
  delimiter: e.file.delimiter,
1358
1358
  csvEncoding: e.file.csvEncoding,
1359
1359
  includeHeaders: e.file.includeHeaders,
1360
- columnSettings: X(e.card),
1360
+ columnSettings: J(e.card),
1361
1361
  visibleColumns: [...n.visibleKeys],
1362
1362
  columnLabels: Object.fromEntries(n.visibleKeys.map((r) => [r, n.labels[r] ?? r]))
1363
1363
  }
1364
1364
  };
1365
1365
  }
1366
- function Lo(e) {
1366
+ function Vo(e) {
1367
1367
  var n;
1368
1368
  const t = (n = e.preferences) == null ? void 0 : n.comparisonPresentation;
1369
1369
  return {
1370
- ...Ia,
1370
+ ...Ca,
1371
1371
  ...t,
1372
1372
  ...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
1373
1373
  ...t != null && t.colors ? { colors: { ...t.colors } } : {}
1374
1374
  };
1375
1375
  }
1376
- function Vo(e) {
1377
- const t = xn(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], o = [
1376
+ function Bo(e) {
1377
+ const t = Tn(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], o = [
1378
1378
  ...i,
1379
1379
  ...Object.keys(e.formatOptions.columnSettings ?? {})
1380
- ], a = yi(
1380
+ ], a = bi(
1381
1381
  e.card,
1382
1382
  i,
1383
1383
  e.effectiveCardConfig
1384
- ), s = bi(
1384
+ ), s = vi(
1385
1385
  e.card,
1386
1386
  e.effectiveCardConfig,
1387
1387
  a
1388
- ), c = ei(
1388
+ ), c = ti(
1389
1389
  t,
1390
1390
  o
1391
1391
  ), l = new Set(
1392
1392
  c.eligibleTargets.map(Re)
1393
- ), d = (v) => l.has(Re(v)) ? ni({
1393
+ ), d = (v) => l.has(Re(v)) ? ri({
1394
1394
  bindings: r.controlBindings,
1395
1395
  controls: [
1396
1396
  ...r.controlDefinitions ?? [],
@@ -1400,14 +1400,14 @@ function Vo(e) {
1400
1400
  target: v,
1401
1401
  knownTargets: c.knownTargets,
1402
1402
  eligibleTargets: c.eligibleTargets
1403
- }).currency : void 0, u = ti({
1403
+ }).currency : void 0, u = ni({
1404
1404
  card: e.card,
1405
1405
  comparisonMetadata: e.comparisonMetadata,
1406
1406
  columnKeyMap: e.columnKeyMap
1407
1407
  }), f = dt({
1408
1408
  card: e.card,
1409
1409
  cardConfig: e.effectiveCardConfig
1410
- }), m = Ro({
1410
+ }), m = Ko({
1411
1411
  card: e.card,
1412
1412
  cardConfig: e.effectiveCardConfig,
1413
1413
  columns: e.resultColumns,
@@ -1429,7 +1429,7 @@ function Vo(e) {
1429
1429
  throw new Error(
1430
1430
  "Canonical raw temporal export requires an authoritative columnKeyMap."
1431
1431
  );
1432
- const b = vi({
1432
+ const b = Ii({
1433
1433
  cardType: e.card.type,
1434
1434
  resultOwner: r.resultOwner,
1435
1435
  effectiveCardConfig: e.effectiveCardConfig,
@@ -1448,13 +1448,13 @@ function Vo(e) {
1448
1448
  }
1449
1449
  } else if (r.resultOwner === "freeform" && r.sql.trim() && !r.python.trim())
1450
1450
  for (const [v, C] of Object.entries(
1451
- X(e.card)
1451
+ J(e.card)
1452
1452
  )) {
1453
1453
  if (C.type !== "date") continue;
1454
- const b = Ii(C.dateFormat);
1454
+ const b = Ci(C.dateFormat);
1455
1455
  b && h.set(
1456
1456
  v,
1457
- _a({
1457
+ Ma({
1458
1458
  format: b,
1459
1459
  preferences: e.reportContext.valueFormat,
1460
1460
  calendar: e.reportContext.calendar
@@ -1468,14 +1468,14 @@ function Vo(e) {
1468
1468
  if (m.byColumnKey.has(v) || h.has(v))
1469
1469
  return [];
1470
1470
  const C = u.columnPresentationOwners.get(v), b = {
1471
- ...Ci(t, v, {
1471
+ ...Fi(t, v, {
1472
1472
  columnKeyMap: e.columnKeyMap,
1473
1473
  resultColumns: e.resultColumns
1474
1474
  }),
1475
1475
  ...C ? { metricId: C.metricId, metricAlias: C.metricAlias } : {}
1476
1476
  }, S = (H = t.sql) != null && H.trim() ? void 0 : pe(t, b), $ = S ? { kind: "metric", metricId: S.id } : { kind: "column", columnKey: v }, k = l.has(
1477
1477
  Re($)
1478
- ), q = d($), G = X(t)[v], E = {
1478
+ ), q = d($), G = J(t)[v], E = {
1479
1479
  dashboardId: e.dashboardId,
1480
1480
  cardId: t.id
1481
1481
  }, ae = { kind: "column", columnKey: v }, _ = S && (!G || G.inheritMetricFormat === !0) ? te(S.format, {
@@ -1495,7 +1495,7 @@ function Vo(e) {
1495
1495
  }
1496
1496
  }
1497
1497
  ];
1498
- const U = (C ? No({
1498
+ const U = (C ? Eo({
1499
1499
  card: t,
1500
1500
  columnId: v,
1501
1501
  columnKeyMap: e.columnKeyMap,
@@ -1508,7 +1508,7 @@ function Vo(e) {
1508
1508
  preferences: e.reportContext.valueFormat,
1509
1509
  resolveBoundCurrency: d
1510
1510
  }
1511
- }) : void 0) ?? (k ? Eo({
1511
+ }) : void 0) ?? (k ? Ro({
1512
1512
  card: t,
1513
1513
  target: $,
1514
1514
  resultColumnKeys: o,
@@ -1519,7 +1519,7 @@ function Vo(e) {
1519
1519
  ...b,
1520
1520
  persistedSettings: G,
1521
1521
  valueFormatPreferences: e.reportContext.valueFormat
1522
- }), j = (U == null ? void 0 : U.type) === "duration" ? U : U ? A(
1522
+ }), z = (U == null ? void 0 : U.type) === "duration" ? U : U ? A(
1523
1523
  U,
1524
1524
  e.reportContext.valueFormat,
1525
1525
  q
@@ -1532,7 +1532,7 @@ function Vo(e) {
1532
1532
  e.reportContext.valueFormat
1533
1533
  );
1534
1534
  return [
1535
- j.type === "duration" ? { scope: E, target: ae, format: j } : { scope: E, target: ae, format: j }
1535
+ z.type === "duration" ? { scope: E, target: ae, format: z } : { scope: E, target: ae, format: z }
1536
1536
  ];
1537
1537
  });
1538
1538
  g.push(
@@ -1550,7 +1550,7 @@ function Vo(e) {
1550
1550
  cardId: e.card.id
1551
1551
  },
1552
1552
  target: { kind: "column", columnKey: v.columnKey },
1553
- format: Fi(
1553
+ format: Si(
1554
1554
  C,
1555
1555
  {
1556
1556
  dateStyle: e.reportContext.valueFormat.dateStyle,
@@ -1567,7 +1567,7 @@ function Vo(e) {
1567
1567
  format: C
1568
1568
  }))
1569
1569
  );
1570
- const I = Ma({
1570
+ const I = Oa({
1571
1571
  reportContext: e.reportContext,
1572
1572
  resolvedFormats: g
1573
1573
  });
@@ -1575,17 +1575,17 @@ function Vo(e) {
1575
1575
  formatOptions: {
1576
1576
  ...e.formatOptions,
1577
1577
  ...a ? { tableTotalsLabelColumnKey: a } : {},
1578
- comparisonPresentation: Lo(e.card),
1578
+ comparisonPresentation: Vo(e.card),
1579
1579
  presentationExecutionSnapshot: I
1580
1580
  },
1581
1581
  ...s ? { tableTotalsRequest: s } : {}
1582
1582
  };
1583
1583
  }
1584
- function Bo(e) {
1585
- const t = ii(
1584
+ function qo(e) {
1585
+ const t = ai(
1586
1586
  e.card,
1587
1587
  e.requestPayloadBase
1588
- ), { cardId: n, ...r } = t.requestPayloadBase, i = Vo(e);
1588
+ ), { cardId: n, ...r } = t.requestPayloadBase, i = Bo(e);
1589
1589
  return {
1590
1590
  type: "card",
1591
1591
  dashboardId: e.dashboardId,
@@ -1599,14 +1599,14 @@ function Bo(e) {
1599
1599
  formatOptions: i.formatOptions
1600
1600
  };
1601
1601
  }
1602
- function Ql(e) {
1602
+ function Jl(e) {
1603
1603
  const { card: t, result: n } = e;
1604
1604
  if (t.type !== "table" && t.type !== "detailTable")
1605
1605
  return { status: "refused", reason: "not_a_table" };
1606
- const r = n.modelFormats ? Oa(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1607
- if (ri({ card: t, comparisonMetadata: n.comparisonMetadata }))
1606
+ const r = n.modelFormats ? Aa(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1607
+ if (ii({ card: t, comparisonMetadata: n.comparisonMetadata }))
1608
1608
  return { status: "refused", reason: "comparison_metadata_missing" };
1609
- const i = Ko({
1609
+ const i = Lo({
1610
1610
  card: t,
1611
1611
  effectiveCardConfig: r,
1612
1612
  rows: e.rows,
@@ -1617,7 +1617,7 @@ function Ql(e) {
1617
1617
  });
1618
1618
  return i ? {
1619
1619
  status: "ready",
1620
- request: Bo({
1620
+ request: qo({
1621
1621
  card: t,
1622
1622
  dashboardId: e.dashboardId,
1623
1623
  title: e.title,
@@ -1633,9 +1633,9 @@ function Ql(e) {
1633
1633
  })
1634
1634
  } : { status: "refused", reason: "columns_unresolved" };
1635
1635
  }
1636
- function sr(e, t, n) {
1637
- if (ua(
1638
- fa(t),
1636
+ function cr(e, t, n) {
1637
+ if (fa(
1638
+ ma(t),
1639
1639
  e.aggregateOrigin
1640
1640
  ))
1641
1641
  return { aggregate: void 0, aggregateOrigin: void 0 };
@@ -1645,7 +1645,7 @@ function sr(e, t, n) {
1645
1645
  aggregateOrigin: e.aggregate ? e.aggregateOrigin : r ? t.aggregateOrigin : void 0
1646
1646
  };
1647
1647
  }
1648
- function qo(e, t, n) {
1648
+ function Uo(e, t, n) {
1649
1649
  var r, i, o, a, s, c;
1650
1650
  if (n === "domain")
1651
1651
  return {
@@ -1658,7 +1658,7 @@ function qo(e, t, n) {
1658
1658
  windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((c = t.parameters) == null ? void 0 : c.windowTransform)
1659
1659
  };
1660
1660
  }
1661
- function Jl(e, t, n) {
1661
+ function Zl(e, t, n) {
1662
1662
  const r = e;
1663
1663
  return {
1664
1664
  id: e.id,
@@ -1667,22 +1667,22 @@ function Jl(e, t, n) {
1667
1667
  // range bounds). They do not identify or redefine the catalog calculation.
1668
1668
  ...n === "selection" && e.alias ? { alias: e.alias } : {},
1669
1669
  granularity: e.granularity ?? t.granularity,
1670
- ...sr(e, t, n),
1670
+ ...cr(e, t, n),
1671
1671
  ...e.role === "metric" ? {
1672
1672
  aliasTemplate: r.aliasTemplate,
1673
1673
  valueAliases: r.valueAliases,
1674
1674
  comparison: r.comparison,
1675
1675
  comparisonPolarity: r.comparisonPolarity,
1676
- parameters: qo(
1676
+ parameters: Uo(
1677
1677
  r,
1678
1678
  t,
1679
1679
  "domain"
1680
1680
  )
1681
1681
  } : {},
1682
- ...Uo(e)
1682
+ ...zo(e)
1683
1683
  };
1684
1684
  }
1685
- function Uo(e) {
1685
+ function zo(e) {
1686
1686
  const t = {
1687
1687
  ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
1688
1688
  ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
@@ -1703,7 +1703,7 @@ function Uo(e) {
1703
1703
  }
1704
1704
  }
1705
1705
  const jo = "table";
1706
- function Xl({ preferences: e, ...t }) {
1706
+ function ed({ preferences: e, ...t }) {
1707
1707
  return {
1708
1708
  ...t,
1709
1709
  type: jo,
@@ -1712,7 +1712,7 @@ function Xl({ preferences: e, ...t }) {
1712
1712
  data: []
1713
1713
  };
1714
1714
  }
1715
- function Zl(e) {
1715
+ function td(e) {
1716
1716
  return {
1717
1717
  id: e.id,
1718
1718
  title: e.title,
@@ -1722,36 +1722,36 @@ function Zl(e) {
1722
1722
  data: []
1723
1723
  };
1724
1724
  }
1725
- const zo = ["light", "dark"], Wo = ["none", "subtle", "raised"];
1726
- function Go(e, t) {
1727
- const { style: n, issues: r } = Ho(e);
1725
+ const Wo = ["light", "dark"], Go = ["none", "subtle", "raised"];
1726
+ function Ho(e, t) {
1727
+ const { style: n, issues: r } = Yo(e);
1728
1728
  return t === "lenient" ? { style: n, dropped: r } : r.length > 0 ? { ok: !1, issues: r } : { ok: !0, style: n };
1729
1729
  }
1730
- function Ho(e) {
1730
+ function Yo(e) {
1731
1731
  if (e == null) return { style: void 0, issues: [] };
1732
- if (!cr(e))
1732
+ if (!lr(e))
1733
1733
  return { style: void 0, issues: [{ field: "dashboardStyle", code: "invalid_value", message: "The dashboard style must be an object." }] };
1734
1734
  const t = [], n = {};
1735
1735
  for (const [r, i] of Object.entries(e)) {
1736
- if (!Qa.includes(r)) {
1736
+ if (!Xa.includes(r)) {
1737
1737
  t.push({ field: r, code: "unknown_field", message: `${r} is not a dashboard style field.` });
1738
1738
  continue;
1739
1739
  }
1740
- const o = Yo(r, i, t);
1740
+ const o = Qo(r, i, t);
1741
1741
  o !== void 0 && (n[r] = o);
1742
1742
  }
1743
1743
  return { style: Object.keys(n).length > 0 ? n : void 0, issues: t };
1744
1744
  }
1745
- function Yo(e, t, n) {
1746
- if (Ga(e)) {
1747
- const { min: r, max: i, label: o } = Ha[e];
1748
- return typeof t != "number" || !Number.isFinite(t) ? R(n, e, "invalid_value", `${o} must be a number of px.`) : Number.isInteger(t) ? t < r || t > i ? R(n, e, "out_of_range", `${Ya(e)}.`) : t : R(n, e, "not_integer", `${o} must be a whole number of px.`);
1745
+ function Qo(e, t, n) {
1746
+ if (Ha(e)) {
1747
+ const { min: r, max: i, label: o } = Ya[e];
1748
+ return typeof t != "number" || !Number.isFinite(t) ? R(n, e, "invalid_value", `${o} must be a number of px.`) : Number.isInteger(t) ? t < r || t > i ? R(n, e, "out_of_range", `${Qa(e)}.`) : t : R(n, e, "not_integer", `${o} must be a whole number of px.`);
1749
1749
  }
1750
1750
  switch (e) {
1751
1751
  case "cardBorder":
1752
1752
  return t === "on" || t === "off" ? t : R(n, e, "invalid_value", "Card border is on or off.");
1753
1753
  case "cardShadow":
1754
- return typeof t == "string" && Wo.includes(t) ? t : R(n, e, "invalid_value", "Card shadow is none, subtle or raised.");
1754
+ return typeof t == "string" && Go.includes(t) ? t : R(n, e, "invalid_value", "Card shadow is none, subtle or raised.");
1755
1755
  case "canvas":
1756
1756
  return an(e, t, n, (r, i) => r === "muted" || r === "background" ? r : Zt(r) ? r.toLowerCase() : R(n, i, "invalid_colour", "The canvas is muted, background or a hex colour."));
1757
1757
  case "chartColors":
@@ -1761,12 +1761,12 @@ function Yo(e, t, n) {
1761
1761
  }
1762
1762
  }
1763
1763
  function an(e, t, n, r) {
1764
- if (!cr(t)) return R(n, e, "invalid_value", `${e} holds a light and a dark value.`);
1764
+ if (!lr(t)) return R(n, e, "invalid_value", `${e} holds a light and a dark value.`);
1765
1765
  const i = {};
1766
1766
  for (const [o, a] of Object.entries(t)) {
1767
1767
  if (a === void 0) continue;
1768
1768
  const s = `${e}.${o}`;
1769
- if (!zo.includes(o)) {
1769
+ if (!Wo.includes(o)) {
1770
1770
  R(n, s, "unknown_field", `${e} holds light and dark values only.`);
1771
1771
  continue;
1772
1772
  }
@@ -1778,14 +1778,14 @@ function an(e, t, n, r) {
1778
1778
  function R(e, t, n, r) {
1779
1779
  e.push({ field: t, code: n, message: r });
1780
1780
  }
1781
- function cr(e) {
1781
+ function lr(e) {
1782
1782
  return typeof e == "object" && e !== null && !Array.isArray(e);
1783
1783
  }
1784
- function ed(e, t) {
1784
+ function nd(e, t) {
1785
1785
  const n = t ?? null;
1786
- return { style: e.dashboardStyle !== void 0 ? Go(e.dashboardStyle, "lenient").style : void 0, organizationAppearance: n ? Wa(n).spec : null };
1786
+ return { style: e.dashboardStyle !== void 0 ? Ho(e.dashboardStyle, "lenient").style : void 0, organizationAppearance: n ? Ga(n).spec : null };
1787
1787
  }
1788
- const Qo = {
1788
+ const Xo = {
1789
1789
  SUM: "total",
1790
1790
  AVG: "average",
1791
1791
  MIN: "lowest",
@@ -1806,7 +1806,7 @@ function on(e) {
1806
1806
  }
1807
1807
  function Jo(e) {
1808
1808
  var i, o, a;
1809
- const t = Ra({ variables: [e] })[0];
1809
+ const t = Ka({ variables: [e] })[0];
1810
1810
  if (!t) return;
1811
1811
  const n = ut(t.card), r = n.kind === "config" ? n.executableSources[0] : n.kind === "sql" ? (i = n.pinnedCatalogSources[0]) == null ? void 0 : i.source : void 0;
1812
1812
  if (!r) {
@@ -1816,32 +1816,32 @@ function Jo(e) {
1816
1816
  if (r.kind === "semantic") return r.label || r.datasetName;
1817
1817
  if (r.kind === "physical") return r.label || r.tableName;
1818
1818
  }
1819
- function Xo(e) {
1819
+ function Zo(e) {
1820
1820
  var r;
1821
- const t = (r = e.query.config) == null ? void 0 : r.filters, n = t ? lr(t) : 0;
1821
+ const t = (r = e.query.config) == null ? void 0 : r.filters, n = t ? dr(t) : 0;
1822
1822
  return n ? n === 1 ? " with one condition" : ` with ${n} conditions` : "";
1823
1823
  }
1824
- function lr(e) {
1824
+ function dr(e) {
1825
1825
  var t;
1826
- return (((t = e.conditions) == null ? void 0 : t.length) ?? 0) + (e.groups ?? []).reduce((n, r) => n + lr(r), 0);
1826
+ return (((t = e.conditions) == null ? void 0 : t.length) ?? 0) + (e.groups ?? []).reduce((n, r) => n + dr(r), 0);
1827
1827
  }
1828
1828
  function sn(e) {
1829
1829
  if (!e) return "";
1830
1830
  const t = me(e.dataType), n = t === "date" || t === "datetime" ? e.direction === "desc" ? "latest first" : "earliest first" : t === "number" ? e.direction === "desc" ? "highest first" : "lowest first" : e.direction === "desc" ? "Z to A" : "A to Z";
1831
1831
  return ` by ${e.aggregate ? ve(e) : se(e)}, ${n}`;
1832
1832
  }
1833
- function Zo(e) {
1833
+ function es(e) {
1834
1834
  var s, c, l;
1835
- const t = Jo(e), n = t ? ` in ${t}` : "", r = Xo(e);
1835
+ const t = Jo(e), n = t ? ` in ${t}` : "", r = Zo(e);
1836
1836
  if ((s = e.query.sql) != null && s.trim()) {
1837
1837
  const d = e.get.kind === "first" ? "the first row" : "the only row";
1838
- return `${es(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1838
+ return `${ts(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1839
1839
  }
1840
1840
  const i = e.query.config ?? {}, o = i.groupByColumns ?? [], a = i.metricColumns ?? [];
1841
1841
  switch (e.get.kind) {
1842
1842
  case "aggregate": {
1843
1843
  const d = a[0];
1844
- return d ? d.aggregate ? `The ${Qo[String(d.aggregate).toUpperCase()] ?? String(d.aggregate).toLowerCase()} ${ve(d)}${n}${r}${cn(e)}` : `The ${se(d)}${n}${r}${cn(e)}` : "An aggregate, with no measure chosen yet";
1844
+ return d ? d.aggregate ? `The ${Xo[String(d.aggregate).toUpperCase()] ?? String(d.aggregate).toLowerCase()} ${ve(d)}${n}${r}${cn(e)}` : `The ${se(d)}${n}${r}${cn(e)}` : "An aggregate, with no measure chosen yet";
1845
1845
  }
1846
1846
  case "list": {
1847
1847
  const d = o[0];
@@ -1858,13 +1858,13 @@ function Zo(e) {
1858
1858
  }
1859
1859
  }
1860
1860
  function cn(e) {
1861
- const t = Ka(e);
1862
- return t ? `, compared with ${Si({ mode: "explicit", spec: t })}` : "";
1861
+ const t = La(e);
1862
+ return t ? `, compared with ${wi({ mode: "explicit", spec: t })}` : "";
1863
1863
  }
1864
- function es(e) {
1864
+ function ts(e) {
1865
1865
  return e.charAt(0).toUpperCase() + e.slice(1);
1866
1866
  }
1867
- function ts(e, t) {
1867
+ function ns(e, t) {
1868
1868
  const n = e.sheets ?? [], r = n.findIndex((a) => a.id === t.sheetId), i = n[r];
1869
1869
  if (!i)
1870
1870
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -1880,11 +1880,11 @@ function ts(e, t) {
1880
1880
  clauses: [x.arranged(i.title || "the dashboard", t.keepOrder === !0, !(i.frames ?? []).length)]
1881
1881
  };
1882
1882
  }
1883
- function ns(e) {
1883
+ function rs(e) {
1884
1884
  return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
1885
1885
  }
1886
1886
  function ee(...e) {
1887
- return wi(e.flatMap((t) => t || []));
1887
+ return xi(e.flatMap((t) => t || []));
1888
1888
  }
1889
1889
  function le(e, t) {
1890
1890
  return {
@@ -1895,10 +1895,10 @@ function le(e, t) {
1895
1895
  function xt(e) {
1896
1896
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => le(t, "sheet"));
1897
1897
  }
1898
- function dr(e) {
1898
+ function ur(e) {
1899
1899
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => le(t, "sheet"));
1900
1900
  }
1901
- function rs(e) {
1901
+ function is(e) {
1902
1902
  return e ? [
1903
1903
  ...(e.calculatedFields || []).filter(
1904
1904
  (t) => t.fieldScope === "dashboard"
@@ -1906,21 +1906,21 @@ function rs(e) {
1906
1906
  ...(e.frames || []).flatMap((t) => t.calculatedFields || [])
1907
1907
  ].map((t) => le(t, "dashboard")) : [];
1908
1908
  }
1909
- function is(e) {
1909
+ function as(e) {
1910
1910
  if (e !== void 0)
1911
1911
  return ee(
1912
1912
  e.map((t) => le(t, "dashboard"))
1913
1913
  );
1914
1914
  }
1915
- function td(e) {
1915
+ function rd(e) {
1916
1916
  var r;
1917
1917
  const t = [], n = (e.sheets || []).map((i) => {
1918
1918
  var o;
1919
- return t.push(...rs(i)), {
1919
+ return t.push(...is(i)), {
1920
1920
  ...i,
1921
1921
  calculatedFields: ee(
1922
1922
  xt(i),
1923
- dr(i)
1923
+ ur(i)
1924
1924
  ),
1925
1925
  frames: (o = i.frames) == null ? void 0 : o.map(
1926
1926
  (a) => a.calculatedFields === void 0 ? a : { ...a, calculatedFields: void 0 }
@@ -1929,7 +1929,7 @@ function td(e) {
1929
1929
  });
1930
1930
  return {
1931
1931
  ...e,
1932
- calculatedFields: is(
1932
+ calculatedFields: as(
1933
1933
  ee(
1934
1934
  (r = e.calculatedFields) == null ? void 0 : r.map(
1935
1935
  (i) => le(i, "dashboard")
@@ -1952,30 +1952,30 @@ function ln(e, t) {
1952
1952
  ...r.map((o) => o.calculatedFields)
1953
1953
  );
1954
1954
  }
1955
- function as(e, t) {
1955
+ function os(e, t) {
1956
1956
  return e ? xt(e) : [];
1957
1957
  }
1958
- function nd(e, t) {
1958
+ function id(e, t) {
1959
1959
  if (!e)
1960
1960
  return [];
1961
- const n = xt(e), r = dr(e), i = ee(
1961
+ const n = xt(e), r = ur(e), i = ee(
1962
1962
  n,
1963
1963
  r
1964
1964
  );
1965
- return ns(e) ? i.length === 0 ? [] : r.length === 0 ? i : ee(
1965
+ return rs(e) ? i.length === 0 ? [] : r.length === 0 ? i : ee(
1966
1966
  i,
1967
1967
  ln(e, t)
1968
1968
  ) : ln(e, t);
1969
1969
  }
1970
- function os(e) {
1970
+ function ss(e) {
1971
1971
  if (e !== void 0)
1972
1972
  return ee(
1973
1973
  e.map((t) => le(t, "sheet"))
1974
1974
  );
1975
1975
  }
1976
- function rd(e) {
1976
+ function ad(e) {
1977
1977
  const { field: t, sheetFields: n = [], dashboardFields: r = [] } = e, i = (s) => s.find(
1978
- (c) => xi(c, t, {
1978
+ (c) => Ti(c, t, {
1979
1979
  allowComparableFallback: !0
1980
1980
  })
1981
1981
  );
@@ -1989,7 +1989,7 @@ function rd(e) {
1989
1989
  const a = i(r);
1990
1990
  return a ? { scope: "dashboard", matchedField: a } : { scope: "card" };
1991
1991
  }
1992
- function ss(e, t) {
1992
+ function cs(e, t) {
1993
1993
  var I, v, C;
1994
1994
  const n = (e.sheets ?? []).findIndex((b) => b.id === t.sheetId), r = (I = e.sheets) == null ? void 0 : I[n];
1995
1995
  if (!(r != null && r.frames))
@@ -2002,31 +2002,31 @@ function ss(e, t) {
2002
2002
  return b.some((S) => S.id === i.id) ? b : [i, ...b];
2003
2003
  })() : [i], u = new Map(d.map((b) => [b.id, b])), f = ne(r, { kind: "frame_updated", frame: i, resizeForNewKind: t.resizeLayouts });
2004
2004
  let m = /* @__PURE__ */ new Set();
2005
- const p = Ti.produce(e, (b) => {
2005
+ const p = Di.produce(e, (b) => {
2006
2006
  const S = b.sheets[n];
2007
- f.layouts !== r.layouts && (S.layouts = Bt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (S.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = os(t.sheetCalculatedFields)), S.frames = S.frames.map((k) => {
2007
+ f.layouts !== r.layouts && (S.layouts = Bt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (S.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = ss(t.sheetCalculatedFields)), S.frames = S.frames.map((k) => {
2008
2008
  const q = u.get(k.id);
2009
2009
  return q ? Bt(c(q)) : k.calculatedFields === void 0 ? k : { ...k, calculatedFields: void 0 };
2010
2010
  });
2011
2011
  const $ = Vt(S);
2012
- m = new Set([...s].filter((k) => !$.has(k))), Di(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
2012
+ m = new Set([...s].filter((k) => !$.has(k))), ki(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
2013
2013
  }), y = p.sheets[n].frames.find((b) => b.id === i.id), h = [
2014
2014
  ...m.size ? [{ kind: "cards_removed", cardIds: [...m] }] : [],
2015
2015
  { kind: "frame_committed", sheetId: t.sheetId, before: a, after: y }
2016
2016
  ], g = ((v = i.cards) == null ? void 0 : v.find((b) => b.id === i.activeCardId)) ?? ((C = i.cards) == null ? void 0 : C[0]);
2017
2017
  return { dashboard: p, runtimeEffects: h, clauses: [x.committed(g == null ? void 0 : g.title)] };
2018
2018
  }
2019
- function cs(e, t) {
2019
+ function ls(e, t) {
2020
2020
  const n = { ...e }, r = [];
2021
2021
  return t.title !== void 0 && t.title !== e.title && (n.title = t.title, r.push(x.plain("dashboard", `renames the dashboard to ${T(t.title)}`))), t.description === null && e.description ? (delete n.description, r.push(x.plain("dashboard", "removes the dashboard's description"))) : typeof t.description == "string" && t.description !== e.description && (n.description = t.description, r.push(x.plain("dashboard", "changes the dashboard's description"))), { dashboard: n, clauses: r.length ? r : [x.plain("dashboard", "changes nothing on the dashboard")] };
2022
2022
  }
2023
- function ls(e, t) {
2023
+ function ds(e, t) {
2024
2024
  const n = { ...e };
2025
2025
  t.style ? n.dashboardStyle = t.style : delete n.dashboardStyle;
2026
2026
  const r = t.sentences.map((i) => x.plain("dashboard", `${i.charAt(0).toLowerCase()}${i.slice(1)}`));
2027
2027
  return { dashboard: n, clauses: r.length ? r : [x.plain("dashboard", "changes nothing in the dashboard's style")] };
2028
2028
  }
2029
- function ds(e, t, n) {
2029
+ function us(e, t, n) {
2030
2030
  const r = e.sheets ?? [], i = r.findIndex((s) => s.id === t), o = r[i];
2031
2031
  if (!o) throw new F("sheet_not_found", `No sheet ${t} on this dashboard.`);
2032
2032
  if (Me(o))
@@ -2034,7 +2034,7 @@ function ds(e, t, n) {
2034
2034
  const a = n.map((s) => {
2035
2035
  const c = (o.frames ?? []).find((l) => l.cards.some((d) => d.id === s));
2036
2036
  if (!c)
2037
- throw new F("card_not_found", `No card ${s} on ${ki(o)}.`, "Read the outline again and use its card ids.");
2037
+ throw new F("card_not_found", `No card ${s} on ${_i(o)}.`, "Read the outline again and use its card ids.");
2038
2038
  return c.cards.find((l) => l.id === s);
2039
2039
  });
2040
2040
  return { sheets: r, sheetIndex: i, sheet: o, cards: a };
@@ -2044,21 +2044,21 @@ function et(e) {
2044
2044
  const { visualId: t, ...n } = e;
2045
2045
  return n;
2046
2046
  }
2047
- const ur = (e) => e.cards.find((t) => t.id === e.activeCardId) ?? e.cards[0], Be = (e) => x.plain("detached", `makes ${e} local to this report; it no longer follows its library visual`);
2048
- function us(e, t) {
2047
+ const fr = (e) => e.cards.find((t) => t.id === e.activeCardId) ?? e.cards[0], Be = (e) => x.plain("detached", `makes ${e} local to this report; it no longer follows its library visual`);
2048
+ function fs(e, t) {
2049
2049
  var p;
2050
- const { sheets: n, sheetIndex: r, sheet: i, cards: o } = ds(e, t.sheetId, t.cardIds), a = Ie(i, t.cardIds[0]).id;
2050
+ const { sheets: n, sheetIndex: r, sheet: i, cards: o } = us(e, t.sheetId, t.cardIds), a = Ie(i, t.cardIds[0]).id;
2051
2051
  let s = i;
2052
2052
  const c = [];
2053
2053
  for (const y of t.cardIds.slice(1)) {
2054
2054
  const h = Ie(s, y);
2055
2055
  if (h.id === a) continue;
2056
- const g = kn(h, y);
2056
+ const g = _n(h, y);
2057
2057
  if (!g.cards.length) {
2058
2058
  h.visualId && c.push(Be(T(h.cards[0].title))), s = ne(s, { kind: "frame_removed", frameId: h.id });
2059
2059
  continue;
2060
2060
  }
2061
- h.visualId && c.push(Be(`the tile of ${T((p = ur(g)) == null ? void 0 : p.title)}`)), s = ne(s, { kind: "frame_updated", frame: h.visualId ? et(g) : g, resizeForNewKind: !0 });
2061
+ h.visualId && c.push(Be(`the tile of ${T((p = fr(g)) == null ? void 0 : p.title)}`)), s = ne(s, { kind: "frame_updated", frame: h.visualId ? et(g) : g, resizeForNewKind: !0 });
2062
2062
  }
2063
2063
  const l = Ie(s, t.cardIds[0]), d = new Set(t.cardIds), u = {
2064
2064
  ...l,
@@ -2073,7 +2073,7 @@ function us(e, t) {
2073
2073
  detached: m.length > 0
2074
2074
  };
2075
2075
  }
2076
- function fs(e, t) {
2076
+ function ms(e, t) {
2077
2077
  var d;
2078
2078
  const n = e.sheets ?? [], r = n.findIndex((u) => !Me(u) && (u.frames ?? []).some((f) => f.cards.some((m) => m.id === t.cardId)));
2079
2079
  if (r < 0)
@@ -2083,7 +2083,7 @@ function fs(e, t) {
2083
2083
  const i = n[r], o = Ie(i, t.cardId), a = o.cards.find((u) => u.id === t.cardId);
2084
2084
  if (o.cards.length < 2)
2085
2085
  throw new F("frame_not_found", `${T(a.title)} already has its own spot.`);
2086
- const s = kn(o, t.cardId);
2086
+ const s = _n(o, t.cardId);
2087
2087
  let c = ne(i, {
2088
2088
  kind: "frame_updated",
2089
2089
  frame: o.visualId ? et(s) : s,
@@ -2098,13 +2098,13 @@ function fs(e, t) {
2098
2098
  return {
2099
2099
  dashboard: { ...e, sheets: n.map((u, f) => f === r ? c : u) },
2100
2100
  clauses: [
2101
- x.plain("layout", `gives ${T(a.title)} its own spot beside ${T((d = ur(s)) == null ? void 0 : d.title)}`),
2101
+ x.plain("layout", `gives ${T(a.title)} its own spot beside ${T((d = fr(s)) == null ? void 0 : d.title)}`),
2102
2102
  ...l ? [x.plain("detached", "makes both spots local to this report; they no longer follow their library visual")] : []
2103
2103
  ],
2104
2104
  detached: l
2105
2105
  };
2106
2106
  }
2107
- function ms() {
2107
+ function ps() {
2108
2108
  return {
2109
2109
  version: 1,
2110
2110
  page: {
@@ -2119,13 +2119,13 @@ function ms() {
2119
2119
  }
2120
2120
  },
2121
2121
  runtime: {
2122
- generatedAtFormat: _i
2122
+ generatedAtFormat: Mi
2123
2123
  },
2124
2124
  inputs: [],
2125
2125
  sections: []
2126
2126
  };
2127
2127
  }
2128
- function ps() {
2128
+ function hs() {
2129
2129
  return {
2130
2130
  region: "header",
2131
2131
  enabled: !0,
@@ -2134,7 +2134,7 @@ function ps() {
2134
2134
  blocks: []
2135
2135
  };
2136
2136
  }
2137
- function hs() {
2137
+ function gs() {
2138
2138
  return {
2139
2139
  region: "footer",
2140
2140
  enabled: !0,
@@ -2143,18 +2143,18 @@ function hs() {
2143
2143
  blocks: []
2144
2144
  };
2145
2145
  }
2146
- function fr(e) {
2146
+ function mr(e) {
2147
2147
  return [{ type: "text", value: e }];
2148
2148
  }
2149
- function id(e, t = []) {
2150
- return Mi(e, { by: "then" }).flatMap((n) => n.type === "link" ? n.children ?? [] : [n]).map((n) => n.type === "text" ? n.value : `{{${Oi(n.ref, Ai({ kind: "document", inputs: t }))}}}`).join("") || "";
2149
+ function od(e, t = []) {
2150
+ return Oi(e, { by: "then" }).flatMap((n) => n.type === "link" ? n.children ?? [] : [n]).map((n) => n.type === "text" ? n.value : `{{${Ai(n.ref, $i({ kind: "document", inputs: t }))}}}`).join("") || "";
2151
2151
  }
2152
- function gs(e, t) {
2152
+ function ys(e, t) {
2153
2153
  return e.find(
2154
2154
  (n) => n.type === "text" && n.role === t
2155
2155
  );
2156
2156
  }
2157
- function ad(e, t) {
2157
+ function sd(e, t) {
2158
2158
  return e.find(
2159
2159
  (n) => n.type === "image" && n.role === t
2160
2160
  );
@@ -2163,31 +2163,31 @@ function dn(e, t) {
2163
2163
  const n = {
2164
2164
  ...t,
2165
2165
  type: "text",
2166
- content: typeof t.content == "string" ? fr(t.content) : t.content
2166
+ content: typeof t.content == "string" ? mr(t.content) : t.content
2167
2167
  };
2168
- return mr(e, n);
2168
+ return pr(e, n);
2169
2169
  }
2170
- function od(e, t) {
2171
- return mr(e, t);
2170
+ function cd(e, t) {
2171
+ return pr(e, t);
2172
2172
  }
2173
- function mr(e, t) {
2173
+ function pr(e, t) {
2174
2174
  const n = e.findIndex((r) => r.id === t.id);
2175
2175
  return n === -1 ? [...e, t] : e.map(
2176
2176
  (r, i) => i === n ? t : r
2177
2177
  );
2178
2178
  }
2179
- function ys(e, t) {
2179
+ function bs(e, t) {
2180
2180
  const n = e.sheets ?? [], { id: r, title: i, kind: o } = t.sheet;
2181
2181
  if (n.some((s) => s.id === r))
2182
2182
  throw new F("sheet_id_taken", `A sheet with id ${r} is already on this dashboard.`);
2183
- const a = o === "document" ? { id: r, title: i, kind: o, document: ms() } : { id: r, title: i };
2183
+ const a = o === "document" ? { id: r, title: i, kind: o, document: ps() } : { id: r, title: i };
2184
2184
  return {
2185
2185
  dashboard: { ...e, sheets: [...n, a] },
2186
2186
  created: [{ kind: "sheet", id: r, title: i, ...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {} }],
2187
2187
  clauses: [x.plain("sheet", `adds the sheet ${T(i)}`)]
2188
2188
  };
2189
2189
  }
2190
- function bs(e, t) {
2190
+ function vs(e, t) {
2191
2191
  const n = e.sheets ?? [], r = n.findIndex((o) => o.id === t.sheetId);
2192
2192
  if (r < 0)
2193
2193
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -2197,21 +2197,21 @@ function bs(e, t) {
2197
2197
  clauses: [x.plain("sheet", `renames the sheet ${T(i.title)} to ${T(t.title)}`)]
2198
2198
  };
2199
2199
  }
2200
- function vs(e, t, n) {
2200
+ function Is(e, t, n) {
2201
2201
  var o;
2202
2202
  if (!e || !t || t.customFilterPreferences) return;
2203
2203
  const r = t.defaultDateFilter;
2204
- return (t.dateSelectionMode === "day" ? $i(r) : t.dateSelectionMode === "months" && Pi(r)) && ((o = ce(t, n)) == null ? void 0 : o.valueType) === "date" ? !0 : void 0;
2204
+ return (t.dateSelectionMode === "day" ? Pi(r) : t.dateSelectionMode === "months" && Ni(r)) && ((o = ce(t, n)) == null ? void 0 : o.valueType) === "date" ? !0 : void 0;
2205
2205
  }
2206
- function sd(e) {
2207
- const t = e.createId ?? Te, n = t(), r = Ei({
2206
+ function ld(e) {
2207
+ const t = e.createId ?? Te, n = t(), r = Ri({
2208
2208
  field: e.field,
2209
2209
  dataSource: e.dataSource,
2210
2210
  connectionId: e.connectionId,
2211
2211
  connectionType: e.connectionType,
2212
2212
  filterId: t()
2213
2213
  });
2214
- return Is({
2214
+ return Cs({
2215
2215
  filter: e.label ? { ...r, title: e.label } : r,
2216
2216
  label: e.label || e.field.label || e.field.name,
2217
2217
  scope: e.scope,
@@ -2219,9 +2219,9 @@ function sd(e) {
2219
2219
  createId: () => n
2220
2220
  });
2221
2221
  }
2222
- function Is(e) {
2223
- const t = e.createId ?? Te, n = e.label || e.filter.title || e.filter.column || e.filter.id, r = _n(e.dashboard, { label: n }), i = {
2224
- ...Mn(e.filter),
2222
+ function Cs(e) {
2223
+ const t = e.createId ?? Te, n = e.label || e.filter.title || e.filter.column || e.filter.id, r = Mn(e.dashboard, { label: n }), i = {
2224
+ ...On(e.filter),
2225
2225
  variableName: r
2226
2226
  };
2227
2227
  return {
@@ -2232,12 +2232,12 @@ function Is(e) {
2232
2232
  requiredAtExecution: !1,
2233
2233
  scope: e.scope,
2234
2234
  runtimeScope: "shared",
2235
- presentation: An(i),
2235
+ presentation: $n(i),
2236
2236
  filter: i,
2237
- exports: On(i)
2237
+ exports: An(i)
2238
2238
  };
2239
2239
  }
2240
- function Cs(e, t, n, r = { calendar: null }) {
2240
+ function Fs(e, t, n, r = { calendar: null }) {
2241
2241
  var Mt, Ot, At, $t, Pt, Nt, Et, Rt;
2242
2242
  const o = Z(e).findFilterInput(t), a = (O, w) => ({
2243
2243
  ok: !1,
@@ -2271,14 +2271,14 @@ function Cs(e, t, n, r = { calendar: null }) {
2271
2271
  if (n.mapping.draft.inputId !== s.id)
2272
2272
  return a("The card mapping was prepared for another filter.");
2273
2273
  }
2274
- const l = n.definition ? Mn(n.definition) : c;
2275
- if (l.kind === "global-date" && n.scope && !Fs(n.scope))
2274
+ const l = n.definition ? On(n.definition) : c;
2275
+ if (l.kind === "global-date" && n.scope && !Ss(n.scope))
2276
2276
  return a("The Global Date filter applies to regular tabs only.");
2277
- const d = (Ot = r.calendar) == null ? void 0 : Ot.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? vs(
2277
+ const d = (Ot = r.calendar) == null ? void 0 : Ot.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? Is(
2278
2278
  n.forceSelection ?? s.forceSelection,
2279
2279
  l,
2280
2280
  d
2281
- ) : s.forceSelection ? !0 : void 0, m = n.variableName !== void 0 ? _n(
2281
+ ) : s.forceSelection ? !0 : void 0, m = n.variableName !== void 0 ? Mn(
2282
2282
  e,
2283
2283
  { name: n.variableName },
2284
2284
  { exclude: { source: "input", inputId: s.id } }
@@ -2286,7 +2286,7 @@ function Cs(e, t, n, r = { calendar: null }) {
2286
2286
  var Kt, Lt;
2287
2287
  const w = { ...O };
2288
2288
  if (y !== void 0 && (w.label = y), n.variableName !== void 0 && (w.variableName = m), n.scope && (w.scope = n.scope), h || g) {
2289
- const Ee = An(l);
2289
+ const Ee = $n(l);
2290
2290
  w.presentation = { ...O.presentation }, h && (w.presentation.placement = Ee.placement), g && (Ee.widthPx === void 0 ? delete w.presentation.widthPx : w.presentation.widthPx = Ee.widthPx);
2291
2291
  }
2292
2292
  return (n.forceSelection !== void 0 || u) && (f ? w.forceSelection = f : delete w.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? w.requiredAtExecution = !0 : delete w.requiredAtExecution), qe(w, "optionSource", n.optionSource), qe(w, "optionDependencies", n.optionDependencies), qe(w, "optionPopulation", n.optionPopulation), ((Kt = n.mapping) == null ? void 0 : Kt.kind) === "save" && n.mapping.draft.acceptance.ok ? w.application = n.mapping.draft.acceptance.application : ((Lt = n.mapping) == null ? void 0 : Lt.kind) === "remove" && delete w.application, w;
@@ -2303,7 +2303,7 @@ function Cs(e, t, n, r = { calendar: null }) {
2303
2303
  filter: b(l)
2304
2304
  } : k
2305
2305
  );
2306
- u && (q.exports = On(l)), S[$] = q;
2306
+ u && (q.exports = An(l)), S[$] = q;
2307
2307
  const G = ht({
2308
2308
  inputs: [q],
2309
2309
  dashboardFilters: []
@@ -2319,12 +2319,12 @@ function Cs(e, t, n, r = { calendar: null }) {
2319
2319
  return a(
2320
2320
  (($t = ae.issues[0]) == null ? void 0 : $t.message) ?? "These settings could not be saved."
2321
2321
  );
2322
- const U = n.variableName !== void 0 || n.scope !== void 0 ? Ss(E, _.input) : void 0;
2322
+ const U = n.variableName !== void 0 || n.scope !== void 0 ? ws(E, _.input) : void 0;
2323
2323
  if (U)
2324
2324
  return a(
2325
2325
  `Another filter on the same cards is already named "${U}". Choose another name.`
2326
2326
  );
2327
- const j = [], H = {
2327
+ const z = [], H = {
2328
2328
  id: _.input.id,
2329
2329
  runtimeScope: _.input.runtimeScope
2330
2330
  };
@@ -2332,7 +2332,7 @@ function Cs(e, t, n, r = { calendar: null }) {
2332
2332
  defaultInputValues: E.defaultInputValues,
2333
2333
  dashboardInputValues: {}
2334
2334
  };
2335
- const ge = ((Pt = n.values) == null ? void 0 : Pt.target) ?? {}, P = Ts(
2335
+ const ge = ((Pt = n.values) == null ? void 0 : Pt.target) ?? {}, P = Ds(
2336
2336
  c,
2337
2337
  l,
2338
2338
  {
@@ -2347,28 +2347,28 @@ function Cs(e, t, n, r = { calendar: null }) {
2347
2347
  r.calendar ?? void 0
2348
2348
  );
2349
2349
  if (P.defaultValueChanged || P.selectionIdentityChanged || P.defaultComparisonChanged) {
2350
- const O = pr({
2350
+ const O = hr({
2351
2351
  state: { ...K, dashboardInputValues: {} },
2352
2352
  input: H,
2353
2353
  settings: P
2354
2354
  });
2355
- K = { ...K, defaultInputValues: O.defaultInputValues }, P.selectionIdentityChanged && j.push({
2355
+ K = { ...K, defaultInputValues: O.defaultInputValues }, P.selectionIdentityChanged && z.push({
2356
2356
  kind: "clear",
2357
2357
  inputId: H.id,
2358
2358
  target: P.target
2359
- }), P.defaultValueChanged && j.push({
2359
+ }), P.defaultValueChanged && z.push({
2360
2360
  kind: "resetToDefault",
2361
2361
  inputId: H.id,
2362
2362
  target: P.target,
2363
2363
  ...P.defaultFilterValue ? { filterValue: P.defaultFilterValue } : {}
2364
- }), P.defaultComparisonChanged && j.push({
2364
+ }), P.defaultComparisonChanged && z.push({
2365
2365
  kind: "setDefaultComparison",
2366
2366
  inputId: H.id,
2367
2367
  target: P.target
2368
2368
  });
2369
2369
  }
2370
2370
  if (n.scope && _.input.runtimeScope !== "shared") {
2371
- const O = ws(
2371
+ const O = xs(
2372
2372
  E,
2373
2373
  s,
2374
2374
  _.input,
@@ -2377,7 +2377,7 @@ function Cs(e, t, n, r = { calendar: null }) {
2377
2377
  K = {
2378
2378
  ...K,
2379
2379
  defaultInputValues: O.defaultInputValues
2380
- }, j.push(
2380
+ }, z.push(
2381
2381
  ...O.dropped.map((w) => ({
2382
2382
  kind: "dropTargetSlot",
2383
2383
  inputId: H.id,
@@ -2385,14 +2385,14 @@ function Cs(e, t, n, r = { calendar: null }) {
2385
2385
  }))
2386
2386
  );
2387
2387
  }
2388
- return E = xs(E, K), {
2388
+ return E = Ts(E, K), {
2389
2389
  ok: !0,
2390
2390
  dashboard: E,
2391
2391
  inputId: _.input.id,
2392
- valueEffects: j
2392
+ valueEffects: z
2393
2393
  };
2394
2394
  }
2395
- function cd(e) {
2395
+ function dd(e) {
2396
2396
  let t = qt({
2397
2397
  dashboard: e.before,
2398
2398
  runtimeValues: e.dashboardInputValues,
@@ -2409,7 +2409,7 @@ function cd(e) {
2409
2409
  case "setDefaultComparison": {
2410
2410
  const o = r(i.inputId);
2411
2411
  if (!o) break;
2412
- t = pr({
2412
+ t = hr({
2413
2413
  state: { dashboardInputValues: t },
2414
2414
  input: o,
2415
2415
  settings: {
@@ -2439,14 +2439,14 @@ function cd(e) {
2439
2439
  calendar: e.calendar
2440
2440
  });
2441
2441
  }
2442
- function Fs(e) {
2442
+ function Ss(e) {
2443
2443
  var t;
2444
2444
  return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
2445
2445
  }
2446
2446
  function qe(e, t, n) {
2447
2447
  n !== void 0 && (n === null ? delete e[t] : e[t] = n);
2448
2448
  }
2449
- function Ss(e, t) {
2449
+ function ws(e, t) {
2450
2450
  const n = [
2451
2451
  ...Z(e).inputs.map((i) => i.input),
2452
2452
  ...(Array.isArray(e.inputs) ? e.inputs : []).filter(
@@ -2456,28 +2456,28 @@ function Ss(e, t) {
2456
2456
  (i) => i.id !== t.id && i.variableName === t.variableName
2457
2457
  );
2458
2458
  if (!n.length) return;
2459
- const r = Xt(e, t);
2459
+ const r = Jt(e, t);
2460
2460
  return n.some(
2461
- (i) => [...Xt(e, i)].some(
2461
+ (i) => [...Jt(e, i)].some(
2462
2462
  (o) => r.has(o)
2463
2463
  )
2464
2464
  ) ? t.variableName : void 0;
2465
2465
  }
2466
- function ws(e, t, n, r) {
2466
+ function xs(e, t, n, r) {
2467
2467
  var d, u;
2468
- const i = [], o = Bn(e), a = (f) => un(t, f, o), s = (f) => un(n, f, o), c = [];
2468
+ const i = [], o = qn(e), a = (f) => un(t, f, o), s = (f) => un(n, f, o), c = [];
2469
2469
  if (n.runtimeScope === "perSheet")
2470
2470
  for (const f of o.values())
2471
2471
  c.push({ sheetId: f.sheetId, sheetKind: f.sheetKind });
2472
2472
  else if (n.runtimeScope === "perCard") {
2473
- for (const f of qn(e))
2473
+ for (const f of Un(e))
2474
2474
  c.push({
2475
2475
  sheetId: f.sheetId,
2476
2476
  cardId: f.cardId,
2477
2477
  sheetKind: (d = o.get(f.sheetId)) == null ? void 0 : d.sheetKind
2478
2478
  });
2479
2479
  for (const f of e.variables ?? [])
2480
- c.push(...La(e, f.id));
2480
+ c.push(...Va(e, f.id));
2481
2481
  } else if (n.runtimeScope === "perDocumentSection")
2482
2482
  for (const f of e.sheets ?? [])
2483
2483
  for (const m of ((u = f.document) == null ? void 0 : u.sections) ?? [])
@@ -2500,16 +2500,16 @@ function ws(e, t, n, r) {
2500
2500
  function un(e, t, n) {
2501
2501
  if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
2502
2502
  const r = n.get(t.sheetId);
2503
- return r ? Un(e, r) : !1;
2503
+ return r ? zn(e, r) : !1;
2504
2504
  }
2505
- return Va(e, t);
2505
+ return Ba(e, t);
2506
2506
  }
2507
- function xs(e, t) {
2507
+ function Ts(e, t) {
2508
2508
  const n = { ...e };
2509
2509
  return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? n.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete n.defaultInputValues, n;
2510
2510
  }
2511
- function Ts(e, t, n, r, i) {
2512
- const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || Ni(e, t);
2511
+ function Ds(e, t, n, r, i) {
2512
+ const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || Ei(e, t);
2513
2513
  return {
2514
2514
  ...n,
2515
2515
  target: (n == null ? void 0 : n.target) ?? r,
@@ -2517,7 +2517,7 @@ function Ts(e, t, n, r, i) {
2517
2517
  defaultFilterValue: o ? ce(t, i) : void 0
2518
2518
  };
2519
2519
  }
2520
- function pr(e) {
2520
+ function hr(e) {
2521
2521
  const { settings: t } = e;
2522
2522
  if (!t) return e.state;
2523
2523
  const n = e.input;
@@ -2538,7 +2538,7 @@ function pr(e) {
2538
2538
  n,
2539
2539
  t.target
2540
2540
  );
2541
- t.defaultFilterValue ? a = jt(
2541
+ t.defaultFilterValue ? a = zt(
2542
2542
  a,
2543
2543
  n,
2544
2544
  t.target,
@@ -2550,7 +2550,7 @@ function pr(e) {
2550
2550
  },
2551
2551
  ...o != null && o.comparisonSelection ? { comparisonSelection: o.comparisonSelection } : {}
2552
2552
  }
2553
- ) : o != null && o.comparisonSelection && (a = jt(
2553
+ ) : o != null && o.comparisonSelection && (a = zt(
2554
2554
  a,
2555
2555
  n,
2556
2556
  t.target,
@@ -2568,12 +2568,12 @@ function pr(e) {
2568
2568
  } : { status: "cleared" }
2569
2569
  );
2570
2570
  }
2571
- return t.defaultComparisonChanged && (i = zt(
2571
+ return t.defaultComparisonChanged && (i = jt(
2572
2572
  i || {},
2573
2573
  n,
2574
2574
  t.target,
2575
2575
  t.defaultComparisonSelection
2576
- ), Object.keys(i).length || (i = void 0), r = zt(
2576
+ ), Object.keys(i).length || (i = void 0), r = jt(
2577
2577
  r,
2578
2578
  n,
2579
2579
  t.target,
@@ -2591,46 +2591,46 @@ function Ne(e, t) {
2591
2591
  throw new F("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
2592
2592
  return n;
2593
2593
  }
2594
- function hr(e, t) {
2594
+ function gr(e, t) {
2595
2595
  const n = jn(e, t);
2596
2596
  return (n == null ? void 0 : n.kind) === "variable" ? `the variable ${n.variable.name}` : T(n == null ? void 0 : n.card.title);
2597
2597
  }
2598
- function gr(e, t) {
2598
+ function yr(e, t) {
2599
2599
  if (!jn(e, t))
2600
2600
  throw new F("card_not_found", `No card or variable ${t} on this dashboard.`, "Read the outline again and use its card ids and variable names.");
2601
2601
  }
2602
- function Ds(e, t, n) {
2602
+ function ks(e, t, n) {
2603
2603
  const r = Z(e), i = r.findFilterInput({ inputId: t });
2604
2604
  return i ? r.reachedCards({ inputId: t }).filter(
2605
2605
  (o) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
2606
- $n(i.input, o.card, n).reach
2606
+ Pn(i.input, o.card, n).reach
2607
2607
  )
2608
2608
  ).length : 0;
2609
2609
  }
2610
- function ks(e, t, n) {
2611
- return yr(e, t, "relationship", n);
2610
+ function _s(e, t, n) {
2611
+ return br(e, t, "relationship", n);
2612
2612
  }
2613
- function _s(e, t) {
2614
- return yr(e, t, "sqlTemplate");
2613
+ function Ms(e, t) {
2614
+ return br(e, t, "sqlTemplate");
2615
2615
  }
2616
- function yr(e, t, n, r) {
2616
+ function br(e, t, n, r) {
2617
2617
  const i = Z(e), o = i.findFilterInput({ inputId: t });
2618
- return o ? i.reachedCards({ inputId: t }).filter((a) => $n(o.input, a.card, r).reach === n).length : 0;
2618
+ return o ? i.reachedCards({ inputId: t }).filter((a) => Pn(o.input, a.card, r).reach === n).length : 0;
2619
2619
  }
2620
- function br(e, t) {
2620
+ function vr(e, t) {
2621
2621
  if (t.scope.kind === "allSheets") return "every sheet";
2622
2622
  if (t.scope.kind !== "sheets") return "its cards";
2623
- const n = [...Bn(e).values()].filter((r) => Un(t, r));
2623
+ const n = [...qn(e).values()].filter((r) => zn(t, r));
2624
2624
  return Oe(n.map((r) => {
2625
2625
  var i, o;
2626
2626
  return ((o = (i = e.sheets) == null ? void 0 : i.find((a) => a.id === r.sheetId)) == null ? void 0 : o.title) ?? r.sheetId;
2627
2627
  }));
2628
2628
  }
2629
- const vr = (e) => {
2629
+ const Ir = (e) => {
2630
2630
  var t;
2631
2631
  return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
2632
2632
  };
2633
- function Ir(e) {
2633
+ function Cr(e) {
2634
2634
  var t, n, r;
2635
2635
  if ((n = (t = e.filter) == null ? void 0 : t.defaultValues) != null && n.length) return `default ${e.filter.defaultValues.join(", ")}`;
2636
2636
  if ((r = e.filter) != null && r.defaultDateFilter) return "a default period";
@@ -2638,16 +2638,16 @@ function Ir(e) {
2638
2638
  function he(e) {
2639
2639
  return x.plain("filter", e);
2640
2640
  }
2641
- function Ms(e, t, n) {
2641
+ function Os(e, t, n) {
2642
2642
  const { input: r } = t, i = re(e);
2643
2643
  if (i.some((f) => f.id === r.id))
2644
2644
  throw new F("filter_id_taken", `A filter with id ${r.id} is already on this dashboard.`);
2645
2645
  if (Z(e).findFilterInput({ filterId: r.filter.id }))
2646
2646
  throw new F("filter_id_taken", `A filter definition with id ${r.filter.id} is already on this dashboard.`);
2647
- const o = { ...e, inputs: [...i, r] }, a = n.relationshipReach ? { relationshipReach: n.relationshipReach } : void 0, s = Ds(o, r.id, a), c = ks(o, r.id, a), l = _s(o, r.id), d = Oe([
2647
+ const o = { ...e, inputs: [...i, r] }, a = n.relationshipReach ? { relationshipReach: n.relationshipReach } : void 0, s = ks(o, r.id, a), c = _s(o, r.id, a), l = Ms(o, r.id), d = Oe([
2648
2648
  ...c ? [`may filter ${c} more through the domain's relationships`] : [],
2649
2649
  ...l ? [`may filter ${l} more through ${l === 1 ? "its" : "their"} SQL`] : []
2650
- ]), u = [vr(r), Ir(r)].filter(Boolean).join(", ");
2650
+ ]), u = [Ir(r), Cr(r)].filter(Boolean).join(", ");
2651
2651
  return {
2652
2652
  dashboard: o,
2653
2653
  created: [
@@ -2660,13 +2660,13 @@ function Ms(e, t, n) {
2660
2660
  ],
2661
2661
  clauses: [
2662
2662
  he(
2663
- `adds the filter ${T(r.label)} (${u}) to ${br(o, r)}; it filters ${s} card${s === 1 ? "" : "s"}${d ? ` and ${d}` : ""}`
2663
+ `adds the filter ${T(r.label)} (${u}) to ${vr(o, r)}; it filters ${s} card${s === 1 ? "" : "s"}${d ? ` and ${d}` : ""}`
2664
2664
  )
2665
2665
  ]
2666
2666
  };
2667
2667
  }
2668
- function Os(e, t, n) {
2669
- const r = Cs(e, { inputId: t.filterId }, t.settings, {
2668
+ function As(e, t, n) {
2669
+ const r = Fs(e, { inputId: t.filterId }, t.settings, {
2670
2670
  calendar: n.calendar
2671
2671
  });
2672
2672
  if (!r.ok) {
@@ -2682,35 +2682,35 @@ function Os(e, t, n) {
2682
2682
  return {
2683
2683
  dashboard: r.dashboard,
2684
2684
  runtimeEffects: [{ kind: "filter_value", effects: r.valueEffects }],
2685
- clauses: [he(`changes the filter ${T((i == null ? void 0 : i.label) ?? o.label)}: ${As(r.dashboard, i, o)}`)]
2685
+ clauses: [he(`changes the filter ${T((i == null ? void 0 : i.label) ?? o.label)}: ${$s(r.dashboard, i, o)}`)]
2686
2686
  };
2687
2687
  }
2688
- function As(e, t, n) {
2688
+ function $s(e, t, n) {
2689
2689
  var o, a, s, c, l, d;
2690
2690
  if (!t) return "updates its settings";
2691
2691
  const r = [];
2692
- if (t.label !== n.label && r.push(`renames it ${T(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((a = n.filter) == null ? void 0 : a.type) ?? "multiple") && r.push(`makes it ${vr(n)}`), JSON.stringify(((s = t.filter) == null ? void 0 : s.defaultValues) ?? null) !== JSON.stringify(((c = n.filter) == null ? void 0 : c.defaultValues) ?? null) || !ma((l = t.filter) == null ? void 0 : l.defaultDateFilter, (d = n.filter) == null ? void 0 : d.defaultDateFilter)) {
2693
- const u = Ir(n);
2692
+ if (t.label !== n.label && r.push(`renames it ${T(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((a = n.filter) == null ? void 0 : a.type) ?? "multiple") && r.push(`makes it ${Ir(n)}`), JSON.stringify(((s = t.filter) == null ? void 0 : s.defaultValues) ?? null) !== JSON.stringify(((c = n.filter) == null ? void 0 : c.defaultValues) ?? null) || !pa((l = t.filter) == null ? void 0 : l.defaultDateFilter, (d = n.filter) == null ? void 0 : d.defaultDateFilter)) {
2693
+ const u = Cr(n);
2694
2694
  r.push(u ? `sets its ${u.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2695
2695
  }
2696
- return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${br(e, n)}`), r.length ? Oe(r) : "keeps its settings";
2696
+ return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${vr(e, n)}`), r.length ? Oe(r) : "keeps its settings";
2697
2697
  }
2698
- function $s(e, t) {
2698
+ function Ps(e, t) {
2699
2699
  const n = Ne(e, t);
2700
2700
  return {
2701
2701
  dashboard: {
2702
2702
  ...e,
2703
2703
  inputs: re(e).filter((i) => i.id !== t),
2704
- defaultInputValues: Ri(e.defaultInputValues, t)
2704
+ defaultInputValues: Ki(e.defaultInputValues, t)
2705
2705
  },
2706
2706
  runtimeEffects: [{ kind: "input_removed", inputId: t }],
2707
2707
  clauses: [he(`removes the filter ${T(n.label)}`)]
2708
2708
  };
2709
2709
  }
2710
- function Ps(e, t, n) {
2710
+ function Ns(e, t, n) {
2711
2711
  var a;
2712
- gr(e, n);
2713
- const r = qa(t.scope, n);
2712
+ yr(e, n);
2713
+ const r = Ua(t.scope, n);
2714
2714
  if (!r)
2715
2715
  throw new F(
2716
2716
  "filter_invalid",
@@ -2725,10 +2725,10 @@ function Ps(e, t, n) {
2725
2725
  inputs: re(e).map((s) => s.id === t.id ? i : s)
2726
2726
  };
2727
2727
  }
2728
- function Cr(e, t, n, r, i) {
2728
+ function Fr(e, t, n, r, i) {
2729
2729
  var d, u;
2730
2730
  const o = Ne(e, t);
2731
- gr(e, n);
2731
+ yr(e, n);
2732
2732
  const a = [...((d = o.application) == null ? void 0 : d.cards) ?? []], s = a.findIndex((f) => f.cardId === n);
2733
2733
  s >= 0 ? a[s] = r : a.push(r);
2734
2734
  const c = {
@@ -2747,7 +2747,7 @@ function Cr(e, t, n, r, i) {
2747
2747
  inputs: re(e).map((f) => f.id === t ? c : f)
2748
2748
  };
2749
2749
  }
2750
- function Ns(e) {
2750
+ function Es(e) {
2751
2751
  switch (e.kind) {
2752
2752
  case "field":
2753
2753
  return `by ${e.field.name}`;
@@ -2757,23 +2757,23 @@ function Ns(e) {
2757
2757
  return String(e.kind);
2758
2758
  }
2759
2759
  }
2760
- function Es(e, t) {
2761
- const n = Ne(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = Ba(n.scope, t.cardId), o = i !== n.scope;
2760
+ function Rs(e, t) {
2761
+ const n = Ne(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = qa(n.scope, t.cardId), o = i !== n.scope;
2762
2762
  return {
2763
- dashboard: Cr(e, t.filterId, t.cardId, r, o ? i : void 0),
2763
+ dashboard: Fr(e, t.filterId, t.cardId, r, o ? i : void 0),
2764
2764
  clauses: [
2765
2765
  he(
2766
- `makes ${T(n.label)} filter ${hr(e, t.cardId)} ${Ns(r.target)}${o ? ", which it used to leave out" : ""}`
2766
+ `makes ${T(n.label)} filter ${gr(e, t.cardId)} ${Es(r.target)}${o ? ", which it used to leave out" : ""}`
2767
2767
  )
2768
2768
  ]
2769
2769
  };
2770
2770
  }
2771
- function Rs(e, t) {
2771
+ function Ks(e, t) {
2772
2772
  var i;
2773
2773
  const n = Ne(e, t.filterId);
2774
2774
  return {
2775
- dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? Ps(e, n, t.cardId) : Cr(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2776
- clauses: [he(`stops ${T(n.label)} from filtering ${hr(e, t.cardId)}`)]
2775
+ dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? Ns(e, n, t.cardId) : Fr(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2776
+ clauses: [he(`stops ${T(n.label)} from filtering ${gr(e, t.cardId)}`)]
2777
2777
  };
2778
2778
  }
2779
2779
  function Tt(e, t) {
@@ -2791,12 +2791,12 @@ function tt(e, t) {
2791
2791
  throw new F("variable_not_found", `No variable ${t} on this dashboard.`, "Read the outline again and use its variable names.");
2792
2792
  return n;
2793
2793
  }
2794
- function Fr(e) {
2794
+ function Sr(e) {
2795
2795
  var r;
2796
- const t = Zo(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2796
+ const t = es(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2797
2797
  return e.get.kind === "only" && !((r = e.query.sql) != null && r.trim()) ? `${n}. When more than one matches it shows nothing` : n;
2798
2798
  }
2799
- function Ks(e, t) {
2799
+ function Ls(e, t) {
2800
2800
  const n = gt(e, { kind: "add", variable: t.variable });
2801
2801
  n.ok || Tt(n.issues, "This variable could not be added.");
2802
2802
  const { variable: r } = t;
@@ -2804,22 +2804,22 @@ function Ks(e, t) {
2804
2804
  dashboard: n.dashboard,
2805
2805
  created: [{ kind: "variable", id: r.id, title: r.name, ...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {} }],
2806
2806
  queryFrames: n.queryFrames,
2807
- clauses: [x.plain("variable", `adds the variable ${r.name}: ${Fr(r)}`)]
2807
+ clauses: [x.plain("variable", `adds the variable ${r.name}: ${Sr(r)}`)]
2808
2808
  };
2809
2809
  }
2810
- function Ls(e, t) {
2810
+ function Vs(e, t) {
2811
2811
  const n = tt(e, t.variableId), r = Object.fromEntries(Object.entries(t.patch).map(([m, p]) => [m, p === null ? void 0 : p])), i = gt(e, { kind: "update", id: t.variableId, patch: r });
2812
2812
  i.ok || Tt(i.issues, "This variable could not be changed.");
2813
2813
  const o = tt(i.dashboard, t.variableId), a = [];
2814
2814
  t.patch.name !== void 0 && t.patch.name !== n.name && a.push(x.plain("variable", `renames the variable ${n.name} to ${o.name}`));
2815
2815
  const { name: s, label: c, ...l } = n, { name: d, label: u, ...f } = o;
2816
- return JSON.stringify(l) !== JSON.stringify(f) ? a.push(x.plain("variable", `changes the variable ${o.name}: ${Fr(o)}`)) : n.label !== o.label && a.push(x.plain("variable", `labels the variable ${o.name} ${T(o.label ?? o.name)}`)), {
2816
+ return JSON.stringify(l) !== JSON.stringify(f) ? a.push(x.plain("variable", `changes the variable ${o.name}: ${Sr(o)}`)) : n.label !== o.label && a.push(x.plain("variable", `labels the variable ${o.name} ${T(o.label ?? o.name)}`)), {
2817
2817
  dashboard: i.dashboard,
2818
2818
  queryFrames: i.queryFrames,
2819
2819
  clauses: a.length ? a : [x.plain("variable", `changes nothing on the variable ${o.name}`)]
2820
2820
  };
2821
2821
  }
2822
- function Vs(e, t) {
2822
+ function Bs(e, t) {
2823
2823
  const n = tt(e, t.variableId), r = gt(e, { kind: "remove", id: t.variableId, confirmed: !1 });
2824
2824
  r.ok || Tt(r.issues, "This variable could not be removed.");
2825
2825
  const i = r.removedMappings ? ` and its ${r.removedMappings === 1 ? "filter mapping" : `${r.removedMappings} filter mappings`}` : "";
@@ -2828,32 +2828,32 @@ function Vs(e, t) {
2828
2828
  clauses: [x.plain("variable", `removes the variable ${n.name}${i}`)]
2829
2829
  };
2830
2830
  }
2831
- function Sr(e) {
2832
- return e.cards.length < Ua;
2831
+ function wr(e) {
2832
+ return e.cards.length < za;
2833
2833
  }
2834
- function Bs(e) {
2835
- return e.kpi.layout === "tiles" && e.cards.length + 1 > zn;
2834
+ function qs(e) {
2835
+ return e.kpi.layout === "tiles" && e.cards.length + 1 > Wn;
2836
2836
  }
2837
- function qs(e, t) {
2838
- return !Sr(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2837
+ function Us(e, t) {
2838
+ return !wr(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2839
2839
  ...e,
2840
2840
  cards: [...e.cards, t],
2841
- kpi: Bs(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2841
+ kpi: qs(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2842
2842
  };
2843
2843
  }
2844
- function Us(e, t) {
2844
+ function zs(e, t) {
2845
2845
  if (e.cards.length <= 1) return e;
2846
2846
  const n = e.cards.filter(({ id: r }) => r !== t);
2847
2847
  return n.length === e.cards.length ? e : { ...e, cards: n };
2848
2848
  }
2849
- function wr(e) {
2850
- return e.cards.length <= zn;
2849
+ function xr(e) {
2850
+ return e.cards.length <= Wn;
2851
2851
  }
2852
2852
  function js(e, t) {
2853
2853
  const n = { ...e.kpi, ...t };
2854
- return n.layout === "tiles" && !wr(e) ? e : { ...e, kpi: n };
2854
+ return n.layout === "tiles" && !xr(e) ? e : { ...e, kpi: n };
2855
2855
  }
2856
- const zs = ["table"], Ws = ["matrixTable"];
2856
+ const Ws = ["table"], Gs = ["matrixTable"];
2857
2857
  function fn(e, t, n) {
2858
2858
  return {
2859
2859
  id: e.section(),
@@ -2885,7 +2885,7 @@ function fn(e, t, n) {
2885
2885
  }
2886
2886
  };
2887
2887
  }
2888
- function xr(e) {
2888
+ function Tr(e) {
2889
2889
  return { id: e, title: "KPI", type: "kpi" };
2890
2890
  }
2891
2891
  const B = {
@@ -2899,7 +2899,7 @@ const B = {
2899
2899
  create: (e) => ({
2900
2900
  id: e.section(),
2901
2901
  type: "text",
2902
- content: fr("New text section")
2902
+ content: mr("New text section")
2903
2903
  })
2904
2904
  },
2905
2905
  table: {
@@ -2908,7 +2908,7 @@ const B = {
2908
2908
  description: "Rows and columns from one dataset.",
2909
2909
  group: "data",
2910
2910
  addable: !0,
2911
- cardTypes: zs,
2911
+ cardTypes: Ws,
2912
2912
  create: (e) => fn(e, "table", "Table")
2913
2913
  },
2914
2914
  matrix: {
@@ -2917,7 +2917,7 @@ const B = {
2917
2917
  description: "Grouped rows with subtotals, and optional column levels.",
2918
2918
  group: "data",
2919
2919
  addable: !0,
2920
- cardTypes: Ws,
2920
+ cardTypes: Gs,
2921
2921
  create: (e) => fn(e, "matrixTable", "Matrix")
2922
2922
  },
2923
2923
  kpi: {
@@ -2930,7 +2930,7 @@ const B = {
2930
2930
  create: (e) => ({
2931
2931
  id: e.section(),
2932
2932
  type: "kpi",
2933
- cards: [xr(e.card())],
2933
+ cards: [Tr(e.card())],
2934
2934
  kpi: { layout: "tiles" }
2935
2935
  })
2936
2936
  },
@@ -2967,7 +2967,7 @@ const B = {
2967
2967
  create: (e) => ({ id: e.section(), type: "page_break" })
2968
2968
  }
2969
2969
  };
2970
- function Tr(e) {
2970
+ function Dr(e) {
2971
2971
  var t;
2972
2972
  switch (e.type) {
2973
2973
  case "table":
@@ -2984,42 +2984,42 @@ function Tr(e) {
2984
2984
  return B.page_break;
2985
2985
  }
2986
2986
  }
2987
- function Gs(e, t) {
2988
- return Tr(e).cardTypes.includes(t);
2987
+ function Hs(e, t) {
2988
+ return Dr(e).cardTypes.includes(t);
2989
2989
  }
2990
- function Dr(e, t) {
2991
- if (Gs(e, t)) return null;
2992
- const n = Tr(e);
2990
+ function kr(e, t) {
2991
+ if (Hs(e, t)) return null;
2992
+ const n = Dr(e);
2993
2993
  return n.id === "table" ? "Table sections hold Table cards only" : n.id === "kpi" ? "KPI sections hold KPI cards only" : n.id === "matrix" ? "Matrix sections hold Matrix cards only" : `${n.label} sections do not accept this visual`;
2994
2994
  }
2995
- function Hs(e, t, n) {
2995
+ function Ys(e, t, n) {
2996
2996
  if (!bt(e).some(({ id: i }) => i === t))
2997
2997
  throw new Error(
2998
2998
  `Document section '${e.id}' has no card '${t}'.`
2999
2999
  );
3000
- const r = Dr(e, n.type);
3000
+ const r = kr(e, n.type);
3001
3001
  if (r)
3002
3002
  throw new Error(r);
3003
- return Wn(
3003
+ return Gn(
3004
3004
  e,
3005
3005
  (i) => i.id === t ? n : i
3006
3006
  );
3007
3007
  }
3008
- const Ys = [
3008
+ const Qs = [
3009
3009
  { id: "data", label: "Data" },
3010
3010
  { id: "content", label: "Content" },
3011
3011
  { id: "layout", label: "Layout" }
3012
3012
  ];
3013
- function ld() {
3013
+ function ud() {
3014
3014
  const e = Object.values(B).filter(
3015
3015
  (t) => t.addable
3016
3016
  );
3017
- return Ys.map((t) => ({
3017
+ return Qs.map((t) => ({
3018
3018
  ...t,
3019
3019
  kinds: e.filter((n) => n.group === t.id)
3020
3020
  })).filter((t) => t.kinds.length > 0);
3021
3021
  }
3022
- const Qs = {
3022
+ const Xs = {
3023
3023
  header: ["title", "metadata"],
3024
3024
  footer: ["note", "pageInfo"]
3025
3025
  };
@@ -3029,26 +3029,26 @@ class D extends Error {
3029
3029
  }
3030
3030
  }
3031
3031
  const mn = 8, Js = 240;
3032
- function dd() {
3032
+ function fd() {
3033
3033
  return {
3034
3034
  section: () => `doc_section_${Te()}`,
3035
3035
  card: () => `doc_card_${Te()}`
3036
3036
  };
3037
3037
  }
3038
- function Xs(e) {
3038
+ function Zs(e) {
3039
3039
  return Number.isFinite(e) ? Math.min(
3040
3040
  Js,
3041
3041
  Math.max(mn, Math.round(e))
3042
3042
  ) : mn;
3043
3043
  }
3044
- function ud(e, t, n, r) {
3044
+ function md(e, t, n, r) {
3045
3045
  const i = e.findIndex(({ id: s }) => s === t), o = e.findIndex(({ id: s }) => s === n);
3046
3046
  if (i === -1 || o === -1) return i;
3047
3047
  const a = r === "after" ? o + 1 : o;
3048
3048
  return i < a ? a - 1 : a;
3049
3049
  }
3050
- const Zs = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
3051
- function ec(e, t = {}) {
3050
+ const ec = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
3051
+ function tc(e, t = {}) {
3052
3052
  const n = new Set(
3053
3053
  (e.sheets || []).flatMap(
3054
3054
  (r) => (r.frames || []).flatMap(
@@ -3056,14 +3056,14 @@ function ec(e, t = {}) {
3056
3056
  )
3057
3057
  )
3058
3058
  );
3059
- return qn(e).filter(
3060
- (r) => Zs.has(r.card.type) && !r.card.linkedSourceCardId && !(r.kind === "frameCard" && n.has(r.frameId)) && !(r.kind === "documentSectionCard" && r.sectionId === t.excludeSectionId) && !Li(r.card)
3059
+ return Un(e).filter(
3060
+ (r) => ec.has(r.card.type) && !r.card.linkedSourceCardId && !(r.kind === "frameCard" && n.has(r.frameId)) && !(r.kind === "documentSectionCard" && r.sectionId === t.excludeSectionId) && !Vi(r.card)
3061
3061
  );
3062
3062
  }
3063
- function tc(e) {
3063
+ function nc(e) {
3064
3064
  return e.type === "kpi" ? "kpi" : e.type === "matrixTable" ? "matrix" : "table";
3065
3065
  }
3066
- function nc(e, t, n) {
3066
+ function rc(e, t, n) {
3067
3067
  const r = e.sections, i = (a) => ({
3068
3068
  ...e,
3069
3069
  sections: a
@@ -3075,17 +3075,17 @@ function nc(e, t, n) {
3075
3075
  throw new D(`${a.label} sections cannot be added.`);
3076
3076
  const s = a.create(n.ids);
3077
3077
  return {
3078
- document: i(je(r, s, t.index)),
3078
+ document: i(ze(r, s, t.index)),
3079
3079
  target: o(s.id)
3080
3080
  };
3081
3081
  }
3082
3082
  case "copyCard": {
3083
- const a = Ue(t.source, n), c = B[tc(a.card)].create({
3083
+ const a = Ue(t.source, n), c = B[nc(a.card)].create({
3084
3084
  section: n.ids.section,
3085
3085
  card: () => a.card.id
3086
3086
  }), l = c.type === "kpi" ? { ...c, title: void 0, cards: [a.card] } : c.type === "table" ? { ...c, title: a.card.title || c.title, card: a.card } : c;
3087
3087
  return {
3088
- document: i(je(r, l, t.index)),
3088
+ document: i(ze(r, l, t.index)),
3089
3089
  target: o(l.id),
3090
3090
  ...a.calculatedFields ? { calculatedFields: a.calculatedFields } : {}
3091
3091
  };
@@ -3096,7 +3096,7 @@ function nc(e, t, n) {
3096
3096
  throw new D(
3097
3097
  "Only a table section can be replaced with a copied card."
3098
3098
  );
3099
- const s = Ue(t.source, n, t.sectionId), c = Dr(a, s.card.type);
3099
+ const s = Ue(t.source, n, t.sectionId), c = kr(a, s.card.type);
3100
3100
  if (c) throw new D(c);
3101
3101
  const l = {
3102
3102
  ...a,
@@ -3124,9 +3124,9 @@ function nc(e, t, n) {
3124
3124
  case "duplicate": {
3125
3125
  const a = r.findIndex(({ id: c }) => c === t.sectionId);
3126
3126
  if (a === -1) throw Ce(t.sectionId);
3127
- const s = rc(r[a], n.ids);
3127
+ const s = ic(r[a], n.ids);
3128
3128
  return {
3129
- document: i(je(r, s, a + 1)),
3129
+ document: i(ze(r, s, a + 1)),
3130
3130
  target: o(s.id)
3131
3131
  };
3132
3132
  }
@@ -3167,13 +3167,13 @@ function nc(e, t, n) {
3167
3167
  };
3168
3168
  }
3169
3169
  case "updateRegionText": {
3170
- if (!Qs[t.region].includes(t.role))
3170
+ if (!Xs[t.region].includes(t.role))
3171
3171
  throw new D(
3172
3172
  `The ${t.region} has ${t.region === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${t.role} line.`
3173
3173
  );
3174
- if (t.style !== void 0 && !Ki(t.role))
3174
+ if (t.style !== void 0 && !Li(t.role))
3175
3175
  throw new D(`The footer's ${t.role === "pageInfo" ? "page info" : t.role} line has no size or alignment; only the header's title and metadata lines do.`);
3176
- const a = e[t.region], s = a ? gs(a.blocks, t.role) : void 0, c = t.style !== void 0 ? Wt(s == null ? void 0 : s.style, t.style) : s == null ? void 0 : s.style, l = {
3176
+ const a = e[t.region], s = a ? ys(a.blocks, t.role) : void 0, c = t.style !== void 0 ? Wt(s == null ? void 0 : s.style, t.style) : s == null ? void 0 : s.style, l = {
3177
3177
  id: (s == null ? void 0 : s.id) ?? `${t.region}_${t.role}`,
3178
3178
  role: t.role,
3179
3179
  area: (s == null ? void 0 : s.area) ?? t.role,
@@ -3181,13 +3181,13 @@ function nc(e, t, n) {
3181
3181
  ...c ? { style: c } : {}
3182
3182
  };
3183
3183
  if (t.region === "header") {
3184
- const u = (a == null ? void 0 : a.region) === "header" ? a : ps();
3184
+ const u = (a == null ? void 0 : a.region) === "header" ? a : hs();
3185
3185
  return {
3186
3186
  document: { ...e, header: { ...u, enabled: !0, blocks: dn(u.blocks, l) } },
3187
3187
  target: { kind: "header" }
3188
3188
  };
3189
3189
  }
3190
- const d = (a == null ? void 0 : a.region) === "footer" ? a : hs();
3190
+ const d = (a == null ? void 0 : a.region) === "footer" ? a : gs();
3191
3191
  return {
3192
3192
  document: { ...e, footer: { ...d, enabled: !0, blocks: dn(d.blocks, l) } },
3193
3193
  target: { kind: "footer" }
@@ -3209,7 +3209,7 @@ function nc(e, t, n) {
3209
3209
  case "updateKpiOptions": {
3210
3210
  const a = V(r, t.sectionId);
3211
3211
  if (a.type !== "kpi") throw Y(t.type, a);
3212
- if (t.options.layout === "tiles" && !wr(a))
3212
+ if (t.options.layout === "tiles" && !xr(a))
3213
3213
  throw new D("Tiles hold up to 6 KPIs.");
3214
3214
  return {
3215
3215
  document: i(
@@ -3225,7 +3225,7 @@ function nc(e, t, n) {
3225
3225
  document: i(
3226
3226
  L(r, {
3227
3227
  ...a,
3228
- heightPx: Xs(t.heightPx)
3228
+ heightPx: Zs(t.heightPx)
3229
3229
  })
3230
3230
  ),
3231
3231
  target: o(a.id)
@@ -3236,7 +3236,7 @@ function nc(e, t, n) {
3236
3236
  t.card.id !== t.oldCardId && pn(n, t.card.id);
3237
3237
  let s;
3238
3238
  try {
3239
- s = Hs(a, t.oldCardId, t.card);
3239
+ s = Ys(a, t.oldCardId, t.card);
3240
3240
  } catch (c) {
3241
3241
  throw new D(c.message);
3242
3242
  }
@@ -3250,14 +3250,14 @@ function nc(e, t, n) {
3250
3250
  case "addKpi": {
3251
3251
  const a = V(r, t.sectionId);
3252
3252
  if (a.type !== "kpi") throw Y(t.type, a);
3253
- if (!Sr(a))
3253
+ if (!wr(a))
3254
3254
  throw new D("A KPI section holds up to 8 KPIs.");
3255
3255
  const s = t.source ? Ue(t.source, n, a.id) : void 0;
3256
3256
  t.card && !s && pn(n, t.card.id);
3257
- const c = (s == null ? void 0 : s.card) ?? t.card ?? xr(n.ids.card());
3257
+ const c = (s == null ? void 0 : s.card) ?? t.card ?? Tr(n.ids.card());
3258
3258
  if (c.type !== "kpi")
3259
3259
  throw new D("KPI sections hold KPI cards only");
3260
- const l = qs(a, c);
3260
+ const l = Us(a, c);
3261
3261
  if (l === a)
3262
3262
  throw new D(`KPI section '${a.id}' already has card '${c.id}'.`);
3263
3263
  return {
@@ -3271,7 +3271,7 @@ function nc(e, t, n) {
3271
3271
  if (a.type !== "kpi") throw Y(t.type, a);
3272
3272
  if (!a.cards.some(({ id: c }) => c === t.cardId))
3273
3273
  throw new D(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3274
- const s = Us(a, t.cardId);
3274
+ const s = zs(a, t.cardId);
3275
3275
  if (s === a)
3276
3276
  throw new D("A KPI section keeps at least one KPI.");
3277
3277
  return {
@@ -3293,19 +3293,19 @@ function nc(e, t, n) {
3293
3293
  };
3294
3294
  }
3295
3295
  default:
3296
- return ac(t);
3296
+ return oc(t);
3297
3297
  }
3298
3298
  }
3299
3299
  function Ue(e, t, n) {
3300
- const r = ec(t.dashboard, {
3300
+ const r = tc(t.dashboard, {
3301
3301
  excludeSectionId: n
3302
- }).find((p) => ic(p, e));
3302
+ }).find((p) => ac(p, e));
3303
3303
  if (!r)
3304
3304
  throw new D(
3305
3305
  `Card '${e.cardId}' cannot be copied into this document.`
3306
3306
  );
3307
3307
  const i = t.dashboard.sheets || [], o = i.find(({ id: p }) => p === e.sheetId), a = i.find(({ id: p }) => p === t.sheetId), s = t.ids.card(), c = we({ ...r.card, id: s });
3308
- Pn(c, /* @__PURE__ */ new Map([[e.cardId, s]]));
3308
+ Nn(c, /* @__PURE__ */ new Map([[e.cardId, s]]));
3309
3309
  const l = /* @__PURE__ */ new Set();
3310
3310
  if (ue(c, {
3311
3311
  oldCardId: e.cardId,
@@ -3315,7 +3315,7 @@ function Ue(e, t, n) {
3315
3315
  onSheetField: (p) => l.add(p)
3316
3316
  }), e.sheetId === t.sheetId || l.size === 0)
3317
3317
  return { card: c };
3318
- const d = as(o), u = /* @__PURE__ */ new Map(), f = [...l];
3318
+ const d = os(o), u = /* @__PURE__ */ new Map(), f = [...l];
3319
3319
  for (; f.length > 0; ) {
3320
3320
  const p = f.pop();
3321
3321
  if (u.has(p)) continue;
@@ -3352,13 +3352,13 @@ function ue(e, t) {
3352
3352
  const n = e;
3353
3353
  typeof n.entityId == "string" && (n.fieldScope === "card" && n.entityId === t.oldCardId ? n.entityId = t.newCardId : n.fieldScope === "sheet" && n.entityId === t.sourceSheetId && (typeof n.id == "string" && t.onSheetField(Ge(n.id) ?? n.id), n.entityId = t.targetSheetId)), Object.values(n).forEach((r) => ue(r, t));
3354
3354
  }
3355
- function rc(e, t) {
3355
+ function ic(e, t) {
3356
3356
  const n = { ...we(e), id: t.section() }, r = new Map(
3357
3357
  bt(n).map((i) => [i.id, t.card()])
3358
3358
  );
3359
- return Wn(n, (i) => {
3359
+ return Gn(n, (i) => {
3360
3360
  const o = r.get(i.id), a = we({ ...i, id: o });
3361
- return Pn(a, r), ue(a, {
3361
+ return Nn(a, r), ue(a, {
3362
3362
  oldCardId: i.id,
3363
3363
  newCardId: o,
3364
3364
  sourceSheetId: "",
@@ -3368,7 +3368,7 @@ function rc(e, t) {
3368
3368
  }), a;
3369
3369
  });
3370
3370
  }
3371
- function ic(e, t) {
3371
+ function ac(e, t) {
3372
3372
  return e.kind !== t.kind || e.sheetId !== t.sheetId || e.cardId !== t.cardId ? !1 : e.kind === "frameCard" && t.kind === "frameCard" ? e.frameId === t.frameId : e.kind === "documentSectionCard" && t.kind === "documentSectionCard" ? e.sectionId === t.sectionId : !0;
3373
3373
  }
3374
3374
  function pn(e, t) {
@@ -3377,7 +3377,7 @@ function pn(e, t) {
3377
3377
  `Card id '${t}' is already used by another card in this dashboard.`
3378
3378
  );
3379
3379
  }
3380
- function je(e, t, n) {
3380
+ function ze(e, t, n) {
3381
3381
  const r = nt(n, e.length);
3382
3382
  return [...e.slice(0, r), t, ...e.slice(r)];
3383
3383
  }
@@ -3402,56 +3402,56 @@ function Y(e, t) {
3402
3402
  `'${e}' does not apply to a ${t.type} section.`
3403
3403
  );
3404
3404
  }
3405
- function ac(e) {
3405
+ function oc(e) {
3406
3406
  throw new D(
3407
3407
  `Unknown document edit '${e.type}'.`
3408
3408
  );
3409
3409
  }
3410
- const oc = {
3410
+ const sc = {
3411
3411
  section: () => {
3412
3412
  throw new F("document_invalid", "A text edit mints no section id.");
3413
3413
  },
3414
3414
  card: () => {
3415
3415
  throw new F("document_invalid", "A text edit mints no card id.");
3416
3416
  }
3417
- }, sc = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3418
- function cc(e, t) {
3417
+ }, cc = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3418
+ function lc(e, t) {
3419
3419
  const n = e.sheets ?? [], r = n.findIndex((d) => d.id === t.sheetId), i = n[r];
3420
3420
  if (!i) throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`, "Read the outline again and use its sheet ids.");
3421
3421
  if (!Me(i) || !i.document)
3422
3422
  throw new F("document_invalid", `"${i.title ?? i.id}" is not a Document sheet.`, "Name a Document sheet; a grid sheet's words are its text cards.");
3423
3423
  let o;
3424
3424
  try {
3425
- o = nc(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: oc }).document;
3425
+ o = rc(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: sc }).document;
3426
3426
  } catch (d) {
3427
3427
  throw d instanceof D ? new F("document_invalid", d.message, "Read the outline again and use its section ids and line roles.") : d;
3428
3428
  }
3429
- const a = { ...e, sheets: n.map((d, u) => u === r ? { ...d, document: o } : d) }, s = t.edit.type === "updateRegionText" ? `the ${sc[t.edit.role]} line of the ${T(i.title)} ${t.edit.region}` : `a text section of ${T(i.title)}`, c = [];
3429
+ const a = { ...e, sheets: n.map((d, u) => u === r ? { ...d, document: o } : d) }, s = t.edit.type === "updateRegionText" ? `the ${cc[t.edit.role]} line of the ${T(i.title)} ${t.edit.region}` : `a text section of ${T(i.title)}`, c = [];
3430
3430
  if (t.edit.content !== void 0) {
3431
- const d = Vi(t.edit.content, { inputs: a.inputs, variables: a.variables }), u = Bi(d);
3432
- c.push(`sets ${s} to ${T(qi(d))}${u ? `, ${u}` : ""}`);
3431
+ const d = Bi(t.edit.content, { inputs: a.inputs, variables: a.variables }), u = qi(d);
3432
+ c.push(`sets ${s} to ${T(Ui(d))}${u ? `, ${u}` : ""}`);
3433
3433
  }
3434
- const l = dc(t.edit.style);
3434
+ const l = uc(t.edit.style);
3435
3435
  return l && c.push(c.length ? `makes it ${l}` : `makes ${s} ${l}`), {
3436
3436
  dashboard: a,
3437
3437
  clauses: [x.plain("document", c.join(" and "))]
3438
3438
  };
3439
3439
  }
3440
- const lc = { left: "left-aligned", center: "centered", right: "right-aligned" };
3441
- function dc(e) {
3440
+ const dc = { left: "left-aligned", center: "centered", right: "right-aligned" };
3441
+ function uc(e) {
3442
3442
  return [
3443
3443
  ...(e == null ? void 0 : e.fontSize) !== void 0 ? [`${e.fontSize}px`] : [],
3444
- ...(e == null ? void 0 : e.align) !== void 0 ? [lc[e.align]] : []
3444
+ ...(e == null ? void 0 : e.align) !== void 0 ? [dc[e.align]] : []
3445
3445
  ].join(" and ");
3446
3446
  }
3447
- function fd(e, t, n) {
3447
+ function pd(e, t, n) {
3448
3448
  let r = e;
3449
3449
  const i = [], o = [], a = [], s = [], c = [];
3450
3450
  let l = !1;
3451
3451
  for (const [u, f] of t.entries()) {
3452
3452
  let m;
3453
3453
  try {
3454
- m = fc(r, f, n);
3454
+ m = mc(r, f, n);
3455
3455
  } catch (p) {
3456
3456
  if (!(p instanceof F)) throw p;
3457
3457
  return {
@@ -3476,66 +3476,66 @@ function fd(e, t, n) {
3476
3476
  dashboard: r,
3477
3477
  created: i,
3478
3478
  touched: o.filter((u) => !d.has(u)),
3479
- queryFrames: [...uc(r, i, o), ...s],
3480
- descriptions: mc(c),
3479
+ queryFrames: [...fc(r, i, o), ...s],
3480
+ descriptions: pc(c),
3481
3481
  runtimeEffects: a,
3482
3482
  detaches: l
3483
3483
  };
3484
3484
  }
3485
- function uc(e, t, n) {
3485
+ function fc(e, t, n) {
3486
3486
  const r = /* @__PURE__ */ new Set([...t.filter((i) => i.kind === "card").map((i) => i.id), ...n]);
3487
3487
  return (e.sheets ?? []).flatMap(
3488
3488
  (i) => (i.frames ?? []).filter((o) => (o.cards ?? []).some((a) => r.has(a.id)))
3489
3489
  );
3490
3490
  }
3491
- function fc(e, t, n) {
3491
+ function mc(e, t, n) {
3492
3492
  switch (t.op) {
3493
3493
  case "card.add":
3494
- return zi(e, t);
3494
+ return Wi(e, t);
3495
3495
  case "card.remove":
3496
3496
  return ji(e, t.cardId);
3497
3497
  case "card.update":
3498
- return oe(Ui(e, t.cardId, t.update), [t.cardId]);
3498
+ return oe(zi(e, t.cardId, t.update), [t.cardId]);
3499
3499
  case "layout.arrange":
3500
- return ts(e, t);
3500
+ return ns(e, t);
3501
3501
  case "frame.commit":
3502
- return oe(ss(e, t.commit), [t.commit.frame.activeCardId]);
3502
+ return oe(cs(e, t.commit), [t.commit.frame.activeCardId]);
3503
3503
  case "filter.add":
3504
- return Ms(e, t, n);
3505
- case "filter.update":
3506
3504
  return Os(e, t, n);
3505
+ case "filter.update":
3506
+ return As(e, t, n);
3507
3507
  case "filter.remove":
3508
- return $s(e, t.filterId);
3508
+ return Ps(e, t.filterId);
3509
3509
  case "filter.bind":
3510
- return oe(Es(e, t), [t.cardId]);
3511
- case "filter.exclude":
3512
3510
  return oe(Rs(e, t), [t.cardId]);
3511
+ case "filter.exclude":
3512
+ return oe(Ks(e, t), [t.cardId]);
3513
3513
  case "dashboard.update":
3514
- return cs(e, t);
3515
- case "dashboard.style":
3516
3514
  return ls(e, t);
3515
+ case "dashboard.style":
3516
+ return ds(e, t);
3517
3517
  case "sheet.add":
3518
- return ys(e, t);
3519
- case "sheet.update":
3520
3518
  return bs(e, t);
3519
+ case "sheet.update":
3520
+ return vs(e, t);
3521
3521
  case "layout.tabs":
3522
- return oe(us(e, t), t.cardIds.slice(0, 1));
3522
+ return oe(fs(e, t), t.cardIds.slice(0, 1));
3523
3523
  case "layout.untab":
3524
- return oe(fs(e, t), [t.cardId]);
3524
+ return oe(ms(e, t), [t.cardId]);
3525
3525
  case "variable.add":
3526
- return Ks(e, t);
3527
- case "variable.update":
3528
3526
  return Ls(e, t);
3529
- case "variable.remove":
3527
+ case "variable.update":
3530
3528
  return Vs(e, t);
3529
+ case "variable.remove":
3530
+ return Bs(e, t);
3531
3531
  case "document.text":
3532
- return cc(e, t);
3532
+ return lc(e, t);
3533
3533
  }
3534
3534
  }
3535
3535
  function oe(e, t) {
3536
3536
  return { ...e, touched: t.filter(Boolean) };
3537
3537
  }
3538
- function mc(e) {
3538
+ function pc(e) {
3539
3539
  const t = [];
3540
3540
  for (const n of e) {
3541
3541
  const r = n.changeIndex === void 0 ? void 0 : t.find((i) => i.changeIndex === n.changeIndex);
@@ -3552,10 +3552,10 @@ function mc(e) {
3552
3552
  }
3553
3553
  return t.map(({ clauses: n, ...r }) => ({
3554
3554
  ...r,
3555
- sentence: Wi(pc(n))
3555
+ sentence: Gi(hc(n))
3556
3556
  }));
3557
3557
  }
3558
- function pc(e) {
3558
+ function hc(e) {
3559
3559
  let t = !1;
3560
3560
  return e.filter((n) => n.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
3561
3561
  }
@@ -3581,14 +3581,14 @@ function fe(e) {
3581
3581
  e.tableName
3582
3582
  ].join(":");
3583
3583
  }
3584
- function hc(e, t) {
3584
+ function gc(e, t) {
3585
3585
  if (e.kind === "semantic")
3586
3586
  return {
3587
3587
  status: "ready",
3588
3588
  request: hn({
3589
3589
  connection_id: e.connectionId,
3590
3590
  domain_id: e.domainId,
3591
- dataset_id: pa(e),
3591
+ dataset_id: ha(e),
3592
3592
  dataset_name: e.datasetName
3593
3593
  })
3594
3594
  };
@@ -3613,14 +3613,14 @@ function hc(e, t) {
3613
3613
  })
3614
3614
  };
3615
3615
  }
3616
- function md(e, t = /* @__PURE__ */ new Map()) {
3616
+ function hd(e, t = /* @__PURE__ */ new Map()) {
3617
3617
  const n = /* @__PURE__ */ new Map();
3618
3618
  for (const { card: r } of e) {
3619
3619
  const i = ut(r), o = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((a) => a.source) : [];
3620
3620
  for (const a of o) {
3621
3621
  const s = fe(a);
3622
3622
  if (!n.has(s)) {
3623
- const c = hc(
3623
+ const c = gc(
3624
3624
  a,
3625
3625
  a.connectionId ? t.get(a.connectionId) : void 0
3626
3626
  );
@@ -3634,7 +3634,7 @@ function md(e, t = /* @__PURE__ */ new Map()) {
3634
3634
  }
3635
3635
  return Array.from(n.values());
3636
3636
  }
3637
- function gc(e, t) {
3637
+ function yc(e, t) {
3638
3638
  if (e.kind !== "semantic" || !e.connectionId) return;
3639
3639
  const n = (t.qualifiedEntityName || "").split(".").map((i) => i.trim()).filter(Boolean), r = n.at(-1);
3640
3640
  if (r)
@@ -3650,36 +3650,36 @@ function Fe(e, t) {
3650
3650
  let n = e.get(t);
3651
3651
  return n || (n = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, n)), n;
3652
3652
  }
3653
- function kr(e, t) {
3653
+ function _r(e, t) {
3654
3654
  e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
3655
3655
  }
3656
3656
  function rt(e, t, n) {
3657
3657
  for (const r of t) {
3658
3658
  const i = r == null ? void 0 : r.trim();
3659
3659
  if (!i) continue;
3660
- const o = Kn(i), a = e.fields.get(o);
3660
+ const o = Ln(i), a = e.fields.get(o);
3661
3661
  a === void 0 ? e.fields.set(o, n) : a !== n && e.fieldConflicts.add(o);
3662
3662
  }
3663
3663
  }
3664
- function _r(e, t) {
3665
- t.sourceLabel && kr(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3664
+ function Mr(e, t) {
3665
+ t.sourceLabel && _r(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3666
3666
  for (const [n, r] of t.fields)
3667
3667
  rt(e, [n], r);
3668
3668
  for (const n of t.fieldConflicts ?? [])
3669
3669
  e.fieldConflicts.add(n);
3670
3670
  }
3671
- function Mr(e) {
3671
+ function Or(e) {
3672
3672
  return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
3673
3673
  }
3674
- function pd(e, t) {
3674
+ function gd(e, t) {
3675
3675
  var r, i;
3676
3676
  const n = /* @__PURE__ */ new Map();
3677
3677
  for (const [o, a] of e) {
3678
3678
  if (a.status !== "ready") continue;
3679
- const s = t == null ? void 0 : t.get(o), c = s ? Mr(s) : void 0;
3679
+ const s = t == null ? void 0 : t.get(o), c = s ? Or(s) : void 0;
3680
3680
  for (const l of a.columns) {
3681
- const d = (r = l.column_name) == null ? void 0 : r.trim(), u = (i = l.label) == null ? void 0 : i.trim(), f = s ? gc(s, l) : void 0;
3682
- f && c && kr(
3681
+ const d = (r = l.column_name) == null ? void 0 : r.trim(), u = (i = l.label) == null ? void 0 : i.trim(), f = s ? yc(s, l) : void 0;
3682
+ f && c && _r(
3683
3683
  Fe(n, fe(f)),
3684
3684
  c
3685
3685
  ), !(!d || !u || u === d) && (rt(
@@ -3695,20 +3695,20 @@ function pd(e, t) {
3695
3695
  }
3696
3696
  return n;
3697
3697
  }
3698
- function hd(...e) {
3698
+ function yd(...e) {
3699
3699
  const t = /* @__PURE__ */ new Map();
3700
3700
  for (const n of e)
3701
3701
  for (const [r, i] of n ?? [])
3702
- _r(Fe(t, r), i);
3702
+ Mr(Fe(t, r), i);
3703
3703
  return t;
3704
3704
  }
3705
3705
  function Dt(e) {
3706
3706
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
3707
3707
  }
3708
- function yc(e) {
3708
+ function bc(e) {
3709
3709
  return e.split(":").slice(2).filter(Boolean).join(".");
3710
3710
  }
3711
- function Or(e, t) {
3711
+ function Ar(e, t) {
3712
3712
  const n = fe(t), r = e.get(n);
3713
3713
  if (t.kind !== "physical") return r;
3714
3714
  const i = `physical:${t.connectionId}:`, o = Dt(t), a = {
@@ -3717,32 +3717,32 @@ function Or(e, t) {
3717
3717
  };
3718
3718
  let s = !1;
3719
3719
  for (const [c, l] of e)
3720
- c.startsWith(i) && (c !== n && !Xa(o, yc(c)) || (_r(a, l), s = !0));
3720
+ c.startsWith(i) && (c !== n && !Za(o, bc(c)) || (Mr(a, l), s = !0));
3721
3721
  return s ? a : void 0;
3722
3722
  }
3723
- function bc(e, t) {
3723
+ function vc(e, t) {
3724
3724
  var i;
3725
3725
  if (!e) return;
3726
- const n = Kn(t.name), r = Or(e, t.source);
3726
+ const n = Ln(t.name), r = Ar(e, t.source);
3727
3727
  return r && !((i = r.fieldConflicts) != null && i.has(n)) ? r.fields.get(n) : void 0;
3728
3728
  }
3729
- function vc(e, t) {
3729
+ function Ic(e, t) {
3730
3730
  if (t.kind === "semantic")
3731
- return Mr(t) || t.datasetId || "Dataset";
3732
- const n = e ? Or(e, t) : void 0;
3731
+ return Or(t) || t.datasetId || "Dataset";
3732
+ const n = e ? Ar(e, t) : void 0;
3733
3733
  return n != null && n.sourceLabel && !n.sourceLabelConflict ? n.sourceLabel : Dt(t);
3734
3734
  }
3735
- function gd(e, t) {
3736
- const n = bc(e, t);
3735
+ function bd(e, t) {
3736
+ const n = vc(e, t);
3737
3737
  return {
3738
3738
  name: t.name,
3739
3739
  ...n ? { label: n } : {},
3740
- entityName: vc(e, t.source),
3740
+ entityName: Ic(e, t.source),
3741
3741
  ...t.source.kind === "physical" ? { qualifiedEntityName: Dt(t.source) } : {},
3742
3742
  dataType: t.dataType
3743
3743
  };
3744
3744
  }
3745
- function Ic(e, t) {
3745
+ function Cc(e, t) {
3746
3746
  var i, o;
3747
3747
  const n = (i = t.column_name) == null ? void 0 : i.trim(), r = me(t.data_type);
3748
3748
  if (!(!n || r === "unknown"))
@@ -3756,7 +3756,7 @@ function Ic(e, t) {
3756
3756
  }
3757
3757
  };
3758
3758
  }
3759
- function yd(e) {
3759
+ function vd(e) {
3760
3760
  const t = {};
3761
3761
  for (const { card: n } of e.cards) {
3762
3762
  const r = ut(n), i = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((s) => s.source) : [];
@@ -3772,7 +3772,7 @@ function yd(e) {
3772
3772
  break;
3773
3773
  }
3774
3774
  for (const l of c.columns) {
3775
- const d = Ic(s, l);
3775
+ const d = Cc(s, l);
3776
3776
  d && o.push(d);
3777
3777
  }
3778
3778
  }
@@ -3780,20 +3780,20 @@ function yd(e) {
3780
3780
  }
3781
3781
  return t;
3782
3782
  }
3783
- function bd(e) {
3784
- const { dashboard: t, target: n, calendar: r } = e, i = $r(n), o = Ar(t, n, r);
3783
+ function Id(e) {
3784
+ const { dashboard: t, target: n, calendar: r } = e, i = Pr(n), o = $r(t, n, r);
3785
3785
  return {
3786
3786
  value: o,
3787
- mode: ai(
3788
- oi(o == null ? void 0 : o.operation) ? o.operation : i.operation
3787
+ mode: oi(
3788
+ si(o == null ? void 0 : o.operation) ? o.operation : i.operation
3789
3789
  )
3790
3790
  };
3791
3791
  }
3792
- function Ar(e, t, n) {
3792
+ function $r(e, t, n) {
3793
3793
  var r;
3794
3794
  switch (t.kind) {
3795
3795
  case "dashboardInput": {
3796
- const i = Hi({
3796
+ const i = Yi({
3797
3797
  dashboard: e,
3798
3798
  input: t.input,
3799
3799
  target: t.scope,
@@ -3805,7 +3805,7 @@ function Ar(e, t, n) {
3805
3805
  const i = (r = e.defaultFilterValues) == null ? void 0 : r.find(
3806
3806
  (o) => o.filterId === t.filter.id
3807
3807
  );
3808
- return i ? Gi({
3808
+ return i ? Hi({
3809
3809
  filterDefinitions: [t.filter],
3810
3810
  filterValues: [i]
3811
3811
  })[0] : ce(t.filter, n);
@@ -3814,16 +3814,16 @@ function Ar(e, t, n) {
3814
3814
  return ce(t.filter, n);
3815
3815
  }
3816
3816
  }
3817
- function $r(e) {
3817
+ function Pr(e) {
3818
3818
  return e.kind === "dashboardInput" ? e.input.filter : e.filter;
3819
3819
  }
3820
- function vd(e) {
3820
+ function Cd(e) {
3821
3821
  var o;
3822
3822
  const { dashboard: t, filter: n, input: r, scope: i } = e;
3823
3823
  return r && (t.inputs || []).some((a) => a.id === r.id) ? { kind: "dashboardInput", input: r, scope: i } : ((o = Z(t).findFilterInput({ filterId: n.id })) == null ? void 0 : o.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
3824
3824
  }
3825
- function Id(e) {
3826
- const { dashboard: t, target: n, calendar: r } = e, i = $r(n), o = Yi(i), a = Cc(t, n);
3825
+ function Fd(e) {
3826
+ const { dashboard: t, target: n, calendar: r } = e, i = Pr(n), o = Qi(i), a = Fc(t, n);
3827
3827
  if (!a) return o;
3828
3828
  if (a === "cleared")
3829
3829
  return {
@@ -3831,13 +3831,13 @@ function Id(e) {
3831
3831
  defaultValues: void 0,
3832
3832
  defaultDateFilter: void 0
3833
3833
  };
3834
- const s = Ar(t, n, r);
3835
- if (!s || Fc(s, ce(i, r)))
3834
+ const s = $r(t, n, r);
3835
+ if (!s || Sc(s, ce(i, r)))
3836
3836
  return o;
3837
3837
  if (s.valueType === "date") {
3838
3838
  const c = Ye(
3839
3839
  "relativeMeta" in s ? s.relativeMeta : void 0
3840
- ) ?? Sc(i, s, r);
3840
+ ) ?? wc(i, s, r);
3841
3841
  return c ? {
3842
3842
  operation: s.operation,
3843
3843
  defaultValues: i.defaultValues,
@@ -3850,7 +3850,7 @@ function Id(e) {
3850
3850
  defaultDateFilter: i.defaultDateFilter
3851
3851
  };
3852
3852
  }
3853
- function Cc(e, t) {
3853
+ function Fc(e, t) {
3854
3854
  var n;
3855
3855
  if (t.kind === "dashboardInput") {
3856
3856
  const r = pt(
@@ -3865,7 +3865,7 @@ function Cc(e, t) {
3865
3865
  (r) => r.filterId === t.filter.id
3866
3866
  ) ? "set" : void 0;
3867
3867
  }
3868
- function Fc(e, t) {
3868
+ function Sc(e, t) {
3869
3869
  return !!(t && e.operation === t.operation && He(gn(e), gn(t)) && He(
3870
3870
  "relativeMeta" in e ? e.relativeMeta : void 0,
3871
3871
  "relativeMeta" in t ? t.relativeMeta : void 0
@@ -3876,8 +3876,8 @@ function gn(e) {
3876
3876
  (t) => t instanceof Date ? t.getTime() : t
3877
3877
  );
3878
3878
  }
3879
- function Sc(e, t, n) {
3880
- const r = Qi(n == null ? void 0 : n.tz), i = Ke(t.values[0], r);
3879
+ function wc(e, t, n) {
3880
+ const r = Xi(n == null ? void 0 : n.tz), i = Ke(t.values[0], r);
3881
3881
  if (!i) return;
3882
3882
  const [o, a, s] = new Intl.DateTimeFormat("en-CA", {
3883
3883
  timeZone: r,
@@ -3914,13 +3914,13 @@ function Sc(e, t, n) {
3914
3914
  });
3915
3915
  }
3916
3916
  function yn(e) {
3917
- return Za(void 0, e ?? "");
3917
+ return eo(void 0, e ?? "");
3918
3918
  }
3919
- const wc = {
3919
+ const xc = {
3920
3920
  type: "temporal_bucket",
3921
3921
  presentation: { mode: "pattern", pattern: "YYYY-MM-DD" }
3922
3922
  };
3923
- function xc(e) {
3923
+ function Tc(e) {
3924
3924
  const t = me(e.dataType);
3925
3925
  if (!["date", "datetime"].includes(t))
3926
3926
  return e;
@@ -3933,20 +3933,20 @@ function xc(e) {
3933
3933
  });
3934
3934
  if (!r.ok)
3935
3935
  return e;
3936
- const i = n ? r.selection.format : wc;
3936
+ const i = n ? r.selection.format : xc;
3937
3937
  return {
3938
3938
  ...e,
3939
3939
  granularity: r.granularity,
3940
3940
  format: i
3941
3941
  };
3942
3942
  }
3943
- function Cd(e, t) {
3943
+ function Sd(e, t) {
3944
3944
  var r, i;
3945
3945
  const n = ((i = (r = globalThis.crypto) == null ? void 0 : r.randomUUID) == null ? void 0 : i.call(r).slice(0, 8)) ?? Math.random().toString(36).slice(2, 10);
3946
3946
  return `${e}-${t.qualifiedEntityName}-${t.name}-${Date.now()}-${n}`;
3947
3947
  }
3948
- function Tc(e, t) {
3949
- const n = Nn(e.replace(/_/g, " "));
3948
+ function Dc(e, t) {
3949
+ const n = En(e.replace(/_/g, " "));
3950
3950
  switch (t) {
3951
3951
  case "SUM":
3952
3952
  return `Sum of ${n}`;
@@ -3964,15 +3964,15 @@ function Tc(e, t) {
3964
3964
  return n;
3965
3965
  }
3966
3966
  }
3967
- function Fd(e, t, n) {
3967
+ function wd(e, t, n) {
3968
3968
  var i;
3969
- const r = En(e.dataType);
3969
+ const r = Rn(e.dataType);
3970
3970
  return n === "detailTable" ? "detailColumns" : n === "matrixTable" ? ((i = e.derivedField) == null ? void 0 : i.computeStage) === "aggregate" || me(e.dataType) === "number" ? "metrics" : "groupBy" : n === "kpi" ? r === "date" ? "groupBy" : "metrics" : t.length === 0 || r === "number" ? "metrics" : r === "date" || r === "string" || r === "boolean" ? "groupBy" : "metrics";
3971
3971
  }
3972
- function Sd(e, t, n, r) {
3973
- const i = En(e.dataType), o = i === "date";
3974
- e = ha(e);
3975
- const a = ga(e), s = a.representation !== "physical", c = a.computeStage, l = s ? e.fieldScope === "domain" ? e.calculatedFieldOrigin : e.calculatedFieldOrigin || {
3972
+ function xd(e, t, n, r) {
3973
+ const i = Rn(e.dataType), o = i === "date";
3974
+ e = ga(e);
3975
+ const a = ya(e), s = a.representation !== "physical", c = a.computeStage, l = s ? e.fieldScope === "domain" ? e.calculatedFieldOrigin : e.calculatedFieldOrigin || {
3976
3976
  id: e.id,
3977
3977
  role: e.role
3978
3978
  } : void 0;
@@ -4022,7 +4022,7 @@ function Sd(e, t, n, r) {
4022
4022
  const g = e, I = {
4023
4023
  ...m,
4024
4024
  role: "metric",
4025
- ...sr(g, g, "selection"),
4025
+ ...cr(g, g, "selection"),
4026
4026
  parameters: g.parameters,
4027
4027
  aliasTemplate: g.aliasTemplate,
4028
4028
  valueAliases: g.valueAliases,
@@ -4048,10 +4048,10 @@ function Sd(e, t, n, r) {
4048
4048
  role: "metric"
4049
4049
  };
4050
4050
  }
4051
- const p = e.aggregate || yn(i), y = Tc(
4051
+ const p = e.aggregate || yn(i), y = Dc(
4052
4052
  e.label,
4053
4053
  p
4054
- ), h = Zi(
4054
+ ), h = ea(
4055
4055
  { ...m, label: y },
4056
4056
  n,
4057
4057
  t
@@ -4067,7 +4067,7 @@ function Sd(e, t, n, r) {
4067
4067
  if (t === "groupBy") {
4068
4068
  if (u) {
4069
4069
  const p = e;
4070
- return xc({
4070
+ return Tc({
4071
4071
  ...m,
4072
4072
  label: e.label || e.name,
4073
4073
  role: "groupby",
@@ -4078,7 +4078,7 @@ function Sd(e, t, n, r) {
4078
4078
  ...m,
4079
4079
  role: "groupby",
4080
4080
  ...o && {
4081
- granularity: Jt(e.granularity) ? e.granularity : "month",
4081
+ granularity: Xt(e.granularity) ? e.granularity : "month",
4082
4082
  // A new shelf placement does not author a presentation override.
4083
4083
  // Same-grain semantic presentation may therefore win; otherwise the
4084
4084
  // viewer's resolved automatic locale/style policy applies.
@@ -4092,13 +4092,13 @@ function Sd(e, t, n, r) {
4092
4092
  ...m,
4093
4093
  role: "pivotby",
4094
4094
  ...o && {
4095
- granularity: Jt(e.granularity) ? e.granularity : "month",
4095
+ granularity: Xt(e.granularity) ? e.granularity : "month",
4096
4096
  format: void 0,
4097
4097
  formatOrigin: void 0
4098
4098
  }
4099
4099
  };
4100
4100
  if (t === "detailColumns") {
4101
- const p = ea(m, "detail");
4101
+ const p = ta(m, "detail");
4102
4102
  if (d) {
4103
4103
  const y = e;
4104
4104
  return {
@@ -4127,14 +4127,14 @@ function Sd(e, t, n, r) {
4127
4127
  direction: "asc"
4128
4128
  } : null;
4129
4129
  }
4130
- function wd(e) {
4131
- return Object.values(Xi(e)).some((t) => t.length > 0);
4130
+ function Td(e) {
4131
+ return Object.values(Zi(e)).some((t) => t.length > 0);
4132
4132
  }
4133
- function Dc(e) {
4133
+ function kc(e) {
4134
4134
  const t = te(e.format);
4135
4135
  if ((t == null ? void 0 : t.type) === "temporal_bucket") {
4136
4136
  if (!e.granularity) return {};
4137
- const n = Aa(
4137
+ const n = $a(
4138
4138
  t,
4139
4139
  e.granularity
4140
4140
  );
@@ -4151,22 +4151,22 @@ function Dc(e) {
4151
4151
  ...t ? { format: t } : {}
4152
4152
  };
4153
4153
  }
4154
- function kc(e, t) {
4154
+ function _c(e, t) {
4155
4155
  var i, o;
4156
4156
  const n = ((i = e.nativeDataType) == null ? void 0 : i.trim()) || ((o = e.native_data_type) == null ? void 0 : o.trim());
4157
4157
  return n || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
4158
4158
  }
4159
- function Pr(e) {
4159
+ function Nr(e) {
4160
4160
  const t = (e.label ?? "").trim();
4161
4161
  return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
4162
4162
  }
4163
4163
  function kt(e) {
4164
- return Pr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4164
+ return Nr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4165
4165
  }
4166
4166
  function bn(e) {
4167
4167
  return kt(e).toLowerCase().trim();
4168
4168
  }
4169
- function _c(e, t) {
4169
+ function Mc(e, t) {
4170
4170
  return bn(e).localeCompare(bn(t), void 0, {
4171
4171
  numeric: !0,
4172
4172
  sensitivity: "base"
@@ -4175,7 +4175,7 @@ function _c(e, t) {
4175
4175
  function de(e) {
4176
4176
  return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
4177
4177
  }
4178
- function xd(e, t) {
4178
+ function Dd(e, t) {
4179
4179
  const n = de(t);
4180
4180
  return n ? [
4181
4181
  kt(e),
@@ -4196,10 +4196,10 @@ function vn(e, t) {
4196
4196
  const r = de(kt(e));
4197
4197
  return r.startsWith(n) ? 0 : r.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(de).some((o) => o.includes(n)) ? 2 : 3;
4198
4198
  }
4199
- function Td(e, t, n) {
4200
- return vn(e, n) - vn(t, n) || _c(e, t);
4199
+ function kd(e, t, n) {
4200
+ return vn(e, n) - vn(t, n) || Mc(e, t);
4201
4201
  }
4202
- function Mc(e, t) {
4202
+ function Oc(e, t) {
4203
4203
  var o;
4204
4204
  const n = e.type === "dataset" ? (o = t.find((a) => a.entityName)) == null ? void 0 : o.entityName : void 0, r = n || e.name, i = Gt(
4205
4205
  e.type === "dataset" && n ? { ...e, name: n } : e
@@ -4213,12 +4213,12 @@ function Mc(e, t) {
4213
4213
  qualifiedEntityName: i,
4214
4214
  columns: t.map((a) => {
4215
4215
  var m;
4216
- const s = e.type === "dataset" ? a.entityName || r : e.name, c = a.qualifiedEntityName || (e.type === "dataset" && s ? Gt({ ...e, name: s }) : i), l = kc(
4216
+ const s = e.type === "dataset" ? a.entityName || r : e.name, c = a.qualifiedEntityName || (e.type === "dataset" && s ? Gt({ ...e, name: s }) : i), l = _c(
4217
4217
  a,
4218
4218
  e.type === "dataset" ? "semantic" : "physical"
4219
4219
  ), d = (m = a.label) != null && m.trim() ? a.label : void 0, u = d ? void 0 : ft(a.column_name);
4220
4220
  return {
4221
- id: ta(s, a.column_name),
4221
+ id: na(s, a.column_name),
4222
4222
  name: a.column_name,
4223
4223
  qualifiedFieldName: a.qualifiedFieldName || a.column_name,
4224
4224
  dataType: a.data_type,
@@ -4242,23 +4242,23 @@ function Mc(e, t) {
4242
4242
  aggregateOrigin: a.aggregateOrigin,
4243
4243
  labelOrigin: a.labelOrigin,
4244
4244
  formatOrigin: a.formatOrigin,
4245
- ...Dc(a),
4245
+ ...kc(a),
4246
4246
  aggregate: a.aggregate
4247
4247
  };
4248
4248
  })
4249
4249
  };
4250
4250
  }
4251
- function Oc(e) {
4251
+ function Ac(e) {
4252
4252
  return e.map((t) => ({
4253
4253
  ...t,
4254
- id: Rn({ ...t }),
4254
+ id: Kn({ ...t }),
4255
4255
  fieldScope: "domain"
4256
4256
  }));
4257
4257
  }
4258
- function Ac(e) {
4258
+ function $c(e) {
4259
4259
  return e.flatMap(
4260
4260
  (t) => t.columns.map((n) => {
4261
- const r = Pr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? Nn(n.name), o = r ?? i ?? n.name;
4261
+ const r = Nr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? En(n.name), o = r ?? i ?? n.name;
4262
4262
  return {
4263
4263
  ...n,
4264
4264
  id: n.id || `${t.entityId}-${n.name}`,
@@ -4276,18 +4276,18 @@ function Ac(e) {
4276
4276
  })
4277
4277
  );
4278
4278
  }
4279
- function Dd(e) {
4280
- const t = e.map((r) => Mc(r.target, r.columns || [])).filter((r) => {
4279
+ function _d(e) {
4280
+ const t = e.map((r) => Oc(r.target, r.columns || [])).filter((r) => {
4281
4281
  var i;
4282
4282
  return ((i = r == null ? void 0 : r.columns) == null ? void 0 : i.length) > 0;
4283
- }), n = Oc(e.flatMap((r) => r.calculatedFields || []));
4283
+ }), n = Ac(e.flatMap((r) => r.calculatedFields || []));
4284
4284
  if (n.length > 0) {
4285
4285
  const r = /* @__PURE__ */ new Map();
4286
4286
  n.forEach((i) => {
4287
- const o = Rn(i);
4287
+ const o = Kn(i);
4288
4288
  r.has(o) || r.set(o, i);
4289
4289
  }), t.unshift({
4290
- entityId: na,
4290
+ entityId: ra,
4291
4291
  entityType: "dataset",
4292
4292
  entityName: Ht,
4293
4293
  label: "Calculated Fields",
@@ -4296,9 +4296,9 @@ function Dd(e) {
4296
4296
  columns: Array.from(r.values())
4297
4297
  });
4298
4298
  }
4299
- return { columnGroups: t, columns: Ac(t) };
4299
+ return { columnGroups: t, columns: $c(t) };
4300
4300
  }
4301
- function $c(e, t) {
4301
+ function Pc(e, t) {
4302
4302
  var i;
4303
4303
  const n = (i = t.columnKeyMap) == null ? void 0 : i.byRole;
4304
4304
  if (!n) return;
@@ -4309,7 +4309,7 @@ function $c(e, t) {
4309
4309
  if (r.length === 1)
4310
4310
  return r[0].outputKey ?? r[0].rawKey;
4311
4311
  }
4312
- function Pc(e, t) {
4312
+ function Nc(e, t) {
4313
4313
  var r;
4314
4314
  const n = (r = t.resultColumns) == null ? void 0 : r.find((i) => {
4315
4315
  const o = i.pivotIdentity;
@@ -4323,9 +4323,9 @@ function In(e, t) {
4323
4323
  var n;
4324
4324
  switch (e.kind) {
4325
4325
  case "field":
4326
- return $c(e.fieldId, t);
4326
+ return Pc(e.fieldId, t);
4327
4327
  case "pivot":
4328
- return Pc(e, t);
4328
+ return Nc(e, t);
4329
4329
  case "result":
4330
4330
  return !t.keys || t.keys.includes(e.key) ? e.key : void 0;
4331
4331
  case "sqlKpiValue":
@@ -4336,7 +4336,7 @@ function In(e, t) {
4336
4336
  return;
4337
4337
  }
4338
4338
  }
4339
- function kd(e, t) {
4339
+ function Md(e, t) {
4340
4340
  return e.flatMap((n) => {
4341
4341
  var s, c;
4342
4342
  const r = In(n.condition.column, t);
@@ -4356,9 +4356,9 @@ function kd(e, t) {
4356
4356
  ];
4357
4357
  });
4358
4358
  }
4359
- function _d(e, t, n) {
4359
+ function Od(e, t, n) {
4360
4360
  var a, s, c, l, d;
4361
- const r = ra(e);
4361
+ const r = ia(e);
4362
4362
  if (r.includes("matrixMeasure"))
4363
4363
  return (s = (a = e.config) == null ? void 0 : a.matrix) != null && s.spec.measures.some((u) => u.id === t) ? { kind: "matrixMeasure", measureId: t } : void 0;
4364
4364
  if (r.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
@@ -4379,7 +4379,7 @@ function _d(e, t, n) {
4379
4379
  );
4380
4380
  return o.length === 1 ? { kind: "field", fieldId: o[0] } : void 0;
4381
4381
  }
4382
- function Md(e, t) {
4382
+ function Ad(e, t) {
4383
4383
  var c;
4384
4384
  if (!e) return;
4385
4385
  const n = e.windows.map((l) => ({
@@ -4393,7 +4393,7 @@ function Md(e, t) {
4393
4393
  // A window's name holds only when it alone is the period (not cut by
4394
4394
  // another window, nor truncated to date by the comparison).
4395
4395
  ...r.length === 1 && !((c = e.conditions) != null && c.length) && r[0].relative && r[0].window && it(r[0].window, e.counted.window) ? { relative: r[0].relative } : {}
4396
- } : { kind: "all_time" } : { kind: "no_date" }, o = Nc(r), a = t == null ? void 0 : t.output, s = t && t.type !== "target" ? t.type : void 0;
4396
+ } : { kind: "all_time" } : { kind: "no_date" }, o = Ec(r), a = t == null ? void 0 : t.output, s = t && t.type !== "target" ? t.type : void 0;
4397
4397
  return {
4398
4398
  ...e.field ? { field: e.field } : {},
4399
4399
  windows: n,
@@ -4405,25 +4405,25 @@ function Md(e, t) {
4405
4405
  ...o ? { overlap: o } : {}
4406
4406
  };
4407
4407
  }
4408
- function Nc(e) {
4408
+ function Ec(e) {
4409
4409
  const t = e.filter((o) => o.source !== "card").flatMap((o) => o.window ? [o.window] : []), n = e.filter((o) => o.source === "card").flatMap((o) => o.window ? [o.window] : []);
4410
4410
  if (t.length && n.length) {
4411
- const o = ze(t), a = ze([...t, ...n]);
4411
+ const o = je(t), a = je([...t, ...n]);
4412
4412
  return o && a && it(o, a) ? void 0 : "dashboard_and_card";
4413
4413
  }
4414
4414
  const r = t.length ? t : n;
4415
4415
  if (r.length < 2) return;
4416
- const i = ze(r);
4416
+ const i = je(r);
4417
4417
  return i && r.some((o) => it(o, i)) ? void 0 : t.length ? "dashboard" : "card";
4418
4418
  }
4419
- function ze(e) {
4419
+ function je(e) {
4420
4420
  const t = Math.max(...e.map((r) => Date.parse(r.startInclusive))), n = Math.min(...e.map((r) => Date.parse(r.endExclusive)));
4421
4421
  return t < n ? { startInclusive: new Date(t).toISOString(), endExclusive: new Date(n).toISOString(), timezone: e[0].timezone } : void 0;
4422
4422
  }
4423
4423
  function it(e, t) {
4424
4424
  return Date.parse(e.startInclusive) === Date.parse(t.startInclusive) && Date.parse(e.endExclusive) === Date.parse(t.endExclusive);
4425
4425
  }
4426
- const Ec = {
4426
+ const Rc = {
4427
4427
  trend_by: "From Trend By",
4428
4428
  comparison_date: "From the comparison's date",
4429
4429
  primary_date: "From the dataset's primary date",
@@ -4447,33 +4447,33 @@ function ie(e, t = /* @__PURE__ */ new Date()) {
4447
4447
  }
4448
4448
  }
4449
4449
  const Cn = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
4450
- function Rc(e, t) {
4450
+ function Kc(e, t) {
4451
4451
  try {
4452
- return $a({
4452
+ return Pa({
4453
4453
  value: e,
4454
4454
  metadata: t,
4455
- format: { type: "temporal_bucket", locale: "en-US", presentation: { mode: "auto", styles: Pa } }
4455
+ format: { type: "temporal_bucket", locale: "en-US", presentation: { mode: "auto", styles: Na } }
4456
4456
  });
4457
4457
  } catch {
4458
4458
  return;
4459
4459
  }
4460
4460
  }
4461
- function Nr(e, t, n) {
4461
+ function Er(e, t, n) {
4462
4462
  if (!t || typeof e != "string") return;
4463
- const r = Vn(e, t);
4463
+ const r = Bn(e, t);
4464
4464
  if (!(!r.ok || !r.value))
4465
4465
  return String(r.value.year) === M(n, t.calendar.tz || "UTC", "yyyy") ? void 0 : r.value.year;
4466
4466
  }
4467
- function Kc(e, t, n) {
4467
+ function Lc(e, t, n) {
4468
4468
  if (e === null) return "(Blank)";
4469
4469
  if (t && typeof e == "string") {
4470
- const r = Vn(e, t);
4470
+ const r = Bn(e, t);
4471
4471
  if (r.ok && r.value) {
4472
- const { year: i, month: o, day: a, hour: s } = r.value, c = `${Cn[o - 1]} ${a}${Nr(e, t, n) ? `, ${i}` : ""}`;
4472
+ const { year: i, month: o, day: a, hour: s } = r.value, c = `${Cn[o - 1]} ${a}${Er(e, t, n) ? `, ${i}` : ""}`;
4473
4473
  switch (t.granularity) {
4474
4474
  case "year":
4475
4475
  case "quarter":
4476
- return Rc(e, t) ?? String(i);
4476
+ return Kc(e, t) ?? String(i);
4477
4477
  case "month":
4478
4478
  return `${Cn[o - 1]} ${i}`;
4479
4479
  case "week":
@@ -4487,41 +4487,41 @@ function Kc(e, t, n) {
4487
4487
  }
4488
4488
  return String(e);
4489
4489
  }
4490
- function Er(e, t, n) {
4491
- const r = e.label && !Nr(e.value, t, n) ? e.label : Kc(e.value, t, n);
4490
+ function Rr(e, t, n) {
4491
+ const r = e.label && !Er(e.value, t, n) ? e.label : Lc(e.value, t, n);
4492
4492
  return e.counted ? e.counted.status === "empty" ? `${r} (no days in the period)` : `${r} (${ie(e.counted.window, n)})` : r;
4493
4493
  }
4494
- function Rr(e, t) {
4495
- return e.values.map((n) => Er(n, e.temporalBucket, t)).join(", ");
4494
+ function Kr(e, t) {
4495
+ return e.values.map((n) => Rr(n, e.temporalBucket, t)).join(", ");
4496
4496
  }
4497
- function Lc(e, t) {
4498
- return e.map((n) => Rr(n, t)).join(" and ");
4497
+ function Vc(e, t) {
4498
+ return e.map((n) => Kr(n, t)).join(" and ");
4499
4499
  }
4500
- function Kr(e, t) {
4500
+ function Lr(e, t) {
4501
4501
  if (!(!e.length || e.some((n) => {
4502
4502
  var r;
4503
4503
  return !((r = n.compared) != null && r.length);
4504
4504
  })))
4505
- return e.map((n) => n.compared.map((r) => Er(r, n.temporalBucket, t)).join(", ")).join(" and ");
4505
+ return e.map((n) => n.compared.map((r) => Rr(r, n.temporalBucket, t)).join(", ")).join(" and ");
4506
4506
  }
4507
- function Vc(e, t) {
4508
- return e.relative ? Ln(e.relative).label : e.window ? ie(e.window, t) : "A date range";
4507
+ function Bc(e, t) {
4508
+ return e.relative ? Vn(e.relative).label : e.window ? ie(e.window, t) : "A date range";
4509
4509
  }
4510
- const Bc = {
4510
+ const qc = {
4511
4511
  dashboard_filter: "Dashboard · Date filter",
4512
4512
  governing_date: "Dashboard · governing date, replaces the card",
4513
4513
  card: "This card"
4514
- }, qc = {
4514
+ }, Uc = {
4515
4515
  dashboard_filter: "Dashboard · Date filter",
4516
4516
  governing_date: "Dashboard · governing date",
4517
4517
  card: "This card"
4518
4518
  };
4519
- function Uc(e) {
4519
+ function zc(e) {
4520
4520
  return e === "previous_year" ? "Previous year" : "Previous period";
4521
4521
  }
4522
- function Lr(e) {
4522
+ function Vr(e) {
4523
4523
  if (!e.comparisonOff) return;
4524
- const t = Uc(e.comparisonOff.kind), n = `No ${t.toLowerCase()}`;
4524
+ const t = zc(e.comparisonOff.kind), n = `No ${t.toLowerCase()}`;
4525
4525
  if (e.counted.kind === "no_date")
4526
4526
  return {
4527
4527
  note: "This dataset has no primary date. Drop a date on Trend By to count by date and compare periods.",
@@ -4552,10 +4552,10 @@ const jc = {
4552
4552
  dashboard: "Two dashboard date filters both apply: the number counts only where they overlap.",
4553
4553
  card: "This card's own date windows both apply: it counts only where they overlap."
4554
4554
  };
4555
- function Vr(e, t) {
4555
+ function Br(e, t) {
4556
4556
  var r, i;
4557
4557
  const n = ((r = e.field) == null ? void 0 : r.name) ?? "";
4558
- return eo(
4558
+ return to(
4559
4559
  {
4560
4560
  name: n,
4561
4561
  operation: t.operation,
@@ -4569,19 +4569,19 @@ function Vr(e, t) {
4569
4569
  }
4570
4570
  );
4571
4571
  }
4572
- function zc(e) {
4573
- return e.conditions.filter((t) => !t.conditional).map((t) => Vr(e, t)).join(" and ");
4572
+ function Wc(e) {
4573
+ return e.conditions.filter((t) => !t.conditional).map((t) => Br(e, t)).join(" and ");
4574
4574
  }
4575
- const Wc = "narrowed by a condition group on this card";
4576
- function Br(e, t, n) {
4577
- const r = e.selections.length ? Lc(e.selections, t) : e.counted.kind === "window" ? n && e.overlap ? `${ie(e.counted.window, t)}, where they overlap` : ie(e.counted.window, t) : e.counted.kind === "empty" ? "No days: the windows share none" : e.counted.kind === "no_date" ? "All rows" : "", i = zc(e), o = e.conditions.some((s) => s.conditional) ? Wc : "", a = [[r, i].filter(Boolean).join(", and "), o].filter(Boolean).join(", ");
4575
+ const Gc = "narrowed by a condition group on this card";
4576
+ function qr(e, t, n) {
4577
+ const r = e.selections.length ? Vc(e.selections, t) : e.counted.kind === "window" ? n && e.overlap ? `${ie(e.counted.window, t)}, where they overlap` : ie(e.counted.window, t) : e.counted.kind === "empty" ? "No days: the windows share none" : e.counted.kind === "no_date" ? "All rows" : "", i = Wc(e), o = e.conditions.some((s) => s.conditional) ? Gc : "", a = [[r, i].filter(Boolean).join(", and "), o].filter(Boolean).join(", ");
4578
4578
  return a ? a.charAt(0).toUpperCase() + a.slice(1) : "All time";
4579
4579
  }
4580
- function Od(e, t = {}) {
4580
+ function $d(e, t = {}) {
4581
4581
  var c, l, d;
4582
4582
  const n = t.now ?? /* @__PURE__ */ new Date(), r = e.windows.map((u) => ({
4583
- text: Vc(u, n),
4584
- from: u.applied ? Bc[u.source] : `${qc[u.source]} · not applied`,
4583
+ text: Bc(u, n),
4584
+ from: u.applied ? qc[u.source] : `${Uc[u.source]} · not applied`,
4585
4585
  applied: u.applied
4586
4586
  }));
4587
4587
  for (const u of e.conditions)
@@ -4591,7 +4591,7 @@ function Od(e, t = {}) {
4591
4591
  from: "This card · see the card's filters",
4592
4592
  applied: !0
4593
4593
  } : {
4594
- text: Vr(e, u),
4594
+ text: Br(e, u),
4595
4595
  from: u.source === "dashboard" ? "Dashboard · Date filter" : "This card",
4596
4596
  applied: !0
4597
4597
  }
@@ -4599,36 +4599,36 @@ function Od(e, t = {}) {
4599
4599
  for (const u of e.selections) {
4600
4600
  const f = (d = t.cardTitle) == null ? void 0 : d.call(t, u.sourceCardId);
4601
4601
  r.push({
4602
- text: Rr(u, n),
4602
+ text: Kr(u, n),
4603
4603
  from: f ? `Clicked on ${f}` : "Clicked on another card",
4604
4604
  applied: !0
4605
4605
  });
4606
4606
  }
4607
- const i = Br(e, n, !0), o = e.compared ? Kr(e.selections, n) ?? ie(e.compared.window, n) : void 0, a = Lr(e), s = e.overlap ? { tone: "warn", text: jc[e.overlap] } : a ? { tone: "muted", text: a.note } : void 0;
4607
+ const i = qr(e, n, !0), o = e.compared ? Lr(e.selections, n) ?? ie(e.compared.window, n) : void 0, a = Vr(e), s = e.overlap ? { tone: "warn", text: jc[e.overlap] } : a ? { tone: "muted", text: a.note } : void 0;
4608
4608
  return {
4609
- ...e.field ? { field: { name: e.field.label || e.field.name, from: Ec[e.field.source] } } : {},
4609
+ ...e.field ? { field: { name: e.field.label || e.field.name, from: Rc[e.field.source] } } : {},
4610
4610
  windows: r,
4611
4611
  counts: i,
4612
4612
  ...o ? { compared: o } : {},
4613
4613
  ...s ? { note: s } : {}
4614
4614
  };
4615
4615
  }
4616
- function Ad(e, t = {}) {
4616
+ function Pd(e, t = {}) {
4617
4617
  var a;
4618
4618
  const n = t.now ?? /* @__PURE__ */ new Date(), r = e.counted.kind === "no_date" && !e.selections.length ? void 0 : {
4619
- text: !e.selections.length && e.counted.kind === "window" && e.counted.relative ? `${Ln(e.counted.relative).label} · ${ie(e.counted.window, n)}` : Br(e, n, !1),
4619
+ text: !e.selections.length && e.counted.kind === "window" && e.counted.relative ? `${Vn(e.counted.relative).label} · ${ie(e.counted.window, n)}` : qr(e, n, !1),
4620
4620
  clicked: e.selections.length > 0
4621
- }, i = e.compared ? Kr(e.selections, n) ?? ie(e.compared.window, n) : void 0, o = (a = Lr(e)) == null ? void 0 : a.tile;
4621
+ }, i = e.compared ? Lr(e.selections, n) ?? ie(e.compared.window, n) : void 0, o = (a = Vr(e)) == null ? void 0 : a.tile;
4622
4622
  return {
4623
4623
  ...r ? { period: r } : {},
4624
4624
  ...i ? { compared: i } : {},
4625
4625
  ...o ? { off: o } : {}
4626
4626
  };
4627
4627
  }
4628
- function $d(e) {
4628
+ function Nd(e) {
4629
4629
  return e != null && e.field ? `Drop a date to trend by · counts on ${e.field.label || e.field.name} now` : void 0;
4630
4630
  }
4631
- const Gc = /* @__PURE__ */ new Set(["count", "sum", "avg", "min", "max", "median"]), Q = { kind: "unlistable", reason: "measure_not_listable" };
4631
+ const Hc = /* @__PURE__ */ new Set(["count", "sum", "avg", "min", "max", "median"]), Q = { kind: "unlistable", reason: "measure_not_listable" };
4632
4632
  function at(e) {
4633
4633
  const {
4634
4634
  aggregate: t,
@@ -4640,19 +4640,19 @@ function at(e) {
4640
4640
  } = e;
4641
4641
  return { ...a, role: "detail" };
4642
4642
  }
4643
- function Hc(e, t) {
4643
+ function Yc(e, t) {
4644
4644
  const n = t.trim();
4645
4645
  if (!n.startsWith("{") || !n.endsWith("}")) return;
4646
4646
  const r = n.slice(1, -1);
4647
4647
  return r.includes("{") || r.includes("}") ? void 0 : _t(e, r);
4648
4648
  }
4649
- function Yc(e, t, n) {
4649
+ function Qc(e, t, n) {
4650
4650
  if (!e.expression) return t.length === 1 ? at(t[0]) : void 0;
4651
4651
  if (!n) return;
4652
- const r = Hc(e, n);
4653
- return r ? at(r) : Qc(e, n);
4652
+ const r = Yc(e, n);
4653
+ return r ? at(r) : Xc(e, n);
4654
4654
  }
4655
- function Qc(e, t) {
4655
+ function Xc(e, t) {
4656
4656
  return {
4657
4657
  ...at(e),
4658
4658
  id: `${e.id}:row`,
@@ -4660,16 +4660,16 @@ function Qc(e, t) {
4660
4660
  calculatedFormula: { ...e.calculatedFormula, computeStage: "row" }
4661
4661
  };
4662
4662
  }
4663
- function qr(e) {
4663
+ function Ur(e) {
4664
4664
  return e.role === "metric" || !!e.aggregate;
4665
4665
  }
4666
- function Ur(e) {
4666
+ function zr(e) {
4667
4667
  var t;
4668
4668
  return ((t = e.calculatedFormula) == null ? void 0 : t.inputFields) ?? [];
4669
4669
  }
4670
4670
  function _t(e, t) {
4671
4671
  if (t.startsWith("field_"))
4672
- return Ur(e)[Number(t.slice(6))];
4672
+ return zr(e)[Number(t.slice(6))];
4673
4673
  }
4674
4674
  function Fn(e, t) {
4675
4675
  const n = [];
@@ -4690,15 +4690,15 @@ function Jc(e, t) {
4690
4690
  }
4691
4691
  if (n.calls.length === 1) {
4692
4692
  if (n.nestedAggregate || !n.aggregateInputsComplete) return "unknown";
4693
- const [i] = n.calls, o = ba(e.expression, i);
4693
+ const [i] = n.calls, o = va(e.expression, i);
4694
4694
  if (o === void 0) return "unknown";
4695
4695
  const a = Fn(e, i.tokens);
4696
4696
  return a === "unknown" ? a : { fields: a, rowExpression: o };
4697
4697
  }
4698
- const r = n.tokensOutsideAggregates.map((i) => _t(e, i)).filter((i) => !!(i && qr(i)));
4698
+ const r = n.tokensOutsideAggregates.map((i) => _t(e, i)).filter((i) => !!(i && Ur(i)));
4699
4699
  return n.calls.length === 0 && r.length === 1 ? { delegate: r[0] } : "unknown";
4700
4700
  }
4701
- function Xc(e, t) {
4701
+ function Zc(e, t) {
4702
4702
  return !e.expression || t === "row" ? !0 : yt(e.expression).skeleton.trim() === "@0";
4703
4703
  }
4704
4704
  function Sn(e) {
@@ -4710,12 +4710,12 @@ function ot(e) {
4710
4710
  var s;
4711
4711
  if ((s = e.parameters) != null && s.windowTransform)
4712
4712
  return { kind: "unlistable", reason: "table_calculation" };
4713
- const t = ya(e);
4713
+ const t = ba(e);
4714
4714
  if (t.windowed || t.unresolved || t.calls.length === 0)
4715
4715
  return Q;
4716
4716
  if (t.calls.length > 1) {
4717
4717
  if (Sn(e)) return Q;
4718
- const c = Ur(e).filter(qr);
4718
+ const c = zr(e).filter(Ur);
4719
4719
  return c.length > 0 ? { kind: "calculation", inputs: c } : Q;
4720
4720
  }
4721
4721
  const [n] = t.calls, r = Jc(e, t.stage);
@@ -4725,13 +4725,13 @@ function ot(e) {
4725
4725
  const c = ot(r.delegate);
4726
4726
  return "valueIsTheAggregate" in c ? { ...c, valueIsTheAggregate: !1 } : c;
4727
4727
  }
4728
- const { fields: i } = r, o = Xc(e, t.stage);
4728
+ const { fields: i } = r, o = Zc(e, t.stage);
4729
4729
  if (n.kind === "count" && i.length === 0) return { kind: "rowCount", valueIsTheAggregate: o };
4730
4730
  if (i.length === 0) return Q;
4731
- const a = Yc(e, i, r.rowExpression);
4732
- return a ? n.kind === "count_distinct" ? { kind: "distinct", rowField: a, valueIsTheAggregate: o } : Gc.has(n.kind) ? { kind: "rows", aggregate: n.kind, rowField: a, valueIsTheAggregate: o } : Q : Q;
4731
+ const a = Qc(e, i, r.rowExpression);
4732
+ return a ? n.kind === "count_distinct" ? { kind: "distinct", rowField: a, valueIsTheAggregate: o } : Hc.has(n.kind) ? { kind: "rows", aggregate: n.kind, rowField: a, valueIsTheAggregate: o } : Q : Q;
4733
4733
  }
4734
- const Zc = {
4734
+ const el = {
4735
4735
  switched_off: "This card doesn't show its records.",
4736
4736
  sql_card: "Not available on cards written in SQL.",
4737
4737
  unsupported_visual: "This visual doesn't show its records.",
@@ -4742,48 +4742,48 @@ const Zc = {
4742
4742
  card_updating: "This card is updating. Try again when it finishes.",
4743
4743
  records_repeat: "Each record appears more than once in this card's data, so its records can't be listed yet."
4744
4744
  }, st = { available: !0 };
4745
- function J(e) {
4746
- return { available: !1, reason: e, message: Zc[e] };
4745
+ function X(e) {
4746
+ return { available: !1, reason: e, message: el[e] };
4747
4747
  }
4748
4748
  function jr(e) {
4749
4749
  return e ? (e.conditions ?? []).some(
4750
- (t) => to(t.field)
4750
+ (t) => no(t.field)
4751
4751
  ) || (e.groups ?? []).some(jr) : !1;
4752
4752
  }
4753
- function el(e, t) {
4753
+ function tl(e, t) {
4754
4754
  var r, i, o;
4755
4755
  return (((o = (i = (r = e.config) == null ? void 0 : r.matrix) == null ? void 0 : i.spec) == null ? void 0 : o.measureFilters) ?? []).some((a) => {
4756
4756
  var s;
4757
4757
  return !((s = t.matrixLevelIds) != null && s.includes(a.levelId));
4758
4758
  });
4759
4759
  }
4760
- function tl(e, t) {
4760
+ function nl(e, t) {
4761
4761
  var r;
4762
4762
  if (t.measure.kind !== "metric") return;
4763
4763
  const { resultId: n } = t.measure;
4764
4764
  return (((r = e.config) == null ? void 0 : r.metricColumns) ?? []).find(
4765
- (i) => i.id === n || oa(i) === n
4765
+ (i) => i.id === n || sa(i) === n
4766
4766
  );
4767
4767
  }
4768
- function nl(e, t) {
4769
- return e.seeRecords === !1 ? J("switched_off") : ia(e.type) ? aa(e) !== "config" ? J("sql_card") : t.isCurrentQueryResult ? st : J("card_updating") : J("unsupported_visual");
4768
+ function rl(e, t) {
4769
+ return e.seeRecords === !1 ? X("switched_off") : aa(e.type) ? oa(e) !== "config" ? X("sql_card") : t.isCurrentQueryResult ? st : X("card_updating") : X("unsupported_visual");
4770
4770
  }
4771
- function Pd(e, t, n) {
4771
+ function Ed(e, t, n) {
4772
4772
  var a;
4773
- const r = nl(e, n);
4773
+ const r = rl(e, n);
4774
4774
  if (!r.available) return r;
4775
- if (t.comparison) return J("comparison_value");
4776
- if (e.type === "matrixTable" ? el(e, t) : (t.kind === "subtotal" || t.kind === "grandTotal") && jr((a = e.config) == null ? void 0 : a.filters))
4777
- return J("total_under_measure_filter");
4778
- const i = tl(e, t);
4775
+ if (t.comparison) return X("comparison_value");
4776
+ if (e.type === "matrixTable" ? tl(e, t) : (t.kind === "subtotal" || t.kind === "grandTotal") && jr((a = e.config) == null ? void 0 : a.filters))
4777
+ return X("total_under_measure_filter");
4778
+ const i = nl(e, t);
4779
4779
  if (!i) return st;
4780
4780
  const o = ot(i);
4781
- return o.kind === "unlistable" ? J(o.reason) : o.kind === "calculation" && o.inputs.every((s) => ot(s).kind === "unlistable") ? J("measure_not_listable") : st;
4781
+ return o.kind === "unlistable" ? X(o.reason) : o.kind === "calculation" && o.inputs.every((s) => ot(s).kind === "unlistable") ? X("measure_not_listable") : st;
4782
4782
  }
4783
- function Nd(e) {
4783
+ function Rd(e) {
4784
4784
  return e === "switched_off" || e === "unsupported_visual";
4785
4785
  }
4786
- function Ed(e, t) {
4786
+ function Kd(e, t) {
4787
4787
  var i, o;
4788
4788
  const n = (i = t == null ? void 0 : t.find(
4789
4789
  (a) => a.filterId === e.id
@@ -4793,11 +4793,11 @@ function Ed(e, t) {
4793
4793
  ]);
4794
4794
  return n && r.has(n) ? n : e.column;
4795
4795
  }
4796
- function Rd(e, t, n) {
4797
- const r = sa({ card: e, stated: t, context: n });
4798
- return r.ok ? { ok: !0, card: r.update ? ca(e, r.update).card : e, warnings: r.warnings } : r;
4796
+ function Ld(e, t, n) {
4797
+ const r = ca({ card: e, stated: t, context: n });
4798
+ return r.ok ? { ok: !0, card: r.update ? la(e, r.update).card : e, warnings: r.warnings } : r;
4799
4799
  }
4800
- function Kd({
4800
+ function Vd({
4801
4801
  resolvedCardConfig: e,
4802
4802
  card: t,
4803
4803
  row: n,
@@ -4807,7 +4807,7 @@ function Kd({
4807
4807
  }) {
4808
4808
  const a = e || t.config, { groupByColumns: s = [], metricColumns: c = [], detailColumns: l = [] } = a || {}, d = t.type === "detailTable", u = d ? "detail" : "groupby", f = d ? l : s, m = d ? [] : c, p = [];
4809
4809
  for (const h of f) {
4810
- const g = r ? Je(r, h.id, u) : void 0, I = (g == null ? void 0 : g.outputKey) || (g == null ? void 0 : g.rawKey) || h.label, v = n.getValue(I), C = i == null ? void 0 : i.byColumnKey.get(I);
4810
+ const g = r ? Xe(r, h.id, u) : void 0, I = (g == null ? void 0 : g.outputKey) || (g == null ? void 0 : g.rawKey) || h.label, v = n.getValue(I), C = i == null ? void 0 : i.byColumnKey.get(I);
4811
4811
  if (v == null)
4812
4812
  p.push({
4813
4813
  field: h,
@@ -4824,14 +4824,14 @@ function Kd({
4824
4824
  value: String(v),
4825
4825
  // Convert to string for consistency
4826
4826
  ...C ? {
4827
- label: da({
4827
+ label: ua({
4828
4828
  value: String(v),
4829
4829
  presentation: C
4830
4830
  }),
4831
4831
  temporalBucket: C.metadata
4832
4832
  } : {},
4833
4833
  ...b ? {
4834
- label: la({ value: String(v), presentation: b }).label,
4834
+ label: da({ value: String(v), presentation: b }).label,
4835
4835
  rawTemporal: { ...b.metadata, tz: b.format.calendarTimezone }
4836
4836
  } : {}
4837
4837
  });
@@ -4841,7 +4841,7 @@ function Kd({
4841
4841
  return;
4842
4842
  const y = [];
4843
4843
  for (const h of m) {
4844
- const g = r ? Je(r, h.id, "metric") : void 0, I = n.getValue(
4844
+ const g = r ? Xe(r, h.id, "metric") : void 0, I = n.getValue(
4845
4845
  (g == null ? void 0 : g.outputKey) || (g == null ? void 0 : g.rawKey) || h.label
4846
4846
  );
4847
4847
  I != null && y.push({
@@ -4856,7 +4856,7 @@ function Kd({
4856
4856
  metrics: y.length > 0 ? y : void 0
4857
4857
  };
4858
4858
  }
4859
- function Ld({
4859
+ function Bd({
4860
4860
  resolvedCardConfig: e,
4861
4861
  card: t,
4862
4862
  columnId: n,
@@ -4864,11 +4864,11 @@ function Ld({
4864
4864
  }) {
4865
4865
  const i = e || t.config, o = t.type === "detailTable", a = o ? "detail" : "groupby";
4866
4866
  return ((o ? i == null ? void 0 : i.detailColumns : i == null ? void 0 : i.groupByColumns) || []).find((c) => {
4867
- const l = r ? Je(r, c.id, a) : void 0;
4867
+ const l = r ? Xe(r, c.id, a) : void 0;
4868
4868
  return ((l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || c.label) === n;
4869
4869
  });
4870
4870
  }
4871
- const rl = {
4871
+ const il = {
4872
4872
  noFields: "There is nothing to filter by here.",
4873
4873
  clickedColumnNotFilterable: "This column cannot filter other cards.",
4874
4874
  noChosenColumns: "This column is not set up to filter other cards.",
@@ -4876,9 +4876,9 @@ const rl = {
4876
4876
  unsupportedCondition: "This value cannot filter other cards."
4877
4877
  };
4878
4878
  function We(e) {
4879
- return { status: "unavailable", code: e, reason: rl[e] };
4879
+ return { status: "unavailable", code: e, reason: il[e] };
4880
4880
  }
4881
- function Vd(e) {
4881
+ function qd(e) {
4882
4882
  const t = e.conditions.filter(
4883
4883
  (s) => s.field.role !== "metric"
4884
4884
  );
@@ -4924,11 +4924,11 @@ function Vd(e) {
4924
4924
  return o.has(c) ? !1 : (o.add(c), !0);
4925
4925
  }) } };
4926
4926
  }
4927
- function Bd(e, t) {
4927
+ function Ud(e, t) {
4928
4928
  const n = e.answers.relationshipIds;
4929
4929
  return !n || !t ? !n && !t : n.length === t.length && n.every((r, i) => t[i] === r);
4930
4930
  }
4931
- const il = /* @__PURE__ */ new Set([
4931
+ const al = /* @__PURE__ */ new Set([
4932
4932
  "dataset_not_reachable",
4933
4933
  "field_not_resolvable",
4934
4934
  "missing_metadata",
@@ -4940,15 +4940,15 @@ const il = /* @__PURE__ */ new Set([
4940
4940
  function W(e) {
4941
4941
  return !!e && typeof e == "object" && !Array.isArray(e);
4942
4942
  }
4943
- function al(e) {
4943
+ function ol(e) {
4944
4944
  if (W(e))
4945
4945
  switch (e.status) {
4946
4946
  case "applied": {
4947
- const t = Gn(e.route);
4947
+ const t = Hn(e.route);
4948
4948
  return t ? { status: "applied", route: t } : void 0;
4949
4949
  }
4950
4950
  case "skipped":
4951
- return typeof e.reason == "string" && il.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4951
+ return typeof e.reason == "string" && al.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4952
4952
  case "needsPath":
4953
4953
  return { status: "needsPath" };
4954
4954
  case "blocked":
@@ -4961,22 +4961,22 @@ function al(e) {
4961
4961
  return;
4962
4962
  }
4963
4963
  }
4964
- function zr(e) {
4964
+ function Wr(e) {
4965
4965
  if (e !== void 0)
4966
4966
  return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
4967
4967
  }
4968
- function ol(e) {
4968
+ function sl(e) {
4969
4969
  if (!W(e)) return;
4970
- const t = Gn(e.route), n = e.target;
4971
- if (!(!t || !W(n) || n.kind !== "relationship" || !W(n.field) || typeof n.field.name != "string" || !W(n.field.source) || n.field.source.kind !== "semantic" || !zr(n.relationshipIds)))
4970
+ const t = Hn(e.route), n = e.target;
4971
+ if (!(!t || !W(n) || n.kind !== "relationship" || !W(n.field) || typeof n.field.name != "string" || !W(n.field.source) || n.field.source.kind !== "semantic" || !Wr(n.relationshipIds)))
4972
4972
  return { route: t, target: n };
4973
4973
  }
4974
- function qd(e) {
4974
+ function zd(e) {
4975
4975
  if (!W(e) || !Array.isArray(e.previews)) return { previews: [] };
4976
4976
  const t = [];
4977
4977
  for (const r of e.previews) {
4978
4978
  if (!W(r) || typeof r.cardId != "string" || !r.cardId || !W(r.answers)) continue;
4979
- const i = zr(r.answers.relationshipIds), o = al(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(ol) : [];
4979
+ const i = Wr(r.answers.relationshipIds), o = ol(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(sl) : [];
4980
4980
  i === null || !o || !a.every(Boolean) || o.status === "needsPath" && a.length < 2 || t.push({
4981
4981
  cardId: r.cardId,
4982
4982
  answers: i ? { relationshipIds: i } : {},
@@ -4988,18 +4988,18 @@ function qd(e) {
4988
4988
  return { previews: t, ...n ? { manageRelationships: n } : {} };
4989
4989
  }
4990
4990
  const Se = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
4991
- function sl(e) {
4991
+ function cl(e) {
4992
4992
  return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
4993
4993
  }
4994
- function Ud(e) {
4994
+ function wn(e) {
4995
4995
  if (e.direction === "to_many") {
4996
4996
  const n = Se(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
4997
- return `${e.base ? sl(Se(e.base)) : "Rows"} with at least one matching ${n}`;
4997
+ return `${e.base ? cl(Se(e.base)) : "Rows"} with at least one matching ${n}`;
4998
4998
  }
4999
4999
  return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(Se).join(", ")}`;
5000
5000
  }
5001
5001
  const jd = "The relationship this card used changed; choose it again";
5002
- function zd(e, t) {
5002
+ function ll(e, t) {
5003
5003
  switch (e) {
5004
5004
  case "relationship_missing":
5005
5005
  return t ? `Not related to ${Se(t)}` : "Not related to this card";
@@ -5016,158 +5016,175 @@ function zd(e, t) {
5016
5016
  return String(e);
5017
5017
  }
5018
5018
  }
5019
+ function Wd(e) {
5020
+ if (e)
5021
+ switch (e.status) {
5022
+ case "applied":
5023
+ return e.through ? {
5024
+ tone: "muted",
5025
+ text: e.through.direction === "to_one" ? `Filtered ${wn(e.through)}` : wn(e.through)
5026
+ } : void 0;
5027
+ case "skipped":
5028
+ return { tone: "attention", text: ll(e.reason) };
5029
+ case "blocked":
5030
+ return { tone: "attention", text: e.message };
5031
+ default:
5032
+ return e;
5033
+ }
5034
+ }
5019
5035
  export {
5020
5036
  jd as $,
5021
5037
  Jo as A,
5022
- Mc as B,
5023
- Oc as C,
5024
- Qs as D,
5025
- Ac as E,
5026
- Dd as F,
5038
+ Oc as B,
5039
+ Ac as C,
5040
+ Xs as D,
5041
+ $c as E,
5042
+ _d as F,
5027
5043
  In as G,
5028
- kd as H,
5029
- _d as I,
5030
- Md as J,
5044
+ Md as H,
5045
+ Od as I,
5046
+ Ad as J,
5031
5047
  ie as K,
5032
- Od as L,
5033
- Ad as M,
5048
+ $d as L,
5049
+ Pd as M,
5034
5050
  jo as N,
5035
- $d as O,
5051
+ Nd as O,
5036
5052
  at as P,
5037
5053
  ot as Q,
5038
5054
  jr as R,
5039
- Zc as S,
5040
- nl as T,
5041
- Pd as U,
5042
- Nd as V,
5043
- Rd as W,
5044
- Bd as X,
5045
- qd as Y,
5046
- sl as Z,
5047
- Ud as _,
5048
- Cd as a,
5049
- Pr as a$,
5050
- zd as a0,
5051
- Go as a1,
5052
- kt as a2,
5053
- Eo as a3,
5054
- lo as a4,
5055
+ el as S,
5056
+ rl as T,
5057
+ Ed as U,
5058
+ Rd as V,
5059
+ Ld as W,
5060
+ Ud as X,
5061
+ zd as Y,
5062
+ cl as Z,
5063
+ wn as _,
5064
+ Sd as a,
5065
+ Dd as a$,
5066
+ ll as a0,
5067
+ Wd as a1,
5068
+ Ho as a2,
5069
+ kt as a3,
5070
+ Ro as a4,
5055
5071
  uo as a5,
5056
- Ae as a6,
5057
- Nl as a7,
5058
- rd as a8,
5059
- Al as a9,
5060
- z as aA,
5061
- Ze as aB,
5062
- ko as aC,
5063
- Ll as aD,
5064
- Vl as aE,
5065
- wd as aF,
5066
- Bl as aG,
5067
- or as aH,
5068
- Pl as aI,
5069
- Ro as aJ,
5070
- io as aK,
5071
- Ml as aL,
5072
- Hn as aM,
5073
- fo as aN,
5074
- vt as aO,
5075
- El as aP,
5076
- Rl as aQ,
5077
- _e as aR,
5078
- pe as aS,
5079
- Ol as aT,
5080
- Ld as aU,
5081
- ql as aV,
5082
- vs as aW,
5083
- B as aX,
5084
- id as aY,
5085
- Tr as aZ,
5086
- xd as a_,
5087
- is as aa,
5088
- os as ab,
5089
- D as ac,
5090
- nc as ad,
5091
- ms as ae,
5092
- td as af,
5093
- dd as ag,
5094
- cd as ah,
5095
- so as ai,
5096
- ao as aj,
5072
+ fo as a6,
5073
+ Ae as a7,
5074
+ Rl as a8,
5075
+ ad as a9,
5076
+ Ql as aA,
5077
+ j as aB,
5078
+ Ze as aC,
5079
+ _o as aD,
5080
+ Bl as aE,
5081
+ ql as aF,
5082
+ Td as aG,
5083
+ Ul as aH,
5084
+ sr as aI,
5085
+ El as aJ,
5086
+ Ko as aK,
5087
+ ao as aL,
5088
+ Al as aM,
5089
+ Yn as aN,
5090
+ mo as aO,
5091
+ vt as aP,
5092
+ Kl as aQ,
5093
+ Ll as aR,
5094
+ _e as aS,
5095
+ pe as aT,
5096
+ $l as aU,
5097
+ Bd as aV,
5098
+ zl as aW,
5099
+ Is as aX,
5100
+ B as aY,
5101
+ od as aZ,
5102
+ Dr as a_,
5103
+ Pl as aa,
5104
+ as as ab,
5105
+ ss as ac,
5106
+ D as ad,
5107
+ rc as ae,
5108
+ ps as af,
5109
+ rd as ag,
5110
+ fd as ah,
5111
+ dd as ai,
5112
+ co as aj,
5097
5113
  oo as ak,
5098
- ke as al,
5099
- Yl as am,
5100
- Ft as an,
5101
- Kl as ao,
5102
- jl as ap,
5114
+ so as al,
5115
+ ke as am,
5116
+ Xl as an,
5117
+ Ft as ao,
5118
+ Vl as ap,
5103
5119
  Wl as aq,
5104
- zl as ar,
5105
- It as as,
5106
- Do as at,
5107
- Ul as au,
5108
- Gl as av,
5109
- bo as aw,
5110
- Oo as ax,
5120
+ Hl as ar,
5121
+ Gl as as,
5122
+ It as at,
5123
+ ko as au,
5124
+ jl as av,
5125
+ Yl as aw,
5126
+ vo as ax,
5111
5127
  Ao as ay,
5112
- Hl as az,
5113
- Tc as b,
5114
- gd as b0,
5115
- vc as b1,
5116
- fe as b2,
5117
- Dt as b3,
5118
- md as b4,
5119
- yd as b5,
5120
- pd as b6,
5121
- hc as b7,
5122
- kc as b8,
5123
- Id as b9,
5124
- vd as ba,
5125
- hd as bb,
5126
- bc,
5127
- nd as bd,
5128
- ns as be,
5129
- To as bf,
5130
- Td as bg,
5131
- vn as bh,
5132
- as as bi,
5133
- Dc as bj,
5134
- ld as bk,
5135
- ec as bl,
5136
- Fd as bm,
5137
- xc as bn,
5138
- de as bo,
5139
- ad as bp,
5140
- ps as bq,
5141
- od as br,
5142
- dn as bs,
5143
- hs as bt,
5144
- wr as bu,
5145
- Sr as bv,
5146
- Bs as bw,
5147
- ud as bx,
5148
- $l as by,
5128
+ $o as az,
5129
+ Dc as b,
5130
+ Nr as b0,
5131
+ bd as b1,
5132
+ Ic as b2,
5133
+ fe as b3,
5134
+ Dt as b4,
5135
+ hd as b5,
5136
+ vd as b6,
5137
+ gd as b7,
5138
+ gc as b8,
5139
+ _c as b9,
5140
+ Fd as ba,
5141
+ Cd as bb,
5142
+ yd as bc,
5143
+ vc as bd,
5144
+ id as be,
5145
+ rs as bf,
5146
+ Do as bg,
5147
+ kd as bh,
5148
+ vn as bi,
5149
+ os as bj,
5150
+ kc as bk,
5151
+ ud as bl,
5152
+ tc as bm,
5153
+ wd as bn,
5154
+ Tc as bo,
5155
+ de as bp,
5156
+ sd as bq,
5157
+ hs as br,
5158
+ cd as bs,
5159
+ dn as bt,
5160
+ gs as bu,
5161
+ xr as bv,
5162
+ wr as bw,
5163
+ qs as bx,
5164
+ md as by,
5165
+ Nl as bz,
5149
5166
  yn as c,
5150
- Ed as d,
5151
- fd as e,
5152
- gs as f,
5153
- Sd as g,
5154
- ed as h,
5155
- sd as i,
5156
- Zl as j,
5157
- Xl as k,
5158
- Ic as l,
5159
- Is as m,
5160
- Cs as n,
5161
- Kd as o,
5162
- Ko as p,
5163
- Vo as q,
5164
- bd as r,
5165
- Vd as s,
5166
- Bo as t,
5167
- Ql as u,
5168
- Zo as v,
5169
- sr as w,
5170
- qo as x,
5171
- Jl as y,
5172
- Uo as z
5167
+ Kd as d,
5168
+ pd as e,
5169
+ ys as f,
5170
+ xd as g,
5171
+ nd as h,
5172
+ ld as i,
5173
+ td as j,
5174
+ ed as k,
5175
+ Cc as l,
5176
+ Cs as m,
5177
+ Fs as n,
5178
+ Vd as o,
5179
+ Lo as p,
5180
+ Bo as q,
5181
+ Id as r,
5182
+ qd as s,
5183
+ qo as t,
5184
+ Jl as u,
5185
+ es as v,
5186
+ cr as w,
5187
+ Uo as x,
5188
+ Zl as y,
5189
+ zo as z
5173
5190
  };