react-semaphor 0.1.338 → 0.1.340

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 (59) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +58 -57
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +3 -3
  5. package/dist/chunks/{braces-Q86XHDaD.js → braces-Ccvdip75.js} +1 -1
  6. package/dist/chunks/{braces-BLa_lORs.js → braces-DDHkbW1c.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-Cocogo9H.js → calendar-preferences-dialog-2IbYrrP1.js} +3 -3
  8. package/dist/chunks/{calendar-preferences-dialog-Bm7ji3k9.js → calendar-preferences-dialog-8-KE5sVX.js} +1 -1
  9. package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +100 -0
  10. package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +1 -0
  11. package/dist/chunks/{chevrons-up-down-BBTZ5pAY.js → chevrons-up-down-B9fTSds9.js} +1 -1
  12. package/dist/chunks/{chevrons-up-down-CYuWasy_.js → chevrons-up-down-pV0i9ptS.js} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-BtqtLx1-.js → dashboard-briefing-launcher-CcqDPVke.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-DF4CoaRn.js → dashboard-briefing-launcher-DtxDRAiu.js} +4 -4
  15. package/dist/chunks/{dashboard-controls-B5U-VUxs.js → dashboard-controls-Bi98DhYD.js} +6 -6
  16. package/dist/chunks/{dashboard-controls-0VMAeMoa.js → dashboard-controls-By7aKmDj.js} +1 -1
  17. package/dist/chunks/{dashboard-json-CqbLOfnr.js → dashboard-json-BOyLuhS6.js} +1 -1
  18. package/dist/chunks/{dashboard-json-Hmc0Ri5z.js → dashboard-json-CGxIsTEP.js} +2 -2
  19. package/dist/chunks/{edit-dashboard-visual-D4VVu-QQ.js → edit-dashboard-visual-Ba8LenNc.js} +6 -6
  20. package/dist/chunks/{edit-dashboard-visual-C0EDM0QB.js → edit-dashboard-visual-BuXlHmJH.js} +1 -1
  21. package/dist/chunks/{index-DE0vIuYG.js → index-DT9osgRT.js} +2 -2
  22. package/dist/chunks/{index-DzyUhzV3.js → index-DVPvpd8u.js} +5 -5
  23. package/dist/chunks/{palette-DalASD28.js → palette-BMXS-AcI.js} +1 -1
  24. package/dist/chunks/{palette-B9AbDw0n.js → palette-DKecBucs.js} +1 -1
  25. package/dist/chunks/{resource-management-panel-C4YydU9I.js → resource-management-panel-98Hy6SYB.js} +3 -3
  26. package/dist/chunks/{resource-management-panel-P9iNqBM1.js → resource-management-panel-ByR-FD3h.js} +1 -1
  27. package/dist/chunks/{switch-BAYfpAEb.js → switch-CP7SmEIZ.js} +1 -1
  28. package/dist/chunks/{switch-CyRoZr5T.js → switch-DYRgERrC.js} +1 -1
  29. package/dist/chunks/{use-create-flow-overlay-state-P1LMwQ89.js → use-create-flow-overlay-state-D5uvjbwY.js} +3 -3
  30. package/dist/chunks/{use-create-flow-overlay-state-CbhjxI3W.js → use-create-flow-overlay-state-uNxArZdj.js} +1 -1
  31. package/dist/chunks/{use-visual-utils-lB-3Zk0b.js → use-visual-utils-BLh9mKic.js} +2 -2
  32. package/dist/chunks/{use-visual-utils-CV6_-y4p.js → use-visual-utils-CpaqIHoc.js} +1 -1
  33. package/dist/chunks/{validators-BOqiGymD.js → validators-CPEQojnV.js} +325 -250
  34. package/dist/chunks/validators-CfP-49k9.js +1 -0
  35. package/dist/dashboard/index.cjs +1 -1
  36. package/dist/dashboard/index.js +1 -1
  37. package/dist/dashboard-authoring/index.cjs +3 -3
  38. package/dist/dashboard-authoring/index.js +424 -561
  39. package/dist/data-app-builder/index.cjs +1 -1
  40. package/dist/data-app-builder/index.js +1 -1
  41. package/dist/data-app-sdk/index.cjs +1 -1
  42. package/dist/data-app-sdk/index.js +313 -308
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +75 -49
  48. package/dist/types/dashboard-authoring.d.ts +26 -52
  49. package/dist/types/dashboard.d.ts +1 -2
  50. package/dist/types/data-app-builder.d.ts +23 -13
  51. package/dist/types/data-app-sdk.d.ts +33 -46
  52. package/dist/types/main.d.ts +29 -50
  53. package/dist/types/shared.d.ts +1 -2
  54. package/dist/types/surfboard.d.ts +1 -2
  55. package/dist/types/types.d.ts +1 -2
  56. package/package.json +1 -1
  57. package/dist/chunks/catalog-field-grounding-DmT7aGUA.js +0 -191
  58. package/dist/chunks/catalog-field-grounding-VgVzDd25.js +0 -1
  59. package/dist/chunks/validators-BtFXY3S_.js +0 -2
@@ -1,151 +1,132 @@
1
- import { b as ye } from "../chunks/catalog-field-grounding-DmT7aGUA.js";
2
- import { c as _e, v as we } from "../chunks/validators-BOqiGymD.js";
3
- const ve = [
1
+ import { s as he, d as W, p as me, v as ne, c as ge } from "../chunks/validators-CPEQojnV.js";
2
+ import { b as be } from "../chunks/catalog-field-grounding-DoEBOXQd.js";
3
+ const Ie = [
4
4
  "lg",
5
5
  "md",
6
6
  "sm",
7
7
  "xs",
8
8
  "xxs"
9
- ], B = 10;
9
+ ], P = 10;
10
10
  function _(e) {
11
11
  return e && typeof e == "object" ? e : null;
12
12
  }
