react-semaphor 0.1.599 → 0.1.601

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 (62) hide show
  1. package/dist/analytics-protocol/index.js +106 -105
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +48 -45
  5. package/dist/chunks/{assistant-chat-f3XuzrAm.js → assistant-chat-BE0XXzZP.js} +12 -12
  6. package/dist/chunks/{bookmark-impact-B5hyttm2.js → bookmark-impact-DXDAN5AY.js} +3 -3
  7. package/dist/chunks/{bookmark-state-h1OLXVjE.js → bookmark-state-BMyB3Tb6.js} +4 -4
  8. package/dist/chunks/{card-filter-builder-DfLqD2RV.js → card-filter-builder-CE0-YVN5.js} +9 -9
  9. package/dist/chunks/comparison-window-caption-Dxj2CHOa.js +741 -0
  10. package/dist/chunks/{dashboard-briefing-launcher-RxYGtk-F.js → dashboard-briefing-launcher-CntwKyiZ.js} +13 -13
  11. package/dist/chunks/{dashboard-controls-DeaXrtLK.js → dashboard-controls-XO089DMg.js} +15 -15
  12. package/dist/chunks/{dashboard-json-DvxKpKd_.js → dashboard-json-CQRiydUv.js} +4 -4
  13. package/dist/chunks/{dashboard-CoI4aOUc.js → dashboard-mJKPFRbb.js} +1 -1
  14. package/dist/chunks/{dates-BhtO28Sn.js → dates-B-Urp5OD.js} +8 -8
  15. package/dist/chunks/{edit-dashboard-visual-C4f5hONA.js → edit-dashboard-visual-f-Dm-BLR.js} +176 -176
  16. package/dist/chunks/filter-line-CKNMyNTQ.js +703 -0
  17. package/dist/chunks/{filter-reach-copy-Cl5Od38Q.js → filter-reach-copy-B8GGyVuR.js} +1441 -1270
  18. package/dist/chunks/{filter-value-text-CXyuLW9Q.js → filter-value-text-CRtKecI5.js} +6 -6
  19. package/dist/chunks/{index-EKpTtkYF.js → index-DoPApnxg.js} +386 -360
  20. package/dist/chunks/{layout-grid-DSrBSfPM.js → layout-grid-CiSCZdIr.js} +1 -1
  21. package/dist/chunks/{matrix-analytical-definition-BuUSBDm7.js → matrix-analytical-definition-myf3D3Qx.js} +383 -362
  22. package/dist/chunks/{matrix-member-presentation-B_2beBc0.js → matrix-member-presentation-g0c_NpDW.js} +1 -1
  23. package/dist/chunks/{matrix-operation-contract-DdK0J_KU.js → matrix-operation-contract-C1SuOHLZ.js} +35 -35
  24. package/dist/chunks/{metric-comparison-Bhz0V841.js → metric-comparison-Cm0G893W.js} +3 -3
  25. package/dist/chunks/{paintbrush-1UiU-uTz.js → paintbrush-DQIwqlck.js} +1 -1
  26. package/dist/chunks/{palette-DFIFf_-m.js → palette-Cun747Rg.js} +1 -1
  27. package/dist/chunks/{pivot-result-contract-expectations-Dk7WFR_u.js → pivot-result-contract-expectations-C1Dyx8du.js} +17 -17
  28. package/dist/chunks/{pivot-result-identity-CzzrJpEm.js → pivot-result-identity-CBS-ssEp.js} +1 -1
  29. package/dist/chunks/{raw-temporal-value-BLvdaMng.js → raw-temporal-value-DN_l-Tss.js} +16 -16
  30. package/dist/chunks/{report-preferences-dialog-CZaYsQLK.js → report-preferences-dialog-SDZEcG2x.js} +13 -13
  31. package/dist/chunks/{report-runtime-context-CEGluufW.js → report-runtime-context-BbedQdtc.js} +1 -1
  32. package/dist/chunks/{resolve-dashboard-input-context-vPtbuDDz.js → resolve-dashboard-input-context-DRBS0eRa.js} +553 -553
  33. package/dist/chunks/{save-CWQ02kHo.js → save-Dj5bjm7P.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-C6X5nP4C.js → saved-dashboard-context-DWVlJcsa.js} +15 -15
  35. package/dist/chunks/{selection-filter-compiler-Ce4BpjRX.js → selection-filter-compiler-DmAr7yqC.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-BUiaKY6O.js → semaphor-ready-indicator-OFOoAY-A.js} +16370 -16518
  37. package/dist/chunks/{shelf-drop-preview-context-CwxWJjBv.js → shelf-drop-preview-context-2swWypXu.js} +5 -5
  38. package/dist/chunks/{stored-dashboard-Bmct-STp.js → stored-dashboard-NtOuEX6a.js} +111 -111
  39. package/dist/chunks/{style-sheet-parts-BX7d7-2-.js → style-sheet-parts-Qv4UcLAo.js} +2 -2
  40. package/dist/chunks/{table-export-sheet-BWSVTclx.js → table-export-sheet-Do7ZB0_F.js} +1 -1
  41. package/dist/chunks/{token-types-CnlEiAdS.js → token-types-Dy_aXO-U.js} +1 -1
  42. package/dist/chunks/{upload-DsqUSS8l.js → upload-Bq-puSVy.js} +1 -1
  43. package/dist/chunks/{validators-D2Hm57lJ.js → validators-C7DFk3QK.js} +78 -78
  44. package/dist/chunks/{variable-draft-Bi-zUa_a.js → variable-draft-Cy03qnEi.js} +4 -4
  45. package/dist/dashboard/index.js +2 -2
  46. package/dist/dashboard-authoring/index.js +80 -75
  47. package/dist/format-utils/index.js +238 -237
  48. package/dist/index.js +18 -18
  49. package/dist/report-runtime-context/index.js +1 -1
  50. package/dist/surfboard/index.js +2 -2
  51. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  52. package/dist/types/briefings/attachments.d.ts +45 -4
  53. package/dist/types/briefings/index.d.ts +1 -1
  54. package/dist/types/index.js +5 -5
  55. package/dist/types/lib/export-utils.d.ts +72 -0
  56. package/dist/types/lib/formatters/dashboard-temporal-presentation.d.ts +10 -0
  57. package/dist/types/shared/analytics-protocol/catalog-source-address.d.ts +16 -0
  58. package/dist/types/shared/dashboard-authoring/card-data-file.d.ts +31 -0
  59. package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
  60. package/package.json +1 -1
  61. package/dist/chunks/comparison-window-caption-DJDwP9XO.js +0 -1309
  62. package/dist/chunks/filter-line-Dkg3yuOX.js +0 -134
@@ -1,59 +1,59 @@
1
- import { G as $, H as A, E as he, I as te, F as K, L as pe } from "./raw-temporal-value-BLvdaMng.js";
2
- import { ap as C, ar as w, aj as U, ah as p, aq as ve, ai as z, aw as ke, ak as X, a7 as Q, e as Ie, K as J, t as Ne } from "./validators-D2Hm57lJ.js";
3
- import { a as Ce } from "./metric-comparison-Bhz0V841.js";
4
- import { M as _e } from "./matrix-operation-contract-DdK0J_KU.js";
1
+ import { G as O, H as A, E as he, I as te, F as U, L as pe } from "./raw-temporal-value-DN_l-Tss.js";
2
+ import { ah as z, ao as C, aq as w, ai as K, ag as p, ap as ve, av as Ne, aj as ke, a6 as Q, e as Ie, J as X, q as Ce } from "./validators-C7DFk3QK.js";
3
+ import { r as _e } from "./metric-comparison-Cm0G893W.js";
4
+ import { M as Se } from "./matrix-operation-contract-C1SuOHLZ.js";
5
5
  class Y extends Error {
6
6
  constructor(t) {
7
7
  super(t), this.name = "RelativeDateUsageError";
8
8
  }
9
9
  }
