react-semaphor 0.1.472 → 0.1.474

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 (67) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +102 -94
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.js +4 -4
  6. package/dist/chunks/{analyze-result-contract-B3agc2XU.js → analyze-result-contract-C8s8EUL5.js} +1 -1
  7. package/dist/chunks/{common-types-g_1fKJLK.js → common-types-BLPy5_E0.js} +1 -1
  8. package/dist/chunks/{dashboard-briefing-launcher-Lw4gjW_M.js → dashboard-briefing-launcher-B0f28WrK.js} +9 -9
  9. package/dist/chunks/{dashboard-briefing-launcher-8vxGyexK.cjs → dashboard-briefing-launcher-BjCkA5vw.cjs} +1 -1
  10. package/dist/chunks/{dashboard-controls-BKR8g3M9.cjs → dashboard-controls-BRclCQEX.cjs} +1 -1
  11. package/dist/chunks/{dashboard-controls-CRgDlxdt.js → dashboard-controls-CMJqSLgo.js} +9 -9
  12. package/dist/chunks/{dashboard-filter-value-compatibility-ilbH2A31.js → dashboard-filter-value-compatibility-9W8Ckcle.js} +168 -158
  13. package/dist/chunks/dashboard-filter-value-compatibility-Co1dn9Bc.cjs +1 -0
  14. package/dist/chunks/{dashboard-input-contract-Vr_3ApfF.js → dashboard-input-contract-BrGdGFz0.js} +6 -6
  15. package/dist/chunks/{dashboard-json-BhhVg9mI.js → dashboard-json-1ohpjO_q.js} +7 -7
  16. package/dist/chunks/{dashboard-json-CUgAzrYq.cjs → dashboard-json-DmtGHdDq.cjs} +1 -1
  17. package/dist/chunks/{edit-dashboard-visual-DlQtYQOO.js → edit-dashboard-visual-D9oKtOo6.js} +12 -12
  18. package/dist/chunks/{edit-dashboard-visual-BxmanBVo.cjs → edit-dashboard-visual-DNqJHdHE.cjs} +1 -1
  19. package/dist/chunks/{editor-action-buttons-CRWacpxi.js → editor-action-buttons-C_B8Wzkf.js} +6 -6
  20. package/dist/chunks/{editor-action-buttons-DKcD0UQy.cjs → editor-action-buttons-DwI3FcSw.cjs} +1 -1
  21. package/dist/chunks/{index-xdqe-Zvd.cjs → index-B6zSYUN4.cjs} +167 -167
  22. package/dist/chunks/{index-0fmECZL2.js → index-DalKzjEZ.js} +31914 -31864
  23. package/dist/chunks/{index-oVXvCLH-.js → index-DsvIlrI-.js} +9 -9
  24. package/dist/chunks/matrix-result-contract-Bhg60NtS.cjs +1 -0
  25. package/dist/chunks/matrix-result-contract-BpzhImar.js +421 -0
  26. package/dist/chunks/{pivot-header-presentation-7XrwJYDm.js → pivot-header-presentation-Be3FyR0N.js} +2 -2
  27. package/dist/chunks/{pivot-result-identity-5v4hRVbc.js → pivot-result-identity-CIZXsI53.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-O_roVguV.js → pivot-result-lifecycle-PxmbJWkm.js} +19 -19
  29. package/dist/chunks/{raw-temporal-contract-BEMf3avg.js → raw-temporal-contract-U8J9RlEH.js} +1 -1
  30. package/dist/chunks/{report-preferences-dialog-Dxt9XMpd.js → report-preferences-dialog-C9mJffNQ.js} +6 -6
  31. package/dist/chunks/{report-preferences-dialog-8KYKazoG.cjs → report-preferences-dialog-DGMd-eTT.cjs} +1 -1
  32. package/dist/chunks/{report-runtime-context-DnNbpkGo.js → report-runtime-context-DNbgCsko.js} +7 -7
  33. package/dist/chunks/{saved-temporal-bucket-format-CygnBDO2.js → saved-temporal-bucket-format-CHsXUPJI.js} +8 -8
  34. package/dist/chunks/source-entity-resolution-BDC-Qngk.cjs +1 -0
  35. package/dist/chunks/source-entity-resolution-ugN3sZUk.js +781 -0
  36. package/dist/chunks/{switch-CQN9Hzho.cjs → switch-B4eH4guz.cjs} +13 -13
  37. package/dist/chunks/{switch-n2yUNY8i.js → switch-D20CIzj6.js} +1460 -1455
  38. package/dist/chunks/{temporal-bucket-CUKJktCl.js → temporal-bucket-CtP7hKLa.js} +12 -12
  39. package/dist/chunks/{temporal-bucket-authoring-CZoJV2L6.js → temporal-bucket-authoring-DJ9kK2wD.js} +3 -3
  40. package/dist/chunks/{temporal-bucket-contract-Cno9TlYr.js → temporal-bucket-contract-CZl5D7FZ.js} +1 -1
  41. package/dist/chunks/{token-types-W3EHNW-D.js → token-types-DfDtCqlw.js} +1 -1
  42. package/dist/chunks/{update-policy-kRNJwwUV.js → update-policy-BybMiM61.js} +1 -1
  43. package/dist/chunks/{validators-B5t1s8oh.js → validators-D-T-2HOR.js} +50 -50
  44. package/dist/dashboard/index.cjs +1 -1
  45. package/dist/dashboard/index.js +2 -2
  46. package/dist/dashboard-authoring/index.cjs +3 -3
  47. package/dist/dashboard-authoring/index.js +355 -341
  48. package/dist/data-app-builder/index.cjs +1 -1
  49. package/dist/data-app-builder/index.js +2 -2
  50. package/dist/data-app-codegen/index.js +2 -2
  51. package/dist/data-app-codegen-node/index.js +3 -3
  52. package/dist/data-app-sdk/index.js +3 -3
  53. package/dist/data-app-sdk-adapters/index.js +2 -2
  54. package/dist/data-app-sdk-validation/index.js +9 -9
  55. package/dist/format-utils/index.js +10 -10
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.js +14 -14
  58. package/dist/report-runtime-context/index.js +2 -2
  59. package/dist/surfboard/index.cjs +1 -1
  60. package/dist/surfboard/index.js +3 -3
  61. package/dist/types/analytics-protocol.d.ts +141 -0
  62. package/dist/types/index.js +4 -4
  63. package/dist/types/main.d.ts +7 -0
  64. package/package.json +1 -1
  65. package/dist/chunks/dashboard-filter-value-compatibility-Dmh-NaPK.cjs +0 -1
  66. package/dist/chunks/matrix-result-contract-DoU9diAh.js +0 -822
  67. package/dist/chunks/matrix-result-contract-SrzyG_KQ.cjs +0 -1
@@ -1,11 +1,11 @@
1
1
  import { D as R, a as Ie } from "../chunks/contracts-CoCOpd_i.js";
2
- import { A as Mt, S as Nt, g as Bt, a as Rt, i as Pt, p as Ot, c as zt, b as qt, r as Vt, s as Lt, t as jt } from "../chunks/temporal-bucket-authoring-CZoJV2L6.js";
3
- import { j as ye, ai as H, aj as _e, x as ae, E as we, A as ve } from "../chunks/validators-B5t1s8oh.js";
4
- import "../chunks/analyze-result-contract-B3agc2XU.js";
2
+ import { A as Mt, S as Nt, g as Bt, a as Rt, i as Pt, p as Ot, c as zt, b as qt, r as Vt, s as Lt, t as jt } from "../chunks/temporal-bucket-authoring-DJ9kK2wD.js";
3
+ import { k as ye, ai as H, aj as _e, y as ae, F as we, B as ve } from "../chunks/validators-D-T-2HOR.js";
4
+ import "../chunks/analyze-result-contract-C8s8EUL5.js";
5
5
  import "../value-format-preferences/index.js";
6
6
  import { n as Se } from "../chunks/operators-C8TxpM4C.js";
7
7
  import { a as Ht, b as Wt, r as Kt } from "../chunks/canonical-result-keys-CEQefvdO.js";
8
- import { D as Ut, b as Qt, l as Yt, d as Jt, e as Xt, m as Zt, f as er, a as tr, c as rr, i as nr, h as ar, o as ir, n as or, k as sr, r as dr, g as cr, j as lr } from "../chunks/dashboard-filter-value-compatibility-ilbH2A31.js";
8
+ import { D as Ut, b as Qt, l as Yt, d as Jt, e as Xt, m as Zt, f as en, a as tn, c as nn, i as rn, h as an, o as on, n as sn, k as dn, r as cn, g as ln, j as un } from "../chunks/dashboard-filter-value-compatibility-9W8Ckcle.js";
9
9
  function _(e) {
10
10
  return e && typeof e == "object" ? e : null;
11
11
  }
@@ -13,8 +13,8 @@ function C(e) {
13
13
  return typeof e == "string" ? e : null;
14
14
  }