13
- function k(e) {
13
+ function S(e) {
14
14
  return typeof e == "string" ? e : null;
15
15
  }
16
- function ke(e) {
16
+ function ye(e) {
17
17
  var t, n, r;
18
18
  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");
19
19
  }
20
- function R(e) {
21
- return ke(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
22
- }
23
- function re(e) {
24
- return e.kind === "semantic" ? [
25
- "semantic",
26
- e.domainId,
27
- e.datasetId || "",
28
- e.datasetName
29
- ].join(":") : e.kind === "physical" ? [
30
- "physical",
31
- e.connectionId,
32
- e.databaseName || "",
33
- e.schemaName || "",
34
- e.tableName
35
- ].join(":") : ["sql", e.connectionId, e.sql].join(":");
36
- }
37
- function G(e, t) {
38
- return e.domainId !== t.domainId ? !1 : e.datasetId && t.datasetId ? e.datasetId === t.datasetId : e.datasetName === t.datasetName;
39
- }
40
- function de(e, t) {
41
- return e.kind === "semantic" && t.kind === "semantic" ? G(e, t) : re(e) === re(t);
42
- }
43
- function Ae(e, t) {
44
- return e.kind !== "semantic" || t.kind !== "semantic" ? e : {
45
- ...e,
46
- datasetId: e.datasetId || t.datasetId,
47
- label: e.label || t.label,
48
- connectionId: e.connectionId || t.connectionId
49
- };
50
- }
51
20
  function V(e) {
21
+ return ye(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
22
+ }
23
+ function mt(e) {
24
+ return he(e);
25
+ }
26
+ function re(e, t) {
27
+ return W(e, t);
28
+ }
29
+ function _e(e, t) {
30
+ return me(e, t);
31
+ }
32
+ function B(e) {
52
33
  const t = [];
53
34
  for (const n of e) {
54
35
  const r = t.findIndex(
55
- (a) => de(a, n)
36
+ (a) => re(a, n)
56
37
  );
57
- r === -1 ? t.push(n) : t[r] = Ae(
38
+ r === -1 ? t.push(n) : t[r] = _e(
58
39
  t[r],
59
40
  n
60
41
  );
61
42
  }
62
43
  return t;
63
44
  }
64
- function kt(e) {
65
- return V(e)[0];
45
+ function gt(e) {
46
+ return B(e)[0];
66
47
  }
67
48
  function O(e, t) {
68
- return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !G(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
49
+ return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !W(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
69
50
  }
70
- function W(e) {
71
- return R(e) ? e : void 0;
51
+ function j(e) {
52
+ return V(e) ? e : void 0;
72
53
  }
73
- function ae(e, t) {
54
+ function te(e, t) {
74
55
  if (!(e.kind !== "semantic" || e.connectionId))
75
56
  return t.find(
76
- (n) => (n == null ? void 0 : n.kind) === "semantic" && G(e, n) && !!n.connectionId
57
+ (n) => (n == null ? void 0 : n.kind) === "semantic" && W(e, n) && !!n.connectionId
77
58
  );
78
59
  }
79
60
  function v(e, t) {
80
- const n = W(e == null ? void 0 : e.source);
61
+ const n = j(e == null ? void 0 : e.source);
81
62
  return n ? O(n, t) : void 0;
82
63
  }
83
- function Se({
64
+ function we({
84
65
  explicitSource: e,
85
66
  field: t,
86
67
  defaultSource: n,
87
68
  fallbackSources: r
88
69
  }) {
89
- const a = [n, ...r || []], i = W(e), s = i ? O(
70
+ const a = [n, ...r || []], i = j(e), o = i ? O(
90
71
  i,
91
- ae(i, a)
72
+ te(i, a)
92
73
  ) : void 0;
93
- if (s)
94
- return s;
74
+ if (o)
75
+ return o;
95
76
  if (e !== void 0)
96
77
  return;
97
- const d = v(t, n), o = d ? O(
78
+ const d = v(t, n), s = d ? O(
98
79
  d,
99
- ae(d, a)
80
+ te(d, a)
100
81
  ) : void 0;
101
- if (o)
102
- return o;
82
+ if (s)
83
+ return s;
103
84
  if ((t == null ? void 0 : t.source) === void 0)
104
- return W(n);
85
+ return j(n);
105
86
  }
106
- function Ce(e, t) {
87
+ function bt(e, t) {
107
88
  if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
108
89
  return !1;
109
90
  const n = v(e), r = v(t);
110
- return !n || !r ? !0 : de(n, r);
91
+ return !n || !r ? !0 : re(n, r);
111
92
  }
112
- function S(e) {
93
+ function x(e) {
113
94
  var t;
114
- return k((t = _(e)) == null ? void 0 : t.kind);
95
+ return S((t = _(e)) == null ? void 0 : t.kind);
115
96
  }
116
- function ce(e) {
97
+ function ae(e) {
117
98
  var t, n;
118
- return S(e) !== "semantic" ? null : ((n = k((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : n.trim()) || null;
99
+ return x(e) !== "semantic" ? null : ((n = S((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : n.trim()) || null;
119
100
  }
120
- function De(e) {
101
+ function ve(e) {
121
102
  var t;
122
- return S(e) !== "semantic" ? null : k((t = _(e)) == null ? void 0 : t.datasetName);
103
+ return x(e) !== "semantic" ? null : S((t = _(e)) == null ? void 0 : t.datasetName);
123
104
  }
124
- function xe(e) {
105
+ function Se(e) {
125
106
  var t;
126
- return S(e) !== "semantic" ? null : k((t = _(e)) == null ? void 0 : t.datasetId);
107
+ return x(e) !== "semantic" ? null : S((t = _(e)) == null ? void 0 : t.datasetId);
127
108
  }
128
- function Fe(e) {
109
+ function ke(e) {
129
110
  var t;
130
- return S(e) !== "physical" ? null : k((t = _(e)) == null ? void 0 : t.connectionId);
111
+ return x(e) !== "physical" ? null : S((t = _(e)) == null ? void 0 : t.connectionId);
131
112
  }
132
- function Ne(e) {
113
+ function xe(e) {
133
114
  var t;
134
- return S(e) !== "physical" ? null : k((t = _(e)) == null ? void 0 : t.tableName);
115
+ return x(e) !== "physical" ? null : S((t = _(e)) == null ? void 0 : t.tableName);
135
116
  }
136
- function Te(e) {
117
+ function Ce(e) {
137
118
  var t;
138
- return S(e) !== "physical" ? "" : k((t = _(e)) == null ? void 0 : t.databaseName) || "";
119
+ return x(e) !== "physical" ? "" : S((t = _(e)) == null ? void 0 : t.databaseName) || "";
139
120
  }
140
- function $e(e) {
121
+ function De(e) {
141
122
  var t;
142
- return S(e) !== "physical" ? "" : k((t = _(e)) == null ? void 0 : t.schemaName) || "";
123
+ return x(e) !== "physical" ? "" : S((t = _(e)) == null ? void 0 : t.schemaName) || "";
143
124
  }
144
- function Re(e) {
125
+ function Ae(e) {
145
126
  if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
146
127
  return e.analyticsIntent.source;
147
128
  }
148
- function Me({
129
+ function Fe({
149
130
  datasets: e,
150
131
  requireAtLeastOne: t
151
132
  }) {
@@ -153,27 +134,27 @@ function Me({
153
134
  return { ok: !1, issue: "invalid_dataset_count" };
154
135
  if (e.length <= 1)
155
136
  return { ok: !0 };
156
- const n = e.map(ce), r = new Set(n.filter(Boolean));
137
+ const n = e.map(ae), r = new Set(n.filter(Boolean));
157
138
  return n.some((a) => !a) || r.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
158
139
  }
159
- function H(e, t) {
140
+ function E(e, t) {
160
141
  if (!t)
161
142
  return !1;
162
143
  if (t.kind === "semantic") {
163
- const n = xe(e);
164
- return ce(e) === t.domainId ? n && t.datasetId ? n === t.datasetId : De(e) === t.datasetName : !1;
144
+ const n = Se(e);
145
+ return ae(e) === t.domainId ? n && t.datasetId ? n === t.datasetId : ve(e) === t.datasetName : !1;
165
146
  }
166
- return t.kind === "physical" ? Fe(e) === t.connectionId && Ne(e) === t.tableName && Te(e) === (t.databaseName || "") && $e(e) === (t.schemaName || "") : !1;
147
+ return t.kind === "physical" ? ke(e) === t.connectionId && xe(e) === t.tableName && Ce(e) === (t.databaseName || "") && De(e) === (t.schemaName || "") : !1;
167
148
  }
168
- function At(e, t) {
149
+ function It(e, t) {
169
150
  return e.find(
170
- (n) => H(n, t)
151
+ (n) => E(n, t)
171
152
  );
172
153
  }
173
154
  function f(e, t, n) {
174
155
  return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
175
156
  }
176
- function q(e) {
157
+ function M(e) {
177
158
  const t = /* @__PURE__ */ new Set();
178
159
  for (const n of e) {
179
160
  if (t.has(n))
@@ -182,14 +163,14 @@ function q(e) {
182
163
  }
183
164
  return null;
184
165
  }
185
- function ue({
166
+ function ie({
186
167
  card: e,
187
168
  datasets: t,
188
169
  errors: n
189
170
  }) {
190
171
  if (e.type === "text")
191
172
  return;
192
- const r = Re(e);
173
+ const r = Ae(e);
193
174
  if (!r) {
194
175
  if (t.length <= 1)
195
176
  return;
@@ -202,7 +183,7 @@ function ue({
202
183
  );
203
184
  return;
204
185
  }
205
- t.some((a) => H(a, r)) || n.push(
186
+ t.some((a) => E(a, r)) || n.push(
206
187
  f(
207
188
  "invalid_card_analytics_source",
208
189
  "Dashboard cards with an explicit analytics source must use one of the selected datasets.",
@@ -210,29 +191,49 @@ function ue({
210
191
  )
211
192
  );
212
193
  }
213
- function qe(e) {
214
- var t;
215
- return e ? [
216
- ...Array.isArray(e.metricRefs) ? e.metricRefs.map((n) => n.source) : [],
217
- (t = e.dateFieldRef) == null ? void 0 : t.source,
218
- ...Array.isArray(e.dimensionRefs) ? e.dimensionRefs.map((n) => n.source) : [],
219
- ...Array.isArray(e.filters) ? e.filters.map((n) => {
220
- var r;
221
- return (r = n.field) == null ? void 0 : r.source;
222
- }) : []
223
- ].filter(
224
- (n) => !!n
194
+ function N(e) {
195
+ return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
196
+ }
197
+ function R(e) {
198
+ return Array.isArray(e) ? e.filter(
199
+ (t) => !!(t && typeof t == "object")
225
200
  ) : [];
226
201
  }
227
- function le({
202
+ function Te(e) {
203
+ return Array.isArray(e) ? e.filter(
204
+ (t) => !!(t && typeof t == "object")
205
+ ) : [];
206
+ }
207
+ function $e(e) {
208
+ var n;
209
+ if (!e)
210
+ return [];
211
+ const t = [e.source];
212
+ return e.kind === "metric" ? t.push(
213
+ ...N([
214
+ ...R(e.metrics),
215
+ e.primaryMetric,
216
+ e.dateField,
217
+ ...R(e.dimensions),
218
+ ...Te(e.filters).map((r) => r.field)
219
+ ])
220
+ ) : e.kind === "records" ? t.push(
221
+ ...N([
222
+ ...R(e.fields),
223
+ e.dateField,
224
+ (n = e.orderBy) == null ? void 0 : n.field
225
+ ])
226
+ ) : e.kind === "inputOptions" ? t.push(...N([e.field])) : e.kind === "sql" && t.push(...N(e.fields || [])), t;
227
+ }
228
+ function oe({
228
229
  card: e,
229
230
  datasets: t,
230
231
  errors: n
231
232
  }) {
232
233
  if (e.type !== "text") {
233
- for (const r of qe(e.query))
234
+ for (const r of $e(e.analyticsIntent))
234
235
  if (r && !t.some(
235
- (a) => H(a, r)
236
+ (a) => E(a, r)
236
237
  )) {
237
238
  n.push(
238
239
  f(
@@ -245,56 +246,29 @@ function le({
245
246
  }
246
247
  }
247
248
  }
248
- function ie(e, t) {
249
- return e.length === t.length && e.every((n, r) => n === t[r]);
250
- }
251
- function fe({
249
+ function se({
252
250
  card: e,
253
251
  errors: t
254
252
  }) {
255
- if (e.type === "text" || !e.query)
256
- return;
257
- const { dateField: n, dateFieldRef: r, dimensions: a, dimensionRefs: i, metrics: s, metricRefs: d } = e.query;
258
- if (r && r.name !== n) {
259
- t.push(
260
- f(
261
- "invalid_card_query_ref",
262
- "Dashboard card source-aware date field reference must match the query date field.",
263
- e.id
264
- )
265
- );
253
+ if (e.type === "text" || !e.analyticsIntent)
266
254
  return;
267
- }
268
- if (Array.isArray(d)) {
269
- const p = Array.isArray(s) ? s : [], b = d.map((g) => g.name);
270
- if (!ie(b, p)) {
255
+ const n = ne(e.analyticsIntent);
256
+ if (!n.ok)
257
+ for (const r of n.errors)
271
258
  t.push(
272
259
  f(
273
- "invalid_card_query_ref",
274
- "Dashboard card source-aware metric references must match the query metrics.",
260
+ r.code,
261
+ r.path ? `${r.path}: ${r.message}` : r.message,
275
262
  e.id
276
263
  )
277
264
  );
278
- return;
279
- }
280
- }
281
- if (!Array.isArray(i))
282
- return;
283
- const o = Array.isArray(a) ? a : [], u = i.map((p) => p.name);
284
- ie(u, o) || t.push(
285
- f(
286
- "invalid_card_query_ref",
287
- "Dashboard card source-aware dimension references must match the query dimensions.",
288
- e.id
289
- )
290
- );
291
265
  }
292
- function me({
266
+ function de({
293
267
  datasets: e,
294
268
  errors: t,
295
269
  requireAtLeastOne: n
296
270
  }) {
297
- const r = Me({
271
+ const r = Fe({
298
272
  datasets: e,
299
273
  requireAtLeastOne: n
300
274
  });
@@ -316,8 +290,8 @@ function me({
316
290
  );
317
291
  }
318
292
  }
319
- function Pe(e) {
320
- var m, w;
293
+ function Me(e) {
294
+ var p, w;
321
295
  const t = [];
322
296
  if (!e || typeof e != "object")
323
297
  return {
@@ -331,30 +305,30 @@ function Pe(e) {
331
305
  warnings: []
332
306
  };
333
307
  const n = e, r = [...n.warnings || []];
334
- n.version !== 1 && t.push(f("invalid_version", "Dashboard plan version must be 1.")), (m = n.title) != null && m.trim() || t.push(f("missing_title", "Dashboard plan needs a title."));
308
+ n.version !== 1 && t.push(f("invalid_version", "Dashboard plan version must be 1.")), (p = n.title) != null && p.trim() || t.push(f("missing_title", "Dashboard plan needs a title."));
335
309
  const a = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.sheets) ? n.sheets : [];
336
- me({ datasets: a, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
310
+ de({ datasets: a, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
337
311
  f(
338
312
  "invalid_sheet_count",
339
313
  "MVP dashboard authoring creates exactly one dashboard sheet."
340
314
  )
341
315
  );
342
- const s = i[0];
343
- s && s.kind !== "dashboard" && t.push(
316
+ const o = i[0];
317
+ o && o.kind !== "dashboard" && t.push(
344
318
  f("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
345
319
  );
346
- const d = (s == null ? void 0 : s.cards) || [];
347
- d.length > B && t.push(
320
+ const d = (o == null ? void 0 : o.cards) || [];
321
+ d.length > P && t.push(
348
322
  f(
349
323
  "too_many_cards",
350
- `Generated dashboards can contain at most ${B} cards.`
324
+ `Generated dashboards can contain at most ${P} cards.`
351
325
  )
352
326
  );
353
- const o = q(d.map((l) => l.id));
354
- o && t.push(
355
- f("duplicate_card_id", `Duplicate generated card id: ${o}.`)
327
+ const s = M(d.map((l) => l.id));
328
+ s && t.push(
329
+ f("duplicate_card_id", `Duplicate generated card id: ${s}.`)
356
330
  );
357
- const u = q(d.map((l) => l.frameId));
331
+ const u = M(d.map((l) => l.frameId));
358
332
  u && t.push(
359
333
  f(
360
334
  "duplicate_frame_id",
@@ -368,29 +342,29 @@ function Pe(e) {
368
342
  "Whole-dashboard authoring supports built-in visual types only.",
369
343
  l.id
370
344
  )
371
- ), l.type !== "text" && !l.query && r.push(
345
+ ), l.type !== "text" && !l.analyticsIntent && r.push(
372
346
  f(
373
- "missing_query_intent",
374
- "Non-text card has no query intent and may be skipped by the app layer.",
347
+ "missing_analytics_intent",
348
+ "Non-text card has no analytics intent and may be skipped by the app layer.",
375
349
  l.id
376
350
  )
377
- ), ue({ card: l, datasets: a, errors: t }), fe({ card: l, errors: t }), le({ card: l, datasets: a, errors: t });
378
- const p = Array.isArray(n.filterInputs) ? n.filterInputs : [], b = p.map((l) => l.id), g = q(b);
379
- g && t.push(
351
+ ), ie({ card: l, datasets: a, errors: t }), se({ card: l, errors: t }), oe({ card: l, datasets: a, errors: t });
352
+ const h = Array.isArray(n.filterInputs) ? n.filterInputs : [], b = h.map((l) => l.id), y = M(b);
353
+ y && t.push(
380
354
  f(
381
355
  "duplicate_input_id",
382
- `Duplicate dashboard input id: ${g}.`
356
+ `Duplicate dashboard input id: ${y}.`
383
357
  )
384
358
  );
385
- const c = p.map((l) => l.variableName).filter(Boolean) || [], I = q(c);
386
- I && t.push(
359
+ const c = h.map((l) => l.variableName).filter(Boolean) || [], g = M(c);
360
+ g && t.push(
387
361
  f(
388
362
  "duplicate_input_variable",
389
- `Duplicate dashboard input variable name: ${I}.`
363
+ `Duplicate dashboard input variable name: ${g}.`
390
364
  )
391
365
  );
392
- const A = Array.isArray(n.calculatedFields) ? n.calculatedFields : [];
393
- for (const l of A)
366
+ const k = Array.isArray(n.calculatedFields) ? n.calculatedFields : [];
367
+ for (const l of k)
394
368
  l.scope === "domain" && l.reuseOnly !== !0 && t.push(
395
369
  f(
396
370
  "domain_calculated_field_create_out_of_scope",
@@ -399,8 +373,8 @@ function Pe(e) {
399
373
  );
400
374
  return { ok: t.length === 0, errors: t, warnings: r };
401
375
  }
402
- function Be(e) {
403
- var s;
376
+ function Ne(e) {
377
+ var o;
404
378
  const t = [];
405
379
  if (!e || typeof e != "object")
406
380
  return {
@@ -416,11 +390,11 @@ function Be(e) {
416
390
  const n = e, r = [...n.warnings || []];
417
391
  n.version !== 1 && t.push(
418
392
  f("invalid_version", "Dashboard change plan version must be 1.")
419
- ), (s = n.dashboardId) != null && s.trim() || t.push(
393
+ ), (o = n.dashboardId) != null && o.trim() || t.push(
420
394
  f("missing_dashboard_id", "Dashboard change plan needs a dashboard id.")
421
395
  );
422
396
  const a = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.operations) ? n.operations : [];
423
- me({ datasets: a, errors: t, requireAtLeastOne: !1 });
397
+ de({ datasets: a, errors: t, requireAtLeastOne: !1 });
424
398
  for (const d of i) {
425
399
  if (d.kind === "unsupported") {
426
400
  r.push(
@@ -434,14 +408,14 @@ function Be(e) {
434
408
  "Whole-dashboard authoring supports built-in visual types only.",
435
409
  d.card.id
436
410
  )
437
- ), d.kind === "addCard" && (ue({
411
+ ), d.kind === "addCard" && (ie({
438
412
  card: d.card,
439
413
  datasets: a,
440
414
  errors: t
441
- }), fe({
415
+ }), se({
442
416
  card: d.card,
443
417
  errors: t
444
- }), le({
418
+ }), oe({
445
419
  card: d.card,
446
420
  datasets: a,
447
421
  errors: t
@@ -454,83 +428,83 @@ function Be(e) {
454
428
  }
455
429
  return { ok: t.length === 0, errors: t, warnings: r };
456
430
  }
457
- const Ve = {
431
+ const Pe = {
458
432
  lg: 48,
459
433
  md: 36,
460
434
  sm: 24,
461
435
  xs: 12,
462
436
  xxs: 6
463
437
  };
464
- function ze(e, t) {
438
+ function Be(e, t) {
465
439
  let n = 0, r = 0, a = 0;
466
440
  return e.map((i) => {
467
- const s = Math.min(i.w, t);
468
- n > 0 && n + s > t && (n = 0, r += a, a = 0);
441
+ const o = Math.min(i.w, t);
442
+ n > 0 && n + o > t && (n = 0, r += a, a = 0);
469
443
  const d = {
470
444
  i: i.frameId,
471
445
  x: n,
472
446
  y: r,
473
- w: s,
447
+ w: o,
474
448
  h: i.h,
475
449
  minW: Math.min(i.minW, t),
476
450
  minH: i.minH,
477
451
  static: !1
478
452
  };
479
- return n += s, a = Math.max(a, i.h), d;
453
+ return n += o, a = Math.max(a, i.h), d;
480
454
  });
481
455
  }
482
- function je(e) {
483
- const t = [...e].sort((o, u) => o.priority - u.priority), n = t.filter((o) => o.role === "kpi"), r = t.filter((o) => o.role === "chart"), a = t.filter((o) => o.role === "table"), i = t.filter((o) => o.role === "text"), s = i.slice(0, 1), d = i.slice(s.length);
484
- return { kpis: n, introText: s, charts: r, tables: a, supportingText: d };
456
+ function Ve(e) {
457
+ const t = [...e].sort((s, u) => s.priority - u.priority), n = t.filter((s) => s.role === "kpi"), r = t.filter((s) => s.role === "chart"), a = t.filter((s) => s.role === "table"), i = t.filter((s) => s.role === "text"), o = i.slice(0, 1), d = i.slice(o.length);
458
+ return { kpis: n, introText: o, charts: r, tables: a, supportingText: d };
485
459
  }
486
- function Le(e, t, n) {
460
+ function ze(e, t, n) {
487
461
  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;
488
462
  }
489
- function Oe(e, t, n, r) {
463
+ function Re(e, t, n, r) {
490
464
  return n === "xxs" || n === "xs" || n === "sm" || n === "md" || t === 1 || t % 2 === 1 && e === 0 ? r : r / 2;
491
465
  }
492
- function We(e) {
493
- const { item: t, band: n, index: r, bandCount: a, breakpoint: i, columns: s } = e;
466
+ function qe(e) {
467
+ const { item: t, band: n, index: r, bandCount: a, breakpoint: i, columns: o } = e;
494
468
  return n === "kpi" ? {
495
469
  ...t,
496
470
  band: n,
497
- w: Le(a, i, s),
471
+ w: ze(a, i, o),
498
472
  h: 15,
499
- minW: Math.min(6, s),
473
+ minW: Math.min(6, o),
500
474
  minH: 12
501
475
  } : n === "table" ? {
502
476
  ...t,
503
477
  band: n,
504
- w: s,
478
+ w: o,
505
479
  h: i === "xxs" || i === "xs" ? 34 : 38,
506
- minW: Math.min(12, s),
480
+ minW: Math.min(12, o),
507
481
  minH: 18
508
482
  } : n === "introText" ? {
509
483
  ...t,
510
484
  band: n,
511
- w: s,
485
+ w: o,
512
486
  h: i === "xxs" || i === "xs" ? 12 : 10,
513
- minW: Math.min(12, s),
487
+ minW: Math.min(12, o),
514
488
  minH: 8
515
489
  } : n === "supportingText" ? {
516
490
  ...t,
517
491
  band: n,
518
- w: i === "lg" ? s / 2 : s,
492
+ w: i === "lg" ? o / 2 : o,
519
493
  h: i === "xxs" || i === "xs" ? 12 : 10,
520
- minW: Math.min(12, s),
494
+ minW: Math.min(12, o),
521
495
  minH: 8
522
496
  } : {
523
497
  ...t,
524
498
  band: n,
525
- w: Oe(r, a, i, s),
499
+ w: Re(r, a, i, o),
526
500
  h: i === "xxs" || i === "xs" ? 28 : 30,
527
- minW: Math.min(12, s),
501
+ minW: Math.min(12, o),
528
502
  minH: 16
529
503
  };
530
504
  }
531
- function F(e, t, n, r) {
505
+ function D(e, t, n, r) {
532
506
  return e.map(
533
- (a, i) => We({
507
+ (a, i) => qe({
534
508
  item: a,
535
509
  band: t,
536
510
  index: i,
@@ -540,37 +514,37 @@ function F(e, t, n, r) {
540
514
  })
541
515
  );
542
516
  }
543
- function U(e) {
544
- const t = je(e);
517
+ function H(e) {
518
+ const t = Ve(e);
545
519
  return Object.fromEntries(
546
- ve.map((n) => {
547
- const r = Ve[n], a = [
548
- ...F(t.introText, "introText", n, r),
549
- ...F(t.kpis, "kpi", n, r),
550
- ...F(t.charts, "chart", n, r),
551
- ...F(t.tables, "table", n, r),
552
- ...F(t.supportingText, "supportingText", n, r)
520
+ Ie.map((n) => {
521
+ const r = Pe[n], a = [
522
+ ...D(t.introText, "introText", n, r),
523
+ ...D(t.kpis, "kpi", n, r),
524
+ ...D(t.charts, "chart", n, r),
525
+ ...D(t.tables, "table", n, r),
526
+ ...D(t.supportingText, "supportingText", n, r)
553
527
  ];
554
- return [n, ze(a, r)];
528
+ return [n, Be(a, r)];
555
529
  })
556
530
  );
557
531
  }
558
- function Ee(e) {
559
- const t = ye(e);
532
+ function Le(e) {
533
+ const t = be(e);
560
534
  return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
561
535
  }
562
- function Ge(e) {
536
+ function Oe(e) {
563
537
  return !!(e && typeof e == "object" && !Array.isArray(e));
564
538
  }
565
- function He(e) {
566
- return Ge(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
539
+ function je(e) {
540
+ return Oe(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
567
541
  }
568
- function Ue(e) {
542
+ function We(e) {
569
543
  return e.filter(
570
544
  (t) => typeof t == "string" || typeof t == "number"
571
545
  );
572
546
  }
573
- function Ke(e) {
547
+ function Ee(e) {
574
548
  return e.filter(
575
549
  (t) => t instanceof Date || typeof t == "string"
576
550
  );
@@ -578,8 +552,8 @@ function Ke(e) {
578
552
  function K(e, t) {
579
553
  if (t === void 0)
580
554
  return;
581
- const n = Ee(e.dataType), r = e.operation || "in";
582
- if (He(t))
555
+ const n = Le(e.dataType), r = e.operation || "in";
556
+ if (je(t))
583
557
  return {
584
558
  ...t,
585
559
  filterId: e.id,
@@ -600,7 +574,7 @@ function K(e, t) {
600
574
  fieldMeta: e.fieldMeta,
601
575
  semanticContext: e.semanticContext
602
576
  };
603
- const a = Array.isArray(t) ? t : [t], i = n === "date" ? Ke(a) : Ue(a);
577
+ const a = Array.isArray(t) ? t : [t], i = n === "date" ? Ee(a) : We(a);
604
578
  if (i.length !== 0 && !((r === "between" || r === "not between") && i.length < 2))
605
579
  return {
606
580
  filterId: e.id,
@@ -613,10 +587,10 @@ function K(e, t) {
613
587
  semanticContext: e.semanticContext
614
588
  };
615
589
  }
616
- function Qe(e, t, n) {
590
+ function He(e, t, n) {
617
591
  return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
618
592
  }
619
- function Je(e, t, n) {
593
+ function Ke(e, t, n) {
620
594
  const r = (t || []).filter(
621
595
  (a) => a.scope === "card" && a.targetCardId === n
622
596
  ).map((a) => a.field).filter(Boolean);
@@ -628,7 +602,7 @@ function Je(e, t, n) {
628
602
  ]
629
603
  };
630
604
  }
631
- function Xe(e) {
605
+ function Ge(e) {
632
606
  const t = {};
633
607
  return {
634
608
  inputs: (e.filterInputs || []).map((r, a) => {
@@ -660,9 +634,9 @@ function Xe(e) {
660
634
  defaultInputValues: t.shared && Object.keys(t.shared).length > 0 ? t : void 0
661
635
  };
662
636
  }
663
- function St(e) {
664
- var b, g;
665
- const t = Pe(e.plan);
637
+ function yt(e) {
638
+ var b, y;
639
+ const t = Me(e.plan);
666
640
  if (!t.ok)
667
641
  throw new Error(
668
642
  t.errors.map((c) => c.message).join(`
@@ -670,34 +644,34 @@ function St(e) {
670
644
  );
671
645
  const n = e.plan.sheets[0], r = [...t.warnings], a = [], i = new Map(
672
646
  e.cardArtifacts.map((c) => [c.planCardId, c])
673
- ), s = [];
647
+ ), o = [];
674
648
  for (const c of n.cards) {
675
- const I = i.get(c.id);
676
- if (!I) {
677
- const m = Qe(
649
+ const g = i.get(c.id);
650
+ if (!g) {
651
+ const p = He(
678
652
  "missing_card_artifact",
679
653
  `Card "${c.title}" was skipped because no generated artifact was supplied.`,
680
654
  c.id
681
655
  );
682
- a.push(m);
656
+ a.push(p);
683
657
  continue;
684
658
  }
685
- r.push(...I.warnings || []);
686
- const A = Je(
687
- I.card,
659
+ r.push(...g.warnings || []);
660
+ const k = Ke(
661
+ g.card,
688
662
  e.plan.calculatedFields,
689
663
  c.id
690
664
  );
691
- s.push({
665
+ o.push({
692
666
  id: c.frameId,
693
- cards: [A],
694
- activeCardId: A.id
667
+ cards: [k],
668
+ activeCardId: k.id
695
669
  });
696
670
  }
697
- if (s.length === 0)
671
+ if (o.length === 0)
698
672
  throw new Error("Dashboard plan did not produce any persistable cards.");
699
- const { inputs: d, defaultInputValues: o } = Xe(e.plan), u = U(
700
- n.cards.filter((c) => s.some((I) => I.id === c.frameId)).map((c) => ({
673
+ const { inputs: d, defaultInputValues: s } = Ge(e.plan), u = H(
674
+ n.cards.filter((c) => o.some((g) => g.id === c.frameId)).map((c) => ({
701
675
  frameId: c.frameId,
702
676
  priority: c.priority,
703
677
  role: c.role
@@ -713,92 +687,92 @@ function St(e) {
713
687
  kind: "dashboard",
714
688
  title: n.title,
715
689
  description: n.description,
716
- frames: s,
690
+ frames: o,
717
691
  layouts: u,
718
692
  calculatedFields: (b = e.plan.calculatedFields) == null ? void 0 : b.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
719
693
  }
720
694
  ],
721
- calculatedFields: (g = e.plan.calculatedFields) == null ? void 0 : g.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
695
+ calculatedFields: (y = e.plan.calculatedFields) == null ? void 0 : y.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
722
696
  inputs: d,
723
- ...o ? { defaultInputValues: o } : {}
697
+ ...s ? { defaultInputValues: s } : {}
724
698
  }, warnings: r, skippedOperations: a };
725
699
  }
726
700
  function C(e, t, n) {
727
701
  return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
728
702
  }
729
- function Ye(e) {
703
+ function Ue(e) {
730
704
  return JSON.parse(JSON.stringify(e));
731
705
  }
732
- function Ze(e) {
706
+ function Je(e) {
733
707
  var t;
734
708
  return (t = e.sheets) == null ? void 0 : t.find(
735
709
  (n) => (n.kind || "dashboard") === "dashboard"
736
710
  );
737
711
  }
738
- function j(e, t) {
712
+ function q(e, t) {
739
713
  var n;
740
714
  for (const r of e.sheets || [])
741
715
  for (const a of r.frames || []) {
742
- const i = (n = a.cards) == null ? void 0 : n.find((s) => s.id === t);
716
+ const i = (n = a.cards) == null ? void 0 : n.find((o) => o.id === t);
743
717
  if (i)
744
718
  return { sheet: r, frame: a, card: i };
745
719
  }
746
720
  return null;
747
721
  }
748
- function pe(e) {
722
+ function ce(e) {
749
723
  var n, r;
750
724
  const t = (r = (n = e.cards) == null ? void 0 : n[0]) == null ? void 0 : r.type;
751
725
  return t === "kpi" ? "kpi" : t === "table" || t === "detailTable" || t === "pivotTable" ? "table" : t === "text" ? "text" : "chart";
752
726
  }
753
- function et(e) {
727
+ function Qe(e) {
754
728
  var t;
755
729
  return new Map(
756
730
  (((t = e.layouts) == null ? void 0 : t.lg) || []).map((n, r) => [n.i, r])
757
731
  );
758
732
  }
759
- function he(e, t = /* @__PURE__ */ new Map()) {
760
- const n = et(e), r = Math.max(
733
+ function le(e, t = /* @__PURE__ */ new Map()) {
734
+ const n = Qe(e), r = Math.max(
761
735
  n.size,
762
736
  t.size
763
737
  ), a = (e.frames || []).map(
764
- (i, s) => ({
738
+ (i, o) => ({
765
739
  frameId: i.id,
766
- role: pe(i),
767
- priority: t.get(i.id) ?? n.get(i.id) ?? r + s
740
+ role: ce(i),
741
+ priority: t.get(i.id) ?? n.get(i.id) ?? r + o
768
742
  })
769
743
  );
770
- e.layouts = U(a);
744
+ e.layouts = H(a);
771
745
  }
772
- function tt(e) {
746
+ function Xe(e) {
773
747
  return Object.values(e.layouts || {}).some((t) => t.length > 0);
774
748
  }
775
- function nt(e, t) {
776
- if (!tt(e)) {
777
- he(e);
749
+ function Ye(e, t) {
750
+ if (!Xe(e)) {
751
+ le(e);
778
752
  return;
779
753
  }
780
- const n = U([
781
- { frameId: t.id, role: pe(t), priority: 0 }
754
+ const n = H([
755
+ { frameId: t.id, role: ce(t), priority: 0 }
782
756
  ]);
783
757
  e.layouts ?? (e.layouts = {});
784
758
  for (const [r, a] of Object.entries(n)) {
785
759
  const i = e.layouts[r] || [];
786
- if (i.some((o) => o.i === t.id))
760
+ if (i.some((s) => s.i === t.id))
787
761
  continue;
788
- const s = a[0];
789
- if (!s)
762
+ const o = a[0];
763
+ if (!o)
790
764
  continue;
791
765
  const d = i.reduce(
792
- (o, u) => Math.max(o, u.y + u.h),
766
+ (s, u) => Math.max(s, u.y + u.h),
793
767
  0
794
768
  );
795
769
  e.layouts[r] = [
796
770
  ...i,
797
- { ...s, y: d }
771
+ { ...o, y: d }
798
772
  ];
799
773
  }
800
774
  }
801
- function rt(e, t) {
775
+ function Ze(e, t) {
802
776
  var r;
803
777
  const n = K(
804
778
  t.filter,
@@ -812,66 +786,66 @@ function rt(e, t) {
812
786
  }
813
787
  });
814
788
  }
815
- function Ct(e) {
789
+ function _t(e) {
816
790
  var d;
817
- const t = Be(e.changePlan);
791
+ const t = Ne(e.changePlan);
818
792
  if (!t.ok)
819
793
  throw new Error(
820
- t.errors.map((o) => o.message).join(`
794
+ t.errors.map((s) => s.message).join(`
821
795
  `) || "Dashboard change plan is invalid."
822
796
  );
823
- const n = Ye(e.dashboard), r = [...t.warnings], a = [], i = new Map(
824
- e.cardArtifacts.map((o) => [o.planCardId, o])
825
- ), s = Ze(n);
826
- if (!s)
797
+ const n = Ue(e.dashboard), r = [...t.warnings], a = [], i = new Map(
798
+ e.cardArtifacts.map((s) => [s.planCardId, s])
799
+ ), o = Je(n);
800
+ if (!o)
827
801
  throw new Error("Dashboard has no editable dashboard sheet.");
828
- s.frames ?? (s.frames = []);
829
- for (const o of e.changePlan.operations)
830
- switch (o.kind) {
802
+ o.frames ?? (o.frames = []);
803
+ for (const s of e.changePlan.operations)
804
+ switch (s.kind) {
831
805
  case "addCard": {
832
- if ((s.frames || []).reduce(
833
- (g, c) => {
834
- var I;
835
- return g + (((I = c.cards) == null ? void 0 : I.length) || 0);
806
+ if ((o.frames || []).reduce(
807
+ (y, c) => {
808
+ var g;
809
+ return y + (((g = c.cards) == null ? void 0 : g.length) || 0);
836
810
  },
837
811
  0
838
- ) >= B) {
812
+ ) >= P) {
839
813
  a.push(
840
814
  C(
841
815
  "generated_card_limit_reached",
842
- `MVP AI refinement is capped at ${B} cards.`,
843
- o.card.id
816
+ `MVP AI refinement is capped at ${P} cards.`,
817
+ s.card.id
844
818
  )
845
819
  );
846
820
  break;
847
821
  }
848
- const p = i.get(o.card.id);
849
- if (!p) {
822
+ const h = i.get(s.card.id);
823
+ if (!h) {
850
824
  a.push(
851
825
  C(
852
826
  "missing_card_artifact",
853
- `Card "${o.card.title}" was skipped because no generated artifact was supplied.`,
854
- o.card.id
827
+ `Card "${s.card.title}" was skipped because no generated artifact was supplied.`,
828
+ s.card.id
855
829
  )
856
830
  );
857
831
  break;
858
832
  }
859
833
  const b = {
860
- id: o.card.frameId,
861
- cards: [p.card],
862
- activeCardId: p.card.id
834
+ id: s.card.frameId,
835
+ cards: [h.card],
836
+ activeCardId: h.card.id
863
837
  };
864
- s.frames.push(b), nt(s, b);
838
+ o.frames.push(b), Ye(o, b);
865
839
  break;
866
840
  }
867
841
  case "addFilterInput": {
868
842
  n.inputs ?? (n.inputs = []);
869
843
  const u = {
870
- id: o.input.id,
844
+ id: s.input.id,
871
845
  kind: "filter",
872
- label: o.input.label,
873
- variableName: o.input.variableName,
874
- scope: o.input.scope || {
846
+ label: s.input.label,
847
+ variableName: s.input.variableName,
848
+ scope: s.input.scope || {
875
849
  kind: "allSheets",
876
850
  sheetKinds: ["dashboard"]
877
851
  },
@@ -881,74 +855,74 @@ function Ct(e) {
881
855
  order: n.inputs.length
882
856
  },
883
857
  exports: ["label", "value", "start", "end", "range"],
884
- filter: o.input.filter
858
+ filter: s.input.filter
885
859
  };
886
- n.inputs.push(u), rt(n, o.input);
860
+ n.inputs.push(u), Ze(n, s.input);
887
861
  break;
888
862
  }
889
863
  case "addCalculatedField": {
890
- if (o.field.scope === "dashboard" && o.field.field)
891
- n.calculatedFields ?? (n.calculatedFields = []), n.calculatedFields.push(o.field.field);
892
- else if (o.field.scope === "sheet" && o.field.field)
893
- s.calculatedFields ?? (s.calculatedFields = []), s.calculatedFields.push(o.field.field);
894
- else if (o.field.scope === "card" && o.field.field) {
895
- const u = o.field.targetCardId ? j(n, o.field.targetCardId) : null;
896
- u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(o.field.field)) : a.push(
864
+ if (s.field.scope === "dashboard" && s.field.field)
865
+ n.calculatedFields ?? (n.calculatedFields = []), n.calculatedFields.push(s.field.field);
866
+ else if (s.field.scope === "sheet" && s.field.field)
867
+ o.calculatedFields ?? (o.calculatedFields = []), o.calculatedFields.push(s.field.field);
868
+ else if (s.field.scope === "card" && s.field.field) {
869
+ const u = s.field.targetCardId ? q(n, s.field.targetCardId) : null;
870
+ u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(s.field.field)) : a.push(
897
871
  C(
898
872
  "missing_calculated_field_target",
899
- `Calculated field "${o.field.name}" needs a valid target card.`
873
+ `Calculated field "${s.field.name}" needs a valid target card.`
900
874
  )
901
875
  );
902
876
  }
903
877
  break;
904
878
  }
905
879
  case "renameCard": {
906
- const u = j(n, o.cardId);
880
+ const u = q(n, s.cardId);
907
881
  if (!u) {
908
882
  a.push(
909
883
  C(
910
884
  "card_not_found",
911
- `Card "${o.cardId}" could not be renamed because it was not found.`,
912
- o.cardId
885
+ `Card "${s.cardId}" could not be renamed because it was not found.`,
886
+ s.cardId
913
887
  )
914
888
  );
915
889
  break;
916
890
  }
917
- u.card.title = o.title, o.description !== void 0 && (u.card.description = o.description);
891
+ u.card.title = s.title, s.description !== void 0 && (u.card.description = s.description);
918
892
  break;
919
893
  }
920
894
  case "reorderCards": {
921
895
  const u = /* @__PURE__ */ new Map();
922
- for (let p = 0; p < o.cardIds.length; p += 1) {
923
- const b = o.cardIds[p], g = j(n, b);
924
- g && u.set(g.frame.id, p);
896
+ for (let h = 0; h < s.cardIds.length; h += 1) {
897
+ const b = s.cardIds[h], y = q(n, b);
898
+ y && u.set(y.frame.id, h);
925
899
  }
926
- he(s, u);
900
+ le(o, u);
927
901
  break;
928
902
  }
929
903
  case "reuseCalculatedField":
930
904
  r.push(
931
905
  C(
932
906
  "reused_calculated_field",
933
- `Calculated field "${o.fieldId}" is reused by reference.`
907
+ `Calculated field "${s.fieldId}" is reused by reference.`
934
908
  )
935
909
  );
936
910
  break;
937
911
  case "unsupported":
938
912
  a.push(
939
- C("unsupported_operation", o.reason || o.requestedAction)
913
+ C("unsupported_operation", s.reason || s.requestedAction)
940
914
  );
941
915
  break;
942
916
  }
943
917
  return { dashboard: n, warnings: r, skippedOperations: a };
944
918
  }
945
- function y(e, t, n) {
919
+ function I(e, t, n) {
946
920
  return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
947
921
  }
948
- function T(e, t) {
922
+ function F(e, t) {
949
923
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
950
924
  }
951
- function be(e, t) {
925
+ function ue(e, t) {
952
926
  if (!t.has(e))
953
927
  return t.add(e), e;
954
928
  let n = 2, r = `${e}-${n}`;
@@ -956,42 +930,25 @@ function be(e, t) {
956
930
  n += 1, r = `${e}-${n}`;
957
931
  return t.add(r), r;
958
932
  }
959
- function x(e) {
933
+ function T(e) {
960
934
  return !!(e && typeof e == "object");
961
935
  }
962
- function Ie(e) {
936
+ function fe(e) {
963
937
  return Array.isArray(e.inputs) ? e.inputs.filter(
964
- (t) => x(t) && typeof t.id == "string"
938
+ (t) => T(t) && typeof t.id == "string"
965
939
  ) : [];
966
940
  }
967
- function Q(e) {
941
+ function G(e) {
968
942
  return Array.isArray(e.sections) ? e.sections.filter(
969
- (t) => x(t)
943
+ (t) => T(t)
970
944
  ) : [];
971
945
  }
972
- function J(e) {
946
+ function U(e) {
973
947
  return Array.isArray(e.views) ? e.views.filter(
974
- (t) => x(t)
948
+ (t) => T(t)
975
949
  ) : [];
976
950
  }
977
- function at(e) {
978
- return R(e) ? e.kind === "semantic" ? {
979
- kind: "semantic",
980
- domainId: e.domainId,
981
- datasetName: e.datasetName,
982
- datasetId: e.datasetId,
983
- label: e.label,
984
- connectionId: e.connectionId
985
- } : e.kind === "physical" ? {
986
- kind: "physical",
987
- connectionId: e.connectionId,
988
- databaseName: e.databaseName,
989
- schemaName: e.schemaName,
990
- tableName: e.tableName,
991
- label: e.label
992
- } : null : null;
993
- }
994
- function N(e) {
951
+ function A(e) {
995
952
  if (!Array.isArray(e))
996
953
  return [];
997
954
  const t = [];
@@ -1001,26 +958,26 @@ function N(e) {
1001
958
  }
1002
959
  return t;
1003
960
  }
1004
- function it(e) {
961
+ function et(e) {
1005
962
  var r;
1006
963
  if (!e)
1007
964
  return [];
1008
965
  const t = [];
1009
- if (R(e.source) && t.push(e.source), e.kind === "metric") {
1010
- t.push(...N(e.metricRefs));
966
+ if (V(e.source) && t.push(e.source), e.kind === "metric") {
967
+ t.push(...A(e.metrics));
1011
968
  const a = v(e.dateField);
1012
- a && t.push(a), t.push(...N(e.dimensions)), t.push(
1013
- ...N(
969
+ a && t.push(a), t.push(...A(e.dimensions)), t.push(
970
+ ...A(
1014
971
  (r = e.filters) == null ? void 0 : r.map((i) => i.field)
1015
972
  )
1016
973
  );
1017
974
  } else if (e.kind === "records") {
1018
975
  const a = v(e.dateField);
1019
- a && t.push(a), t.push(...N(e.fields));
976
+ a && t.push(a), t.push(...A(e.fields));
1020
977
  } else if (e.kind === "inputOptions") {
1021
978
  const a = v(e.field);
1022
979
  a && t.push(a);
1023
- } else e.kind === "sql" && t.push(...N(e.fields));
980
+ } else e.kind === "sql" && t.push(...A(e.fields));
1024
981
  const n = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
1025
982
  for (const a of n) {
1026
983
  const i = v(a.field);
@@ -1028,31 +985,30 @@ function it(e) {
1028
985
  }
1029
986
  return t;
1030
987
  }
1031
- function st(e) {
988
+ function tt(e) {
1032
989
  const t = [];
1033
- for (const n of Ie(e)) {
1034
- R(n.source) && t.push(n.source);
990
+ for (const n of fe(e)) {
1035
991
  const r = v(n.field);
1036
992
  r && t.push(r);
1037
993
  }
1038
- for (const n of Q(e))
1039
- for (const r of J(n))
1040
- t.push(...it(r.analytics));
994
+ for (const n of G(e))
995
+ for (const r of U(n))
996
+ t.push(...et(r.analytics));
1041
997
  return t;
1042
998
  }
1043
- function ot(e) {
999
+ function nt(e) {
1044
1000
  var n;
1045
1001
  const t = [];
1046
- for (const r of Q(e))
1047
- for (const a of J(r))
1048
- R((n = a.analytics) == null ? void 0 : n.source) && t.push(a.analytics.source);
1002
+ for (const r of G(e))
1003
+ for (const a of U(r))
1004
+ V((n = a.analytics) == null ? void 0 : n.source) && t.push(a.analytics.source);
1049
1005
  return t;
1050
1006
  }
1051
- function dt(e, t) {
1052
- const n = V(e).map(at).filter((i) => !!i);
1007
+ function rt(e, t) {
1008
+ const n = B(e).filter(V);
1053
1009
  if (n.length === 0)
1054
1010
  return t.push(
1055
- y(
1011
+ I(
1056
1012
  "missing_materializable_dataset",
1057
1013
  "No semantic or physical source could be converted into the current dashboard authoring dataset reference."
1058
1014
  )
@@ -1063,15 +1019,15 @@ function dt(e, t) {
1063
1019
  )
1064
1020
  );
1065
1021
  return n.length > 1 && (!r || a.length !== 1) ? (t.push(
1066
- y(
1022
+ I(
1067
1023
  "multiple_datasets_out_of_scope",
1068
1024
  "The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
1069
1025
  )
1070
1026
  ), [n[0]]) : n;
1071
1027
  }
1072
- function ct(e, t) {
1073
- const n = Q(e), r = Ie(e), a = V(st(e)), i = V(
1074
- ot(e)
1028
+ function at(e, t) {
1029
+ const n = G(e), r = fe(e), a = B(tt(e)), i = B(
1030
+ nt(e)
1075
1031
  );
1076
1032
  return {
1077
1033
  sections: n,
@@ -1079,105 +1035,13 @@ function ct(e, t) {
1079
1035
  sources: a,
1080
1036
  primarySources: i,
1081
1037
  defaultSource: i.length === 1 ? i[0] : void 0,
1082
- datasets: dt(a, t)
1038
+ datasets: rt(a, t)
1083
1039
  };
1084
1040
  }
1085
- function se(e) {
1086
- return E(e).map((t) => t.name).filter(Boolean);
1087
- }
1088
- function E(e) {
1089
- return (Array.isArray(e.fields) ? e.fields : []).filter(
1090
- (t) => !Ce(t, e.dateField)
1091
- );
1092
- }
1093
- function ut(e) {
1094
- const t = Array.isArray(e.metrics) ? e.metrics.filter(
1095
- (n) => typeof n == "string" && n.trim().length > 0
1096
- ) : [];
1097
- return Array.from(new Set(t));
1098
- }
1099
- function lt(e) {
1100
- return x(e) && typeof e.name == "string" && e.name.trim().length > 0;
1101
- }
1102
- function oe(e) {
1103
- if (!Array.isArray(e.dimensions))
1104
- return;
1105
- const t = e.dimensions.filter(lt).map((n) => n.name);
1106
- return t.length ? t : void 0;
1107
- }
1108
- function P(e) {
1109
- return e === "hour" ? "day" : e;
1110
- }
1111
- function $(e, t = {}) {
1112
- var n, r;
1113
- if (e != null && e.name) {
1114
- if (((n = e.source) == null ? void 0 : n.kind) === "semantic")
1115
- return !e.source.domainId || !e.source.datasetName ? void 0 : {
1116
- name: e.name,
1117
- source: {
1118
- kind: "semantic",
1119
- domainId: e.source.domainId,
1120
- datasetName: e.source.datasetName,
1121
- datasetId: e.source.datasetId,
1122
- label: e.source.label,
1123
- connectionId: e.source.connectionId
1124
- }
1125
- };
1126
- if (((r = e.source) == null ? void 0 : r.kind) === "physical")
1127
- return !e.source.connectionId || !e.source.tableName ? void 0 : {
1128
- name: e.name,
1129
- source: {
1130
- kind: "physical",
1131
- connectionId: e.source.connectionId,
1132
- tableName: e.source.tableName,
1133
- databaseName: e.source.databaseName,
1134
- schemaName: e.source.schemaName,
1135
- label: e.source.label
1136
- }
1137
- };
1138
- if (!(e.source !== void 0 || !t.includeUnsourced))
1139
- return { name: e.name };
1140
- }
1141
- }
1142
- function D(e) {
1143
- if (!Array.isArray(e))
1144
- return;
1145
- const t = e.map((n) => $(n, { includeUnsourced: !0 })).filter(Boolean);
1146
- if (t.length === e.length)
1147
- return t.some((n) => n.source) ? t : void 0;
1148
- }
1149
- function ft(e) {
1150
- var t, n;
1151
- if (e) {
1152
- if (e.kind === "metric")
1153
- return {
1154
- metrics: ut(e),
1155
- ...e.primaryMetric ? { primaryMetric: e.primaryMetric } : {},
1156
- ...(t = e.dateField) != null && t.name ? { dateField: e.dateField.name } : {},
1157
- ...D(e.metricRefs) ? { metricRefs: D(e.metricRefs) } : {},
1158
- ...$(e.dateField) ? { dateFieldRef: $(e.dateField) } : {},
1159
- ...P(e.timeGrain) ? { timeGrain: P(e.timeGrain) } : {},
1160
- ...oe(e) ? { dimensions: oe(e) } : {},
1161
- ...D(e.dimensions) ? { dimensionRefs: D(e.dimensions) } : {},
1162
- ...e.filters ? { filters: e.filters } : {},
1163
- ...e.limit !== void 0 ? { limit: e.limit } : {}
1164
- };
1165
- if (e.kind === "records")
1166
- return {
1167
- metrics: e.measures,
1168
- ...(n = e.dateField) != null && n.name ? { dateField: e.dateField.name } : {},
1169
- ...$(e.dateField) ? { dateFieldRef: $(e.dateField) } : {},
1170
- ...P(e.timeGrain) ? { timeGrain: P(e.timeGrain) } : {},
1171
- ...se(e) ? { dimensions: se(e) } : {},
1172
- ...D(E(e)) ? { dimensionRefs: D(E(e)) } : {},
1173
- ...e.limit !== void 0 ? { limit: e.limit } : {}
1174
- };
1175
- }
1176
- }
1177
- function mt(e) {
1178
- return e && we(e).ok ? e : void 0;
1041
+ function it(e) {
1042
+ return e && ne(e).ok ? e : void 0;
1179
1043
  }
1180
- function pt(e) {
1044
+ function ot(e) {
1181
1045
  var t;
1182
1046
  switch ((t = e.presentation) == null ? void 0 : t.kind) {
1183
1047
  case "kpi":
@@ -1196,11 +1060,11 @@ function pt(e) {
1196
1060
  return null;
1197
1061
  }
1198
1062
  }
1199
- function ht(e) {
1063
+ function st(e) {
1200
1064
  var t, n, r;
1201
1065
  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";
1202
1066
  }
1203
- function bt(e) {
1067
+ function dt(e) {
1204
1068
  switch (e) {
1205
1069
  case "not_in":
1206
1070
  return "not in";
@@ -1212,66 +1076,66 @@ function bt(e) {
1212
1076
  return e || "in";
1213
1077
  }
1214
1078
  }
1215
- function It(e) {
1216
- return x(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
1079
+ function ct(e) {
1080
+ return T(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
1217
1081
  }
1218
- function gt(e) {
1082
+ function lt(e) {
1219
1083
  if (!(!e || e.kind !== "physical"))
1220
1084
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
1221
1085
  }
1222
- function yt(e, t, n, r, a, i) {
1086
+ function ut(e, t, n, r, a, i) {
1223
1087
  if (e.kind !== "filter")
1224
1088
  return i.push(
1225
- y(
1089
+ I(
1226
1090
  "control_inputs_deferred",
1227
1091
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
1228
1092
  )
1229
1093
  ), null;
1230
- if (!x(e.field) || typeof e.field.name != "string")
1094
+ if (!T(e.field) || typeof e.field.name != "string")
1231
1095
  return i.push(
1232
- y(
1096
+ I(
1233
1097
  "filter_requires_field",
1234
1098
  `Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
1235
1099
  )
1236
1100
  ), null;
1237
- const s = Se({
1238
- explicitSource: e.source,
1101
+ const o = we({
1102
+ explicitSource: void 0,
1239
1103
  field: e.field,
1240
1104
  defaultSource: t,
1241
1105
  fallbackSources: n
1242
- }), d = (s == null ? void 0 : s.kind) === "semantic" || (s == null ? void 0 : s.kind) === "physical" ? s.connectionId : void 0;
1106
+ }), d = (o == null ? void 0 : o.kind) === "semantic" || (o == null ? void 0 : o.kind) === "physical" ? o.connectionId : void 0;
1243
1107
  if (!d)
1244
1108
  return i.push(
1245
- y(
1109
+ I(
1246
1110
  "filter_requires_connection_id",
1247
1111
  `Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
1248
1112
  )
1249
1113
  ), null;
1250
- const p = {
1251
- id: `filter-${be(
1252
- T(e.id, e.field.name),
1114
+ const h = {
1115
+ id: `filter-${ue(
1116
+ F(e.id, e.field.name),
1253
1117
  a
1254
1118
  )}`,
1255
1119
  variableName: e.id,
1256
1120
  connectionId: d,
1257
1121
  title: e.label,
1258
1122
  column: e.field.name,
1259
- dataType: It(e),
1260
- qualifiedTableName: gt(s),
1123
+ dataType: ct(e),
1124
+ qualifiedTableName: lt(o),
1261
1125
  sql: "",
1262
- operation: bt(e.operator),
1126
+ operation: dt(e.operator),
1263
1127
  type: e.multi === !1 ? "single" : "multiple",
1264
1128
  location: "dashboard",
1265
1129
  displayMode: "toolbar",
1266
- fieldMeta: (s == null ? void 0 : s.kind) === "semantic" ? {
1130
+ fieldMeta: (o == null ? void 0 : o.kind) === "semantic" ? {
1267
1131
  name: e.field.name,
1268
1132
  qualifiedFieldName: e.field.name,
1269
1133
  dataType: e.field.dataType,
1270
1134
  role: e.field.role === "measure" ? "metric" : "groupby"
1271
1135
  } : void 0,
1272
- semanticContext: (s == null ? void 0 : s.kind) === "semantic" ? {
1273
- semanticDomainId: s.domainId,
1274
- connectionId: s.connectionId
1136
+ semanticContext: (o == null ? void 0 : o.kind) === "semantic" ? {
1137
+ semanticDomainId: o.domainId,
1138
+ connectionId: o.connectionId
1275
1139
  } : void 0
1276
1140
  };
1277
1141
  return {
@@ -1279,9 +1143,9 @@ function yt(e, t, n, r, a, i) {
1279
1143
  label: e.label,
1280
1144
  variableName: e.id,
1281
1145
  scope: r,
1282
- filter: p,
1146
+ filter: h,
1283
1147
  defaultValue: K(
1284
- p,
1148
+ h,
1285
1149
  e.defaultValue
1286
1150
  )
1287
1151
  };
@@ -1293,13 +1157,13 @@ function L(e) {
1293
1157
  a ? t.push(a) : n.push(r);
1294
1158
  }
1295
1159
  return n.length > 0 && e.warnings.push(
1296
- y(
1160
+ I(
1297
1161
  "input_scope_view_not_found",
1298
1162
  `Filter "${e.inputLabel}" referenced unknown view ids: ${n.join(", ")}.`
1299
1163
  )
1300
1164
  ), Array.from(new Set(t));
1301
1165
  }
1302
- function _t(e) {
1166
+ function ft(e) {
1303
1167
  var r, a;
1304
1168
  if (!e.protocolScope) {
1305
1169
  const i = Array.from(new Set(e.boundCardIds));
@@ -1318,7 +1182,7 @@ function _t(e) {
1318
1182
  );
1319
1183
  return {
1320
1184
  kind: "cards",
1321
- cardIds: e.allCardIds.filter((s) => !i.has(s))
1185
+ cardIds: e.allCardIds.filter((o) => !i.has(o))
1322
1186
  };
1323
1187
  }
1324
1188
  if (e.protocolScope.level === "view") {
@@ -1329,7 +1193,7 @@ function _t(e) {
1329
1193
  warnings: e.warnings
1330
1194
  });
1331
1195
  return i.length === 0 ? (e.warnings.push(
1332
- y(
1196
+ I(
1333
1197
  "input_scope_has_no_materialized_cards",
1334
1198
  `Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
1335
1199
  )
@@ -1338,7 +1202,7 @@ function _t(e) {
1338
1202
  const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
1339
1203
  if (t.length === 0)
1340
1204
  return e.warnings.push(
1341
- y(
1205
+ I(
1342
1206
  "input_scope_section_not_found",
1343
1207
  `Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
1344
1208
  )
@@ -1358,36 +1222,36 @@ function _t(e) {
1358
1222
  cardIds: t.filter((i) => !n.has(i))
1359
1223
  };
1360
1224
  }
1361
- function Dt(e) {
1362
- var c, I, A;
1363
- const t = [], n = _e(e);
1364
- for (const m of n.warnings)
1365
- t.push(y(m.code, m.message));
1366
- for (const m of n.errors)
1367
- t.push(y(m.code, m.message));
1368
- const r = ct(e, t), a = [], i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1369
- let p = 0;
1370
- for (const [m, w] of r.sections.entries()) {
1371
- const l = typeof w.title == "string" ? w.title : `Section ${m + 1}`, X = w.id || T(l, `section-${m + 1}`);
1372
- s.set(X, []);
1373
- for (const [Y, h] of J(w).entries()) {
1374
- const Z = pt(h), z = T(
1375
- h.id || `${l}-${h.title || `View ${Y + 1}`}`,
1376
- `card-${m + 1}-${Y + 1}`
1225
+ function wt(e) {
1226
+ var c, g, k;
1227
+ const t = [], n = ge(e);
1228
+ for (const p of n.warnings)
1229
+ t.push(I(p.code, p.message));
1230
+ for (const p of n.errors)
1231
+ t.push(I(p.code, p.message));
1232
+ const r = at(e, t), a = [], i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1233
+ let h = 0;
1234
+ for (const [p, w] of r.sections.entries()) {
1235
+ const l = typeof w.title == "string" ? w.title : `Section ${p + 1}`, J = w.id || F(l, `section-${p + 1}`);
1236
+ o.set(J, []);
1237
+ for (const [Q, m] of U(w).entries()) {
1238
+ const X = ot(m), z = F(
1239
+ m.id || `${l}-${m.title || `View ${Q + 1}`}`,
1240
+ `card-${p + 1}-${Q + 1}`
1377
1241
  );
1378
- if (!Z) {
1242
+ if (!X) {
1379
1243
  t.push(
1380
- y(
1244
+ I(
1381
1245
  "unsupported_presentation",
1382
- `Dashboard presentation "${((c = h.presentation) == null ? void 0 : c.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1246
+ `Dashboard presentation "${((c = m.presentation) == null ? void 0 : c.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1383
1247
  `card-${z}`
1384
1248
  )
1385
1249
  );
1386
1250
  continue;
1387
1251
  }
1388
- if (((I = h.analytics) == null ? void 0 : I.kind) === "sql") {
1252
+ if (((g = m.analytics) == null ? void 0 : g.kind) === "sql") {
1389
1253
  t.push(
1390
- y(
1254
+ I(
1391
1255
  "sql_intent_deferred",
1392
1256
  "SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
1393
1257
  `card-${z}`
@@ -1395,56 +1259,55 @@ function Dt(e) {
1395
1259
  );
1396
1260
  continue;
1397
1261
  }
1398
- const ee = be(z, o), M = `card-${ee}`;
1399
- h.id && i.set(h.id, M), (A = s.get(X)) == null || A.push(M);
1400
- const ge = h.analytics && "inputs" in h.analytics ? h.analytics.inputs : void 0;
1401
- for (const te of ge || []) {
1402
- const ne = d.get(te.inputId) || [];
1403
- ne.push(M), d.set(te.inputId, ne);
1262
+ const Y = ue(z, s), $ = `card-${Y}`;
1263
+ m.id && i.set(m.id, $), (k = o.get(J)) == null || k.push($);
1264
+ const pe = m.analytics && "inputs" in m.analytics ? m.analytics.inputs : void 0;
1265
+ for (const Z of pe || []) {
1266
+ const ee = d.get(Z.inputId) || [];
1267
+ ee.push($), d.set(Z.inputId, ee);
1404
1268
  }
1405
1269
  a.push({
1406
- id: M,
1407
- frameId: `frame-${ee}`,
1408
- title: h.title,
1409
- description: h.description,
1410
- type: Z,
1411
- role: ht(h),
1412
- priority: p,
1270
+ id: $,
1271
+ frameId: `frame-${Y}`,
1272
+ title: m.title,
1273
+ description: m.description,
1274
+ type: X,
1275
+ role: st(m),
1276
+ priority: h,
1413
1277
  section: l,
1414
- query: ft(h.analytics),
1415
- analyticsIntent: mt(h.analytics),
1416
- text: h.text
1417
- }), p += 1;
1278
+ analyticsIntent: it(m.analytics),
1279
+ text: m.text
1280
+ }), h += 1;
1418
1281
  }
1419
1282
  }
1420
- const b = r.inputs.map((m) => {
1421
- const w = _t({
1422
- protocolScope: m.scope,
1423
- inputLabel: m.label,
1283
+ const b = r.inputs.map((p) => {
1284
+ const w = ft({
1285
+ protocolScope: p.scope,
1286
+ inputLabel: p.label,
1424
1287
  allCardIds: a.map((l) => l.id),
1425
- boundCardIds: d.get(m.id) || [],
1288
+ boundCardIds: d.get(p.id) || [],
1426
1289
  viewIdToCardId: i,
1427
- sectionIdToCardIds: s,
1290
+ sectionIdToCardIds: o,
1428
1291
  warnings: t
1429
1292
  });
1430
- return w === null ? null : yt(
1431
- m,
1293
+ return w === null ? null : ut(
1294
+ p,
1432
1295
  r.defaultSource,
1433
1296
  r.sources,
1434
1297
  w,
1435
1298
  u,
1436
1299
  t
1437
1300
  );
1438
- }).filter((m) => !!m);
1301
+ }).filter((p) => !!p);
1439
1302
  return { plan: {
1440
1303
  version: 1,
1441
- id: `plan-${T(e.title, "dashboard")}`,
1304
+ id: `plan-${F(e.title, "dashboard")}`,
1442
1305
  title: e.title,
1443
1306
  description: e.description,
1444
1307
  datasets: r.datasets,
1445
1308
  sheets: [
1446
1309
  {
1447
- id: `sheet-${T(e.title, "dashboard")}`,
1310
+ id: `sheet-${F(e.title, "dashboard")}`,
1448
1311
  title: e.title,
1449
1312
  description: e.description,
1450
1313
  kind: "dashboard",
@@ -1453,30 +1316,30 @@ function Dt(e) {
1453
1316
  ],
1454
1317
  filterInputs: b.length ? b : void 0,
1455
1318
  warnings: t.length ? t : void 0,
1456
- unresolvedRequests: n.ok ? void 0 : n.errors.map((m) => m.message)
1319
+ unresolvedRequests: n.ok ? void 0 : n.errors.map((p) => p.message)
1457
1320
  }, warnings: t };
1458
1321
  }
1459
1322
  export {
1460
- ve as DASHBOARD_AUTHORING_BREAKPOINTS,
1461
- B as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1462
- Ct as applyDashboardChangePlan,
1463
- St as compileDashboardFromPlan,
1464
- U as compileResponsiveDashboardLayouts,
1465
- H as dashboardAuthoringDatasetMatchesSource,
1466
- Ce as dashboardAuthoringFieldsReferToSameTarget,
1323
+ Ie as DASHBOARD_AUTHORING_BREAKPOINTS,
1324
+ P as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1325
+ _t as applyDashboardChangePlan,
1326
+ yt as compileDashboardFromPlan,
1327
+ H as compileResponsiveDashboardLayouts,
1328
+ E as dashboardAuthoringDatasetMatchesSource,
1329
+ bt as dashboardAuthoringFieldsReferToSameTarget,
1467
1330
  v as dashboardAuthoringSourceFromField,
1468
- re as dashboardAuthoringSourceKey,
1469
- de as dashboardAuthoringSourcesReferToSameDataset,
1470
- Dt as dashboardPlanFromSemaphorDashboardIntent,
1471
- At as findDashboardAuthoringDatasetForSource,
1472
- Re as getDashboardAuthoringCardSource,
1473
- R as isMaterializableDashboardAuthoringSource,
1474
- ke as isSemaphorSourceRef,
1475
- V as mergeDashboardAuthoringSources,
1476
- Ae as preferDashboardAuthoringSourceMetadata,
1477
- kt as preferredDashboardAuthoringSource,
1478
- Se as resolveDashboardAuthoringSource,
1479
- Me as validateDashboardAuthoringDatasetScope,
1480
- Be as validateDashboardChangePlan,
1481
- Pe as validateDashboardPlan
1331
+ mt as dashboardAuthoringSourceKey,
1332
+ re as dashboardAuthoringSourcesReferToSameDataset,
1333
+ wt as dashboardPlanFromSemaphorDashboardIntent,
1334
+ It as findDashboardAuthoringDatasetForSource,
1335
+ Ae as getDashboardAuthoringCardSource,
1336
+ V as isMaterializableDashboardAuthoringSource,
1337
+ ye as isSemaphorSourceRef,
1338
+ B as mergeDashboardAuthoringSources,
1339
+ _e as preferDashboardAuthoringSourceMetadata,
1340
+ gt as preferredDashboardAuthoringSource,
1341
+ we as resolveDashboardAuthoringSource,
1342
+ Fe as validateDashboardAuthoringDatasetScope,
1343
+ Ne as validateDashboardChangePlan,
1344
+ Me as validateDashboardPlan
1482
1345
  };