10
- function Se(e, t, n = {}) {
10
+ function Ae(e, t, n = {}) {
11
11
  const i = n.spansBack ?? 0;
12
- if (i !== 0) return Ae(e, t, i);
12
+ if (i !== 0) return Te(e, t, i);
13
13
  const { calendar: a, now: r } = t;
14
14
  switch (e.kind) {
15
15
  case "periods": {
16
- const s = ne(e, t);
16
+ const o = ne(e, t);
17
17
  return {
18
- start: K(s, e.unit, a, e.from).start,
19
- end: e.toDate ? s : ie(s, e.unit, a, e.to)
18
+ start: U(o, e.unit, a, e.from).start,
19
+ end: e.toDate ? o : ie(o, e.unit, a, e.to)
20
20
  };
21
21
  }
22
22
  case "rolling": {
23
- const s = e.anchor === "latest_data" ? t.latestData ?? r : r, o = he[e.unit];
23
+ const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s = he[e.unit];
24
24
  return {
25
- start: o === void 0 ? te(s, -e.n, e.unit, a) : new Date(s.getTime() - e.n * o),
26
- end: s
25
+ start: s === void 0 ? te(o, -e.n, e.unit, a) : new Date(o.getTime() - e.n * s),
26
+ end: o
27
27
  };
28
28
  }
29
29
  case "monthDay": {
30
- const s = e.day === "first" ? $(r, "month", a) : A(r, "month", a);
31
- return { start: $(s, "day", a), end: A(s, "day", a) };
30
+ const o = e.day === "first" ? O(r, "month", a) : A(r, "month", a);
31
+ return { start: O(o, "day", a), end: A(o, "day", a) };
32
32
  }
33
33
  }
34
34
  }
35
35
  function ne(e, t) {
36
36
  const { anchor: n } = e;
37
- return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date($(t.now, n.lastComplete, t.calendar).getTime() - 1);
37
+ return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date(O(t.now, n.lastComplete, t.calendar).getTime() - 1);
38
38
  }
39
39
  function ie(e, t, n, i) {
40
- return new Date(K(e, t, n, i).endExclusive.getTime() - 1);
40
+ return new Date(U(e, t, n, i).endExclusive.getTime() - 1);
41
41
  }
42
- function Ae(e, t, n) {
42
+ function Te(e, t, n) {
43
43
  if (!Number.isInteger(n) || n < 0)
44
44
  throw new Y(`spansBack must be a whole number of spans, got ${n}.`);
45
45
  if (e.kind !== "periods" || typeof e.anchor != "object")
46
46
  throw new Y("spansBack applies only to a window anchored at the end of the last complete period.");
47
- const { calendar: i } = t, { unit: a } = e, r = Se(e, t), s = -n * (e.to - e.from + 1), o = K(r.start, a, i, s).start;
47
+ const { calendar: i } = t, { unit: a } = e, r = Ae(e, t), o = -n * (e.to - e.from + 1), s = U(r.start, a, i, o).start;
48
48
  if (A(r.end, a, i).getTime() === r.end.getTime())
49
- return { start: o, end: ie(r.end, a, i, s) };
50
- const d = te(ne(e, t), s, a, i), c = Math.min(
51
- A(d, e.anchor.lastComplete, i).getTime(),
52
- A(d, a, i).getTime()
49
+ return { start: s, end: ie(r.end, a, i, o) };
50
+ const l = te(ne(e, t), o, a, i), c = Math.min(
51
+ A(l, e.anchor.lastComplete, i).getTime(),
52
+ A(l, a, i).getTime()
53
53
  );
54
- return { start: o, end: new Date(c) };
54
+ return { start: s, end: new Date(c) };
55
55
  }
56
- function ae(e) {
56
+ function G(e) {
57
57
  return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
58
58
  /* @__PURE__ */ new Set([
59
59
  "database",
@@ -61,20 +61,32 @@ function ae(e) {
61
61
  ])
62
62
  );
63
63
  }
64
- function st(e) {
64
+ function ae(e) {
65
+ const { recorded: t, capabilities: n } = e, i = G(n);
66
+ return !(t.databaseName && !i.includes("database") || t.schemaName && !i.includes("schema")) || !t.tableName ? t : {
67
+ ...z({
68
+ qualifiedName: [t.databaseName, t.schemaName, t.tableName].filter(Boolean).join("."),
69
+ capabilities: n
70
+ }),
71
+ ...i.includes("database") && t.databaseName ? { databaseName: t.databaseName } : {},
72
+ ...i.includes("schema") && t.schemaName ? { schemaName: t.schemaName } : {},
73
+ tableName: t.tableName
74
+ };
75
+ }
76
+ function rt(e) {
65
77
  const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? w(e.source.dialect) : void 0, i = e.source.dialect && e.source.dialect !== "unknown" ? C(e.source.dialect) : void 0;
66
78
  if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!t || n === "unknown" || t.dialect !== n))
67
79
  return { kind: "incompatible_capabilities" };
68
80
  const a = e.capabilities || t || i;
69
81
  if (!a) return { kind: "incompatible_capabilities" };
70
- const r = ae(a), s = {
82
+ const r = G(a), o = {
71
83
  ...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
72
84
  ...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
73
85
  ...e.source.tableName ? { tableName: e.source.tableName } : {}
74
- }, o = r.filter((d) => d === "database" ? !s.databaseName : d === "schema" ? !s.schemaName : !s.tableName);
75
- return o.length > 0 ? { kind: "missing_coordinates", missing: o } : {
86
+ }, s = r.filter((l) => l === "database" ? !o.databaseName : l === "schema" ? !o.schemaName : !o.tableName);
87
+ return s.length > 0 ? { kind: "missing_coordinates", missing: s } : {
76
88
  kind: "resolved",
77
- coordinates: s
89
+ coordinates: o
78
90
  };
79
91
  }
80
92
  function f(e) {
@@ -83,55 +95,58 @@ function f(e) {
83
95
  function D(e) {
84
96
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
85
97
  }
86
- function oe(e) {
98
+ function se(e) {
87
99
  const t = D(e);
88
100
  return !t || !f(t.name) || t.type === "model" ? !1 : t.type === "dataset" ? t.datasetType === "physical" : !0;
89
101
  }
90
- function q(e) {
91
- const t = D(e);
92
- if (!t) return {};
93
- const n = f(t.table) || f(t.name);
94
- return {
95
- ...f(t.database) ? { databaseName: f(t.database) } : {},
96
- ...f(t.schema) ? { schemaName: f(t.schema) } : {},
97
- ...n ? { tableName: n } : {}
98
- };
102
+ function q(e, t) {
103
+ const n = D(e);
104
+ if (!n) return {};
105
+ const i = f(n.table) || f(n.name);
106
+ return ae({
107
+ recorded: {
108
+ ...f(n.database) ? { databaseName: f(n.database) } : {},
109
+ ...f(n.schema) ? { schemaName: f(n.schema) } : {},
110
+ ...i ? { tableName: i } : {}
111
+ },
112
+ capabilities: t
113
+ });
99
114
  }
100
- function Te(e) {
101
- if (Fe(e)) return { kind: "malformed" };
102
- const t = e.entities.filter(oe), n = De(e), i = Ee({
115
+ function De(e) {
116
+ if (Be(e)) return { kind: "malformed" };
117
+ const t = e.entities.filter(se), n = Ee(e), i = qe({
103
118
  entities: t,
104
119
  connectionType: e.connectionType,
105
120
  dialect: e.dialect,
106
121
  capabilities: e.capabilities
107
122
  });
108
123
  if (!i) return { kind: "incompatible_capabilities" };
109
- const { capabilities: a } = i, r = Be({
124
+ const { capabilities: a } = i, r = He({
110
125
  hints: e.qualifiedHints || [],
111
126
  coordinateHint: e.coordinateHint,
112
127
  capabilityAuthority: i
113
128
  });
114
129
  if (r.kind !== "valid")
115
130
  return { kind: r.kind };
116
- const s = r.coordinates, o = s ? t.filter(
117
- (c) => U({
118
- left: se(
119
- q(c),
131
+ const o = r.coordinates, s = o ? t.filter(
132
+ (c) => K({
133
+ left: oe(
134
+ q(c, a),
120
135
  a
121
136
  ),
122
- right: s,
137
+ right: o,
123
138
  capabilities: a
124
139
  })
125
140
  ) : t;
126
- if (s && o.length === 0)
141
+ if (o && s.length === 0)
127
142
  return {
128
143
  kind: "not_found",
129
144
  basis: "qualified",
130
- coordinates: s,
145
+ coordinates: o,
131
146
  capabilityAuthority: i
132
147
  };
133
- if (s && o.length === 1) {
134
- const c = o[0], l = R(
148
+ if (o && s.length === 1) {
149
+ const c = s[0], d = R(
135
150
  i,
136
151
  c
137
152
  );
@@ -139,35 +154,41 @@ function Te(e) {
139
154
  kind: "resolved",
140
155
  basis: "qualified",
141
156
  entity: c,
142
- coordinates: Pe(
143
- q(c),
144
- s,
145
- l
157
+ coordinates: Re(
158
+ q(
159
+ c,
160
+ d.capabilities
161
+ ),
162
+ o,
163
+ d
146
164
  ),
147
- capabilityAuthority: l
165
+ capabilityAuthority: d
148
166
  };
149
167
  }
150
- const d = re([
168
+ const l = re([
151
169
  ...e.bareHints || [],
152
170
  ...r.bareHints,
153
- s == null ? void 0 : s.tableName
171
+ o == null ? void 0 : o.tableName
154
172
  ]);
155
- if (d.size > 0) {
156
- const c = o.filter((l) => {
157
- const m = Le(l);
158
- return Array.from(d).some((b) => m.has(b));
173
+ if (l.size > 0) {
174
+ const c = s.filter((d) => {
175
+ const m = Pe(d);
176
+ return Array.from(l).some((g) => m.has(g));
159
177
  });
160
178
  if (c.length === 1) {
161
- const l = c[0], m = R(
179
+ const d = c[0], m = R(
162
180
  i,
163
- l
181
+ d
164
182
  );
165
183
  return {
166
184
  kind: "resolved",
167
185
  basis: "bare",
168
- entity: l,
186
+ entity: d,
169
187
  coordinates: B(
170
- q(l),
188
+ q(
189
+ d,
190
+ m.capabilities
191
+ ),
171
192
  m
172
193
  ),
173
194
  capabilityAuthority: m
@@ -175,7 +196,7 @@ function Te(e) {
175
196
  }
176
197
  return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: i };
177
198
  }
178
- if (s)
199
+ if (o)
179
200
  return { kind: "ambiguous", basis: "qualified" };
180
201
  if (n)
181
202
  return {
@@ -184,7 +205,7 @@ function Te(e) {
184
205
  capabilityAuthority: i
185
206
  };
186
207
  if (t.length === 1) {
187
- const c = t[0], l = R(
208
+ const c = t[0], d = R(
188
209
  i,
189
210
  c
190
211
  );
@@ -193,15 +214,18 @@ function Te(e) {
193
214
  basis: "unqualified",
194
215
  entity: c,
195
216
  coordinates: B(
196
- q(c),
197
- l
217
+ q(
218
+ c,
219
+ d.capabilities
220
+ ),
221
+ d
198
222
  ),
199
- capabilityAuthority: l
223
+ capabilityAuthority: d
200
224
  };
201
225
  }
202
226
  return { kind: "unqualified" };
203
227
  }
204
- function De(e) {
228
+ function Ee(e) {
205
229
  const t = (e.qualifiedHints || []).map(f).filter((i) => !!i);
206
230
  return Object.values(e.coordinateHint || {}).some(
207
231
  (i) => !!f(i)
@@ -218,24 +242,24 @@ function F(e) {
218
242
  prefixLevels: [...e.prefixLevels]
219
243
  };
220
244
  }
221
- function Ee(e) {
222
- var k;
223
- const t = f(e.connectionType), n = f(e.dialect), i = e.capabilities ? F(e.capabilities) : void 0, a = t ? C(t) : void 0, r = n ? w(n) : void 0, s = n && n !== "unknown" ? C(n) : void 0;
245
+ function qe(e) {
246
+ var N;
247
+ const t = f(e.connectionType), n = f(e.dialect), i = e.capabilities ? F(e.capabilities) : void 0, a = t ? C(t) : void 0, r = n ? w(n) : void 0, o = n && n !== "unknown" ? C(n) : void 0;
224
248
  if (t && !a || n && n !== "unknown" && r === "unknown" || i && a && T(i) !== T(a))
225
249
  return;
226
- const o = i || (a ? F(a) : s ? F(s) : void 0);
227
- if (o)
228
- return r && r !== "unknown" && o.dialect !== r ? void 0 : {
229
- capabilities: o,
250
+ const s = i || (a ? F(a) : o ? F(o) : void 0);
251
+ if (s)
252
+ return r && r !== "unknown" && s.dialect !== r ? void 0 : {
253
+ capabilities: s,
230
254
  ...t ? { connectionType: t } : {},
231
- dialect: o.dialect,
255
+ dialect: s.dialect,
232
256
  evidence: "explicit"
233
257
  };
234
- const d = e.entities.map((g) => {
235
- const I = D(g), h = f(I == null ? void 0 : I.connectionType), N = f(I == null ? void 0 : I.dialect), S = h ? C(h) : void 0, E = N ? w(N) : void 0, L = N && N !== "unknown" ? C(N) : void 0;
236
- if (h && !S || N && N !== "unknown" && E === "unknown" || N && N !== "unknown" && !S && !L || S && E && E !== "unknown" && S.dialect !== E)
258
+ const l = e.entities.map((b) => {
259
+ const k = D(b), h = f(k == null ? void 0 : k.connectionType), I = f(k == null ? void 0 : k.dialect), S = h ? C(h) : void 0, E = I ? w(I) : void 0, L = I && I !== "unknown" ? C(I) : void 0;
260
+ if (h && !S || I && I !== "unknown" && E === "unknown" || I && I !== "unknown" && !S && !L || S && E && E !== "unknown" && S.dialect !== E)
237
261
  return;
238
- const V = S || L, P = V ? F(V) : qe(I);
262
+ const J = S || L, P = J ? F(J) : Fe(k);
239
263
  return P ? {
240
264
  capabilities: P,
241
265
  connectionType: h,
@@ -244,28 +268,28 @@ function Ee(e) {
244
268
  signature: T(P)
245
269
  } : void 0;
246
270
  });
247
- if (d.some((g) => !g)) return;
248
- const c = d.filter(
249
- (g) => !!g
271
+ if (l.some((b) => !b)) return;
272
+ const c = l.filter(
273
+ (b) => !!b
250
274
  );
251
- if (new Set(c.map((g) => g.signature)).size > 1)
275
+ if (new Set(c.map((b) => b.signature)).size > 1)
252
276
  return;
253
- const l = (k = c[0]) == null ? void 0 : k.capabilities;
254
- if (!l || r && r !== "unknown" && l.dialect !== r)
277
+ const d = (N = c[0]) == null ? void 0 : N.capabilities;
278
+ if (!d || r && r !== "unknown" && d.dialect !== r)
255
279
  return;
256
280
  const m = new Set(
257
- c.map((g) => g.capabilityIdentity).filter((g) => !!g)
258
- ), b = c.every(
259
- (g) => g.connectionType && g.capabilityIdentity
281
+ c.map((b) => b.capabilityIdentity).filter((b) => !!b)
282
+ ), g = c.every(
283
+ (b) => b.connectionType && b.capabilityIdentity
260
284
  );
261
285
  return {
262
- capabilities: l,
263
- ...b && m.size === 1 ? { connectionType: c[0].connectionType } : {},
264
- dialect: l.dialect,
265
- evidence: c.every((g) => g.inferred) ? "coordinates" : "entity"
286
+ capabilities: d,
287
+ ...g && m.size === 1 ? { connectionType: c[0].connectionType } : {},
288
+ dialect: d.dialect,
289
+ evidence: c.every((b) => b.inferred) ? "coordinates" : "entity"
266
290
  };
267
291
  }
268
- function qe(e) {
292
+ function Fe(e) {
269
293
  const t = !!f(e == null ? void 0 : e.database), n = !!f(e == null ? void 0 : e.schema);
270
294
  if (!(t && n)) {
271
295
  if (n)
@@ -280,7 +304,7 @@ function R(e, t) {
280
304
  const n = f((a = D(t)) == null ? void 0 : a.connectionType), i = n ? C(n) : void 0;
281
305
  return i && T(i) === T(e.capabilities) ? { ...e, connectionType: n } : e;
282
306
  }
283
- function Fe(e) {
307
+ function Be(e) {
284
308
  return (e.qualifiedHints || []).some(
285
309
  (n) => {
286
310
  const i = f(n);
@@ -291,20 +315,20 @@ function Fe(e) {
291
315
  return !!(i && !p(i));
292
316
  });
293
317
  }
294
- function Be(e) {
318
+ function He(e) {
295
319
  const { capabilities: t } = e.capabilityAuthority, n = [], i = [];
296
320
  for (const m of e.hints) {
297
- const b = f(m);
298
- if (!b) continue;
299
- if (!b.includes(".")) {
300
- i.push(b);
321
+ const g = f(m);
322
+ if (!g) continue;
323
+ if (!g.includes(".")) {
324
+ i.push(g);
301
325
  continue;
302
326
  }
303
- const k = p(b);
304
- if (!k) return { kind: "malformed" };
305
- n.push(k);
327
+ const N = p(g);
328
+ if (!N) return { kind: "malformed" };
329
+ n.push(N);
306
330
  }
307
- const a = He(e.coordinateHint);
331
+ const a = xe(e.coordinateHint);
308
332
  if (a.kind === "malformed") return a;
309
333
  const r = Array.from(new Set(n)).map(
310
334
  (m) => z({
@@ -312,37 +336,37 @@ function Be(e) {
312
336
  capabilities: t
313
337
  })
314
338
  );
315
- if (!xe(r, t))
339
+ if (!Le(r, t))
316
340
  return { kind: "conflicting" };
317
- const s = [...new Set(n)].sort(
318
- (m, b) => b.split(".").length - m.split(".").length
319
- )[0], o = s ? z({
320
- qualifiedName: s,
341
+ const o = [...new Set(n)].sort(
342
+ (m, g) => g.split(".").length - m.split(".").length
343
+ )[0], s = o ? z({
344
+ qualifiedName: o,
321
345
  capabilities: t
322
- }) : void 0, d = se(
346
+ }) : void 0, l = oe(
323
347
  a.coordinates,
324
348
  t
325
349
  ), c = B(
326
350
  a.coordinates,
327
351
  e.capabilityAuthority
328
- ), l = !!(d.tableName && (d.databaseName || d.schemaName));
329
- return o && l && !U({
330
- left: o,
331
- right: d,
352
+ ), d = !!(l.tableName && (l.databaseName || l.schemaName));
353
+ return s && d && !K({
354
+ left: s,
355
+ right: l,
332
356
  capabilities: t
333
357
  }) ? { kind: "conflicting" } : {
334
358
  kind: "valid",
335
- coordinates: o ? {
359
+ coordinates: s ? {
336
360
  ...c,
337
- ...o
338
- } : l ? c : void 0,
361
+ ...s
362
+ } : d ? c : void 0,
339
363
  bareHints: [
340
364
  ...i,
341
- ...!l && d.tableName ? [d.tableName] : []
365
+ ...!d && l.tableName ? [l.tableName] : []
342
366
  ]
343
367
  };
344
368
  }
345
- function He(e) {
369
+ function xe(e) {
346
370
  const t = {};
347
371
  for (const [n, i] of Object.entries(e || {})) {
348
372
  const a = f(i);
@@ -353,17 +377,17 @@ function He(e) {
353
377
  }
354
378
  return { kind: "valid", coordinates: t };
355
379
  }
356
- function se(e, t) {
380
+ function oe(e, t) {
357
381
  return {
358
382
  ...t.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
359
383
  ...t.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
360
384
  ...e.tableName ? { tableName: e.tableName } : {}
361
385
  };
362
386
  }
363
- function xe(e, t) {
387
+ function Le(e, t) {
364
388
  return e.every(
365
389
  (n, i) => e.slice(i + 1).every(
366
- (a) => U({
390
+ (a) => K({
367
391
  left: n,
368
392
  right: a,
369
393
  capabilities: t
@@ -376,7 +400,7 @@ function re(e) {
376
400
  e.map(f).map(p).filter((t) => !!t)
377
401
  );
378
402
  }
379
- function Le(e) {
403
+ function Pe(e) {
380
404
  const t = D(e);
381
405
  return t ? re([
382
406
  f(t.name),
@@ -384,7 +408,7 @@ function Le(e) {
384
408
  f(t.id)
385
409
  ]) : /* @__PURE__ */ new Set();
386
410
  }
387
- function Pe(e, t, n) {
411
+ function Re(e, t, n) {
388
412
  return B(
389
413
  {
390
414
  ...e,
@@ -394,7 +418,7 @@ function Pe(e, t, n) {
394
418
  );
395
419
  }
396
420
  function B(e, t) {
397
- const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : ae(t.capabilities);
421
+ const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : G(t.capabilities);
398
422
  return {
399
423
  ...n.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
400
424
  ...n.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
@@ -407,7 +431,7 @@ function u(e) {
407
431
  function _(e) {
408
432
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
409
433
  }
410
- function Re(e) {
434
+ function je(e) {
411
435
  const t = _(e);
412
436
  return !!(t && t.type === "dataset" && u(t.name));
413
437
  }
@@ -424,8 +448,8 @@ function Z(e) {
424
448
  if (!a) continue;
425
449
  const r = a.toLowerCase();
426
450
  t.add(r);
427
- const s = r.split("."), o = s[s.length - 1];
428
- o && t.add(o);
451
+ const o = r.split("."), s = o[o.length - 1];
452
+ s && t.add(s);
429
453
  }
430
454
  return t;
431
455
  }
@@ -437,35 +461,35 @@ function H(e) {
437
461
  function j(e, t) {
438
462
  const n = _(t), i = u(n == null ? void 0 : n.domainId) || u(e.semanticDomainId), a = u(n == null ? void 0 : n.name);
439
463
  if (!i || !a) return;
440
- const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : ke(n || {}), s = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
464
+ const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : Ne(n || {}), o = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
441
465
  return {
442
466
  kind: "semantic",
443
467
  domainId: i,
444
468
  datasetName: a,
445
469
  ...r ? { datasetId: r } : {},
446
- ...s ? { connectionId: s } : {}
470
+ ...o ? { connectionId: o } : {}
447
471
  };
448
472
  }
449
- function je(e, t = {}) {
473
+ function Me(e, t = {}) {
450
474
  const n = u(e.fieldEntityType);
451
475
  if (n && n !== "dataset")
452
476
  return { kind: "unqualified" };
453
477
  const i = e.entities.filter(
454
- (s) => t.includePhysicalDatasets ? Re(s) : ce(s)
478
+ (o) => t.includePhysicalDatasets ? je(o) : ce(o)
455
479
  ), a = u(e.entityId);
456
480
  if (a) {
457
- const s = H(a), o = i.filter((d) => {
458
- const c = _(d);
459
- return !!(s && H(c == null ? void 0 : c.id) === s);
481
+ const o = H(a), s = i.filter((l) => {
482
+ const c = _(l);
483
+ return !!(o && H(c == null ? void 0 : c.id) === o);
460
484
  });
461
- if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
462
- if (o.length === 1) {
463
- const d = j(e, o[0]);
464
- return d ? {
485
+ if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
486
+ if (s.length === 1) {
487
+ const l = j(e, s[0]);
488
+ return l ? {
465
489
  kind: "resolved",
466
490
  basis: "bare",
467
- entity: o[0],
468
- source: d,
491
+ entity: s[0],
492
+ source: l,
469
493
  matchedById: !0
470
494
  } : { kind: "not_found", basis: "bare" };
471
495
  }
@@ -476,51 +500,51 @@ function je(e, t = {}) {
476
500
  ...e.bareHints || []
477
501
  ]);
478
502
  if (r.size > 0) {
479
- const s = i.filter((o) => {
480
- const d = _(o);
481
- return [...Z([d == null ? void 0 : d.id, d == null ? void 0 : d.name])].some((l) => r.has(l));
503
+ const o = i.filter((s) => {
504
+ const l = _(s);
505
+ return [...Z([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((d) => r.has(d));
482
506
  });
483
- if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
484
- if (s.length === 1) {
485
- const o = j(e, s[0]);
486
- return o ? {
507
+ if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
508
+ if (o.length === 1) {
509
+ const s = j(e, o[0]);
510
+ return s ? {
487
511
  kind: "resolved",
488
512
  basis: "bare",
489
- entity: s[0],
490
- source: o,
513
+ entity: o[0],
514
+ source: s,
491
515
  matchedById: !1
492
516
  } : { kind: "not_found", basis: "bare" };
493
517
  }
494
518
  return { kind: "not_found", basis: "bare" };
495
519
  }
496
520
  if (i.length === 1) {
497
- const s = j(e, i[0]);
498
- return s ? {
521
+ const o = j(e, i[0]);
522
+ return o ? {
499
523
  kind: "resolved",
500
524
  basis: "unqualified",
501
525
  entity: i[0],
502
- source: s,
526
+ source: o,
503
527
  matchedById: !1
504
528
  } : { kind: "unqualified" };
505
529
  }
506
530
  return { kind: "unqualified" };
507
531
  }
508
532
  function M(e) {
509
- const t = e.resolution.kind === "resolved" ? _(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: i, dialect: a } = e.resolution.capabilityAuthority, r = C(a), s = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
533
+ const t = e.resolution.kind === "resolved" ? _(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: i, dialect: a } = e.resolution.capabilityAuthority, r = C(a), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
510
534
  "."
511
- )), o = e.resolution.coordinates;
512
- if (!(!n || !(o != null && o.tableName)))
535
+ )), s = e.resolution.coordinates;
536
+ if (!(!n || !(s != null && s.tableName)))
513
537
  return {
514
538
  kind: "physical",
515
539
  connectionId: n,
516
540
  ...i ? { connectionType: i } : {},
517
- ...!i && s ? { dialect: a } : {},
518
- tableName: o.tableName,
519
- ...o.databaseName ? { databaseName: o.databaseName } : {},
520
- ...o.schemaName ? { schemaName: o.schemaName } : {}
541
+ ...!i && o ? { dialect: a } : {},
542
+ tableName: s.tableName,
543
+ ...s.databaseName ? { databaseName: s.databaseName } : {},
544
+ ...s.schemaName ? { schemaName: s.schemaName } : {}
521
545
  };
522
546
  }
523
- function Me(e) {
547
+ function $e(e) {
524
548
  if (!e.coordinates.tableName) return !1;
525
549
  const t = _(e.entity), n = H(t == null ? void 0 : t.id), i = e.qualifiedHints.map(u).filter((l) => !!(l != null && l.includes(".")));
526
550
  if (n && i.length > 0 && i.every((l) => H(l) === n))
@@ -529,80 +553,76 @@ function Me(e) {
529
553
  if (!a) return !1;
530
554
  const r = p(
531
555
  u(t == null ? void 0 : t.database)
532
- ), s = p(
556
+ ), o = p(
533
557
  u(t == null ? void 0 : t.schema)
534
- ), { capabilities: o } = e.capabilityAuthority, d = {
535
- ...r ? { databaseName: r } : {},
536
- ...s ? { schemaName: s } : {},
537
- tableName: a
538
- };
539
- return X({
558
+ ), { capabilities: s } = e.capabilityAuthority;
559
+ return ke({
540
560
  requested: e.coordinates,
541
- allowed: d,
542
- capabilities: o
543
- }) ? !0 : r && !o.prefixLevels.includes("database") || s && !o.prefixLevels.includes("schema") ? X({
544
- requested: e.coordinates,
545
- allowed: z({
546
- qualifiedName: [r, s, a].filter(Boolean).join("."),
547
- capabilities: o
561
+ allowed: ae({
562
+ recorded: {
563
+ ...r ? { databaseName: r } : {},
564
+ ...o ? { schemaName: o } : {},
565
+ tableName: a
566
+ },
567
+ capabilities: s
548
568
  }),
549
- capabilities: o
550
- }) : !1;
569
+ capabilities: s
570
+ });
551
571
  }
552
572
  function Oe(e) {
553
- var a, r, s;
573
+ var a, r, o;
554
574
  if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((a = e.fallbackCoordinateHint) == null ? void 0 : a.databaseName) || u((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
555
575
  return;
556
576
  const t = [
557
- u((s = e.fallbackCoordinateHint) == null ? void 0 : s.tableName),
577
+ u((o = e.fallbackCoordinateHint) == null ? void 0 : o.tableName),
558
578
  ...(e.qualifiedHints || []).map(u),
559
579
  ...(e.bareHints || []).map(u),
560
580
  u(e.entityName),
561
581
  ...u(e.fieldEntityType) === "table" ? [u(e.entityId)] : []
562
- ].filter((o) => !!o);
563
- if (!t.length || t.some((o) => o.includes(".")))
582
+ ].filter((s) => !!s);
583
+ if (!t.length || t.some((s) => s.includes(".")))
564
584
  return;
565
585
  const n = t.map(p);
566
- return n.some((o) => !o) ? void 0 : new Set(n.map((o) => o.toLowerCase())).size === 1 ? n[0] : void 0;
586
+ return n.some((s) => !s) ? void 0 : new Set(n.map((s) => s.toLowerCase())).size === 1 ? n[0] : void 0;
567
587
  }
568
- function rt(e) {
588
+ function ct(e) {
569
589
  const t = e.entities.filter(
570
- oe
590
+ se
571
591
  ), n = e.entities.filter(
572
592
  ce
573
- ), i = t.length > 0 || n.length > 0, a = je(e), r = e.qualifiedHints || [], s = r.some(
593
+ ), i = t.length > 0 || n.length > 0, a = Me(e), r = e.qualifiedHints || [], o = r.some(
574
594
  (c) => {
575
- var l;
576
- return (l = u(c)) == null ? void 0 : l.includes(".");
595
+ var d;
596
+ return (d = u(c)) == null ? void 0 : d.includes(".");
577
597
  }
578
- ), o = Te({
598
+ ), s = De({
579
599
  entities: t,
580
600
  connectionType: u(e.connectionType),
581
601
  dialect: e.dialect,
582
602
  capabilities: e.capabilities,
583
603
  qualifiedHints: r,
584
604
  bareHints: [e.entityName, e.entityId, ...e.bareHints || []],
585
- ...!s && e.fallbackCoordinateHint ? { coordinateHint: e.fallbackCoordinateHint } : {}
605
+ ...!o && e.fallbackCoordinateHint ? { coordinateHint: e.fallbackCoordinateHint } : {}
586
606
  });
587
- if (o.kind === "malformed" || o.kind === "conflicting" || o.kind === "incompatible_capabilities" && s || o.kind === "ambiguous" && o.basis === "qualified")
588
- return o;
589
- if (o.kind === "resolved" && o.basis === "qualified") {
607
+ if (s.kind === "malformed" || s.kind === "conflicting" || s.kind === "incompatible_capabilities" && o || s.kind === "ambiguous" && s.basis === "qualified")
608
+ return s;
609
+ if (s.kind === "resolved" && s.basis === "qualified") {
590
610
  const c = M({
591
- resolution: o,
611
+ resolution: s,
592
612
  connectionId: e.connectionId
593
613
  });
594
614
  return c ? {
595
615
  kind: "resolved",
596
- basis: o.basis,
616
+ basis: s.basis,
597
617
  source: c,
598
- entity: o.entity
618
+ entity: s.entity
599
619
  } : { kind: "missing_connection" };
600
620
  }
601
- if (o.kind === "not_found" && o.basis === "qualified" && o.coordinates) {
602
- if (a.kind === "resolved" && a.matchedById && Me({
621
+ if (s.kind === "not_found" && s.basis === "qualified" && s.coordinates) {
622
+ if (a.kind === "resolved" && a.matchedById && $e({
603
623
  entity: a.entity,
604
- coordinates: o.coordinates,
605
- capabilityAuthority: o.capabilityAuthority,
624
+ coordinates: s.coordinates,
625
+ capabilityAuthority: s.capabilityAuthority,
606
626
  qualifiedHints: r
607
627
  }))
608
628
  return {
@@ -612,77 +632,77 @@ function rt(e) {
612
632
  entity: a.entity
613
633
  };
614
634
  const c = M({
615
- resolution: o,
635
+ resolution: s,
616
636
  connectionId: e.connectionId
617
637
  });
618
638
  return c ? i ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
619
639
  }
620
640
  if (a.kind === "resolved")
621
- return o.kind === "resolved" && o.basis === "bare" && !a.matchedById ? { kind: "ambiguous", basis: "bare" } : {
641
+ return s.kind === "resolved" && s.basis === "bare" && !a.matchedById ? { kind: "ambiguous", basis: "bare" } : {
622
642
  kind: "resolved",
623
643
  basis: a.basis,
624
644
  source: a.source,
625
645
  entity: a.entity
626
646
  };
627
647
  if (a.kind === "ambiguous") return a;
628
- if (o.kind === "resolved") {
648
+ if (s.kind === "resolved") {
629
649
  const c = M({
630
- resolution: o,
650
+ resolution: s,
631
651
  connectionId: e.connectionId
632
652
  });
633
653
  return c ? {
634
654
  kind: "resolved",
635
- basis: o.basis,
655
+ basis: s.basis,
636
656
  source: c,
637
- entity: o.entity
657
+ entity: s.entity
638
658
  } : { kind: "missing_connection" };
639
659
  }
640
- const d = u(e.entityName) || u(e.entityId);
641
- if (!i && !s && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && d)
660
+ const l = u(e.entityName) || u(e.entityId);
661
+ if (!i && !o && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && l)
642
662
  return {
643
663
  kind: "resolved",
644
664
  basis: "historical",
645
665
  source: {
646
666
  kind: "semantic",
647
667
  domainId: u(e.semanticDomainId),
648
- datasetName: d,
668
+ datasetName: l,
649
669
  ...u(e.connectionId) ? { connectionId: u(e.connectionId) } : {}
650
670
  }
651
671
  };
652
- if (o.kind === "incompatible_capabilities") {
653
- const c = i ? void 0 : Oe(e), l = u(e.connectionId);
654
- return c && l ? {
672
+ if (s.kind === "incompatible_capabilities") {
673
+ const c = i ? void 0 : Oe(e), d = u(e.connectionId);
674
+ return c && d ? {
655
675
  kind: "resolved",
656
676
  basis: "historical",
657
- source: { kind: "physical", connectionId: l, tableName: c }
658
- } : o;
677
+ source: { kind: "physical", connectionId: d, tableName: c }
678
+ } : s;
659
679
  }
660
- return o.kind === "ambiguous" ? o : o.kind === "not_found" ? {
680
+ return s.kind === "ambiguous" ? s : s.kind === "not_found" ? {
661
681
  kind: "not_found",
662
- basis: o.basis
682
+ basis: s.basis
663
683
  } : { kind: "unqualified" };
664
684
  }
665
685
  const le = "click-reach:";
666
- function ct(e, t) {
686
+ function lt(e, t) {
667
687
  const n = t.source.kind === "semantic" ? t.source.datasetName : t.source.tableName;
668
688
  return `${le}${e}:${n}.${t.name}`;
669
689
  }
670
- function lt(e) {
690
+ function dt(e) {
671
691
  return typeof e == "string" && e.startsWith(le);
672
692
  }
673
- function $e(e, t) {
674
- return Ce({ ...e, role: t });
693
+ function ze(e, t) {
694
+ return _e({ ...e, role: t });
675
695
  }
676
- function dt(e, t) {
696
+ function ut(e, t) {
677
697
  if (t.id) {
678
698
  const n = [];
679
699
  e.forEach(
680
- ({ fields: a }, r) => a.forEach((s, o) => {
681
- s.id === t.id && n.push({ group: r, index: o });
700
+ ({ fields: a }, r) => a.forEach((o, s) => {
701
+ o.id === t.id && n.push({ group: r, index: s });
682
702
  })
683
703
  );
684
704
  const i = t.alias ? n.find(
685
- ({ group: a, index: r }) => $e(e[a].fields[r], e[a].role) === t.alias
705
+ ({ group: a, index: r }) => ze(e[a].fields[r], e[a].role) === t.alias
686
706
  ) : void 0;
687
707
  if (i) return i;
688
708
  if (n.length === 1) return n[0];
@@ -695,11 +715,11 @@ function dt(e, t) {
695
715
  }
696
716
  }
697
717
  function de(e, t) {
698
- const n = e.split(".").map((o) => o.trim()), i = t.split(".").map((o) => o.trim());
699
- if (n.length === 0 || i.length === 0 || n.some((o) => !o) || i.some((o) => !o))
718
+ const n = e.split(".").map((s) => s.trim()), i = t.split(".").map((s) => s.trim());
719
+ if (n.length === 0 || i.length === 0 || n.some((s) => !s) || i.some((s) => !s))
700
720
  return !1;
701
- const [a, r] = n.length <= i.length ? [n, i] : [i, n], s = r.length - a.length;
702
- return a.every((o, d) => o === r[d + s]);
721
+ const [a, r] = n.length <= i.length ? [n, i] : [i, n], o = r.length - a.length;
722
+ return a.every((s, l) => s === r[l + o]);
703
723
  }
704
724
  function we(e, t) {
705
725
  const n = e.split("."), i = t.split("."), a = n.pop(), r = i.pop();
@@ -708,7 +728,7 @@ function we(e, t) {
708
728
  i.join(".")
709
729
  ));
710
730
  }
711
- function ze(e) {
731
+ function Qe(e) {
712
732
  const t = e.map((i) => i.trim()).filter(Boolean);
713
733
  if (t.every(
714
734
  (i, a) => t.slice(a + 1).every(
@@ -735,12 +755,12 @@ function W(e) {
735
755
  function y(e) {
736
756
  return typeof e == "string" ? e.trim() : "";
737
757
  }
738
- function Qe(e, t) {
758
+ function We(e, t) {
739
759
  return e.every(
740
760
  (n, i) => e.slice(i + 1).every((a) => t(n, a))
741
761
  );
742
762
  }
743
- function We(e, t) {
763
+ function Ue(e, t) {
744
764
  const n = y(e.id), i = y(e.name), a = y(t.entityId), r = y(t.entityName);
745
765
  return !i || !a && !r ? !1 : (!a || a === n || a === i) && (!r || r === i);
746
766
  }
@@ -751,68 +771,68 @@ function Ke(e) {
751
771
  if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
752
772
  if (!i)
753
773
  return { status: "unresolved", reason: "incomplete_source_identity" };
754
- const s = y(n == null ? void 0 : n.entityId), o = y(n == null ? void 0 : n.entityName), d = !!(s || o), c = d ? a.filter(
755
- (h) => We(h, {
756
- entityId: s,
757
- entityName: o
774
+ const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ? a.filter(
775
+ (h) => Ue(h, {
776
+ entityId: o,
777
+ entityName: s
758
778
  })
759
779
  ) : a;
760
780
  if (c.length > 1)
761
781
  return { status: "unresolved", reason: "incomplete_source_identity" };
762
- if (d && a.length > 0 && c.length === 0)
782
+ if (l && a.length > 0 && c.length === 0)
763
783
  return { status: "unresolved", reason: "divergent_source_identity" };
764
- const l = c[0], m = y(l == null ? void 0 : l.domainId), b = y(l == null ? void 0 : l.id), k = y(l == null ? void 0 : l.name);
784
+ const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id), N = y(d == null ? void 0 : d.name);
765
785
  if (m && m !== i)
766
786
  return { status: "unresolved", reason: "divergent_source_identity" };
767
- const g = b, I = k || o;
768
- return I ? {
787
+ const b = g, k = N || s;
788
+ return k ? {
769
789
  status: "resolved",
770
790
  source: {
771
791
  kind: "semantic",
772
792
  domainId: i,
773
- datasetName: I,
774
- ...g ? { datasetId: g } : {}
793
+ datasetName: k,
794
+ ...b ? { datasetId: b } : {}
775
795
  }
776
796
  } : { status: "unresolved", reason: "incomplete_source_identity" };
777
797
  }
778
- function Ue(e, t) {
798
+ function Ge(e, t) {
779
799
  const n = y(e.connectionId), i = v(e.semanticContext) ? e.semanticContext : void 0, a = y(i == null ? void 0 : i.connectionId);
780
800
  if (n && a && n !== a)
781
801
  return { status: "unresolved", reason: "divergent_source_identity" };
782
- const r = n || a, s = v(e.fieldMeta) ? e.fieldMeta : void 0, o = t.split(".").slice(0, -1).join("."), d = W(e.qualifiedTableName), c = W(
783
- s == null ? void 0 : s.qualifiedEntityName
784
- ), l = [
785
- d,
802
+ const r = n || a, o = v(e.fieldMeta) ? e.fieldMeta : void 0, s = t.split(".").slice(0, -1).join("."), l = W(e.qualifiedTableName), c = W(
803
+ o == null ? void 0 : o.qualifiedEntityName
804
+ ), d = [
805
+ l,
786
806
  c,
787
- o
788
- ].filter(Boolean), m = ze(l);
789
- return !m && l.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
807
+ s
808
+ ].filter(Boolean), m = Qe(d);
809
+ return !m && d.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
790
810
  status: "resolved",
791
811
  source: { kind: "physical", connectionId: r, tableName: m }
792
812
  };
793
813
  }
794
- function Ge(e, t) {
814
+ function Ve(e, t) {
795
815
  const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = ee(
796
816
  n == null ? void 0 : n.qualifiedFieldName
797
- ), r = typeof e.column == "string" ? e.column.trim() : "", s = ee(r), o = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", d = W(
817
+ ), r = typeof e.column == "string" ? e.column.trim() : "", o = ee(r), s = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = W(
798
818
  e.qualifiedTableName
799
819
  );
800
- if (i && !a || t && o && !d || r.includes(".") && !s)
820
+ if (i && !a || t && s && !l || r.includes(".") && !o)
801
821
  return { status: "unresolved", reason: "incomplete_field_identity" };
802
- const c = s.split("."), l = s ? c[c.length - 1] : r, m = t && d && l ? `${d}.${l}` : "", b = [
822
+ const c = o.split("."), d = o ? c[c.length - 1] : r, m = t && l && d ? `${l}.${d}` : "", g = [
803
823
  a,
804
- s,
824
+ o,
805
825
  m
806
826
  ].filter(Boolean);
807
- if (!Qe(
808
- b,
827
+ if (!We(
828
+ g,
809
829
  we
810
830
  ))
811
831
  return { status: "unresolved", reason: "divergent_field_identity" };
812
- const k = s || a || m;
813
- return k ? { status: "resolved", qualifiedFieldName: k } : { status: "unresolved", reason: "incomplete_field_identity" };
832
+ const N = o || a || m;
833
+ return N ? { status: "resolved", qualifiedFieldName: N } : { status: "unresolved", reason: "incomplete_field_identity" };
814
834
  }
815
- function Ve(e) {
835
+ function Je(e) {
816
836
  if (!v(e))
817
837
  return { status: "ineligible", reason: "invalid_input" };
818
838
  if (e.kind === "global-date")
@@ -829,61 +849,61 @@ function Ve(e) {
829
849
  return { status: "ineligible", reason: "custom_filter" };
830
850
  if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
831
851
  return { status: "ineligible", reason: "multi_target_filter" };
832
- const a = Ke(e), r = Ge(e, a === void 0);
852
+ const a = Ke(e), r = Ve(e, a === void 0);
833
853
  if (r.status === "unresolved")
834
854
  return { status: "ineligible", reason: r.reason };
835
- const s = a || Ue(e, r.qualifiedFieldName);
836
- return s.status === "resolved" ? {
855
+ const o = a || Ge(e, r.qualifiedFieldName);
856
+ return o.status === "resolved" ? {
837
857
  status: "eligible",
838
858
  kind: "field_date",
839
859
  qualifiedFieldName: r.qualifiedFieldName,
840
- source: s.source
841
- } : { status: "ineligible", reason: s.reason };
860
+ source: o.source
861
+ } : { status: "ineligible", reason: o.reason };
842
862
  }
843
863
  function Xe(e) {
844
864
  if (!v(e) || e.kind !== "filter" || !v(e.filter))
845
865
  return { status: "ineligible", reason: "invalid_input" };
846
- const t = Ve(
866
+ const t = Je(
847
867
  e.filter
848
868
  );
849
869
  return t.status === "ineligible" ? t : t.kind === "field_date" && v(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
850
870
  }
851
- function ut(e) {
871
+ function ft(e) {
852
872
  return Xe(e).status === "eligible";
853
873
  }
854
- function ft(e) {
874
+ function mt(e) {
855
875
  return `compat-filter:${e}`;
856
876
  }
857
- function mt(e) {
877
+ function bt(e) {
858
878
  return `compat-control:${e}`;
859
879
  }
860
880
  function gt(e, t) {
861
881
  return `compat-inline-filter:${e}:${t}`;
862
882
  }
863
- function bt(e, t) {
883
+ function yt(e, t) {
864
884
  return `compat-card-control:${e}:${t}`;
865
885
  }
866
- function Je(e) {
886
+ function Ye(e) {
867
887
  var i;
868
888
  if (!e) return !1;
869
889
  if (typeof e.aggregate == "string" || e.isPreAggregated) return !0;
870
890
  const t = typeof e.expression == "string" ? e.expression : "";
871
891
  if (!t) return !1;
872
- if (_e(t).calls.length > 0) return !0;
892
+ if (Se(t).calls.length > 0) return !0;
873
893
  const n = (i = e.calculatedFormula) == null ? void 0 : i.inputFields;
874
894
  return Array.isArray(n) && n.some((a) => {
875
- const r = String((a == null ? void 0 : a.role) || "").toLowerCase(), s = String((a == null ? void 0 : a.aggregate) || "").trim();
876
- return r === "metric" && s.length > 0;
895
+ const r = String((a == null ? void 0 : a.role) || "").toLowerCase(), o = String((a == null ? void 0 : a.aggregate) || "").trim();
896
+ return r === "metric" && o.length > 0;
877
897
  });
878
898
  }
879
- function yt(e) {
880
- return !!((e == null ? void 0 : e.role) === "metric" && (Ie(e) || Je(e)));
899
+ function ht(e) {
900
+ return !!((e == null ? void 0 : e.role) === "metric" && (Ie(e) || Ye(e)));
881
901
  }
882
902
  const ue = "col:";
883
- function ht(e) {
903
+ function pt(e) {
884
904
  return `${ue}${e}`;
885
905
  }
886
- function pt(e) {
906
+ function vt(e) {
887
907
  return typeof e == "string" && e.startsWith(ue);
888
908
  }
889
909
  function fe(e, t) {
@@ -891,23 +911,23 @@ function fe(e, t) {
891
911
  const n = t === void 0 ? "unknown" : Q(t);
892
912
  return n === "number" || n === "unknown" ? "SUM" : "COUNT";
893
913
  }
894
- function Ye(e) {
914
+ function Ze(e) {
895
915
  const t = e.aggregate === fe(e.semanticAggregate, e.dataType);
896
916
  return {
897
917
  effectiveAggregate: e.aggregate,
898
918
  aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
899
919
  };
900
920
  }
901
- function Ze(e, t, n) {
921
+ function et(e, t, n) {
902
922
  const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
903
923
  return {
904
924
  aggregate: t,
905
925
  aggregateOrigin: n,
906
- ...i ? Ye({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
926
+ ...i ? Ze({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
907
927
  };
908
928
  }
909
- function vt(e, t, n) {
910
- return { ...e, ...Ze(e, t, n) };
929
+ function Nt(e, t, n) {
930
+ return { ...e, ...et(e, t, n) };
911
931
  }
912
932
  function kt(e) {
913
933
  return e.aggregate ?? e.effectiveAggregate;
@@ -921,23 +941,23 @@ function It(e) {
921
941
  }
922
942
  return e.aggregateOrigin !== "default";
923
943
  }
924
- const Nt = ["label", "labelOrigin", "derivedLabel"];
925
- function Ct(e) {
944
+ const Ct = ["label", "labelOrigin", "derivedLabel"];
945
+ function _t(e) {
926
946
  return { label: e, labelOrigin: "override", derivedLabel: void 0 };
927
947
  }
928
- function _t(e, t) {
948
+ function St(e, t) {
929
949
  const { derivedLabel: n, ...i } = e;
930
950
  return { ...i, label: t, labelOrigin: "override" };
931
951
  }
932
- function St(e, t) {
952
+ function At(e, t) {
933
953
  return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
934
954
  }
935
- function At(e) {
955
+ function Tt(e) {
936
956
  if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
937
957
  if (!(!e.grouped || e.measures.length === 0))
938
958
  return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
939
959
  }
940
- const Tt = /* @__PURE__ */ new Set([
960
+ const Dt = /* @__PURE__ */ new Set([
941
961
  "contains",
942
962
  "startsWith",
943
963
  "endsWith",
@@ -947,7 +967,7 @@ const Tt = /* @__PURE__ */ new Set([
947
967
  function me(e) {
948
968
  return e.includes("%") || e.includes("_");
949
969
  }
950
- function et(e, t) {
970
+ function tt(e, t) {
951
971
  switch (e) {
952
972
  case "contains":
953
973
  return { pattern: `%${t}%`, negate: !1 };
@@ -961,15 +981,15 @@ function et(e, t) {
961
981
  return { pattern: t, negate: !0 };
962
982
  }
963
983
  }
964
- function tt(e) {
984
+ function nt(e) {
965
985
  return me(e) ? e : `%${e}%`;
966
986
  }
967
- function Dt(e, t) {
968
- const { pattern: n, negate: i } = et(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = a !== void 0 && !me(a) ? a : n;
969
- if (tt(r) === n)
987
+ function Et(e, t) {
988
+ const { pattern: n, negate: i } = tt(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = a !== void 0 && !me(a) ? a : n;
989
+ if (nt(r) === n)
970
990
  return { operator: i ? "not_contains" : "contains", value: r };
971
991
  }
972
- function Et(e) {
992
+ function qt(e) {
973
993
  const { operation: t, values: n, temporalPrecision: i } = e;
974
994
  if (t !== "=" && t !== "!=" || i === "minute")
975
995
  return null;
@@ -978,41 +998,41 @@ function Et(e) {
978
998
  const r = a[0].trim();
979
999
  return pe(r) ? { operation: t, day: r } : null;
980
1000
  }
981
- function ge(e) {
1001
+ function be(e) {
982
1002
  const { label: t, ...n } = e;
983
1003
  return {
984
- dataset: Ne(n),
1004
+ dataset: Ce(n),
985
1005
  ...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
986
1006
  };
987
1007
  }
988
- function be(e) {
1008
+ function ge(e) {
989
1009
  const { label: t, source: n, ...i } = e;
990
- return { ...i, source: n && ge(n) };
1010
+ return { ...i, source: n && be(n) };
991
1011
  }
992
- function G(e) {
1012
+ function V(e) {
993
1013
  const {
994
1014
  label: t,
995
1015
  format: n,
996
1016
  description: i,
997
1017
  tags: a,
998
1018
  inputs: r,
999
- ...s
1019
+ ...o
1000
1020
  } = e;
1001
1021
  return {
1002
- ...s,
1022
+ ...o,
1003
1023
  inputs: Object.fromEntries(
1004
- Object.entries(r).map(([o, d]) => [
1005
- o,
1006
- { ...d, field: be(d.field) }
1024
+ Object.entries(r).map(([s, l]) => [
1025
+ s,
1026
+ { ...l, field: ge(l.field) }
1007
1027
  ])
1008
1028
  )
1009
1029
  };
1010
1030
  }
1011
- function O(e) {
1031
+ function $(e) {
1012
1032
  const { derivedField: t, ...n } = e;
1013
1033
  return {
1014
- ...be(n),
1015
- derivedField: t && G(t)
1034
+ ...ge(n),
1035
+ derivedField: t && V(t)
1016
1036
  };
1017
1037
  }
1018
1038
  function x(e) {
@@ -1022,18 +1042,18 @@ function x(e) {
1022
1042
  description: i,
1023
1043
  semanticTemporalPresentation: a,
1024
1044
  derivedField: r,
1025
- calculatedFormula: s,
1026
- ...o
1045
+ calculatedFormula: o,
1046
+ ...s
1027
1047
  } = e;
1028
1048
  return {
1029
- ...o,
1049
+ ...s,
1030
1050
  semanticTemporalPresentation: a && {
1031
1051
  granularity: a.granularity
1032
1052
  },
1033
- derivedField: r && G(r),
1034
- calculatedFormula: s && {
1035
- ...s,
1036
- inputFields: s.inputFields.map(x)
1053
+ derivedField: r && V(r),
1054
+ calculatedFormula: o && {
1055
+ ...o,
1056
+ inputFields: o.inputFields.map(x)
1037
1057
  }
1038
1058
  };
1039
1059
  }
@@ -1049,22 +1069,22 @@ function ye(e) {
1049
1069
  groups: e.groups.map(ye)
1050
1070
  };
1051
1071
  }
1052
- function qt(e) {
1072
+ function Ft(e) {
1053
1073
  return {
1054
1074
  ...e,
1055
- source: ge(e.source),
1075
+ source: be(e.source),
1056
1076
  rows: e.rows.map((t) => ({
1057
1077
  ...t,
1058
- field: O(t.field)
1078
+ field: $(t.field)
1059
1079
  })),
1060
1080
  columns: e.columns.map((t) => ({
1061
1081
  ...t,
1062
- field: O(t.field)
1082
+ field: $(t.field)
1063
1083
  })),
1064
1084
  measures: e.measures.map(
1065
- (t) => t.kind === "aggregate" ? { ...t, field: O(t.field) } : {
1085
+ (t) => t.kind === "aggregate" ? { ...t, field: $(t.field) } : {
1066
1086
  ...t,
1067
- definition: G(t.definition)
1087
+ definition: V(t.definition)
1068
1088
  }
1069
1089
  ),
1070
1090
  filters: e.filters && ye(e.filters),
@@ -1085,57 +1105,58 @@ function qt(e) {
1085
1105
  },
1086
1106
  // Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
1087
1107
  sorts: [...e.sorts].sort((t, n) => {
1088
- const i = J(t), a = J(n);
1108
+ const i = X(t), a = X(n);
1089
1109
  return i < a ? -1 : i > a ? 1 : 0;
1090
1110
  })
1091
1111
  };
1092
1112
  }
1093
1113
  export {
1094
- Se as A,
1095
- fe as B,
1096
- Ye as C,
1097
- vt as D,
1098
- kt as E,
1099
- It as F,
1100
- Nt as G,
1114
+ vt as A,
1115
+ Ae as B,
1116
+ fe as C,
1117
+ Ze as D,
1118
+ Nt as E,
1119
+ kt as F,
1120
+ It as G,
1101
1121
  Ct as H,
1102
1122
  _t as I,
1103
- At as J,
1104
- me as K,
1105
- et as L,
1123
+ St as J,
1124
+ Tt as K,
1125
+ me as L,
1106
1126
  tt as M,
1107
- Dt as N,
1127
+ nt as N,
1108
1128
  Et as O,
1109
- de as P,
1110
- ze as Q,
1129
+ qt as P,
1130
+ de as Q,
1111
1131
  Y as R,
1112
- Tt as S,
1113
- G as T,
1114
- we as U,
1115
- qt as a,
1116
- ae as b,
1117
- oe as c,
1118
- Te as d,
1119
- ce as e,
1120
- je as f,
1121
- St as g,
1122
- rt as h,
1123
- lt as i,
1132
+ Dt as S,
1133
+ Qe as T,
1134
+ V as U,
1135
+ we as V,
1136
+ Ft as a,
1137
+ G as b,
1138
+ rt as c,
1139
+ se as d,
1140
+ De as e,
1141
+ ce as f,
1142
+ At as g,
1143
+ Me as h,
1144
+ dt as i,
1124
1145
  ct as j,
1125
- dt as k,
1126
- We as l,
1127
- Ze as m,
1128
- Ve as n,
1129
- Xe as o,
1130
- ut as p,
1146
+ lt as k,
1147
+ ut as l,
1148
+ et as m,
1149
+ Ue as n,
1150
+ Je as o,
1151
+ Xe as p,
1131
1152
  ft as q,
1132
- st as r,
1133
- $e as s,
1153
+ ae as r,
1154
+ ze as s,
1134
1155
  mt as t,
1135
- gt as u,
1136
- bt as v,
1137
- Je as w,
1138
- yt as x,
1156
+ bt as u,
1157
+ gt as v,
1158
+ yt as w,
1159
+ Ye as x,
1139
1160
  ht as y,
1140
1161
  pt as z
1141
1162
  };