15
15
  function Ce(e) {
16
- var t, r, n;
17
- return !!(e && typeof e == "object") && (((t = _(e)) == null ? void 0 : t.kind) === "semantic" || ((r = _(e)) == null ? void 0 : r.kind) === "physical" || ((n = _(e)) == null ? void 0 : n.kind) === "sql");
16
+ var t, n, r;
17
+ return !!(e && typeof e == "object") && (((t = _(e)) == null ? void 0 : t.kind) === "semantic" || ((n = _(e)) == null ? void 0 : n.kind) === "physical" || ((r = _(e)) == null ? void 0 : r.kind) === "sql");
18
18
  }
19
19
  function T(e) {
20
20
  return Ce(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
@@ -30,13 +30,13 @@ function ke(e, t) {
30
30
  }
31
31
  function P(e) {
32
32
  const t = [];
33
- for (const r of e) {
34
- const n = t.findIndex(
35
- (o) => ie(o, r)
33
+ for (const n of e) {
34
+ const r = t.findIndex(
35
+ (o) => ie(o, n)
36
36
  );
37
- n === -1 ? t.push(r) : t[n] = ke(
38
- t[n],
39
- r
37
+ r === -1 ? t.push(n) : t[r] = ke(
38
+ t[r],
39
+ n
40
40
  );
41
41
  }
42
42
  return t;
@@ -50,52 +50,52 @@ function L(e, t) {
50
50
  function j(e) {
51
51
  return T(e) ? e : void 0;
52
52
  }
53
- function re(e, t) {
53
+ function ne(e, t) {
54
54
  if (!(e.kind !== "semantic" || e.connectionId))
55
55
  return t.find(
56
- (r) => (r == null ? void 0 : r.kind) === "semantic" && H(e, r) && !!r.connectionId
56
+ (n) => (n == null ? void 0 : n.kind) === "semantic" && H(e, n) && !!n.connectionId
57
57
  );
58
58
  }
59
59
  function S(e, t) {
60
- const r = j(e == null ? void 0 : e.source);
61
- return r ? L(r, t) : void 0;
60
+ const n = j(e == null ? void 0 : e.source);
61
+ return n ? L(n, t) : void 0;
62
62
  }
63
63
  function De({
64
64
  explicitSource: e,
65
65
  field: t,
66
- defaultSource: r,
67
- fallbackSources: n
66
+ defaultSource: n,
67
+ fallbackSources: r
68
68
  }) {
69
- const o = [r, ...n || []], a = j(e), i = a ? L(
70
- a,
71
- re(a, o)
69
+ const o = [n, ...r || []], i = j(e), a = i ? L(
70
+ i,
71
+ ne(i, o)
72
72
  ) : void 0;
73
- if (i)
74
- return i;
73
+ if (a)
74
+ return a;
75
75
  if (e !== void 0)
76
76
  return;
77
- const d = S(t, r), s = d ? L(
77
+ const d = S(t, n), s = d ? L(
78
78
  d,
79
- re(d, o)
79
+ ne(d, o)
80
80
  ) : void 0;
81
81
  if (s)
82
82
  return s;
83
83
  if ((t == null ? void 0 : t.source) === void 0)
84
- return j(r);
84
+ return j(n);
85
85
  }
86
86
  function kt(e, t) {
87
87
  if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
88
88
  return !1;
89
- const r = S(e), n = S(t);
90
- return !r || !n ? !0 : ie(r, n);
89
+ const n = S(e), r = S(t);
90
+ return !n || !r ? !0 : ie(n, r);
91
91
  }
92
92
  function D(e) {
93
93
  var t;
94
94
  return C((t = _(e)) == null ? void 0 : t.kind);
95
95
  }
96
96
  function oe(e) {
97
- var t, r;
98
- return D(e) !== "semantic" ? null : ((r = C((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : r.trim()) || null;
97
+ var t, n;
98
+ return D(e) !== "semantic" ? null : ((n = C((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : n.trim()) || null;
99
99
  }
100
100
  function Ae(e) {
101
101
  var t;
@@ -133,47 +133,47 @@ function Be({
133
133
  return { ok: !1, issue: "invalid_dataset_count" };
134
134
  if (e.length <= 1)
135
135
  return { ok: !0 };
136
- const r = e.map(oe), n = new Set(r.filter(Boolean));
137
- return r.some((o) => !o) || n.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
136
+ const n = e.map(oe), r = new Set(n.filter(Boolean));
137
+ return n.some((o) => !o) || r.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
138
138
  }
139
139
  function W(e, t) {
140
140
  if (!t)
141
141
  return !1;
142
142
  if (t.kind === "semantic") {
143
- const r = xe(e);
144
- return oe(e) === t.domainId ? r && t.datasetId ? r === t.datasetId : Ae(e) === t.datasetName : !1;
143
+ const n = xe(e);
144
+ return oe(e) === t.domainId ? n && t.datasetId ? n === t.datasetId : Ae(e) === t.datasetName : !1;
145
145
  }
146
146
  return t.kind === "physical" ? Fe(e) === t.connectionId && Te(e) === t.tableName && $e(e) === (t.databaseName || "") && Me(e) === (t.schemaName || "") : !1;
147
147
  }
148
148
  function Dt(e, t) {
149
149
  return e.find(
150
- (r) => W(r, t)
150
+ (n) => W(n, t)
151
151
  );
152
152
  }
153
- function p(e, t, r) {
154
- return r ? { code: e, message: t, cardId: r } : { code: e, message: t };
153
+ function p(e, t, n) {
154
+ return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
155
155
  }
156
156
  function N(e) {
157
157
  const t = /* @__PURE__ */ new Set();
158
- for (const r of e) {
159
- if (t.has(r))
160
- return r;
161
- t.add(r);
158
+ for (const n of e) {
159
+ if (t.has(n))
160
+ return n;
161
+ t.add(n);
162
162
  }
163
163
  return null;
164
164
  }
165
165
  function se({
166
166
  card: e,
167
167
  datasets: t,
168
- errors: r
168
+ errors: n
169
169
  }) {
170
170
  if (e.type === "text")
171
171
  return;
172
- const n = Ne(e);
173
- if (!n) {
172
+ const r = Ne(e);
173
+ if (!r) {
174
174
  if (t.length <= 1)
175
175
  return;
176
- r.push(
176
+ n.push(
177
177
  p(
178
178
  "missing_card_analytics_source",
179
179
  "Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",
@@ -182,7 +182,7 @@ function se({
182
182
  );
183
183
  return;
184
184
  }
185
- t.some((o) => W(o, n)) || r.push(
185
+ t.some((o) => W(o, r)) || n.push(
186
186
  p(
187
187
  "invalid_card_analytics_source",
188
188
  "Dashboard cards with an explicit analytics source must use one of the selected datasets.",
@@ -198,13 +198,13 @@ function z(e) {
198
198
  (t) => !!(t && typeof t == "object")
199
199
  ) : [];
200
200
  }
201
- function ne(e) {
201
+ function re(e) {
202
202
  return Array.isArray(e) ? e.filter(
203
203
  (t) => !!(t && typeof t == "object")
204
204
  ) : [];
205
205
  }
206
206
  function Re(e) {
207
- var r, n;
207
+ var n, r;
208
208
  if (!e)
209
209
  return [];
210
210
  const t = [e.source];
@@ -214,16 +214,16 @@ function Re(e) {
214
214
  e.primaryMeasure,
215
215
  e.dateField,
216
216
  ...z(e.dimensions),
217
- ...ne(e.filters).map((o) => o.field)
217
+ ...re(e.filters).map((o) => o.field)
218
218
  ])
219
219
  ) : e.kind === "records" ? t.push(
220
220
  ...B([
221
221
  ...z(e.fields),
222
222
  e.dateField,
223
- (r = e.orderBy) == null ? void 0 : r.field,
224
- ...ne(e.filters).map((o) => o.field)
223
+ (n = e.orderBy) == null ? void 0 : n.field,
224
+ ...re(e.filters).map((o) => o.field)
225
225
  ])
226
- ) : e.kind === "inputOptions" ? (((n = e.population) == null ? void 0 : n.kind) === "related_population" && t.push(e.population.baseSource), t.push(
226
+ ) : e.kind === "inputOptions" ? (((r = e.population) == null ? void 0 : r.kind) === "related_population" && t.push(e.population.baseSource), t.push(
227
227
  ...B([
228
228
  e.labelField,
229
229
  e.valueField,
@@ -235,14 +235,14 @@ function Re(e) {
235
235
  function de({
236
236
  card: e,
237
237
  datasets: t,
238
- errors: r
238
+ errors: n
239
239
  }) {
240
240
  if (e.type !== "text") {
241
- for (const n of Re(e.analyticsIntent))
242
- if (n && !t.some(
243
- (o) => W(o, n)
241
+ for (const r of Re(e.analyticsIntent))
242
+ if (r && !t.some(
243
+ (o) => W(o, r)
244
244
  )) {
245
- r.push(
245
+ n.push(
246
246
  p(
247
247
  "invalid_card_query_source",
248
248
  "Dashboard card query field references must use one of the selected datasets.",
@@ -259,13 +259,13 @@ function ce({
259
259
  }) {
260
260
  if (e.type === "text" || !e.analyticsIntent)
261
261
  return;
262
- const r = ae(e.analyticsIntent);
263
- if (!r.ok)
264
- for (const n of r.errors)
262
+ const n = ae(e.analyticsIntent);
263
+ if (!n.ok)
264
+ for (const r of n.errors)
265
265
  t.push(
266
266
  p(
267
- n.code,
268
- n.path ? `${n.path}: ${n.message}` : n.message,
267
+ r.code,
268
+ r.path ? `${r.path}: ${r.message}` : r.message,
269
269
  e.id
270
270
  )
271
271
  );
@@ -273,14 +273,14 @@ function ce({
273
273
  function le({
274
274
  datasets: e,
275
275
  errors: t,
276
- requireAtLeastOne: r
276
+ requireAtLeastOne: n
277
277
  }) {
278
- const n = Be({
278
+ const r = Be({
279
279
  datasets: e,
280
- requireAtLeastOne: r
280
+ requireAtLeastOne: n
281
281
  });
282
- if (!n.ok) {
283
- if (n.issue === "invalid_dataset_count") {
282
+ if (!r.ok) {
283
+ if (r.issue === "invalid_dataset_count") {
284
284
  t.push(
285
285
  p(
286
286
  "invalid_dataset_count",
@@ -301,8 +301,8 @@ function ue({
301
301
  input: e,
302
302
  errors: t
303
303
  }) {
304
- var r;
305
- (r = e.filter.sql) != null && r.trim() && t.push(
304
+ var n;
305
+ (n = e.filter.sql) != null && n.trim() && t.push(
306
306
  p(
307
307
  "generated_filter_sql_out_of_scope",
308
308
  `Generated dashboard filter "${e.label}" must use grounded filter configuration; custom SQL is outside the dashboard-authoring contract.`
@@ -323,20 +323,20 @@ function Pe(e) {
323
323
  ],
324
324
  warnings: []
325
325
  };
326
- const r = e, n = [...r.warnings || []];
327
- r.version !== 1 && t.push(p("invalid_version", "Dashboard plan version must be 1.")), (f = r.title) != null && f.trim() || t.push(p("missing_title", "Dashboard plan needs a title."));
328
- const o = Array.isArray(r.datasets) ? r.datasets : [], a = Array.isArray(r.sheets) ? r.sheets : [];
329
- le({ datasets: o, errors: t, requireAtLeastOne: !0 }), a.length !== 1 && t.push(
326
+ const n = e, r = [...n.warnings || []];
327
+ n.version !== 1 && t.push(p("invalid_version", "Dashboard plan version must be 1.")), (f = n.title) != null && f.trim() || t.push(p("missing_title", "Dashboard plan needs a title."));
328
+ const o = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.sheets) ? n.sheets : [];
329
+ le({ datasets: o, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
330
330
  p(
331
331
  "invalid_sheet_count",
332
332
  "MVP dashboard authoring creates exactly one dashboard sheet."
333
333
  )
334
334
  );
335
- const i = a[0];
336
- i && i.kind !== "dashboard" && t.push(
335
+ const a = i[0];
336
+ a && a.kind !== "dashboard" && t.push(
337
337
  p("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
338
338
  );
339
- const d = (i == null ? void 0 : i.cards) || [];
339
+ const d = (a == null ? void 0 : a.cards) || [];
340
340
  d.length > R && t.push(
341
341
  p(
342
342
  "too_many_cards",
@@ -361,14 +361,14 @@ function Pe(e) {
361
361
  "Whole-dashboard authoring supports built-in visual types only.",
362
362
  l.id
363
363
  )
364
- ), l.type !== "text" && !l.analyticsIntent && n.push(
364
+ ), l.type !== "text" && !l.analyticsIntent && r.push(
365
365
  p(
366
366
  "missing_analytics_intent",
367
367
  "Non-text card has no analytics intent and may be skipped by the app layer.",
368
368
  l.id
369
369
  )
370
370
  ), se({ card: l, datasets: o, errors: t }), ce({ card: l, errors: t }), de({ card: l, datasets: o, errors: t });
371
- const h = Array.isArray(r.filterInputs) ? r.filterInputs : [], I = h.map((l) => l.id), w = N(I);
371
+ const h = Array.isArray(n.filterInputs) ? n.filterInputs : [], I = h.map((l) => l.id), w = N(I);
372
372
  w && t.push(
373
373
  p(
374
374
  "duplicate_input_id",
@@ -384,7 +384,7 @@ function Pe(e) {
384
384
  );
385
385
  for (const l of h)
386
386
  ue({ input: l, errors: t });
387
- const c = Array.isArray(r.calculatedFields) ? r.calculatedFields : [];
387
+ const c = Array.isArray(n.calculatedFields) ? n.calculatedFields : [];
388
388
  for (const l of c)
389
389
  l.scope === "domain" && l.reuseOnly !== !0 && t.push(
390
390
  p(
@@ -392,10 +392,10 @@ function Pe(e) {
392
392
  `Creating domain calculated field "${l.name}" is outside MVP.`
393
393
  )
394
394
  );
395
- return { ok: t.length === 0, errors: t, warnings: n };
395
+ return { ok: t.length === 0, errors: t, warnings: r };
396
396
  }
397
397
  function Oe(e) {
398
- var i;
398
+ var a;
399
399
  const t = [];
400
400
  if (!e || typeof e != "object")
401
401
  return {
@@ -408,17 +408,17 @@ function Oe(e) {
408
408
  ],
409
409
  warnings: []
410
410
  };
411
- const r = e, n = [...r.warnings || []];
412
- r.version !== 1 && t.push(
411
+ const n = e, r = [...n.warnings || []];
412
+ n.version !== 1 && t.push(
413
413
  p("invalid_version", "Dashboard change plan version must be 1.")
414
- ), (i = r.dashboardId) != null && i.trim() || t.push(
414
+ ), (a = n.dashboardId) != null && a.trim() || t.push(
415
415
  p("missing_dashboard_id", "Dashboard change plan needs a dashboard id.")
416
416
  );
417
- const o = Array.isArray(r.datasets) ? r.datasets : [], a = Array.isArray(r.operations) ? r.operations : [];
417
+ const o = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.operations) ? n.operations : [];
418
418
  le({ datasets: o, errors: t, requireAtLeastOne: !1 });
419
- for (const d of a) {
419
+ for (const d of i) {
420
420
  if (d.kind === "unsupported") {
421
- n.push(
421
+ r.push(
422
422
  p("unsupported_operation", d.reason || d.requestedAction)
423
423
  );
424
424
  continue;
@@ -447,7 +447,7 @@ function Oe(e) {
447
447
  )
448
448
  );
449
449
  }
450
- return { ok: t.length === 0, errors: t, warnings: n };
450
+ return { ok: t.length === 0, errors: t, warnings: r };
451
451
  }
452
452
  const ze = {
453
453
  lg: 48,
@@ -457,96 +457,96 @@ const ze = {
457
457
  xxs: 6
458
458
  };
459
459
  function qe(e, t) {
460
- let r = 0, n = 0, o = 0;
461
- return e.map((a) => {
462
- const i = Math.min(a.w, t);
463
- r > 0 && r + i > t && (r = 0, n += o, o = 0);
460
+ let n = 0, r = 0, o = 0;
461
+ return e.map((i) => {
462
+ const a = Math.min(i.w, t);
463
+ n > 0 && n + a > t && (n = 0, r += o, o = 0);
464
464
  const d = {
465
- i: a.frameId,
466
- x: r,
467
- y: n,
468
- w: i,
469
- h: a.h,
470
- minW: Math.min(a.minW, t),
471
- minH: a.minH,
465
+ i: i.frameId,
466
+ x: n,
467
+ y: r,
468
+ w: a,
469
+ h: i.h,
470
+ minW: Math.min(i.minW, t),
471
+ minH: i.minH,
472
472
  static: !1
473
473
  };
474
- return r += i, o = Math.max(o, a.h), d;
474
+ return n += a, o = Math.max(o, i.h), d;
475
475
  });
476
476
  }
477
477
  function Ve(e) {
478
- const t = [...e].sort((s, u) => s.priority - u.priority), r = t.filter((s) => s.role === "kpi"), n = t.filter((s) => s.role === "chart"), o = t.filter((s) => s.role === "table"), a = t.filter((s) => s.role === "text"), i = a.slice(0, 1), d = a.slice(i.length);
479
- return { kpis: r, introText: i, charts: n, tables: o, supportingText: d };
478
+ const t = [...e].sort((s, u) => s.priority - u.priority), n = t.filter((s) => s.role === "kpi"), r = t.filter((s) => s.role === "chart"), o = t.filter((s) => s.role === "table"), i = t.filter((s) => s.role === "text"), a = i.slice(0, 1), d = i.slice(a.length);
479
+ return { kpis: n, introText: a, charts: r, tables: o, supportingText: d };
480
480
  }
481
- function Le(e, t, r) {
482
- return t === "xxs" || t === "xs" ? r : t === "sm" ? Math.min(12, r) : t === "md" ? e <= 1 || e === 2 ? 18 : 12 : e <= 1 || e === 2 ? 24 : e === 3 ? 16 : 12;
481
+ function Le(e, t, n) {
482
+ return t === "xxs" || t === "xs" ? n : t === "sm" ? Math.min(12, n) : t === "md" ? e <= 1 || e === 2 ? 18 : 12 : e <= 1 || e === 2 ? 24 : e === 3 ? 16 : 12;
483
483
  }
484
- function je(e, t, r, n) {
485
- return r === "xxs" || r === "xs" || r === "sm" || r === "md" || t === 1 || t % 2 === 1 && e === 0 ? n : n / 2;
484
+ function je(e, t, n, r) {
485
+ return n === "xxs" || n === "xs" || n === "sm" || n === "md" || t === 1 || t % 2 === 1 && e === 0 ? r : r / 2;
486
486
  }
487
487
  function Ee(e) {
488
- const { item: t, band: r, index: n, bandCount: o, breakpoint: a, columns: i } = e;
489
- return r === "kpi" ? {
488
+ const { item: t, band: n, index: r, bandCount: o, breakpoint: i, columns: a } = e;
489
+ return n === "kpi" ? {
490
490
  ...t,
491
- band: r,
492
- w: Le(o, a, i),
491
+ band: n,
492
+ w: Le(o, i, a),
493
493
  h: 15,
494
- minW: Math.min(6, i),
494
+ minW: Math.min(6, a),
495
495
  minH: 12
496
- } : r === "table" ? {
496
+ } : n === "table" ? {
497
497
  ...t,
498
- band: r,
499
- w: i,
500
- h: a === "xxs" || a === "xs" ? 34 : 38,
501
- minW: Math.min(12, i),
498
+ band: n,
499
+ w: a,
500
+ h: i === "xxs" || i === "xs" ? 34 : 38,
501
+ minW: Math.min(12, a),
502
502
  minH: 18
503
- } : r === "introText" ? {
503
+ } : n === "introText" ? {
504
504
  ...t,
505
- band: r,
506
- w: i,
507
- h: a === "xxs" || a === "xs" ? 12 : 10,
508
- minW: Math.min(12, i),
505
+ band: n,
506
+ w: a,
507
+ h: i === "xxs" || i === "xs" ? 12 : 10,
508
+ minW: Math.min(12, a),
509
509
  minH: 8
510
- } : r === "supportingText" ? {
510
+ } : n === "supportingText" ? {
511
511
  ...t,
512
- band: r,
513
- w: a === "lg" ? i / 2 : i,
514
- h: a === "xxs" || a === "xs" ? 12 : 10,
515
- minW: Math.min(12, i),
512
+ band: n,
513
+ w: i === "lg" ? a / 2 : a,
514
+ h: i === "xxs" || i === "xs" ? 12 : 10,
515
+ minW: Math.min(12, a),
516
516
  minH: 8
517
517
  } : {
518
518
  ...t,
519
- band: r,
520
- w: je(n, o, a, i),
521
- h: a === "xxs" || a === "xs" ? 28 : 30,
522
- minW: Math.min(12, i),
519
+ band: n,
520
+ w: je(r, o, i, a),
521
+ h: i === "xxs" || i === "xs" ? 28 : 30,
522
+ minW: Math.min(12, a),
523
523
  minH: 16
524
524
  };
525
525
  }
526
- function x(e, t, r, n) {
526
+ function x(e, t, n, r) {
527
527
  return e.map(
528
- (o, a) => Ee({
528
+ (o, i) => Ee({
529
529
  item: o,
530
530
  band: t,
531
- index: a,
531
+ index: i,
532
532
  bandCount: e.length,
533
- breakpoint: r,
534
- columns: n
533
+ breakpoint: n,
534
+ columns: r
535
535
  })
536
536
  );
537
537
  }
538
538
  function K(e) {
539
539
  const t = Ve(e);
540
540
  return Object.fromEntries(
541
- Ie.map((r) => {
542
- const n = ze[r], o = [
543
- ...x(t.introText, "introText", r, n),
544
- ...x(t.kpis, "kpi", r, n),
545
- ...x(t.charts, "chart", r, n),
546
- ...x(t.tables, "table", r, n),
547
- ...x(t.supportingText, "supportingText", r, n)
541
+ Ie.map((n) => {
542
+ const r = ze[n], o = [
543
+ ...x(t.introText, "introText", n, r),
544
+ ...x(t.kpis, "kpi", n, r),
545
+ ...x(t.charts, "chart", n, r),
546
+ ...x(t.tables, "table", n, r),
547
+ ...x(t.supportingText, "supportingText", n, r)
548
548
  ];
549
- return [r, qe(o, n)];
549
+ return [n, qe(o, r)];
550
550
  })
551
551
  );
552
552
  }
@@ -573,68 +573,68 @@ function Ue(e) {
573
573
  function G(e, t) {
574
574
  if (t === void 0)
575
575
  return;
576
- const r = He(e.dataType), n = e.operation || "in";
576
+ const n = He(e.dataType), r = e.operation || "in";
577
577
  if (Ke(t))
578
578
  return {
579
579
  ...t,
580
580
  filterId: e.id,
581
581
  name: t.name || e.column,
582
- valueType: r,
582
+ valueType: n,
583
583
  dataType: e.dataType,
584
584
  fieldMeta: e.fieldMeta,
585
585
  semanticContext: e.semanticContext
586
586
  };
587
- if (n === "is null" || n === "is not null")
587
+ if (r === "is null" || r === "is not null")
588
588
  return {
589
589
  filterId: e.id,
590
590
  name: e.column,
591
- operation: n,
592
- valueType: r,
591
+ operation: r,
592
+ valueType: n,
593
593
  values: [],
594
594
  dataType: e.dataType,
595
595
  fieldMeta: e.fieldMeta,
596
596
  semanticContext: e.semanticContext
597
597
  };
598
- const o = Array.isArray(t) ? t : [t], a = r === "date" ? Ue(o) : Ge(o);
599
- if (a.length !== 0 && !((n === "between" || n === "not between") && a.length < 2))
598
+ const o = Array.isArray(t) ? t : [t], i = n === "date" ? Ue(o) : Ge(o);
599
+ if (i.length !== 0 && !((r === "between" || r === "not between") && i.length < 2))
600
600
  return {
601
601
  filterId: e.id,
602
602
  name: e.column,
603
- operation: n,
604
- valueType: r,
605
- values: a,
603
+ operation: r,
604
+ valueType: n,
605
+ values: i,
606
606
  dataType: e.dataType,
607
607
  fieldMeta: e.fieldMeta,
608
608
  semanticContext: e.semanticContext
609
609
  };
610
610
  }
611
- function fe(e, t, r) {
612
- return r ? { code: e, message: t, cardId: r } : { code: e, message: t };
611
+ function fe(e, t, n) {
612
+ return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
613
613
  }
614
- function Qe(e, t, r) {
615
- const n = (t || []).filter(
616
- (o) => o.scope === "card" && o.targetCardId === r
614
+ function Qe(e, t, n) {
615
+ const r = (t || []).filter(
616
+ (o) => o.scope === "card" && o.targetCardId === n
617
617
  ).map((o) => o.field).filter(Boolean);
618
- return n.length === 0 ? e : {
618
+ return r.length === 0 ? e : {
619
619
  ...e,
620
620
  calculatedFields: [
621
621
  ...e.calculatedFields || [],
622
- ...n
622
+ ...r
623
623
  ]
624
624
  };
625
625
  }
626
626
  function E(e, t) {
627
627
  return Array.from(
628
628
  new Set(
629
- (e || []).map((r) => t.get(r)).filter((r) => !!r)
629
+ (e || []).map((n) => t.get(n)).filter((n) => !!n)
630
630
  )
631
631
  );
632
632
  }
633
633
  function Ye(e, t) {
634
634
  if ((e == null ? void 0 : e.kind) !== "cards")
635
635
  return e;
636
- const r = E(e.cardIds, t);
637
- return r.length > 0 ? { ...e, cardIds: r } : null;
636
+ const n = E(e.cardIds, t);
637
+ return n.length > 0 ? { ...e, cardIds: n } : null;
638
638
  }
639
639
  function Je(e, t) {
640
640
  return !e.applyToCardIds && !e.excludeCardIds ? e : {
@@ -654,23 +654,23 @@ function Je(e, t) {
654
654
  };
655
655
  }
656
656
  function Xe(e, t) {
657
- const r = {}, n = [];
657
+ const n = {}, r = [];
658
658
  return {
659
659
  inputs: (e.filterInputs || []).flatMap(
660
- (a, i) => {
661
- const d = Ye(a.scope, t);
660
+ (i, a) => {
661
+ const d = Ye(i.scope, t);
662
662
  if (d === null)
663
- return n.push(
663
+ return r.push(
664
664
  fe(
665
665
  "filter_input_scope_empty",
666
- `Filter input "${a.label}" was skipped because all scoped cards were skipped during query validation.`
666
+ `Filter input "${i.label}" was skipped because all scoped cards were skipped during query validation.`
667
667
  )
668
668
  ), [];
669
669
  const s = G(
670
- a.filter,
671
- a.defaultValue
670
+ i.filter,
671
+ i.defaultValue
672
672
  );
673
- return s && (r.shared ?? (r.shared = {}), r.shared[a.id] = {
673
+ return s && (n.shared ?? (n.shared = {}), n.shared[i.id] = {
674
674
  status: "set",
675
675
  value: {
676
676
  kind: "filter",
@@ -678,24 +678,24 @@ function Xe(e, t) {
678
678
  }
679
679
  }), [
680
680
  {
681
- id: a.id,
681
+ id: i.id,
682
682
  kind: "filter",
683
- label: a.label,
684
- variableName: a.variableName,
683
+ label: i.label,
684
+ variableName: i.variableName,
685
685
  scope: d || { kind: "allSheets", sheetKinds: ["dashboard"] },
686
686
  runtimeScope: "shared",
687
687
  presentation: {
688
688
  placement: "toolbar",
689
- order: i
689
+ order: a
690
690
  },
691
691
  exports: ["label", "value", "start", "end", "range"],
692
- filter: Je(a.filter, t)
692
+ filter: Je(i.filter, t)
693
693
  }
694
694
  ];
695
695
  }
696
696
  ),
697
- warnings: n,
698
- defaultInputValues: r.shared && Object.keys(r.shared).length > 0 ? r : void 0
697
+ warnings: r,
698
+ defaultInputValues: n.shared && Object.keys(n.shared).length > 0 ? n : void 0
699
699
  };
700
700
  }
701
701
  function At(e) {
@@ -706,16 +706,16 @@ function At(e) {
706
706
  t.errors.map((c) => c.message).join(`
707
707
  `) || "Dashboard plan is invalid."
708
708
  );
709
- const r = e.plan.sheets[0], n = [...t.warnings], o = [], a = new Map(
709
+ const n = e.plan.sheets[0], r = [...t.warnings], o = [], i = new Map(
710
710
  e.cardArtifacts.map((c) => [c.planCardId, c])
711
- ), i = new Map(
711
+ ), a = new Map(
712
712
  e.cardArtifacts.map((c) => [
713
713
  c.planCardId,
714
714
  c.card.id
715
715
  ])
716
716
  ), d = [];
717
- for (const c of r.cards) {
718
- const f = a.get(c.id);
717
+ for (const c of n.cards) {
718
+ const f = i.get(c.id);
719
719
  if (!f) {
720
720
  const l = fe(
721
721
  "missing_card_artifact",
@@ -725,7 +725,7 @@ function At(e) {
725
725
  o.push(l);
726
726
  continue;
727
727
  }
728
- n.push(...f.warnings || []);
728
+ r.push(...f.warnings || []);
729
729
  const b = Qe(
730
730
  f.card,
731
731
  e.plan.calculatedFields,
@@ -739,10 +739,10 @@ function At(e) {
739
739
  }
740
740
  if (d.length === 0)
741
741
  throw new Error("Dashboard plan did not produce any persistable cards.");
742
- const { inputs: s, defaultInputValues: u, warnings: h } = Xe(e.plan, i);
743
- n.push(...h);
742
+ const { inputs: s, defaultInputValues: u, warnings: h } = Xe(e.plan, a);
743
+ r.push(...h);
744
744
  const I = K(
745
- r.cards.filter((c) => d.some((f) => f.id === c.frameId)).map((c) => ({
745
+ n.cards.filter((c) => d.some((f) => f.id === c.frameId)).map((c) => ({
746
746
  frameId: c.frameId,
747
747
  priority: c.priority,
748
748
  role: c.role
@@ -754,10 +754,10 @@ function At(e) {
754
754
  description: e.plan.description || "",
755
755
  sheets: [
756
756
  {
757
- id: r.id,
757
+ id: n.id,
758
758
  kind: "dashboard",
759
- title: r.title,
760
- description: r.description,
759
+ title: n.title,
760
+ description: n.description,
761
761
  frames: d,
762
762
  layouts: I,
763
763
  calculatedFields: (v = e.plan.calculatedFields) == null ? void 0 : v.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
@@ -766,10 +766,10 @@ function At(e) {
766
766
  calculatedFields: (y = e.plan.calculatedFields) == null ? void 0 : y.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
767
767
  inputs: s,
768
768
  ...u ? { defaultInputValues: u } : {}
769
- }, warnings: n, skippedOperations: o };
769
+ }, warnings: r, skippedOperations: o };
770
770
  }
771
- function A(e, t, r) {
772
- return r ? { code: e, message: t, cardId: r } : { code: e, message: t };
771
+ function A(e, t, n) {
772
+ return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
773
773
  }
774
774
  function Ze(e) {
775
775
  return JSON.parse(JSON.stringify(e));
@@ -777,83 +777,83 @@ function Ze(e) {
777
777
  function et(e) {
778
778
  var t;
779
779
  return (t = e.sheets) == null ? void 0 : t.find(
780
- (r) => (r.kind || "dashboard") === "dashboard"
780
+ (n) => (n.kind || "dashboard") === "dashboard"
781
781
  );
782
782
  }
783
783
  function q(e, t) {
784
- var r;
785
- for (const n of e.sheets || [])
786
- for (const o of n.frames || []) {
787
- const a = (r = o.cards) == null ? void 0 : r.find((i) => i.id === t);
788
- if (a)
789
- return { sheet: n, frame: o, card: a };
784
+ var n;
785
+ for (const r of e.sheets || [])
786
+ for (const o of r.frames || []) {
787
+ const i = (n = o.cards) == null ? void 0 : n.find((a) => a.id === t);
788
+ if (i)
789
+ return { sheet: r, frame: o, card: i };
790
790
  }
791
791
  return null;
792
792
  }
793
793
  function pe(e) {
794
- var r, n;
795
- const t = (n = (r = e.cards) == null ? void 0 : r[0]) == null ? void 0 : n.type;
794
+ var n, r;
795
+ const t = (r = (n = e.cards) == null ? void 0 : n[0]) == null ? void 0 : r.type;
796
796
  return t === "kpi" ? "kpi" : t === "table" || t === "detailTable" || t === "pivotTable" ? "table" : t === "text" ? "text" : "chart";
797
797
  }
798
798
  function tt(e) {
799
799
  var t;
800
800
  return new Map(
801
- (((t = e.layouts) == null ? void 0 : t.lg) || []).map((r, n) => [r.i, n])
801
+ (((t = e.layouts) == null ? void 0 : t.lg) || []).map((n, r) => [n.i, r])
802
802
  );
803
803
  }
804
804
  function he(e, t = /* @__PURE__ */ new Map()) {
805
- const r = tt(e), n = Math.max(
806
- r.size,
805
+ const n = tt(e), r = Math.max(
806
+ n.size,
807
807
  t.size
808
808
  ), o = (e.frames || []).map(
809
- (a, i) => ({
810
- frameId: a.id,
811
- role: pe(a),
812
- priority: t.get(a.id) ?? r.get(a.id) ?? n + i
809
+ (i, a) => ({
810
+ frameId: i.id,
811
+ role: pe(i),
812
+ priority: t.get(i.id) ?? n.get(i.id) ?? r + a
813
813
  })
814
814
  );
815
815
  e.layouts = K(o);
816
816
  }
817
- function rt(e) {
817
+ function nt(e) {
818
818
  return Object.values(e.layouts || {}).some((t) => t.length > 0);
819
819
  }
820
- function nt(e, t) {
821
- if (!rt(e)) {
820
+ function rt(e, t) {
821
+ if (!nt(e)) {
822
822
  he(e);
823
823
  return;
824
824
  }
825
- const r = K([
825
+ const n = K([
826
826
  { frameId: t.id, role: pe(t), priority: 0 }
827
827
  ]);
828
828
  e.layouts ?? (e.layouts = {});
829
- for (const [n, o] of Object.entries(r)) {
830
- const a = e.layouts[n] || [];
831
- if (a.some((s) => s.i === t.id))
829
+ for (const [r, o] of Object.entries(n)) {
830
+ const i = e.layouts[r] || [];
831
+ if (i.some((s) => s.i === t.id))
832
832
  continue;
833
- const i = o[0];
834
- if (!i)
833
+ const a = o[0];
834
+ if (!a)
835
835
  continue;
836
- const d = a.reduce(
836
+ const d = i.reduce(
837
837
  (s, u) => Math.max(s, u.y + u.h),
838
838
  0
839
839
  );
840
- e.layouts[n] = [
841
- ...a,
842
- { ...i, y: d }
840
+ e.layouts[r] = [
841
+ ...i,
842
+ { ...a, y: d }
843
843
  ];
844
844
  }
845
845
  }
846
846
  function at(e, t) {
847
- var n;
848
- const r = G(
847
+ var r;
848
+ const n = G(
849
849
  t.filter,
850
850
  t.defaultValue
851
851
  );
852
- r && (e.defaultInputValues ?? (e.defaultInputValues = {}), (n = e.defaultInputValues).shared ?? (n.shared = {}), e.defaultInputValues.shared[t.id] = {
852
+ n && (e.defaultInputValues ?? (e.defaultInputValues = {}), (r = e.defaultInputValues).shared ?? (r.shared = {}), e.defaultInputValues.shared[t.id] = {
853
853
  status: "set",
854
854
  value: {
855
855
  kind: "filter",
856
- filterValue: r
856
+ filterValue: n
857
857
  }
858
858
  });
859
859
  }
@@ -865,16 +865,16 @@ function xt(e) {
865
865
  t.errors.map((s) => s.message).join(`
866
866
  `) || "Dashboard change plan is invalid."
867
867
  );
868
- const r = Ze(e.dashboard), n = [...t.warnings], o = [], a = new Map(
868
+ const n = Ze(e.dashboard), r = [...t.warnings], o = [], i = new Map(
869
869
  e.cardArtifacts.map((s) => [s.planCardId, s])
870
- ), i = et(r);
871
- if (!i)
870
+ ), a = et(n);
871
+ if (!a)
872
872
  throw new Error("Dashboard has no editable dashboard sheet.");
873
- i.frames ?? (i.frames = []);
873
+ a.frames ?? (a.frames = []);
874
874
  for (const s of e.changePlan.operations)
875
875
  switch (s.kind) {
876
876
  case "addCard": {
877
- if ((i.frames || []).reduce(
877
+ if ((a.frames || []).reduce(
878
878
  (w, v) => {
879
879
  var y;
880
880
  return w + (((y = v.cards) == null ? void 0 : y.length) || 0);
@@ -890,7 +890,7 @@ function xt(e) {
890
890
  );
891
891
  break;
892
892
  }
893
- const h = a.get(s.card.id);
893
+ const h = i.get(s.card.id);
894
894
  if (!h) {
895
895
  o.push(
896
896
  A(
@@ -906,11 +906,11 @@ function xt(e) {
906
906
  cards: [h.card],
907
907
  activeCardId: h.card.id
908
908
  };
909
- i.frames.push(I), nt(i, I);
909
+ a.frames.push(I), rt(a, I);
910
910
  break;
911
911
  }
912
912
  case "addFilterInput": {
913
- r.inputs ?? (r.inputs = []);
913
+ n.inputs ?? (n.inputs = []);
914
914
  const u = {
915
915
  id: s.input.id,
916
916
  kind: "filter",
@@ -923,21 +923,21 @@ function xt(e) {
923
923
  runtimeScope: "shared",
924
924
  presentation: {
925
925
  placement: "toolbar",
926
- order: r.inputs.length
926
+ order: n.inputs.length
927
927
  },
928
928
  exports: ["label", "value", "start", "end", "range"],
929
929
  filter: s.input.filter
930
930
  };
931
- r.inputs.push(u), at(r, s.input);
931
+ n.inputs.push(u), at(n, s.input);
932
932
  break;
933
933
  }
934
934
  case "addCalculatedField": {
935
935
  if (s.field.scope === "dashboard" && s.field.field)
936
- r.calculatedFields ?? (r.calculatedFields = []), r.calculatedFields.push(s.field.field);
936
+ n.calculatedFields ?? (n.calculatedFields = []), n.calculatedFields.push(s.field.field);
937
937
  else if (s.field.scope === "sheet" && s.field.field)
938
- i.calculatedFields ?? (i.calculatedFields = []), i.calculatedFields.push(s.field.field);
938
+ a.calculatedFields ?? (a.calculatedFields = []), a.calculatedFields.push(s.field.field);
939
939
  else if (s.field.scope === "card" && s.field.field) {
940
- const u = s.field.targetCardId ? q(r, s.field.targetCardId) : null;
940
+ const u = s.field.targetCardId ? q(n, s.field.targetCardId) : null;
941
941
  u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(s.field.field)) : o.push(
942
942
  A(
943
943
  "missing_calculated_field_target",
@@ -948,7 +948,7 @@ function xt(e) {
948
948
  break;
949
949
  }
950
950
  case "renameCard": {
951
- const u = q(r, s.cardId);
951
+ const u = q(n, s.cardId);
952
952
  if (!u) {
953
953
  o.push(
954
954
  A(
@@ -965,14 +965,14 @@ function xt(e) {
965
965
  case "reorderCards": {
966
966
  const u = /* @__PURE__ */ new Map();
967
967
  for (let h = 0; h < s.cardIds.length; h += 1) {
968
- const I = s.cardIds[h], w = q(r, I);
968
+ const I = s.cardIds[h], w = q(n, I);
969
969
  w && u.set(w.frame.id, h);
970
970
  }
971
- he(i, u);
971
+ he(a, u);
972
972
  break;
973
973
  }
974
974
  case "reuseCalculatedField":
975
- n.push(
975
+ r.push(
976
976
  A(
977
977
  "reused_calculated_field",
978
978
  `Calculated field "${s.fieldId}" is reused by reference.`
@@ -985,10 +985,10 @@ function xt(e) {
985
985
  );
986
986
  break;
987
987
  }
988
- return { dashboard: r, warnings: n, skippedOperations: o };
988
+ return { dashboard: n, warnings: r, skippedOperations: o };
989
989
  }
990
- function g(e, t, r) {
991
- return r ? { code: e, message: t, cardId: r } : { code: e, message: t };
990
+ function g(e, t, n) {
991
+ return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
992
992
  }
993
993
  function F(e, t) {
994
994
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
@@ -996,10 +996,10 @@ function F(e, t) {
996
996
  function me(e, t) {
997
997
  if (!t.has(e))
998
998
  return t.add(e), e;
999
- let r = 2, n = `${e}-${r}`;
1000
- for (; t.has(n); )
1001
- r += 1, n = `${e}-${r}`;
1002
- return t.add(n), n;
999
+ let n = 2, r = `${e}-${n}`;
1000
+ for (; t.has(r); )
1001
+ n += 1, r = `${e}-${n}`;
1002
+ return t.add(r), r;
1003
1003
  }
1004
1004
  function $(e) {
1005
1005
  return !!(e && typeof e == "object");
@@ -1023,97 +1023,97 @@ function k(e) {
1023
1023
  if (!Array.isArray(e))
1024
1024
  return [];
1025
1025
  const t = [];
1026
- for (const r of e) {
1027
- const n = S(r);
1028
- n && t.push(n);
1026
+ for (const n of e) {
1027
+ const r = S(n);
1028
+ r && t.push(r);
1029
1029
  }
1030
1030
  return t;
1031
1031
  }
1032
1032
  function it(e) {
1033
- var n, o, a;
1033
+ var r, o, i;
1034
1034
  if (!e)
1035
1035
  return [];
1036
1036
  const t = [];
1037
1037
  if (T(e.source) && t.push(e.source), e.kind === "metric") {
1038
1038
  t.push(...k(e.measures));
1039
- const i = S(e.dateField);
1040
- i && t.push(i), t.push(...k(e.dimensions)), t.push(
1039
+ const a = S(e.dateField);
1040
+ a && t.push(a), t.push(...k(e.dimensions)), t.push(
1041
1041
  ...k(
1042
- (n = e.filters) == null ? void 0 : n.map((d) => d.field)
1042
+ (r = e.filters) == null ? void 0 : r.map((d) => d.field)
1043
1043
  )
1044
1044
  );
1045
1045
  } else if (e.kind === "records") {
1046
- const i = S(e.dateField);
1047
- i && t.push(i), t.push(...k(e.fields)), t.push(
1046
+ const a = S(e.dateField);
1047
+ a && t.push(a), t.push(...k(e.fields)), t.push(
1048
1048
  ...k(
1049
1049
  (o = e.filters) == null ? void 0 : o.map((d) => d.field)
1050
1050
  )
1051
1051
  );
1052
- } else e.kind === "inputOptions" ? (((a = e.population) == null ? void 0 : a.kind) === "related_population" && T(e.population.baseSource) && t.push(e.population.baseSource), t.push(
1052
+ } else e.kind === "inputOptions" ? (((i = e.population) == null ? void 0 : i.kind) === "related_population" && T(e.population.baseSource) && t.push(e.population.baseSource), t.push(
1053
1053
  ...k([
1054
1054
  e.labelField,
1055
1055
  e.valueField,
1056
1056
  e.searchField,
1057
1057
  ...e.disambiguationFields || []
1058
- ].filter((i) => !!i))
1058
+ ].filter((a) => !!a))
1059
1059
  )) : e.kind === "sql" && t.push(...k(e.fields));
1060
- const r = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
1061
- for (const i of r) {
1062
- const d = S(i.field);
1060
+ const n = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
1061
+ for (const a of n) {
1062
+ const d = S(a.field);
1063
1063
  d && t.push(d);
1064
1064
  }
1065
1065
  return t;
1066
1066
  }
1067
1067
  function ot(e) {
1068
1068
  const t = [];
1069
- for (const r of be(e)) {
1070
- const n = S(r.field);
1071
- n && t.push(n);
1069
+ for (const n of be(e)) {
1070
+ const r = S(n.field);
1071
+ r && t.push(r);
1072
1072
  }
1073
- for (const r of U(e))
1074
- for (const n of Q(r))
1075
- t.push(...it(n.analytics));
1073
+ for (const n of U(e))
1074
+ for (const r of Q(n))
1075
+ t.push(...it(r.analytics));
1076
1076
  return t;
1077
1077
  }
1078
1078
  function st(e) {
1079
- var r;
1079
+ var n;
1080
1080
  const t = [];
1081
- for (const n of U(e))
1082
- for (const o of Q(n))
1083
- T((r = o.analytics) == null ? void 0 : r.source) && t.push(o.analytics.source);
1081
+ for (const r of U(e))
1082
+ for (const o of Q(r))
1083
+ T((n = o.analytics) == null ? void 0 : n.source) && t.push(o.analytics.source);
1084
1084
  return t;
1085
1085
  }
1086
1086
  function dt(e, t) {
1087
- const r = P(e).filter(T);
1088
- if (r.length === 0)
1087
+ const n = P(e).filter(T);
1088
+ if (n.length === 0)
1089
1089
  return t.push(
1090
1090
  g(
1091
1091
  "missing_materializable_dataset",
1092
1092
  "No semantic or physical source could be converted into the current dashboard authoring dataset reference."
1093
1093
  )
1094
1094
  ), [];
1095
- const n = r.every((a) => a.kind === "semantic"), o = Array.from(
1095
+ const r = n.every((i) => i.kind === "semantic"), o = Array.from(
1096
1096
  new Set(
1097
- r.filter((a) => a.kind === "semantic").map((a) => a.domainId)
1097
+ n.filter((i) => i.kind === "semantic").map((i) => i.domainId)
1098
1098
  )
1099
1099
  );
1100
- return r.length > 1 && (!n || o.length !== 1) ? (t.push(
1100
+ return n.length > 1 && (!r || o.length !== 1) ? (t.push(
1101
1101
  g(
1102
1102
  "multiple_datasets_out_of_scope",
1103
1103
  "The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
1104
1104
  )
1105
- ), [r[0]]) : r;
1105
+ ), [n[0]]) : n;
1106
1106
  }
1107
1107
  function ct(e, t) {
1108
- const r = U(e), n = be(e), o = P(ot(e)), a = P(
1108
+ const n = U(e), r = be(e), o = P(ot(e)), i = P(
1109
1109
  st(e)
1110
1110
  );
1111
1111
  return {
1112
- sections: r,
1113
- inputs: n,
1112
+ sections: n,
1113
+ inputs: r,
1114
1114
  sources: o,
1115
- primarySources: a,
1116
- defaultSource: a.length === 1 ? a[0] : void 0,
1115
+ primarySources: i,
1116
+ defaultSource: i.length === 1 ? i[0] : void 0,
1117
1117
  datasets: dt(o, t)
1118
1118
  };
1119
1119
  }
@@ -1140,8 +1140,8 @@ function ut(e) {
1140
1140
  }
1141
1141
  }
1142
1142
  function ft(e) {
1143
- var t, r, n;
1144
- return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((r = e.presentation) == null ? void 0 : r.kind) === "table" ? "table" : ((n = e.presentation) == null ? void 0 : n.kind) === "text" ? "text" : "chart";
1143
+ var t, n, r;
1144
+ return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((n = e.presentation) == null ? void 0 : n.kind) === "table" ? "table" : ((r = e.presentation) == null ? void 0 : r.kind) === "text" ? "text" : "chart";
1145
1145
  }
1146
1146
  function pt(e) {
1147
1147
  const t = Se(e);
@@ -1165,29 +1165,29 @@ function mt(e) {
1165
1165
  if (!(!e || e.kind !== "physical"))
1166
1166
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
1167
1167
  }
1168
- function bt(e, t, r, n, o, a) {
1168
+ function bt(e, t, n, r, o, i) {
1169
1169
  if (e.kind !== "filter")
1170
- return a.push(
1170
+ return i.push(
1171
1171
  g(
1172
1172
  "control_inputs_deferred",
1173
1173
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
1174
1174
  )
1175
1175
  ), null;
1176
1176
  if (!$(e.field) || typeof e.field.name != "string")
1177
- return a.push(
1177
+ return i.push(
1178
1178
  g(
1179
1179
  "filter_requires_field",
1180
1180
  `Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
1181
1181
  )
1182
1182
  ), null;
1183
- const i = De({
1183
+ const a = De({
1184
1184
  explicitSource: void 0,
1185
1185
  field: e.field,
1186
1186
  defaultSource: t,
1187
- fallbackSources: r
1188
- }), d = (i == null ? void 0 : i.kind) === "semantic" || (i == null ? void 0 : i.kind) === "physical" ? i.connectionId : void 0;
1187
+ fallbackSources: n
1188
+ }), d = (a == null ? void 0 : a.kind) === "semantic" || (a == null ? void 0 : a.kind) === "physical" ? a.connectionId : void 0;
1189
1189
  if (!d)
1190
- return a.push(
1190
+ return i.push(
1191
1191
  g(
1192
1192
  "filter_requires_connection_id",
1193
1193
  `Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
@@ -1203,28 +1203,42 @@ function bt(e, t, r, n, o, a) {
1203
1203
  title: e.label,
1204
1204
  column: e.field.name,
1205
1205
  dataType: ht(e),
1206
- qualifiedTableName: mt(i),
1206
+ qualifiedTableName: mt(a),
1207
1207
  sql: "",
1208
1208
  operation: pt(e.operator),
1209
1209
  type: e.multi === !1 ? "single" : "multiple",
1210
1210
  location: "dashboard",
1211
1211
  displayMode: "toolbar",
1212
- fieldMeta: (i == null ? void 0 : i.kind) === "semantic" ? {
1212
+ fieldMeta: (a == null ? void 0 : a.kind) === "semantic" ? {
1213
1213
  name: e.field.name,
1214
1214
  qualifiedFieldName: e.field.name,
1215
1215
  dataType: e.field.dataType,
1216
1216
  role: e.field.role === "measure" ? "metric" : "groupby"
1217
1217
  } : void 0,
1218
- semanticContext: (i == null ? void 0 : i.kind) === "semantic" ? {
1219
- semanticDomainId: i.domainId,
1220
- connectionId: i.connectionId
1218
+ semanticContext: (a == null ? void 0 : a.kind) === "semantic" ? {
1219
+ semanticDomainId: a.domainId,
1220
+ connectionId: a.connectionId
1221
+ } : (a == null ? void 0 : a.kind) === "physical" ? {
1222
+ connectionId: a.connectionId,
1223
+ connectionType: a.connectionType,
1224
+ selectedEntities: [
1225
+ {
1226
+ type: "table",
1227
+ connectionId: a.connectionId,
1228
+ connectionType: a.connectionType,
1229
+ dialect: a.dialect,
1230
+ database: a.databaseName,
1231
+ schema: a.schemaName,
1232
+ name: a.tableName
1233
+ }
1234
+ ]
1221
1235
  } : void 0
1222
1236
  };
1223
1237
  return {
1224
1238
  id: e.id,
1225
1239
  label: e.label,
1226
1240
  variableName: e.id,
1227
- scope: n,
1241
+ scope: r,
1228
1242
  filter: h,
1229
1243
  defaultValue: G(
1230
1244
  h,
@@ -1233,28 +1247,28 @@ function bt(e, t, r, n, o, a) {
1233
1247
  };
1234
1248
  }
1235
1249
  function V(e) {
1236
- const t = [], r = [];
1237
- for (const n of e.viewIds) {
1238
- const o = e.viewIdToCardId.get(n);
1239
- o ? t.push(o) : r.push(n);
1250
+ const t = [], n = [];
1251
+ for (const r of e.viewIds) {
1252
+ const o = e.viewIdToCardId.get(r);
1253
+ o ? t.push(o) : n.push(r);
1240
1254
  }
1241
- return r.length > 0 && e.warnings.push(
1255
+ return n.length > 0 && e.warnings.push(
1242
1256
  g(
1243
1257
  "input_scope_view_not_found",
1244
- `Filter "${e.inputLabel}" referenced unknown view ids: ${r.join(", ")}.`
1258
+ `Filter "${e.inputLabel}" referenced unknown view ids: ${n.join(", ")}.`
1245
1259
  )
1246
1260
  ), Array.from(new Set(t));
1247
1261
  }
1248
1262
  function gt(e) {
1249
- var n, o;
1263
+ var r, o;
1250
1264
  if (!e.protocolScope) {
1251
- const a = Array.from(new Set(e.boundCardIds));
1252
- return a.length > 0 && a.length < e.allCardIds.length ? { kind: "cards", cardIds: a } : void 0;
1265
+ const i = Array.from(new Set(e.boundCardIds));
1266
+ return i.length > 0 && i.length < e.allCardIds.length ? { kind: "cards", cardIds: i } : void 0;
1253
1267
  }
1254
1268
  if (e.protocolScope.level === "dashboard") {
1255
- if (!((n = e.protocolScope.excludeViewIds) != null && n.length))
1269
+ if (!((r = e.protocolScope.excludeViewIds) != null && r.length))
1256
1270
  return;
1257
- const a = new Set(
1271
+ const i = new Set(
1258
1272
  V({
1259
1273
  inputLabel: e.inputLabel,
1260
1274
  viewIds: e.protocolScope.excludeViewIds,
@@ -1264,22 +1278,22 @@ function gt(e) {
1264
1278
  );
1265
1279
  return {
1266
1280
  kind: "cards",
1267
- cardIds: e.allCardIds.filter((i) => !a.has(i))
1281
+ cardIds: e.allCardIds.filter((a) => !i.has(a))
1268
1282
  };
1269
1283
  }
1270
1284
  if (e.protocolScope.level === "view") {
1271
- const a = V({
1285
+ const i = V({
1272
1286
  inputLabel: e.inputLabel,
1273
1287
  viewIds: e.protocolScope.viewIds,
1274
1288
  viewIdToCardId: e.viewIdToCardId,
1275
1289
  warnings: e.warnings
1276
1290
  });
1277
- return a.length === 0 ? (e.warnings.push(
1291
+ return i.length === 0 ? (e.warnings.push(
1278
1292
  g(
1279
1293
  "input_scope_has_no_materialized_cards",
1280
1294
  `Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
1281
1295
  )
1282
- ), null) : { kind: "cards", cardIds: a };
1296
+ ), null) : { kind: "cards", cardIds: i };
1283
1297
  }
1284
1298
  const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
1285
1299
  if (t.length === 0)
@@ -1291,7 +1305,7 @@ function gt(e) {
1291
1305
  ), null;
1292
1306
  if (!((o = e.protocolScope.excludeViewIds) != null && o.length))
1293
1307
  return { kind: "cards", cardIds: t };
1294
- const r = new Set(
1308
+ const n = new Set(
1295
1309
  V({
1296
1310
  inputLabel: e.inputLabel,
1297
1311
  viewIds: e.protocolScope.excludeViewIds,
@@ -1301,21 +1315,21 @@ function gt(e) {
1301
1315
  );
1302
1316
  return {
1303
1317
  kind: "cards",
1304
- cardIds: t.filter((a) => !r.has(a))
1318
+ cardIds: t.filter((i) => !n.has(i))
1305
1319
  };
1306
1320
  }
1307
1321
  function Ft(e) {
1308
1322
  var v, y, c;
1309
- const t = [], r = ve(e);
1310
- for (const f of r.warnings)
1323
+ const t = [], n = ve(e);
1324
+ for (const f of n.warnings)
1311
1325
  t.push(g(f.code, f.message));
1312
- for (const f of r.errors)
1326
+ for (const f of n.errors)
1313
1327
  t.push(g(f.code, f.message));
1314
- const n = ct(e, t), o = [], a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1328
+ const r = ct(e, t), o = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1315
1329
  let h = 0;
1316
- for (const [f, b] of n.sections.entries()) {
1330
+ for (const [f, b] of r.sections.entries()) {
1317
1331
  const l = typeof b.title == "string" ? b.title : `Section ${f + 1}`, Y = b.id || F(l, `section-${f + 1}`);
1318
- i.set(Y, []);
1332
+ a.set(Y, []);
1319
1333
  for (const [J, m] of Q(b).entries()) {
1320
1334
  const X = ut(m), O = F(
1321
1335
  m.id || `${l}-${m.title || `View ${J + 1}`}`,
@@ -1342,7 +1356,7 @@ function Ft(e) {
1342
1356
  continue;
1343
1357
  }
1344
1358
  const Z = me(O, s), M = `card-${Z}`;
1345
- m.id && a.set(m.id, M), (c = i.get(Y)) == null || c.push(M);
1359
+ m.id && i.set(m.id, M), (c = a.get(Y)) == null || c.push(M);
1346
1360
  const ge = m.analytics && "inputs" in m.analytics ? m.analytics.inputs : void 0;
1347
1361
  for (const ee of ge || []) {
1348
1362
  const te = d.get(ee.inputId) || [];
@@ -1362,20 +1376,20 @@ function Ft(e) {
1362
1376
  }), h += 1;
1363
1377
  }
1364
1378
  }
1365
- const I = n.inputs.map((f) => {
1379
+ const I = r.inputs.map((f) => {
1366
1380
  const b = gt({
1367
1381
  protocolScope: f.scope,
1368
1382
  inputLabel: f.label,
1369
1383
  allCardIds: o.map((l) => l.id),
1370
1384
  boundCardIds: d.get(f.id) || [],
1371
- viewIdToCardId: a,
1372
- sectionIdToCardIds: i,
1385
+ viewIdToCardId: i,
1386
+ sectionIdToCardIds: a,
1373
1387
  warnings: t
1374
1388
  });
1375
1389
  return b === null ? null : bt(
1376
1390
  f,
1377
- n.defaultSource,
1378
- n.sources,
1391
+ r.defaultSource,
1392
+ r.sources,
1379
1393
  b,
1380
1394
  u,
1381
1395
  t
@@ -1386,7 +1400,7 @@ function Ft(e) {
1386
1400
  id: `plan-${F(e.title, "dashboard")}`,
1387
1401
  title: e.title,
1388
1402
  description: e.description,
1389
- datasets: n.datasets,
1403
+ datasets: r.datasets,
1390
1404
  sheets: [
1391
1405
  {
1392
1406
  id: `sheet-${F(e.title, "dashboard")}`,
@@ -1398,7 +1412,7 @@ function Ft(e) {
1398
1412
  ],
1399
1413
  filterInputs: I.length ? I : void 0,
1400
1414
  warnings: t.length ? t : void 0,
1401
- unresolvedRequests: r.ok ? void 0 : r.errors.map((f) => f.message)
1415
+ unresolvedRequests: n.ok ? void 0 : n.errors.map((f) => f.message)
1402
1416
  }, warnings: t };
1403
1417
  }
1404
1418
  export {
@@ -1422,32 +1436,32 @@ export {
1422
1436
  Zt as dashboardFilterValueTypeForDataType,
1423
1437
  Ft as dashboardPlanFromSemaphorDashboardIntent,
1424
1438
  Dt as findDashboardAuthoringDatasetForSource,
1425
- er as findDashboardCardExecutableSource,
1426
- tr as findDashboardCardPinnedCatalogSource,
1427
- rr as findDashboardSqlPinnedCatalogSource,
1439
+ en as findDashboardCardExecutableSource,
1440
+ tn as findDashboardCardPinnedCatalogSource,
1441
+ nn as findDashboardSqlPinnedCatalogSource,
1428
1442
  Ne as getDashboardAuthoringCardSource,
1429
- nr as getDashboardFilterSubscriptionHint,
1443
+ rn as getDashboardFilterSubscriptionHint,
1430
1444
  Bt as getTemporalBucketAuthoringOptions,
1431
1445
  Rt as getTemporalBucketAuthoringSelection,
1432
- ar as hasDashboardFilterSubscription,
1433
- ir as isDashboardFilterOperationCompatible,
1446
+ an as hasDashboardFilterSubscription,
1447
+ on as isDashboardFilterOperationCompatible,
1434
1448
  T as isMaterializableDashboardAuthoringSource,
1435
1449
  Pt as isSemaphorCartesianChartType,
1436
1450
  Ce as isSemaphorSourceRef,
1437
1451
  P as mergeDashboardAuthoringSources,
1438
- or as normalizeDashboardInputs,
1452
+ sn as normalizeDashboardInputs,
1439
1453
  ke as preferDashboardAuthoringSourceMetadata,
1440
1454
  Ct as preferredDashboardAuthoringSource,
1441
1455
  Ot as previewTemporalBucketAuthoringFormat,
1442
1456
  zt as reconcileTemporalBucketAuthoringFormat,
1443
- sr as requireNormalizedDashboardInputs,
1457
+ dn as requireNormalizedDashboardInputs,
1444
1458
  Ht as resolveCanonicalDetailResultRawKey,
1445
1459
  Wt as resolveCanonicalResultOutputKey,
1446
1460
  Kt as resolveCanonicalResultRawKey,
1447
1461
  De as resolveDashboardAuthoringSource,
1448
- dr as resolveDashboardFilterAutomaticTarget,
1449
- cr as resolveDashboardFilterInheritedTarget,
1450
- lr as resolveDashboardSqlFilterTarget,
1462
+ cn as resolveDashboardFilterAutomaticTarget,
1463
+ ln as resolveDashboardFilterInheritedTarget,
1464
+ un as resolveDashboardSqlFilterTarget,
1451
1465
  qt as resolveTemporalBucketAuthoringFormat,
1452
1466
  Vt as resolveTemporalResultOwner,
1453
1467
  Lt as supportsCanonicalDashboardTemporalResult,