react-semaphor 0.1.559 → 0.1.561

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 (168) hide show
  1. package/dist/analytics-protocol/index.js +389 -378
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/analytics-base-schemas-CB3oFAXk.js +658 -0
  7. package/dist/chunks/{assistant-chat-B_4bVE6I.js → assistant-chat-DiVHY3Hw.js} +209 -211
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Rdxa3H-s.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-CKzQ5LcF.js → comparison-window-caption-DDsIWJYT.js} +201 -201
  12. package/dist/chunks/{context-DVy4HOU0.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-zVa9wX_o.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-BziwOVpZ.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CbeNR-YI.js → dashboard-briefing-launcher-CgvTLndW.js} +1163 -1178
  16. package/dist/chunks/{dashboard-controls-RD6UJs1r.js → dashboard-controls-B4vfSzTF.js} +877 -941
  17. package/dist/chunks/{dashboard-json-DGpv17vL.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-AQ2pQkFp.js → edit-dashboard-visual-DwjZcxj-.js} +9080 -9354
  20. package/dist/chunks/filter-reach-copy-bijwf_-b.js +3596 -0
  21. package/dist/chunks/{filter-value-text-B4l-xqJT.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-B1Xr7W24.js → index-ClwbY3BL.js} +648 -674
  24. package/dist/chunks/{layout-grid-Bbz3zKif.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-3sbH0Uy1.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CEe3PGEo.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-BRNGb1C4.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-CEegvTqg.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-COxrfQTS.js → matrix-operation-contract-BSiGEXVC.js} +221 -214
  30. package/dist/chunks/{metric-comparison-DQx-uX__.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-DMJtp3Vn.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-CAj8SiRL.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-0sc8B1lh.js → report-preferences-dialog-C2YUIwKG.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-bYoExeWr.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-DSb1jTtG.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-BQWM3ldX.js → saved-dashboard-context-8jqfI7hI.js} +59 -59
  40. package/dist/chunks/{selection-reducer-DSzMWb4x.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-Bz14Oma5.js → semaphor-ready-indicator-E2XWyibu.js} +40105 -41658
  42. package/dist/chunks/{shelf-drop-preview-context-DBHAkgch.js → shelf-drop-preview-context-C29EUzDp.js} +570 -570
  43. package/dist/chunks/{source-entity-resolution-BOrmNCEM.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-Dq8XPFpT.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_RvEUyO.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-LCYMJ3pa.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-Dr_WAxHQ.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-BK3YFkfc.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-C87JPd-_.js → validators-BtaCFIEB.js} +1206 -1579
  51. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2713 -1459
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +262 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +50 -51
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  68. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  69. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  70. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  71. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  72. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  73. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  74. package/dist/types/lib/stores/editor-store.d.ts +48 -10
  75. package/dist/types/lib/stores/table-actions.d.ts +9 -5
  76. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  79. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  80. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  81. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  82. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  83. package/dist/types/lib/types/common-types.d.ts +40 -47
  84. package/dist/types/lib/types/explorer-types.d.ts +11 -43
  85. package/dist/types/lib/utils/card-config-utils.d.ts +8 -0
  86. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  87. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +169 -513
  88. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  89. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  90. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  91. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  92. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  93. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  94. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  95. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  96. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  97. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  98. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  99. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  100. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  101. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  102. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  103. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  106. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  107. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  108. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  109. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  110. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  111. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  112. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  113. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  114. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  117. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  120. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  121. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +555 -38
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  124. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  125. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  127. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +7 -0
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  130. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  131. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  132. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  133. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  134. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  135. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  136. package/dist/types/shared/dashboard-authoring/index.d.ts +8 -0
  137. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  138. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  139. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  142. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  143. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  144. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  145. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +13 -2
  146. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  147. package/dist/types/shared/format-utils/index.d.ts +2 -0
  148. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  149. package/dist/types/shared/format-utils/raw-temporal.d.ts +31 -1
  150. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  151. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  152. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  153. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  154. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  155. package/package.json +2 -2
  156. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  157. package/dist/chunks/bookmark-state-ssqrs5oP.js +0 -111
  158. package/dist/chunks/document-dashboard-inputs-ChVkcBuu.js +0 -3010
  159. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  160. package/dist/chunks/filter-reach-copy-B5Y7FHzg.js +0 -3411
  161. package/dist/chunks/global-date-filter-utils-DBzEOX9M.js +0 -12222
  162. package/dist/chunks/pivot-result-contract-expectations-DOYhqeZb.js +0 -1926
  163. package/dist/chunks/raw-temporal-presentation-BmT7z6NH.js +0 -584
  164. package/dist/chunks/resolve-dashboard-input-context-B_C_VAJH.js +0 -5520
  165. package/dist/chunks/table-settings-DXj_zXwS.js +0 -637
  166. package/dist/chunks/temporal-input-presentation-AhLSkGPf.js +0 -2939
  167. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  168. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,24 +1,24 @@
1
- import { M as xe, j as z, l as Ue, m as jt, o as $t, q as Ot, v as Pt, g as He, h as ie, a as Yt, c as ze } from "./analytics-base-schemas-BUFUoO6G.js";
2
- import { z as n } from "zod";
3
- function qt(e) {
1
+ import { M as ve, x as O, w as It, B as St, C as kt, E as wt, G as At, v as xt, h as je, j as X, k as Ft, b as Dt, d as Ye } from "./analytics-base-schemas-CB3oFAXk.js";
2
+ import { z as a } from "zod";
3
+ function Mt(e) {
4
4
  return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
5
5
  }
6
- function Lt(e) {
7
- return !Array.isArray(e) || e.length === 0 || e.length > xe || !e.every(qt) ? {
6
+ function Et(e) {
7
+ return !Array.isArray(e) || e.length === 0 || e.length > ve || !e.every(Mt) ? {
8
8
  ok: !1,
9
- error: `matchValues must be 1 to ${xe} string, number or boolean values.`
9
+ error: `matchValues must be 1 to ${ve} string, number or boolean values.`
10
10
  } : { ok: !0, values: e };
11
11
  }
12
- const Bt = [
12
+ const Tt = [
13
13
  "day",
14
14
  "week",
15
15
  "month",
16
16
  "quarter",
17
17
  "year"
18
- ], pa = ["this", "previous"], Vt = ["now", "latest_available"], Ut = [
18
+ ], Ma = ["this", "previous"], Nt = ["now", "latest_available"], Rt = [
19
19
  "include_partial",
20
20
  "complete_periods"
21
- ], ma = {
21
+ ], Ea = {
22
22
  second: 31536e4,
23
23
  minute: 5256e3,
24
24
  hour: 87600,
@@ -28,23 +28,23 @@ const Bt = [
28
28
  quarter: 40,
29
29
  year: 10
30
30
  };
31
- function Ht(e) {
31
+ function Ct(e) {
32
32
  return e.anchor ?? "latest_available";
33
33
  }
34
- function N(e) {
34
+ function M(e) {
35
35
  return !!e && (e.kind === void 0 || e.kind === "relative");
36
36
  }
37
- function zt(e) {
37
+ function $t(e) {
38
38
  return (e == null ? void 0 : e.kind) === "calendar";
39
39
  }
40
- function fa(e) {
41
- return N(e) && e.anchor === "latest_available" || Qt(e) ? null : N(e) && e.unit === "day" && e.completeness !== "complete_periods" ? { mode: "between", unit: "day", from: 1 - e.value, to: 0 } : Kt(N(e) ? { ...e, anchor: "now" } : e);
40
+ function Ta(e) {
41
+ return M(e) && e.anchor === "latest_available" || Yt(e) ? null : M(e) && e.unit === "day" && e.completeness !== "complete_periods" ? { mode: "between", unit: "day", from: 1 - e.value, to: 0 } : Ot(M(e) ? { ...e, anchor: "now" } : e);
42
42
  }
43
- const Gt = /* @__PURE__ */ new Set(["week", "month", "quarter", "year"]);
44
- function Qt(e) {
45
- return N(e) && Gt.has(e.unit) && e.completeness !== "complete_periods";
43
+ const jt = /* @__PURE__ */ new Set(["week", "month", "quarter", "year"]);
44
+ function Yt(e) {
45
+ return M(e) && jt.has(e.unit) && e.completeness !== "complete_periods";
46
46
  }
47
- function ga(e) {
47
+ function Na(e) {
48
48
  const t = e;
49
49
  return t.mode === "between" ? t.unit === "day" && t.to === 0 && typeof t.from == "number" && t.from <= 0 ? { unit: "day", value: 1 - t.from } : null : t.mode === "last" && typeof t.n == "number" ? t.relativeTo === "latest_data" ? null : {
50
50
  unit: t.unit,
@@ -53,28 +53,28 @@ function ga(e) {
53
53
  completeness: t.complete ? "complete_periods" : "include_partial"
54
54
  } : t.mode === "this" ? t.boundary ? null : { kind: "calendar", unit: t.unit, period: "this", ...t.toDate ? { toDate: !0 } : {} } : t.mode === "previous" ? { kind: "calendar", unit: t.unit, period: "previous" } : null;
55
55
  }
56
- function Kt(e, t = {}) {
57
- if (zt(e))
56
+ function Ot(e, t = {}) {
57
+ if ($t(e))
58
58
  return e.period === "previous" ? { mode: "previous", unit: e.unit } : {
59
59
  mode: "this",
60
60
  unit: e.unit,
61
61
  ...e.toDate ? { toDate: !0 } : {}
62
62
  };
63
- if (!N(e))
63
+ if (!M(e))
64
64
  return null;
65
- const i = Ht(e) === "latest_available" ? { relativeTo: "latest_data" } : {}, a = e.value, o = (t.completeness ?? e.completeness) === "complete_periods";
65
+ const i = Ct(e) === "latest_available" ? { relativeTo: "latest_data" } : {}, s = e.value, l = (t.completeness ?? e.completeness) === "complete_periods";
66
66
  switch (e.unit) {
67
67
  case "second":
68
68
  return null;
69
69
  case "minute":
70
70
  case "hour":
71
- return o ? null : { mode: "last", n: a, unit: e.unit, ...i };
71
+ return l ? null : { mode: "last", n: s, unit: e.unit, ...i };
72
72
  default:
73
73
  return {
74
74
  mode: "last",
75
- n: a,
75
+ n: s,
76
76
  unit: e.unit,
77
- ...o ? { complete: !0 } : {},
77
+ ...l ? { complete: !0 } : {},
78
78
  ...i
79
79
  };
80
80
  }
@@ -82,54 +82,54 @@ function Kt(e, t = {}) {
82
82
  function r(e, t, i) {
83
83
  return i ? { code: e, message: t, path: i } : { code: e, message: t };
84
84
  }
85
- function m(e) {
85
+ function c(e) {
86
86
  return typeof e == "string" && e.trim().length > 0;
87
87
  }
88
- function Xt(e) {
88
+ function Pt(e) {
89
89
  const t = /* @__PURE__ */ new Set();
90
- return Wt(e, (i) => (t.add(i), `{${i}}`)), Array.from(t);
91
- }
92
- function Wt(e, t) {
93
- let i = "", a = 0, o = 0;
94
- for (; o < e.length; ) {
95
- const s = e[o];
96
- if (s === "'" || s === '"') {
97
- o = Zt(e, o);
90
+ return qt(e, (i) => (t.add(i), `{${i}}`)), Array.from(t);
91
+ }
92
+ function qt(e, t) {
93
+ let i = "", s = 0, l = 0;
94
+ for (; l < e.length; ) {
95
+ const n = e[l];
96
+ if (n === "'" || n === '"') {
97
+ l = Lt(e, l);
98
98
  continue;
99
99
  }
100
- if (s === "{") {
101
- const l = e.indexOf("}", o + 1);
102
- if (l === -1) {
103
- o += 1;
100
+ if (n === "{") {
101
+ const o = e.indexOf("}", l + 1);
102
+ if (o === -1) {
103
+ l += 1;
104
104
  continue;
105
105
  }
106
- const d = e.slice(o + 1, l);
107
- /^[A-Za-z_][A-Za-z0-9_]*$/.test(d) && (i += e.slice(a, o) + t(d), a = l + 1), o = l + 1;
106
+ const d = e.slice(l + 1, o);
107
+ /^[A-Za-z_][A-Za-z0-9_]*$/.test(d) && (i += e.slice(s, l) + t(d), s = o + 1), l = o + 1;
108
108
  continue;
109
109
  }
110
- o += 1;
110
+ l += 1;
111
111
  }
112
- return i + e.slice(a);
112
+ return i + e.slice(s);
113
113
  }
114
- function Zt(e, t) {
114
+ function Lt(e, t) {
115
115
  const i = e[t];
116
- let a = t + 1;
117
- for (; a < e.length; ) {
118
- if (e[a] === i) {
119
- if (e[a + 1] === i) {
120
- a += 2;
116
+ let s = t + 1;
117
+ for (; s < e.length; ) {
118
+ if (e[s] === i) {
119
+ if (e[s + 1] === i) {
120
+ s += 2;
121
121
  continue;
122
122
  }
123
- return a + 1;
123
+ return s + 1;
124
124
  }
125
- a += 1;
125
+ s += 1;
126
126
  }
127
127
  return e.length;
128
128
  }
129
129
  function f(e) {
130
130
  return !!(e && typeof e == "object" && !Array.isArray(e));
131
131
  }
132
- const Jt = /* @__PURE__ */ new Set([
132
+ const Bt = /* @__PURE__ */ new Set([
133
133
  "SUM",
134
134
  "COUNT",
135
135
  "AVG",
@@ -138,7 +138,7 @@ const Jt = /* @__PURE__ */ new Set([
138
138
  "MEDIAN",
139
139
  "DISTINCT"
140
140
  ]);
141
- function pe(e, t, i) {
141
+ function se(e, t, i) {
142
142
  if (!e || typeof e != "object") {
143
143
  i.push(
144
144
  r("missing_source", "Analytics intent needs a source.", t)
@@ -146,13 +146,13 @@ function pe(e, t, i) {
146
146
  return;
147
147
  }
148
148
  if (e.kind === "semantic") {
149
- m(e.domainId) || i.push(
149
+ c(e.domainId) || i.push(
150
150
  r(
151
151
  "missing_semantic_domain",
152
152
  "Semantic source needs a domainId.",
153
153
  `${t}.domainId`
154
154
  )
155
- ), m(e.datasetName) || i.push(
155
+ ), c(e.datasetName) || i.push(
156
156
  r(
157
157
  "missing_dataset_name",
158
158
  "Semantic source needs a datasetName.",
@@ -162,13 +162,13 @@ function pe(e, t, i) {
162
162
  return;
163
163
  }
164
164
  if (e.kind === "physical") {
165
- m(e.connectionId) || i.push(
165
+ c(e.connectionId) || i.push(
166
166
  r(
167
167
  "missing_connection_id",
168
168
  "Physical source needs a connectionId.",
169
169
  `${t}.connectionId`
170
170
  )
171
- ), m(e.tableName) || i.push(
171
+ ), c(e.tableName) || i.push(
172
172
  r(
173
173
  "missing_table_name",
174
174
  "Physical source needs a tableName.",
@@ -178,7 +178,7 @@ function pe(e, t, i) {
178
178
  return;
179
179
  }
180
180
  if (e.kind === "sql") {
181
- m(e.connectionId) || i.push(
181
+ c(e.connectionId) || i.push(
182
182
  r(
183
183
  "missing_connection_id",
184
184
  "SQL source needs a connectionId.",
@@ -191,23 +191,23 @@ function pe(e, t, i) {
191
191
  r("invalid_source_kind", "Source kind is not supported.", t)
192
192
  );
193
193
  }
194
- function y(e, t, i, a = {}) {
194
+ function _(e, t, i, s = {}) {
195
195
  if (!e || !f(e)) {
196
- a.required && i.push(
196
+ s.required && i.push(
197
197
  r("missing_field_ref", "Field reference needs a name.", t)
198
198
  );
199
199
  return;
200
200
  }
201
- m(e.name) || i.push(
201
+ c(e.name) || i.push(
202
202
  r(
203
203
  "missing_field_ref",
204
204
  "Field reference needs a name.",
205
205
  `${t}.name`
206
206
  )
207
- ), e.source !== void 0 && pe(e.source, `${t}.source`, i), me(e.aggregate, `${t}.aggregate`, i);
207
+ ), e.source !== void 0 && se(e.source, `${t}.source`, i), re(e.aggregate, `${t}.aggregate`, i);
208
208
  }
209
- function me(e, t, i) {
210
- e !== void 0 && (typeof e != "string" || !Jt.has(e)) && i.push(
209
+ function re(e, t, i) {
210
+ e !== void 0 && (typeof e != "string" || !Bt.has(e)) && i.push(
211
211
  r(
212
212
  "invalid_aggregate",
213
213
  "Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
@@ -215,38 +215,21 @@ function me(e, t, i) {
215
215
  )
216
216
  );
217
217
  }
218
- const ei = /* @__PURE__ */ new Set([
218
+ const Ht = /* @__PURE__ */ new Set([
219
219
  "measure",
220
220
  "dimension",
221
221
  "date",
222
222
  "id",
223
223
  "unknown"
224
- ]), ti = /* @__PURE__ */ new Set(["row", "aggregate"]), Ge = /* @__PURE__ */ new Set([
224
+ ]), Vt = /* @__PURE__ */ new Set(["row", "aggregate"]), Oe = /* @__PURE__ */ new Set([
225
225
  "string",
226
226
  "number",
227
227
  "boolean",
228
228
  "date",
229
229
  "datetime",
230
230
  "unknown"
231
- ]), ii = /* @__PURE__ */ new Set([
232
- "number",
233
- "currency",
234
- "percent",
235
- "percentage",
236
- "scientific",
237
- "date",
238
- "datetime",
239
- "duration",
240
- "string",
241
- "temporal_bucket"
242
- ]), ni = /* @__PURE__ */ new Set([
243
- "millisecond",
244
- "second",
245
- "minute",
246
- "hour",
247
- "day"
248
- ]), ai = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
249
- function Qe(e, t, i) {
231
+ ]);
232
+ function Pe(e, t, i) {
250
233
  if (e === void 0)
251
234
  return;
252
235
  if (!f(e)) {
@@ -259,93 +242,32 @@ function Qe(e, t, i) {
259
242
  );
260
243
  return;
261
244
  }
262
- const a = e;
263
- (typeof a.type != "string" || !ii.has(a.type)) && i.push(
264
- r(
265
- "invalid_value_format_type",
266
- "Value format type must be number, currency, percent, percentage, scientific, date, datetime, duration, string, or temporal_bucket.",
267
- `${t}.type`
268
- )
269
- ), a.type === "temporal_bucket" && !z.safeParse(e).success && i.push(
270
- r(
271
- "invalid_temporal_bucket_format",
272
- "Temporal bucket format must contain a valid auto, preset, or pattern presentation.",
273
- t
274
- )
275
- ), (a.type === "number" || a.type === "currency" || a.type === "percent" || a.type === "percentage" || a.type === "scientific") && Object.prototype.hasOwnProperty.call(e, "locale") && i.push(
276
- r(
277
- "invalid_value_format",
278
- "Numeric value formats cannot define viewer locale.",
279
- `${t}.locale`
280
- )
281
- ), q(
282
- e.minimumFractionDigits,
283
- `${t}.minimumFractionDigits`,
284
- i
285
- ), q(
286
- e.maximumFractionDigits,
287
- `${t}.maximumFractionDigits`,
288
- i
289
- ), q(e.scale, `${t}.scale`, i), q(e.maxUnits, `${t}.maxUnits`, i), e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" && i.push(
290
- r(
291
- "invalid_value_format_use_grouping",
292
- "Value format useGrouping must be boolean.",
293
- `${t}.useGrouping`
294
- )
295
- ), e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && i.push(
296
- r(
297
- "invalid_value_format_negative_style",
298
- "Value format negativeStyle must be minus or parentheses.",
299
- `${t}.negativeStyle`
300
- )
301
- ), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && i.push(
302
- r(
303
- "invalid_value_format_percent_mode",
304
- "Value format percentValueMode must be fraction or whole.",
305
- `${t}.percentValueMode`
306
- )
307
- );
308
- for (const o of ["inputUnit", "largestUnit", "smallestUnit"]) {
309
- const s = e[o];
310
- s !== void 0 && (typeof s != "string" || !ni.has(s)) && i.push(
245
+ const s = (e.type === "temporal_bucket" ? O : It).safeParse(e);
246
+ if (s.success) return;
247
+ const l = e.type === "temporal_bucket" ? "invalid_temporal_bucket_format" : "invalid_value_format";
248
+ for (const n of s.error.issues)
249
+ i.push(
311
250
  r(
312
- "invalid_value_format_duration_unit",
313
- "Duration format units must be millisecond, second, minute, hour, or day.",
314
- `${t}.${o}`
251
+ l,
252
+ n.message,
253
+ [t, ...n.path.map(String)].filter(Boolean).join(".")
315
254
  )
316
255
  );
317
- }
318
- e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !ai.has(e.outputStyle)) && i.push(
319
- r(
320
- "invalid_value_format_duration_style",
321
- "Duration format outputStyle must be compact, digital, or long.",
322
- `${t}.outputStyle`
323
- )
324
- );
325
256
  }
326
- function q(e, t, i) {
327
- e !== void 0 && (typeof e != "number" || !Number.isFinite(e)) && i.push(
328
- r(
329
- "invalid_value_format_number",
330
- "Value format numeric options must be finite numbers.",
331
- t
332
- )
333
- );
334
- }
335
- const si = /* @__PURE__ */ new Set([
257
+ const Ut = /* @__PURE__ */ new Set([
336
258
  "additive",
337
259
  "non_additive",
338
260
  "ratio_of_sums",
339
261
  "weighted",
340
262
  "pre_aggregated",
341
263
  "snapshot"
342
- ]), oi = /* @__PURE__ */ new Set([
264
+ ]), zt = /* @__PURE__ */ new Set([
343
265
  "default",
344
266
  "symmetric_aggregate",
345
267
  "aggregate_then_join",
346
268
  "weighted"
347
269
  ]);
348
- function ri(e, t, i) {
270
+ function Gt(e, t, i) {
349
271
  if (!e || !f(e)) {
350
272
  i.push(
351
273
  r(
@@ -357,7 +279,7 @@ function ri(e, t, i) {
357
279
  return;
358
280
  }
359
281
  if (e.kind === "field") {
360
- y(e.field, `${t}.field`, i, { required: !0 }), me(e.aggregate, `${t}.aggregate`, i);
282
+ _(e.field, `${t}.field`, i, { required: !0 }), re(e.aggregate, `${t}.aggregate`, i);
361
283
  return;
362
284
  }
363
285
  i.push(
@@ -368,7 +290,7 @@ function ri(e, t, i) {
368
290
  )
369
291
  );
370
292
  }
371
- function fe(e) {
293
+ function oe(e) {
372
294
  const t = [];
373
295
  if (!f(e))
374
296
  return t.push(
@@ -383,31 +305,31 @@ function fe(e) {
383
305
  "Derived field kind must be derived_field.",
384
306
  "kind"
385
307
  )
386
- ), m(e.name) || t.push(
308
+ ), c(e.name) || t.push(
387
309
  r(
388
310
  "invalid_derived_field_name",
389
311
  "Derived field needs a name.",
390
312
  "name"
391
313
  )
392
- ), m(e.label) || t.push(
314
+ ), c(e.label) || t.push(
393
315
  r(
394
316
  "invalid_derived_field_label",
395
317
  "Derived field needs a label.",
396
318
  "label"
397
319
  )
398
- ), ei.has(e.resultRole) || t.push(
320
+ ), Ht.has(e.resultRole) || t.push(
399
321
  r(
400
322
  "invalid_derived_field_role",
401
323
  "Derived field resultRole must be measure, dimension, date, id, or unknown.",
402
324
  "resultRole"
403
325
  )
404
- ), Ge.has(e.dataType) || t.push(
326
+ ), Oe.has(e.dataType) || t.push(
405
327
  r(
406
328
  "invalid_derived_field_data_type",
407
329
  "Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
408
330
  "dataType"
409
331
  )
410
- ), ti.has(e.computeStage) || t.push(
332
+ ), Vt.has(e.computeStage) || t.push(
411
333
  r(
412
334
  "invalid_derived_field_compute_stage",
413
335
  "Derived field computeStage must be row or aggregate.",
@@ -431,11 +353,11 @@ function fe(e) {
431
353
  "Row-stage measure derived fields must declare defaultAggregate so row results have explicit rollup semantics.",
432
354
  "defaultAggregate"
433
355
  )
434
- ), me(
356
+ ), re(
435
357
  e.defaultAggregate,
436
358
  "defaultAggregate",
437
359
  t
438
- ), e.aggregationBehavior !== void 0 && !si.has(
360
+ ), e.aggregationBehavior !== void 0 && !Ut.has(
439
361
  e.aggregationBehavior
440
362
  ) && t.push(
441
363
  r(
@@ -443,7 +365,7 @@ function fe(e) {
443
365
  "Derived field aggregationBehavior is not supported.",
444
366
  "aggregationBehavior"
445
367
  )
446
- ), e.aggregationStrategy !== void 0 && !oi.has(
368
+ ), e.aggregationStrategy !== void 0 && !zt.has(
447
369
  e.aggregationStrategy
448
370
  ) && t.push(
449
371
  r(
@@ -451,7 +373,7 @@ function fe(e) {
451
373
  "Derived field aggregationStrategy is not supported.",
452
374
  "aggregationStrategy"
453
375
  )
454
- ), m(e.expression) || t.push(
376
+ ), c(e.expression) || t.push(
455
377
  r(
456
378
  "invalid_derived_field_expression",
457
379
  "Derived field needs a named-token expression.",
@@ -469,8 +391,8 @@ function fe(e) {
469
391
  "Derived field needs at least one typed input.",
470
392
  "inputs"
471
393
  )
472
- ) : Object.entries(e.inputs).forEach(([a, o]) => {
473
- if (!m(a)) {
394
+ ) : Object.entries(e.inputs).forEach(([s, l]) => {
395
+ if (!c(s)) {
474
396
  t.push(
475
397
  r(
476
398
  "invalid_derived_field_input_name",
@@ -480,31 +402,31 @@ function fe(e) {
480
402
  );
481
403
  return;
482
404
  }
483
- ri(
484
- o,
485
- `inputs.${a}`,
405
+ Gt(
406
+ l,
407
+ `inputs.${s}`,
486
408
  t
487
409
  );
488
- }), m(e.expression) && f(e.inputs)) {
489
- const a = Xt(
410
+ }), c(e.expression) && f(e.inputs)) {
411
+ const s = Pt(
490
412
  e.expression
491
- ), o = new Set(a), s = Object.keys(e.inputs).filter(
492
- (l) => m(l)
413
+ ), l = new Set(s), n = Object.keys(e.inputs).filter(
414
+ (o) => c(o)
493
415
  );
494
- a.forEach((l) => {
495
- Object.prototype.hasOwnProperty.call(e.inputs, l) || t.push(
416
+ s.forEach((o) => {
417
+ Object.prototype.hasOwnProperty.call(e.inputs, o) || t.push(
496
418
  r(
497
419
  "invalid_derived_field_expression_token",
498
- `Derived field expression token "{${l}}" needs a matching inputs.${l} entry.`,
420
+ `Derived field expression token "{${o}}" needs a matching inputs.${o} entry.`,
499
421
  "expression"
500
422
  )
501
423
  );
502
- }), s.forEach((l) => {
503
- o.has(l) || t.push(
424
+ }), n.forEach((o) => {
425
+ l.has(o) || t.push(
504
426
  r(
505
427
  "unused_derived_field_input",
506
- `Derived field input "${l}" is not referenced by expression.`,
507
- `inputs.${l}`
428
+ `Derived field input "${o}" is not referenced by expression.`,
429
+ `inputs.${o}`
508
430
  )
509
431
  );
510
432
  });
@@ -516,7 +438,7 @@ function fe(e) {
516
438
  "Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
517
439
  "format"
518
440
  )
519
- ) : Qe(i, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((a) => !m(a))) && t.push(
441
+ ) : Pe(i, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((s) => !c(s))) && t.push(
520
442
  r(
521
443
  "invalid_derived_field_tags",
522
444
  "Derived field tags must be non-empty strings.",
@@ -524,55 +446,41 @@ function fe(e) {
524
446
  )
525
447
  ), { ok: t.length === 0, errors: t, warnings: [] };
526
448
  }
527
- const R = n.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [li, di, ui, ci] = Ue.options, Ke = n.union([
528
- li.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
529
- const { minimumFractionDigits: i = 0, maximumFractionDigits: a = 2 } = e;
530
- (![i, a].every((o) => Number.isInteger(o) && o >= 0 && o <= 20) || i > a) && t.addIssue({
531
- code: "custom",
532
- message: "Fraction digits must be integers from 0 to 20 with minimum <= maximum."
533
- }), e.scale !== void 0 && !Number.isFinite(e.scale) && t.addIssue({ code: "custom", message: "Scale must be finite." });
534
- }),
535
- di.strict(),
536
- ui.strict(),
537
- ci.strict()
538
- ]), Fe = n.union([
539
- Ke,
540
- z
541
- ]), ge = n.union([
542
- jt.extend({ domainId: R, datasetName: R }).strict(),
543
- $t.extend({ connectionId: R, tableName: R }).strict()
544
- ]), Xe = Ot.extend({
545
- name: R,
546
- source: ge.optional()
547
- }).strict(), he = Pt.extend({
548
- format: Ke.optional(),
549
- inputs: n.record(
550
- n.object({
551
- kind: n.literal("field"),
552
- field: Xe,
553
- aggregate: He.optional()
449
+ const D = a.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), le = a.union([
450
+ St.extend({ domainId: D, datasetName: D }).strict(),
451
+ kt.extend({ connectionId: D, tableName: D }).strict()
452
+ ]), qe = wt.extend({
453
+ name: D,
454
+ source: le.optional()
455
+ }).strict(), de = At.extend({
456
+ format: xt.optional(),
457
+ inputs: a.record(
458
+ a.object({
459
+ kind: a.literal("field"),
460
+ field: qe,
461
+ aggregate: je.optional()
554
462
  }).strict()
555
463
  )
556
464
  }).strict().superRefine((e, t) => {
557
465
  var i;
558
- for (const a of fe(e).errors)
466
+ for (const s of oe(e).errors)
559
467
  t.addIssue({
560
468
  code: "custom",
561
- path: ((i = a.path) == null ? void 0 : i.split(".")) ?? [],
562
- message: a.message
469
+ path: ((i = s.path) == null ? void 0 : i.split(".")) ?? [],
470
+ message: s.message
563
471
  });
564
- }), pi = Xe.extend({
565
- derivedField: he.optional()
472
+ }), Qt = qe.extend({
473
+ derivedField: de.optional()
566
474
  }).strict();
567
- function be(e) {
475
+ function ue(e) {
568
476
  return typeof e == "string" ? e.trim().toLowerCase() : "";
569
477
  }
570
- function mi(e) {
478
+ function Kt(e) {
571
479
  return String(
572
480
  e.column_name || e.name || e.qualifiedFieldName || ""
573
481
  );
574
482
  }
575
- function fi(e) {
483
+ function Xt(e) {
576
484
  return Array.from(
577
485
  new Set(
578
486
  [e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
@@ -581,11 +489,11 @@ function fi(e) {
581
489
  )
582
490
  );
583
491
  }
584
- function _e(e) {
585
- const t = Ze(e);
586
- return t ? _i(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
492
+ function ce(e) {
493
+ const t = Be(e);
494
+ return t ? ei(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
587
495
  }
588
- const W = /* @__PURE__ */ new Map([
496
+ const U = /* @__PURE__ */ new Map([
589
497
  // Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
590
498
  ["int", "integer"],
591
499
  ["uint", "integer"],
@@ -614,97 +522,97 @@ const W = /* @__PURE__ */ new Map([
614
522
  ["money", null],
615
523
  ["currency", null],
616
524
  ["percent", null]
617
- ]), gi = ["int", "uint", "decimal", "float"];
618
- function hi(e) {
525
+ ]), Zt = ["int", "uint", "decimal", "float"];
526
+ function Jt(e) {
619
527
  return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
620
528
  }
621
- function bi(e) {
529
+ function Wt(e) {
622
530
  var i;
623
531
  const t = (i = /^number\s*\(\s*\d+\s*,\s*(\d+)\s*\)$/.exec(e)) == null ? void 0 : i[1];
624
532
  return t === void 0 ? null : Number(t) === 0 ? "integer" : "decimal";
625
533
  }
626
- function We(e) {
534
+ function Le(e) {
627
535
  const t = e.split(/[\s(]/, 1)[0] || "";
628
536
  if (t === "number")
629
- return { numeric: !0, kind: bi(e) };
630
- if (W.has(t))
631
- return { numeric: !0, kind: W.get(t) ?? null };
632
- const i = gi.find(
633
- (a) => t.startsWith(a) && hi(t.slice(a.length))
537
+ return { numeric: !0, kind: Wt(e) };
538
+ if (U.has(t))
539
+ return { numeric: !0, kind: U.get(t) ?? null };
540
+ const i = Zt.find(
541
+ (s) => t.startsWith(s) && Jt(t.slice(s.length))
634
542
  );
635
- return i ? { numeric: !0, kind: W.get(i) ?? null } : { numeric: !1, kind: null };
543
+ return i ? { numeric: !0, kind: U.get(i) ?? null } : { numeric: !1, kind: null };
636
544
  }
637
- function _i(e) {
638
- return We(e).numeric;
545
+ function ei(e) {
546
+ return Le(e).numeric;
639
547
  }
640
- function yi(e) {
641
- return We(Ze(e)).kind;
548
+ function ti(e) {
549
+ return Le(Be(e)).kind;
642
550
  }
643
- function Ze(e) {
644
- let t = be(e), i = "";
551
+ function Be(e) {
552
+ let t = ue(e), i = "";
645
553
  for (; t && t !== i; )
646
- i = t, t = De(t, "nullable"), t = De(t, "lowcardinality");
554
+ i = t, t = Ie(t, "nullable"), t = Ie(t, "lowcardinality");
647
555
  return t;
648
556
  }
649
- function De(e, t) {
557
+ function Ie(e, t) {
650
558
  const i = `${t}(`;
651
559
  return !e.startsWith(i) || !e.endsWith(")") ? e : e.slice(i.length, -1).trim();
652
560
  }
653
- function vi(e) {
654
- const t = _e(e);
561
+ function ii(e) {
562
+ const t = ce(e);
655
563
  return t === "date" || t === "datetime";
656
564
  }
657
- function Je(e) {
658
- return vi(e.dataType || e.data_type);
565
+ function He(e) {
566
+ return ii(e.dataType || e.data_type);
659
567
  }
660
- function et(e) {
661
- const t = tt(e);
568
+ function Ve(e) {
569
+ const t = Ue(e);
662
570
  return t === "id" || t === "row_id";
663
571
  }
664
- function Me(e) {
665
- const t = tt(e);
666
- return et(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
572
+ function Se(e) {
573
+ const t = Ue(e);
574
+ return Ve(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
667
575
  }
668
- function tt(e) {
669
- return be(
670
- mi(e) || e.name || e.alias
576
+ function Ue(e) {
577
+ return ue(
578
+ Kt(e) || e.name || e.alias
671
579
  ).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
672
580
  }
673
- function it(e, t = {}) {
674
- const i = be(e.role);
675
- return i === "metric" || i === "measure" ? !t.excludeIdentifiers || !Me(e) : i === "groupby" || i === "dimension" || i === "date" || i === "id" ? !1 : _e(
581
+ function ze(e, t = {}) {
582
+ const i = ue(e.role);
583
+ return i === "metric" || i === "measure" ? !t.excludeIdentifiers || !Se(e) : i === "groupby" || i === "dimension" || i === "date" || i === "id" ? !1 : ce(
676
584
  e.dataType || e.data_type
677
- ) === "number" && (!t.excludeIdentifiers || !Me(e));
585
+ ) === "number" && (!t.excludeIdentifiers || !Se(e));
678
586
  }
679
- function ha(e) {
680
- return !it(e) && !Je(e);
587
+ function Ra(e) {
588
+ return !ze(e) && !He(e);
681
589
  }
682
- function ba(e) {
683
- const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
684
- for (const o of e) {
685
- if (et(o))
590
+ function Ca(e) {
591
+ const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
592
+ for (const l of e) {
593
+ if (Ve(l))
686
594
  continue;
687
- const s = fi(o);
688
- if (s.length !== 0) {
689
- if (Je(o)) {
690
- s.forEach((l) => i.add(l));
595
+ const n = Xt(l);
596
+ if (n.length !== 0) {
597
+ if (He(l)) {
598
+ n.forEach((o) => i.add(o));
691
599
  continue;
692
600
  }
693
- if (it(o, { excludeIdentifiers: !0 })) {
694
- s.forEach((l) => t.add(l));
601
+ if (ze(l, { excludeIdentifiers: !0 })) {
602
+ n.forEach((o) => t.add(o));
695
603
  continue;
696
604
  }
697
- s.forEach((l) => a.add(l));
605
+ n.forEach((o) => s.add(o));
698
606
  }
699
607
  }
700
608
  return {
701
609
  validMeasureCandidates: Array.from(t).sort(),
702
610
  validDateCandidates: Array.from(i).sort(),
703
- validDimensionCandidates: Array.from(a).sort()
611
+ validDimensionCandidates: Array.from(s).sort()
704
612
  };
705
613
  }
706
- const T = 16 * 1024;
707
- function V(e) {
614
+ const E = 16 * 1024;
615
+ function P(e) {
708
616
  const t = /^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/.exec(e);
709
617
  return t ? {
710
618
  sign: t[1],
@@ -713,91 +621,91 @@ function V(e) {
713
621
  exponent: Number(t[5] ?? "0")
714
622
  } : null;
715
623
  }
716
- function Re(e) {
717
- const { sign: t, whole: i, fraction: a = "", exponent: o } = e, s = (i + a).replace(/^0+/, ""), l = s.replace(/0+$/, ""), d = o - a.length + s.length - l.length;
718
- return !Number.isSafeInteger(o) || !Number.isSafeInteger(d) ? null : l ? `${t === "-" ? "-" : ""}${l}e${d}` : "0";
624
+ function ke(e) {
625
+ const { sign: t, whole: i, fraction: s = "", exponent: l } = e, n = (i + s).replace(/^0+/, ""), o = n.replace(/0+$/, ""), d = l - s.length + n.length - o.length;
626
+ return !Number.isSafeInteger(l) || !Number.isSafeInteger(d) ? null : o ? `${t === "-" ? "-" : ""}${o}e${d}` : "0";
719
627
  }
720
- function Ii(e) {
721
- const t = V(e);
628
+ function $a(e) {
629
+ const t = P(e);
722
630
  if (!t) return null;
723
- const i = t.sign === "+" ? e.slice(1) : e, a = Number(e);
724
- if (!Number.isFinite(a)) return i;
725
- const o = Re(t), s = V(String(a));
726
- return o !== null && s !== null && o === Re(s) ? a : i;
631
+ const i = t.sign === "+" ? e.slice(1) : e, s = Number(e);
632
+ if (!Number.isFinite(s)) return i;
633
+ const l = ke(t), n = P(String(s));
634
+ return l !== null && n !== null && l === ke(n) ? s : i;
727
635
  }
728
- function Si(e) {
729
- if (e.length > T)
636
+ function ja(e) {
637
+ if (e.length > E)
730
638
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
731
- const t = V(e);
639
+ const t = P(e);
732
640
  if (!t) throw new TypeError("Expected finite decimal text.");
733
- const { sign: i, whole: a, fraction: o, exponent: s } = t, l = `${i}${a || "0"}${o ? `.${o}` : ""}`;
734
- return x(`${l}e${s}`);
641
+ const { sign: i, whole: s, fraction: l, exponent: n } = t, o = `${i}${s || "0"}${l ? `.${l}` : ""}`;
642
+ return R(`${o}e${n}`);
735
643
  }
736
- function x(e) {
737
- if (e.length > T)
644
+ function R(e) {
645
+ if (e.length > E)
738
646
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
739
- const t = V(e);
647
+ const t = P(e);
740
648
  if (!t || t.whole === "" || t.fraction === "")
741
649
  throw new TypeError("Expected finite decimal text.");
742
- const { sign: i, whole: a, fraction: o = "", exponent: s } = t;
743
- if (!Number.isSafeInteger(s) || Math.abs(s) > T)
650
+ const { sign: i, whole: s, fraction: l = "", exponent: n } = t;
651
+ if (!Number.isSafeInteger(n) || Math.abs(n) > E)
744
652
  throw new RangeError("Exact numeric exponent exceeds the text budget.");
745
- const l = a + o, d = a.length + s;
746
- if (Math.max(l.length, d) + Math.max(0, -d) + 3 > T)
653
+ const o = s + l, d = s.length + n;
654
+ if (Math.max(o.length, d) + Math.max(0, -d) + 3 > E)
747
655
  throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
748
- let p;
749
- d <= 0 ? p = `0.${"0".repeat(-d)}${l}` : d >= l.length ? p = l + "0".repeat(d - l.length) : p = `${l.slice(0, d)}.${l.slice(d)}`;
750
- const [u, h = ""] = p.split("."), _ = u.replace(/^0+(?=\d)/, ""), S = h.replace(/0+$/, ""), b = _ + (S ? `.${S}` : "");
751
- return i === "-" && b !== "0" ? `-${b}` : b;
752
- }
753
- function nt(e, t) {
754
- const i = e.startsWith("-"), a = t.startsWith("-");
755
- if (i !== a) return i ? -1 : 1;
756
- const [o, s = ""] = (i ? e.slice(1) : e).split("."), [l, d = ""] = (a ? t.slice(1) : t).split(".");
757
- let c = Math.sign(o.length - l.length);
758
- if (!c && o !== l && (c = o < l ? -1 : 1), !c) {
759
- const p = Math.max(s.length, d.length), u = s.padEnd(p, "0"), h = d.padEnd(p, "0");
760
- c = u === h ? 0 : u < h ? -1 : 1;
656
+ let m;
657
+ d <= 0 ? m = `0.${"0".repeat(-d)}${o}` : d >= o.length ? m = o + "0".repeat(d - o.length) : m = `${o.slice(0, d)}.${o.slice(d)}`;
658
+ const [u, g = ""] = m.split("."), y = u.replace(/^0+(?=\d)/, ""), I = g.replace(/0+$/, ""), S = y + (I ? `.${I}` : "");
659
+ return i === "-" && S !== "0" ? `-${S}` : S;
660
+ }
661
+ function Ya(e, t) {
662
+ const i = e.startsWith("-"), s = t.startsWith("-");
663
+ if (i !== s) return i ? -1 : 1;
664
+ const [l, n = ""] = (i ? e.slice(1) : e).split("."), [o, d = ""] = (s ? t.slice(1) : t).split(".");
665
+ let p = Math.sign(l.length - o.length);
666
+ if (!p && l !== o && (p = l < o ? -1 : 1), !p) {
667
+ const m = Math.max(n.length, d.length), u = n.padEnd(m, "0"), g = d.padEnd(m, "0");
668
+ p = u === g ? 0 : u < g ? -1 : 1;
761
669
  }
762
- return c === 0 ? 0 : i ? -c : c;
670
+ return p === 0 ? 0 : i ? -p : p;
763
671
  }
764
- function _a(e, t) {
672
+ function Oa(e, t) {
765
673
  if (typeof t == "number" && !Number.isFinite(t))
766
674
  throw new TypeError("Numeric scale must be finite.");
767
- const i = [e, x(String(t))].map((s) => {
768
- const [l, d = ""] = s.split(".");
769
- return { coefficient: BigInt(l + d), digits: d.length };
770
- }), a = i[0].coefficient * i[1].coefficient, o = i[0].digits + i[1].digits;
771
- return x(`${a}e-${o}`);
675
+ const i = [e, R(String(t))].map((n) => {
676
+ const [o, d = ""] = n.split(".");
677
+ return { coefficient: BigInt(o + d), digits: d.length };
678
+ }), s = i[0].coefficient * i[1].coefficient, l = i[0].digits + i[1].digits;
679
+ return R(`${s}e-${l}`);
772
680
  }
773
- function ki(e) {
681
+ function ai(e) {
774
682
  try {
775
- return x(e) === e;
683
+ return R(e) === e;
776
684
  } catch {
777
685
  return !1;
778
686
  }
779
687
  }
780
- const at = n.object({
781
- kind: n.literal("exact_number"),
782
- type: n.enum(["integer", "decimal"]),
783
- value: n.string().max(T).refine(ki, "Expected canonical decimal text.")
688
+ const Ge = a.object({
689
+ kind: a.literal("exact_number"),
690
+ type: a.enum(["integer", "decimal"]),
691
+ value: a.string().max(E).refine(ai, "Expected canonical decimal text.")
784
692
  }).strict().superRefine((e, t) => {
785
693
  e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
786
- }), B = n.union([
787
- n.null(),
788
- n.string(),
789
- n.boolean(),
790
- n.number().finite(),
791
- at
694
+ }), ni = a.union([
695
+ a.null(),
696
+ a.string(),
697
+ a.boolean(),
698
+ a.number().finite(),
699
+ Ge
792
700
  ]);
793
- function wi(e, t) {
794
- return at.parse({ kind: "exact_number", type: t, value: x(e) });
701
+ function si(e, t) {
702
+ return Ge.parse({ kind: "exact_number", type: t, value: R(e) });
795
703
  }
796
- function U(e) {
704
+ function Pa(e) {
797
705
  return typeof e == "object" && e !== null && "kind" in e && e.kind === "exact_number" && "type" in e && (e.type === "integer" || e.type === "decimal") && "value" in e && typeof e.value == "string";
798
706
  }
799
- function ya(e) {
800
- const t = yi(e.nativeDataType);
707
+ function qa(e) {
708
+ const t = ti(e.nativeDataType);
801
709
  if (!t) throw new TypeError("Numeric result type is not established.");
802
710
  if (e.value === null) return null;
803
711
  if (t === "float") {
@@ -807,29 +715,29 @@ function ya(e) {
807
715
  }
808
716
  if (e.exactText === void 0)
809
717
  throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
810
- return wi(e.exactText, t);
718
+ return si(e.exactText, t);
811
719
  }
812
- const ye = n.string().uuid(), G = n.enum(["rows", "columns"]), Ai = n.enum(["member", "subtotal", "grand_total", "others"]), xi = n.discriminatedUnion("kind", [
813
- n.object({ kind: n.literal("value"), value: B }).strict(),
814
- n.object({ kind: n.literal("others"), rankingId: ye }).strict()
815
- ]), F = n.array(n.object({ levelId: ye, member: xi }).strict()).readonly().superRefine((e, t) => {
720
+ const pe = a.string().uuid(), me = a.enum(["rows", "columns"]), La = a.enum(["member", "subtotal", "grand_total", "others"]), ri = a.discriminatedUnion("kind", [
721
+ a.object({ kind: a.literal("value"), value: ni }).strict(),
722
+ a.object({ kind: a.literal("others"), rankingId: pe }).strict()
723
+ ]), A = a.array(a.object({ levelId: pe, member: ri }).strict()).readonly().superRefine((e, t) => {
816
724
  new Set(e.map((i) => i.levelId)).size !== e.length && t.addIssue({
817
725
  code: "custom",
818
726
  path: [],
819
727
  message: "Duplicate identity."
820
728
  }), e.some(
821
- (i, a) => i.member.kind === "others" && a !== e.length - 1
729
+ (i, s) => i.member.kind === "others" && s !== e.length - 1
822
730
  ) && t.addIssue({
823
731
  code: "custom",
824
732
  path: [],
825
733
  message: "Others is terminal."
826
734
  });
827
- }), va = n.object({
828
- rowPath: F,
829
- columnPath: F,
830
- measureId: ye
735
+ }), Ba = a.object({
736
+ rowPath: A,
737
+ columnPath: A,
738
+ measureId: pe
831
739
  }).strict();
832
- function st(e) {
740
+ function Qe(e) {
833
741
  return JSON.stringify(
834
742
  e.map(({ levelId: t, member: i }) => [
835
743
  t,
@@ -837,11 +745,11 @@ function st(e) {
837
745
  ])
838
746
  );
839
747
  }
840
- const ne = "SEMAPHOR_CALCULATED_FIELD", Fi = "calculated_fields";
841
- function Di(e) {
748
+ const Z = "SEMAPHOR_CALCULATED_FIELD", oi = "calculated_fields";
749
+ function li(e) {
842
750
  return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
843
751
  }
844
- const Mi = [
752
+ const di = [
845
753
  // Day granularity formats
846
754
  "MM-DD-YYYY",
847
755
  "YYYY-MM-DD",
@@ -876,17 +784,17 @@ const Mi = [
876
784
  // Custom format
877
785
  "custom"
878
786
  ];
879
- function Ia(e) {
787
+ function Ha(e) {
880
788
  return e.role === "metric" && "expression" in e && !!e.expression;
881
789
  }
882
- function Sa(e) {
790
+ function Va(e) {
883
791
  return !!e.expression;
884
792
  }
885
- function Ri(e) {
886
- return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || ae(e)));
793
+ function ui(e) {
794
+ return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || J(e)));
887
795
  }
888
- function ot(e) {
889
- var h, _, S;
796
+ function Ke(e) {
797
+ var g, y, I;
890
798
  if (!e)
891
799
  return {
892
800
  representation: "physical",
@@ -895,22 +803,22 @@ function ot(e) {
895
803
  runtimeExecutable: !1,
896
804
  legacyManual: !1
897
805
  };
898
- const t = e.fieldScope === "domain" ? "domain" : "local", i = ((h = e.derivedField) == null ? void 0 : h.computeStage) || ((_ = e.calculatedFormula) == null ? void 0 : _.computeStage), a = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((b) => {
899
- const Y = b && Di(b);
900
- return typeof Y == "string" && !!Y.trim();
901
- }), o = typeof e.expression == "string" && !!e.expression.trim() && a, s = e.calculationRepresentation;
902
- if (e.derivedField || s === "typed-derived") {
903
- const b = e.derivedField !== void 0 && fe(e.derivedField).ok;
806
+ const t = e.fieldScope === "domain" ? "domain" : "local", i = ((g = e.derivedField) == null ? void 0 : g.computeStage) || ((y = e.calculatedFormula) == null ? void 0 : y.computeStage), s = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((S) => {
807
+ const be = S && li(S);
808
+ return typeof be == "string" && !!be.trim();
809
+ }), l = typeof e.expression == "string" && !!e.expression.trim() && s, n = e.calculationRepresentation;
810
+ if (e.derivedField || n === "typed-derived") {
811
+ const S = e.derivedField !== void 0 && oe(e.derivedField).ok;
904
812
  return {
905
813
  representation: "typed-derived",
906
814
  ownership: t,
907
- completeness: (!s || s === "typed-derived") && b && (!e.expression && !e.calculatedFormula || o) ? "complete" : "incomplete",
815
+ completeness: (!n || n === "typed-derived") && S && (!e.expression && !e.calculatedFormula || l) ? "complete" : "incomplete",
908
816
  computeStage: i,
909
- runtimeExecutable: o,
817
+ runtimeExecutable: l,
910
818
  legacyManual: !1
911
819
  };
912
820
  }
913
- if (!(!!s || Ri(e)))
821
+ if (!(!!n || ui(e)))
914
822
  return {
915
823
  representation: "physical",
916
824
  ownership: t,
@@ -918,73 +826,73 @@ function ot(e) {
918
826
  runtimeExecutable: !1,
919
827
  legacyManual: !1
920
828
  };
921
- const d = i || (e.role === "groupby" || ((S = e.calculatedFieldOrigin) == null ? void 0 : S.role) === "groupby" ? "row" : void 0), c = t === "domain" || ae(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", p = s === "manual" || s === "inline-expression" ? s : c, u = (!s || s === "manual" || s === "inline-expression") && !(s === "inline-expression" && ae(e));
829
+ const d = i || (e.role === "groupby" || ((I = e.calculatedFieldOrigin) == null ? void 0 : I.role) === "groupby" ? "row" : void 0), p = t === "domain" || J(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", m = n === "manual" || n === "inline-expression" ? n : p, u = (!n || n === "manual" || n === "inline-expression") && !(n === "inline-expression" && J(e));
922
830
  return {
923
- representation: p,
831
+ representation: m,
924
832
  ownership: t,
925
- completeness: o && u ? "complete" : "incomplete",
833
+ completeness: l && u ? "complete" : "incomplete",
926
834
  computeStage: d,
927
- runtimeExecutable: o,
928
- legacyManual: p === "manual" && t === "local" && !d
835
+ runtimeExecutable: l,
836
+ legacyManual: m === "manual" && t === "local" && !d
929
837
  };
930
838
  }
931
- function ka(e) {
839
+ function Ua(e) {
932
840
  if (e.calculationRepresentation) return e;
933
- const { representation: t } = ot(e);
841
+ const { representation: t } = Ke(e);
934
842
  return t === "physical" ? e : { ...e, calculationRepresentation: t };
935
843
  }
936
- function wa(e) {
937
- return ot(e).computeStage;
844
+ function za(e) {
845
+ return Ke(e).computeStage;
938
846
  }
939
- function Aa(e, t) {
847
+ function Ga(e, t) {
940
848
  return e === "aggregate" && t === "default";
941
849
  }
942
- function xa(e) {
943
- var i, a;
850
+ function Qa(e) {
851
+ var i, s;
944
852
  const t = e;
945
- return !!(t != null && t.expression && ((a = (i = t.calculatedFormula) == null ? void 0 : i.inputFields) != null && a.length));
853
+ return !!(t != null && t.expression && ((s = (i = t.calculatedFormula) == null ? void 0 : i.inputFields) != null && s.length));
946
854
  }
947
- function Fa(e) {
948
- return !!(e && (e.entityName === ne || e.entityId === ne));
855
+ function Ka(e) {
856
+ return !!(e && (e.entityName === Z || e.entityId === Z));
949
857
  }
950
- function ae(e) {
858
+ function J(e) {
951
859
  return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
952
- (t) => t === ne || t === Fi
860
+ (t) => t === Z || t === oi
953
861
  ) : !1;
954
862
  }
955
- function Ni(e) {
956
- const t = lt(e);
863
+ function ci(e) {
864
+ const t = Ze(e);
957
865
  return t.length > 0 ? t.join(".") : void 0;
958
866
  }
959
- function Da(e) {
960
- const t = Ni(
867
+ function Xa(e) {
868
+ const t = ci(
961
869
  e.qualifiedName
962
870
  ), i = (t == null ? void 0 : t.split(".")) || [];
963
871
  if (i.length === 0) return {};
964
- const a = {};
965
- let o = i.length - 1;
966
- for (let s = e.capabilities.prefixLevels.length - 1; s >= 0 && o >= 0; s -= 1, o -= 1)
967
- Ci(
968
- a,
969
- e.capabilities.prefixLevels[s],
970
- i[o]
872
+ const s = {};
873
+ let l = i.length - 1;
874
+ for (let n = e.capabilities.prefixLevels.length - 1; n >= 0 && l >= 0; n -= 1, l -= 1)
875
+ fi(
876
+ s,
877
+ e.capabilities.prefixLevels[n],
878
+ i[l]
971
879
  );
972
- return a;
880
+ return s;
973
881
  }
974
- function Ma(e) {
882
+ function Za(e) {
975
883
  return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((t) => {
976
- const i = D(e.left, t), a = D(e.right, t);
977
- return !i || !a || i === a;
884
+ const i = x(e.left, t), s = x(e.right, t);
885
+ return !i || !s || i === s;
978
886
  });
979
887
  }
980
- function Ra(e) {
888
+ function Ja(e) {
981
889
  return e.capabilities.prefixLevels.every((t) => {
982
- const i = D(e.requested, t);
983
- return i ? D(e.allowed, t) === i : !0;
890
+ const i = x(e.requested, t);
891
+ return i ? x(e.allowed, t) === i : !0;
984
892
  });
985
893
  }
986
- function rt(e, t = {}) {
987
- const i = j(e), a = {
894
+ function Xe(e, t = {}) {
895
+ const i = C(e), s = {
988
896
  connectionId: t.connectionId,
989
897
  connectionType: e,
990
898
  path: ["database", "schema", "table"],
@@ -998,24 +906,24 @@ function rt(e, t = {}) {
998
906
  supportsFilterClause: !0
999
907
  };
1000
908
  return i.includes("postgres") ? {
1001
- ...a,
909
+ ...s,
1002
910
  prefixLevels: ["schema", "table"],
1003
911
  dialect: "postgres"
1004
912
  } : i.includes("mysql") ? {
1005
- ...a,
913
+ ...s,
1006
914
  prefixLevels: ["database", "table"],
1007
915
  dialect: "mysql",
1008
916
  supportsFilterClause: !1
1009
917
  } : i.includes("mssql") || i.includes("sqlserver") ? {
1010
- ...a,
918
+ ...s,
1011
919
  dialect: "mssql",
1012
920
  supportsFilterClause: !1
1013
921
  } : i.includes("redshift") ? {
1014
- ...a,
922
+ ...s,
1015
923
  prefixLevels: ["schema", "table"],
1016
924
  dialect: "redshift"
1017
925
  } : i.includes("snowflake") ? {
1018
- ...a,
926
+ ...s,
1019
927
  dialect: "snowflake"
1020
928
  } : i.includes("clickhouse") ? {
1021
929
  connectionId: t.connectionId,
@@ -1049,7 +957,7 @@ function rt(e, t = {}) {
1049
957
  dialect: "postgres",
1050
958
  supportsFilterClause: !0
1051
959
  } : i === "bigquery" ? {
1052
- ...a,
960
+ ...s,
1053
961
  labels: {
1054
962
  database: "Project",
1055
963
  schema: "Dataset",
@@ -1058,9 +966,9 @@ function rt(e, t = {}) {
1058
966
  prefixLevels: ["schema", "table"],
1059
967
  dialect: "bigquery",
1060
968
  supportsFilterClause: !1
1061
- } : a;
969
+ } : s;
1062
970
  }
1063
- const ve = [
971
+ const fe = [
1064
972
  "GoogleSheets",
1065
973
  "FileUpload",
1066
974
  "MySQL",
@@ -1074,31 +982,31 @@ const ve = [
1074
982
  "API",
1075
983
  "none"
1076
984
  ];
1077
- function Na(e) {
985
+ function Wa(e) {
1078
986
  if (!e) return;
1079
- const t = ve.filter(
1080
- (i) => i !== "none" && rt(i).dialect === e
987
+ const t = fe.filter(
988
+ (i) => i !== "none" && Xe(i).dialect === e
1081
989
  );
1082
990
  return t.length === 1 ? t[0] : void 0;
1083
991
  }
1084
- const Ti = {
992
+ const pi = {
1085
993
  postgres: "PostgreSQL",
1086
994
  sqlserver: "MSSQL"
1087
995
  };
1088
- function Ta(e) {
1089
- const t = j(e);
996
+ function en(e) {
997
+ const t = C(e);
1090
998
  if (t)
1091
- return ve.find(
1092
- (i) => j(i) === t
1093
- ) ?? Ti[t];
999
+ return fe.find(
1000
+ (i) => C(i) === t
1001
+ ) ?? pi[t];
1094
1002
  }
1095
- function Ea(e, t = {}) {
1096
- return Ei(
1003
+ function tn(e, t = {}) {
1004
+ return mi(
1097
1005
  e
1098
- ) ? rt(e, t) : void 0;
1006
+ ) ? Xe(e, t) : void 0;
1099
1007
  }
1100
- function Ei(e) {
1101
- const t = j(e);
1008
+ function mi(e) {
1009
+ const t = C(e);
1102
1010
  if (t.includes("postgres")) return "postgres";
1103
1011
  if (t.includes("mysql")) return "mysql";
1104
1012
  if (t.includes("mssql") || t.includes("sqlserver"))
@@ -1109,8 +1017,8 @@ function Ei(e) {
1109
1017
  if (t === "s3" || t === "api" || t === "googlesheets" || t === "fileupload" || t === "bigquery")
1110
1018
  return t;
1111
1019
  }
1112
- function Ca(e) {
1113
- const t = j(e);
1020
+ function an(e) {
1021
+ const t = C(e);
1114
1022
  switch (t) {
1115
1023
  case "mysql":
1116
1024
  case "bigquery":
@@ -1130,116 +1038,110 @@ function Ca(e) {
1130
1038
  return "unknown";
1131
1039
  }
1132
1040
  }
1133
- function ja(e) {
1041
+ function nn(e) {
1134
1042
  return e.capabilities.prefixLevels.every(
1135
- (t) => !!D(e.source, t)
1043
+ (t) => !!x(e.source, t)
1136
1044
  );
1137
1045
  }
1138
- function $a(e) {
1139
- const t = e.quoteIdentifier ?? Oi;
1140
- return e.capabilities.prefixLevels.map((i) => D(e.source, i)).filter((i) => !!i).map((i) => t(i, e.capabilities.dialect)).join(".");
1046
+ function sn(e) {
1047
+ const t = e.quoteIdentifier ?? _i;
1048
+ return e.capabilities.prefixLevels.map((i) => x(e.source, i)).filter((i) => !!i).map((i) => t(i, e.capabilities.dialect)).join(".");
1141
1049
  }
1142
- function D(e, t) {
1050
+ function x(e, t) {
1143
1051
  return t === "database" ? e.databaseName : t === "schema" ? e.schemaName : e.tableName;
1144
1052
  }
1145
- function Ci(e, t, i) {
1053
+ function fi(e, t, i) {
1146
1054
  t === "database" ? e.databaseName = i : t === "schema" ? e.schemaName = i : e.tableName = i;
1147
1055
  }
1148
- const ji = [
1056
+ const gi = [
1149
1057
  ['"', '"'],
1150
1058
  ["`", "`"],
1151
1059
  ["[", "]"]
1152
1060
  ];
1153
- function $i(e) {
1061
+ function hi(e) {
1154
1062
  const t = e.trim();
1155
- for (const [i, a] of ji)
1156
- if (t.length >= 2 && t.startsWith(i) && t.endsWith(a))
1157
- return t.slice(1, -1).split(a + a).join(a);
1063
+ for (const [i, s] of gi)
1064
+ if (t.length >= 2 && t.startsWith(i) && t.endsWith(s))
1065
+ return t.slice(1, -1).split(s + s).join(s);
1158
1066
  return t;
1159
1067
  }
1160
- function lt(e) {
1068
+ function Ze(e) {
1161
1069
  const t = e == null ? void 0 : e.trim();
1162
1070
  if (!t) return [];
1163
- const i = t.split(".").map($i);
1164
- return i.some((a) => !a) ? [] : i;
1071
+ const i = t.split(".").map(hi);
1072
+ return i.some((s) => !s) ? [] : i;
1165
1073
  }
1166
- function Oa(e) {
1167
- const t = lt(e ?? void 0);
1074
+ function rn(e) {
1075
+ const t = Ze(e ?? void 0);
1168
1076
  return t[t.length - 1] || "";
1169
1077
  }
1170
- function Oi(e, t) {
1078
+ function _i(e, t) {
1171
1079
  return t === "mysql" || t === "bigquery" || t === "clickhouse" || t === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : t === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
1172
1080
  }
1173
- function j(e) {
1081
+ function C(e) {
1174
1082
  if (typeof e != "string")
1175
1083
  return "";
1176
1084
  const t = [];
1177
1085
  for (const i of e.trim().toLowerCase())
1178
- Pi(i) && t.push(i);
1086
+ yi(i) && t.push(i);
1179
1087
  return t.join("");
1180
1088
  }
1181
- function Pi(e) {
1089
+ function yi(e) {
1182
1090
  const t = e.charCodeAt(0);
1183
1091
  return t >= 48 && t <= 57 || t >= 97 && t <= 122;
1184
1092
  }
1185
- function Pa(e) {
1093
+ function on(e) {
1186
1094
  return typeof e == "object" && e !== null && e.mode === "last" && e.relativeTo === "latest_data";
1187
1095
  }
1188
- function Yi(e) {
1096
+ function bi(e) {
1189
1097
  return e === "between" || e === "not between";
1190
1098
  }
1191
- const Q = n.enum(["day", "week", "month", "quarter", "year"]), qi = n.enum(["minute", "hour"]), dt = n.number().int().positive(), Ne = n.number().int(), ut = n.object({
1192
- mode: n.literal("last"),
1193
- n: dt,
1194
- unit: qi,
1195
- complete: n.literal(!1).optional(),
1196
- relativeTo: n.literal("latest_data").optional()
1197
- }), ct = n.object({
1198
- mode: n.literal("last"),
1199
- n: dt,
1200
- unit: Q,
1201
- complete: n.boolean().optional(),
1202
- relativeTo: n.literal("latest_data").optional()
1203
- }), pt = n.object({
1204
- mode: n.literal("this"),
1205
- unit: Q,
1206
- toDate: n.boolean().optional(),
1207
- boundary: n.enum(["first_day", "last_day"]).optional()
1208
- }), mt = n.object({ mode: n.literal("previous"), unit: Q }), ft = n.object({
1209
- mode: n.literal("between"),
1210
- unit: Q,
1211
- from: Ne,
1212
- to: Ne
1213
- }), se = {
1099
+ const B = a.enum(["day", "week", "month", "quarter", "year"]), vi = a.enum(["minute", "hour"]), Je = a.number().int().positive(), we = a.number().int(), We = a.object({
1100
+ mode: a.literal("last"),
1101
+ n: Je,
1102
+ unit: vi,
1103
+ complete: a.literal(!1).optional(),
1104
+ relativeTo: a.literal("latest_data").optional()
1105
+ }), et = a.object({
1106
+ mode: a.literal("last"),
1107
+ n: Je,
1108
+ unit: B,
1109
+ complete: a.boolean().optional(),
1110
+ relativeTo: a.literal("latest_data").optional()
1111
+ }), tt = a.object({
1112
+ mode: a.literal("this"),
1113
+ unit: B,
1114
+ toDate: a.boolean().optional(),
1115
+ boundary: a.enum(["first_day", "last_day"]).optional()
1116
+ }), it = a.object({ mode: a.literal("previous"), unit: B }), at = a.object({
1117
+ mode: a.literal("between"),
1118
+ unit: B,
1119
+ from: we,
1120
+ to: we
1121
+ }), W = {
1214
1122
  check: (e) => e.boundary === void 0 || e.unit === "month",
1215
1123
  message: 'A month boundary requires unit "month".'
1216
- }, Li = n.union([
1217
- ut.strict(),
1218
- ct.strict(),
1219
- pt.strict().refine(se.check, {
1220
- message: se.message,
1124
+ }, Ii = a.union([
1125
+ We.strict(),
1126
+ et.strict(),
1127
+ tt.strict().refine(W.check, {
1128
+ message: W.message,
1221
1129
  path: ["boundary"]
1222
1130
  }),
1223
- mt.strict(),
1224
- ft.strict()
1225
- ]), Bi = n.union([
1226
- ut,
1227
- ct,
1228
- pt.refine(se.check),
1229
- mt,
1230
- ft
1131
+ it.strict(),
1132
+ at.strict()
1133
+ ]), Si = a.union([
1134
+ We,
1135
+ et,
1136
+ tt.refine(W.check),
1137
+ it,
1138
+ at
1231
1139
  ]);
1232
- function Ya(e) {
1233
- const t = Bi.safeParse(e);
1140
+ function ln(e) {
1141
+ const t = Si.safeParse(e);
1234
1142
  return t.success ? t.data : void 0;
1235
1143
  }
1236
- const [Vi, Ui, Hi, zi] = Ue.options, Gi = n.union([
1237
- Vi.innerType().strict(),
1238
- Ui.extend({ type: n.literal("date") }).strict(),
1239
- Hi.strict(),
1240
- zi.strict(),
1241
- z
1242
- ]), I = n.string().min(1), Te = n.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), gt = n.enum([
1144
+ const v = a.string().min(1), Ae = a.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), nt = a.enum([
1243
1145
  "table",
1244
1146
  "view",
1245
1147
  "materialized view",
@@ -1248,23 +1150,23 @@ const [Vi, Ui, Hi, zi] = Ue.options, Gi = n.union([
1248
1150
  "dataset",
1249
1151
  "url",
1250
1152
  "upload"
1251
- ]), Z = n.object({
1252
- connectionId: I,
1253
- connectionType: n.enum(ve),
1254
- type: gt,
1255
- name: I,
1153
+ ]), z = a.object({
1154
+ connectionId: v,
1155
+ connectionType: a.enum(fe),
1156
+ type: nt,
1157
+ name: v,
1256
1158
  // Grounded relationship plans retain semantic identity and display metadata.
1257
1159
  // SQL stays server-resolved; it is not accepted inside a join entity.
1258
- alias: n.string().optional(),
1259
- id: I.optional(),
1260
- domainId: I.optional(),
1261
- datasetType: n.enum(["physical", "virtual"]).optional(),
1262
- label: n.string().optional(),
1263
- description: n.string().optional(),
1264
- dbObjectType: n.string().optional(),
1265
- database: n.string().optional(),
1266
- schema: n.string().optional(),
1267
- dialect: n.enum([
1160
+ alias: a.string().optional(),
1161
+ id: v.optional(),
1162
+ domainId: v.optional(),
1163
+ datasetType: a.enum(["physical", "virtual"]).optional(),
1164
+ label: a.string().optional(),
1165
+ description: a.string().optional(),
1166
+ dbObjectType: a.string().optional(),
1167
+ database: a.string().optional(),
1168
+ schema: a.string().optional(),
1169
+ dialect: a.enum([
1268
1170
  "mysql",
1269
1171
  "postgres",
1270
1172
  "bigquery",
@@ -1274,44 +1176,44 @@ const [Vi, Ui, Hi, zi] = Ue.options, Gi = n.union([
1274
1176
  "duckdb",
1275
1177
  "mssql"
1276
1178
  ]).optional()
1277
- }).strict(), H = n.lazy(
1278
- () => n.object({
1279
- id: I,
1280
- name: I,
1281
- label: n.string(),
1179
+ }).strict(), q = a.lazy(
1180
+ () => a.object({
1181
+ id: v,
1182
+ name: v,
1183
+ label: a.string(),
1282
1184
  /** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
1283
- derivedLabel: n.string().optional(),
1284
- qualifiedFieldName: I,
1285
- dataType: I,
1286
- entityId: I,
1287
- entityName: I,
1288
- entityType: gt,
1289
- alias: n.string().optional(),
1290
- sourceField: n.string().optional(),
1291
- source: ge.optional(),
1292
- nativeDataType: n.string().optional(),
1293
- description: n.string().optional(),
1294
- qualifiedEntityName: n.string().optional(),
1295
- dateFormat: n.enum(Mi).optional(),
1296
- customFormat: n.string().optional(),
1297
- granularity: ie.optional(),
1298
- role: Te.optional(),
1299
- calculationRepresentation: n.enum(["inline-expression", "manual", "typed-derived"]).optional(),
1300
- calculatedFieldOrigin: n.object({ id: I, role: Te.optional() }).strict().optional(),
1301
- aggregateOrigin: n.enum(["default", "explicit"]).optional(),
1302
- labelOrigin: n.enum(["semantic", "override"]).optional(),
1303
- formatOrigin: n.enum(["semantic", "override"]).optional(),
1304
- expression: n.string().optional(),
1305
- derivedField: he.optional(),
1306
- format: Gi.optional(),
1307
- semanticTemporalPresentation: n.object({
1308
- granularity: ie,
1309
- format: z
1185
+ derivedLabel: a.string().optional(),
1186
+ qualifiedFieldName: v,
1187
+ dataType: v,
1188
+ entityId: v,
1189
+ entityName: v,
1190
+ entityType: nt,
1191
+ alias: a.string().optional(),
1192
+ sourceField: a.string().optional(),
1193
+ source: le.optional(),
1194
+ nativeDataType: a.string().optional(),
1195
+ description: a.string().optional(),
1196
+ qualifiedEntityName: a.string().optional(),
1197
+ dateFormat: a.enum(di).optional(),
1198
+ customFormat: a.string().optional(),
1199
+ granularity: X.optional(),
1200
+ role: Ae.optional(),
1201
+ calculationRepresentation: a.enum(["inline-expression", "manual", "typed-derived"]).optional(),
1202
+ calculatedFieldOrigin: a.object({ id: v, role: Ae.optional() }).strict().optional(),
1203
+ aggregateOrigin: a.enum(["default", "explicit"]).optional(),
1204
+ labelOrigin: a.enum(["semantic", "override"]).optional(),
1205
+ formatOrigin: a.enum(["semantic", "override"]).optional(),
1206
+ expression: a.string().optional(),
1207
+ derivedField: de.optional(),
1208
+ format: O.optional(),
1209
+ semanticTemporalPresentation: a.object({
1210
+ granularity: X,
1211
+ format: Ft
1310
1212
  }).strict().optional(),
1311
- aggregate: He.optional(),
1312
- fieldScope: n.enum(["card", "sheet", "dashboard", "domain"]).optional(),
1313
- calculatedFormula: n.object({
1314
- operation: n.enum([
1213
+ aggregate: je.optional(),
1214
+ fieldScope: a.enum(["card", "sheet", "dashboard", "domain"]).optional(),
1215
+ calculatedFormula: a.object({
1216
+ operation: a.enum([
1315
1217
  "sum",
1316
1218
  "difference",
1317
1219
  "product",
@@ -1321,21 +1223,21 @@ const [Vi, Ui, Hi, zi] = Ue.options, Gi = n.union([
1321
1223
  "scale",
1322
1224
  "custom"
1323
1225
  ]),
1324
- inputFields: n.array(H),
1325
- constant: n.number().finite().optional(),
1326
- computeStage: n.enum(["row", "aggregate"]).optional()
1226
+ inputFields: a.array(q),
1227
+ constant: a.number().finite().optional(),
1228
+ computeStage: a.enum(["row", "aggregate"]).optional()
1327
1229
  }).strict().optional()
1328
1230
  }).strict()
1329
- ), Qi = n.union([
1330
- n.string(),
1331
- n.number().finite(),
1332
- n.boolean(),
1333
- n.date(),
1334
- n.null()
1335
- ]), Ki = n.object({
1336
- id: I,
1337
- field: H,
1338
- operator: n.enum([
1231
+ ), ki = a.union([
1232
+ a.string(),
1233
+ a.number().finite(),
1234
+ a.boolean(),
1235
+ a.date(),
1236
+ a.null()
1237
+ ]), wi = a.object({
1238
+ id: v,
1239
+ field: q,
1240
+ operator: a.enum([
1339
1241
  "=",
1340
1242
  "!=",
1341
1243
  ">",
@@ -1354,289 +1256,74 @@ const [Vi, Ui, Hi, zi] = Ue.options, Gi = n.union([
1354
1256
  "isNull",
1355
1257
  "isNotNull"
1356
1258
  ]),
1357
- value: n.union([Qi, n.array(n.string()), n.array(n.number().finite())]),
1358
- label: n.string().optional(),
1359
- temporalBucket: Yt.optional(),
1360
- relativeMeta: Li.optional(),
1361
- latestValue: n.literal(!0).optional(),
1362
- latestValuePolicy: n.literal("snapshot").optional()
1259
+ value: a.union([ki, a.array(a.string()), a.array(a.number().finite())]),
1260
+ label: a.string().optional(),
1261
+ temporalBucket: Dt.optional(),
1262
+ relativeMeta: Ii.optional(),
1263
+ latestValue: a.literal(!0).optional(),
1264
+ latestValuePolicy: a.literal("snapshot").optional()
1363
1265
  }).strict().superRefine((e, t) => {
1364
- const { operator: i, value: a } = e;
1365
- if ((i === "between" || i === "not between") && (!Array.isArray(a) || a.length !== 2) && t.addIssue({
1266
+ const { operator: i, value: s } = e;
1267
+ if ((i === "between" || i === "not between") && (!Array.isArray(s) || s.length !== 2) && t.addIssue({
1366
1268
  code: "custom",
1367
1269
  path: ["value"],
1368
1270
  message: "Between requires two endpoints."
1369
- }), e.relativeMeta && !Yi(i) && t.addIssue({
1271
+ }), e.relativeMeta && !bi(i) && t.addIssue({
1370
1272
  code: "custom",
1371
1273
  path: ["relativeMeta"],
1372
1274
  message: "A relative date requires between or not between."
1373
1275
  }), e.latestValue) {
1374
- const s = [e.field.nativeDataType, e.field.dataType].map((l) => _e(l)).some((l) => l === "date" || l === "datetime");
1375
- (i !== "=" || !s) && t.addIssue({
1276
+ const n = [e.field.nativeDataType, e.field.dataType].map((o) => ce(o)).some((o) => o === "date" || o === "datetime");
1277
+ (i !== "=" || !n) && t.addIssue({
1376
1278
  code: "custom",
1377
1279
  path: ["latestValue"],
1378
1280
  message: "Latest value requires = on a date or timestamp field."
1379
1281
  });
1380
1282
  }
1381
- (i === "in" || i === "not in") && !Array.isArray(a) && t.addIssue({
1283
+ (i === "in" || i === "not in") && !Array.isArray(s) && t.addIssue({
1382
1284
  code: "custom",
1383
1285
  path: ["value"],
1384
1286
  message: "Membership requires an array."
1385
1287
  });
1386
- }), ht = n.lazy(
1387
- () => n.object({
1388
- id: I,
1389
- logicalOperator: n.enum(["AND", "OR"]),
1390
- negate: n.boolean(),
1391
- conditions: n.array(Ki),
1392
- groups: n.array(ht)
1288
+ }), st = a.lazy(
1289
+ () => a.object({
1290
+ id: v,
1291
+ logicalOperator: a.enum(["AND", "OR"]),
1292
+ negate: a.boolean(),
1293
+ conditions: a.array(wi),
1294
+ groups: a.array(st)
1393
1295
  }).strict()
1394
- ), Xi = n.object({
1395
- baseEntity: Z,
1396
- joins: n.array(
1397
- n.object({
1398
- id: I,
1399
- source: Z,
1400
- target: Z,
1401
- joinType: n.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
1402
- sequence: n.number().int().nonnegative(),
1403
- autoResolved: n.boolean().optional(),
1404
- relationshipId: n.string().optional(),
1405
- relationshipName: n.string().optional(),
1406
- relationshipCardinality: n.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
1407
- relationshipTraversalDirection: n.enum(["forward", "reverse"]).optional(),
1408
- joinKeyGroups: n.array(
1409
- n.object({
1410
- id: I,
1411
- operator: n.enum(["AND", "OR"]),
1412
- keys: n.array(
1413
- n.object({
1414
- id: n.string().optional(),
1415
- source: H,
1416
- target: H,
1417
- operator: n.enum(["=", "!=", ">", ">=", "<", "<="])
1296
+ ), Ai = a.object({
1297
+ baseEntity: z,
1298
+ joins: a.array(
1299
+ a.object({
1300
+ id: v,
1301
+ source: z,
1302
+ target: z,
1303
+ joinType: a.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
1304
+ sequence: a.number().int().nonnegative(),
1305
+ autoResolved: a.boolean().optional(),
1306
+ relationshipId: a.string().optional(),
1307
+ relationshipName: a.string().optional(),
1308
+ relationshipCardinality: a.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
1309
+ relationshipTraversalDirection: a.enum(["forward", "reverse"]).optional(),
1310
+ joinKeyGroups: a.array(
1311
+ a.object({
1312
+ id: v,
1313
+ operator: a.enum(["AND", "OR"]),
1314
+ keys: a.array(
1315
+ a.object({
1316
+ id: a.string().optional(),
1317
+ source: q,
1318
+ target: q,
1319
+ operator: a.enum(["=", "!=", ">", ">=", "<", "<="])
1418
1320
  }).strict()
1419
1321
  ).min(1)
1420
1322
  }).strict()
1421
1323
  ).min(1)
1422
1324
  }).strict()
1423
1325
  )
1424
- }).strict(), Wi = n.object({
1425
- axis: G,
1426
- levelId: n.string().uuid().optional(),
1427
- // Persisted table preferences are edited through Immer; runtime paths remain readonly.
1428
- oppositePath: F.transform((e) => [...e]).optional()
1429
- }).strict(), k = n.string().min(1), Zi = n.array(
1430
- n.enum(["body", "header", "footer", "subtotal", "grandTotal"])
1431
- ), Ji = n.enum(["normal", "medium", "semibold", "bold"]), en = n.enum(["none", "underline", "line-through"]), bt = n.object({
1432
- version: n.literal(1),
1433
- rules: n.array(
1434
- n.object({
1435
- id: n.string().min(1),
1436
- name: n.string().optional(),
1437
- enabled: n.boolean().optional(),
1438
- target: n.object({
1439
- level: n.enum(["cell", "row"]),
1440
- matrix: Wi.optional(),
1441
- columnIds: n.array(k).optional(),
1442
- conditionColumnId: k.optional(),
1443
- applyToColumnIds: n.array(k).optional(),
1444
- tableParts: Zi.optional(),
1445
- rowRoles: n.array(n.string()).optional(),
1446
- depth: n.number().int().nonnegative().optional(),
1447
- includeTotals: n.boolean().optional(),
1448
- includeSubtotals: n.boolean().optional()
1449
- }).strict(),
1450
- condition: n.discriminatedUnion("kind", [
1451
- n.object({
1452
- kind: n.literal("comparison"),
1453
- columnId: k,
1454
- operator: n.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
1455
- value: B
1456
- }).strict(),
1457
- n.object({
1458
- kind: n.literal("between"),
1459
- columnId: k,
1460
- min: B,
1461
- max: B,
1462
- inclusive: n.boolean().optional()
1463
- }).strict(),
1464
- n.object({
1465
- kind: n.literal("blank"),
1466
- columnId: k,
1467
- isBlank: n.boolean()
1468
- }).strict(),
1469
- n.object({
1470
- kind: n.literal("contains"),
1471
- columnId: k,
1472
- value: n.string(),
1473
- caseSensitive: n.boolean().optional(),
1474
- exact: n.boolean().optional()
1475
- }).strict(),
1476
- n.object({
1477
- kind: n.literal("topBottom"),
1478
- columnId: k,
1479
- direction: n.enum(["top", "bottom"]),
1480
- count: n.number().int().positive()
1481
- }).strict(),
1482
- n.object({
1483
- kind: n.literal("colorScale"),
1484
- columnId: k,
1485
- range: n.enum(["auto", "manual"]),
1486
- min: n.number().finite().optional(),
1487
- mid: n.number().finite().optional(),
1488
- max: n.number().finite().optional(),
1489
- colors: n.object({
1490
- min: n.string(),
1491
- mid: n.string().optional(),
1492
- max: n.string()
1493
- }).strict()
1494
- }).strict(),
1495
- n.object({
1496
- kind: n.literal("dataBar"),
1497
- columnId: k,
1498
- range: n.enum(["auto", "manual"]),
1499
- min: n.number().finite().optional(),
1500
- max: n.number().finite().optional(),
1501
- color: n.string(),
1502
- showValue: n.boolean().optional()
1503
- }).strict()
1504
- ]),
1505
- style: n.object({
1506
- backgroundColor: n.string().optional(),
1507
- textColor: n.string().optional(),
1508
- fontWeight: Ji.optional(),
1509
- italic: n.boolean().optional(),
1510
- textDecoration: en.optional(),
1511
- icon: n.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
1512
- dataBar: n.object({ color: n.string(), showValue: n.boolean() }).strict().optional()
1513
- }).strict().optional()
1514
- }).strict()
1515
- )
1516
- }).strict();
1517
- function qa(e, t) {
1518
- const i = (s) => {
1519
- if (U(s)) return s.value;
1520
- const l = typeof s == "string" ? Ii(s.trim()) ?? oe(s) : oe(s);
1521
- if (l === null) return null;
1522
- try {
1523
- return Si(String(l));
1524
- } catch {
1525
- return null;
1526
- }
1527
- }, a = i(e), o = i(t);
1528
- return a === null || o === null ? null : nt(a, o);
1529
- }
1530
- function La(e, t, i) {
1531
- const a = an(e);
1532
- if (a === null) return null;
1533
- if (typeof a == "number" && typeof t == "number" && typeof i == "number") {
1534
- const b = sn(a, t, i);
1535
- return { ratio: b, midpointComparison: Math.sign(b - 0.5) };
1536
- }
1537
- if ([t, i].some((b) => typeof b == "number" && !Number.isFinite(b))) return null;
1538
- const o = [a, t, i].map((b) => {
1539
- const Y = typeof b == "number" ? x(String(b)) : b.value, [Ct, Ae = ""] = Y.split(".");
1540
- return { coefficient: Ct + Ae, scale: Ae.length };
1541
- }), s = Math.max(...o.map((b) => b.scale)), [l, d, c] = o.map(
1542
- (b) => BigInt(b.coefficient) * 10n ** BigInt(s - b.scale)
1543
- ), p = c - d, u = l - d;
1544
- if (p <= 0n)
1545
- return {
1546
- ratio: l >= c ? 1 : 0,
1547
- midpointComparison: l >= c ? 1 : -1
1548
- };
1549
- const h = u * 2n - p, _ = h < 0n ? -1 : h > 0n ? 1 : 0;
1550
- return { ratio: u <= 0n ? 0 : u >= p ? 1 : Number(u * 1000000000n / p) / 1e9, midpointComparison: _ };
1551
- }
1552
- function Ba(e) {
1553
- return !!e && typeof e == "object" && !Array.isArray(e);
1554
- }
1555
- function Va(e) {
1556
- return e.enabled !== !1;
1557
- }
1558
- function Ua(e) {
1559
- return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
1560
- }
1561
- function tn(e) {
1562
- return e.columnId;
1563
- }
1564
- function nn(e) {
1565
- const t = [tn(e.condition)];
1566
- return { validationRefs: [.../* @__PURE__ */ new Set([
1567
- ...t,
1568
- ...e.target.conditionColumnId === void 0 ? [] : [e.target.conditionColumnId],
1569
- ...e.target.columnIds ?? [],
1570
- ...e.target.applyToColumnIds ?? []
1571
- ])], evaluationInputs: t };
1572
- }
1573
- function oe(e) {
1574
- if (typeof e == "number")
1575
- return Number.isFinite(e) ? e : null;
1576
- if (typeof e == "string" && e.trim() !== "") {
1577
- const t = Number(e);
1578
- return Number.isFinite(t) ? t : null;
1579
- }
1580
- return null;
1581
- }
1582
- function an(e) {
1583
- return U(e) ? e : oe(e);
1584
- }
1585
- function Ha(e) {
1586
- const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
1587
- for (const a of e)
1588
- U(a) ? i.add(a.value) : t.add(a);
1589
- return {
1590
- has: (a) => U(a) ? i.has(a.value) : t.has(a)
1591
- };
1592
- }
1593
- function za(e, t) {
1594
- return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : nt(
1595
- typeof e == "number" ? x(String(e)) : e.value,
1596
- typeof t == "number" ? x(String(t)) : t.value
1597
- );
1598
- }
1599
- function Ga(e) {
1600
- return e == null || e === "";
1601
- }
1602
- function sn(e, t, i) {
1603
- return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(i) ? 0 : i === t ? e >= i ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (i - t)));
1604
- }
1605
- function on(e) {
1606
- switch (e) {
1607
- case "bold":
1608
- return 700;
1609
- case "semibold":
1610
- return 600;
1611
- case "medium":
1612
- return 500;
1613
- case "normal":
1614
- return 400;
1615
- default:
1616
- return;
1617
- }
1618
- }
1619
- function Qa(e) {
1620
- return e ? _t({
1621
- fontWeight: on(e.fontWeight),
1622
- fontStyle: e.italic ? "italic" : void 0,
1623
- color: e.textColor,
1624
- backgroundColor: e.backgroundColor,
1625
- textDecoration: e.textDecoration
1626
- }) : {};
1627
- }
1628
- function Ka(...e) {
1629
- return Object.assign(
1630
- {},
1631
- ...e.filter((t) => !!t).map(_t)
1632
- );
1633
- }
1634
- function _t(e) {
1635
- return Object.fromEntries(
1636
- Object.entries(e).filter(([, t]) => t !== void 0)
1637
- );
1638
- }
1639
- const v = n.string().uuid(), rn = n.string().min(1), ln = n.number().int().positive().max(Number.MAX_SAFE_INTEGER), dn = n.enum([
1326
+ }).strict(), b = a.string().uuid(), xi = a.string().min(1), Fi = a.number().int().positive().max(Number.MAX_SAFE_INTEGER), Di = a.enum([
1640
1327
  "SUM",
1641
1328
  "COUNT",
1642
1329
  "DISTINCT",
@@ -1644,406 +1331,363 @@ const v = n.string().uuid(), rn = n.string().min(1), ln = n.number().int().posit
1644
1331
  "MIN",
1645
1332
  "MAX",
1646
1333
  "MEDIAN"
1647
- ]), yt = pi.omit({
1334
+ ]), rt = Qt.omit({
1648
1335
  aggregate: !0
1649
- }), un = {
1650
- id: v,
1651
- field: yt,
1652
- grain: ie.optional()
1653
- }, re = n.object(un).strict(), cn = n.object({
1654
- id: v,
1655
- kind: n.literal("aggregate"),
1656
- field: yt,
1657
- aggregate: dn
1658
- }).strict(), pn = n.object({
1659
- id: v,
1660
- kind: n.literal("calculated"),
1661
- definition: he
1662
- }).strict(), vt = n.discriminatedUnion("kind", [cn, pn]), mn = n.discriminatedUnion("kind", [
1663
- n.object({ kind: n.literal("member") }).strict(),
1664
- n.object({
1665
- kind: n.literal("measure"),
1666
- measureId: v,
1667
- oppositePath: F
1336
+ }), Mi = {
1337
+ id: b,
1338
+ field: rt,
1339
+ grain: X.optional()
1340
+ }, ee = a.object(Mi).strict(), Ei = a.object({
1341
+ id: b,
1342
+ kind: a.literal("aggregate"),
1343
+ field: rt,
1344
+ aggregate: Di
1345
+ }).strict(), Ti = a.object({
1346
+ id: b,
1347
+ kind: a.literal("calculated"),
1348
+ definition: de
1349
+ }).strict(), ot = a.discriminatedUnion("kind", [Ei, Ti]), Ni = a.discriminatedUnion("kind", [
1350
+ a.object({ kind: a.literal("member") }).strict(),
1351
+ a.object({
1352
+ kind: a.literal("measure"),
1353
+ measureId: b,
1354
+ oppositePath: A
1668
1355
  }).strict()
1669
- ]), fn = {
1670
- axis: G,
1671
- levelId: v,
1672
- scope: n.discriminatedUnion("kind", [
1673
- n.object({ kind: n.literal("level") }).strict(),
1674
- n.object({ kind: n.literal("branch"), parent: F }).strict()
1356
+ ]), Ri = {
1357
+ axis: me,
1358
+ levelId: b,
1359
+ scope: a.discriminatedUnion("kind", [
1360
+ a.object({ kind: a.literal("level") }).strict(),
1361
+ a.object({ kind: a.literal("branch"), parent: A }).strict()
1675
1362
  ]),
1676
- target: mn,
1677
- direction: n.enum(["asc", "desc"]),
1678
- nulls: n.enum(["first", "last"])
1679
- }, It = n.object(fn).strict(), gn = n.object({
1680
- id: v,
1681
- axis: G,
1682
- levelId: v,
1683
- direction: n.enum(["top", "bottom"]),
1684
- count: ln,
1685
- measureId: v,
1686
- oppositePath: F,
1687
- others: n.boolean()
1688
- }).strict(), J = n.number().finite(), hn = n.object({
1689
- id: v,
1690
- axis: G,
1691
- levelId: v,
1692
- measureId: v,
1693
- operator: n.enum(["=", "!=", ">", ">=", "<", "<=", "between", "not between"]),
1694
- value: n.union([
1695
- J,
1696
- n.tuple([J, J]).readonly()
1363
+ target: Ni,
1364
+ direction: a.enum(["asc", "desc"]),
1365
+ nulls: a.enum(["first", "last"])
1366
+ }, lt = a.object(Ri).strict(), Ci = a.object({
1367
+ id: b,
1368
+ axis: me,
1369
+ levelId: b,
1370
+ direction: a.enum(["top", "bottom"]),
1371
+ count: Fi,
1372
+ measureId: b,
1373
+ oppositePath: A,
1374
+ others: a.boolean()
1375
+ }).strict(), G = a.number().finite(), $i = a.object({
1376
+ id: b,
1377
+ axis: me,
1378
+ levelId: b,
1379
+ measureId: b,
1380
+ operator: a.enum(["=", "!=", ">", ">=", "<", "<=", "between", "not between"]),
1381
+ value: a.union([
1382
+ G,
1383
+ a.tuple([G, G]).readonly()
1697
1384
  ])
1698
1385
  }).strict().superRefine((e, t) => {
1699
1386
  const i = e.operator === "between" || e.operator === "not between";
1700
- i !== Array.isArray(e.value) ? g(t, ["value"], i ? "A range condition needs a low and a high bound." : "A comparison needs one number.") : i && e.value[0] > e.value[1] && g(t, ["value"], "The low bound must not exceed the high bound.");
1701
- }), St = n.object({
1702
- source: ge,
1703
- rows: n.array(re).min(1).readonly(),
1704
- columns: n.array(re).readonly(),
1705
- measures: n.array(vt).min(1).readonly(),
1706
- filters: ht.optional(),
1707
- joinPlan: Xi.optional(),
1708
- relationshipHint: n.object({ relationshipIds: n.array(rn).optional() }).strict().optional(),
1709
- sorts: n.array(It).readonly(),
1710
- rankings: n.array(gn).readonly(),
1711
- measureFilters: n.array(hn).readonly().optional()
1387
+ i !== Array.isArray(e.value) ? h(t, ["value"], i ? "A range condition needs a low and a high bound." : "A comparison needs one number.") : i && e.value[0] > e.value[1] && h(t, ["value"], "The low bound must not exceed the high bound.");
1388
+ }), dt = a.object({
1389
+ source: le,
1390
+ rows: a.array(ee).min(1).readonly(),
1391
+ columns: a.array(ee).readonly(),
1392
+ measures: a.array(ot).min(1).readonly(),
1393
+ filters: st.optional(),
1394
+ joinPlan: Ai.optional(),
1395
+ relationshipHint: a.object({ relationshipIds: a.array(xi).optional() }).strict().optional(),
1396
+ sorts: a.array(lt).readonly(),
1397
+ rankings: a.array(Ci).readonly(),
1398
+ measureFilters: a.array($i).readonly().optional()
1712
1399
  }).strict();
1713
- function kt(e) {
1400
+ function ut(e) {
1714
1401
  return JSON.stringify([
1715
1402
  e.axis,
1716
1403
  e.levelId,
1717
1404
  e.scope.kind,
1718
- e.scope.kind === "branch" ? st(e.scope.parent) : null
1405
+ e.scope.kind === "branch" ? Qe(e.scope.parent) : null
1719
1406
  ]);
1720
1407
  }
1721
- function g(e, t, i) {
1408
+ function h(e, t, i) {
1722
1409
  e.addIssue({ code: "custom", path: t, message: i });
1723
1410
  }
1724
1411
  function w(e, t, i) {
1725
- new Set(e).size !== e.length && g(t, i, "Duplicate identity.");
1726
- }
1727
- function $(e, t, i, a, o, s = !1) {
1728
- i.length > e[t].length && g(a, o, "Path exceeds axis depth."), i.forEach((l, d) => {
1729
- var c;
1730
- if (l.levelId !== ((c = e[t][d]) == null ? void 0 : c.id) && g(a, [...o, d], "Path must be an ordered axis prefix."), l.member.kind === "others") {
1731
- const p = l.member.rankingId;
1732
- (s || d !== i.length - 1 || !e.rankings.some(
1733
- (u) => u.id === p && u.others && u.axis === t && u.levelId === l.levelId
1734
- )) && g(
1735
- a,
1736
- [...o, d],
1412
+ new Set(e).size !== e.length && h(t, i, "Duplicate identity.");
1413
+ }
1414
+ function L(e, t, i, s, l, n = !1) {
1415
+ i.length > e[t].length && h(s, l, "Path exceeds axis depth."), i.forEach((o, d) => {
1416
+ var p;
1417
+ if (o.levelId !== ((p = e[t][d]) == null ? void 0 : p.id) && h(s, [...l, d], "Path must be an ordered axis prefix."), o.member.kind === "others") {
1418
+ const m = o.member.rankingId;
1419
+ (n || d !== i.length - 1 || !e.rankings.some(
1420
+ (u) => u.id === m && u.others && u.axis === t && u.levelId === o.levelId
1421
+ )) && h(
1422
+ s,
1423
+ [...l, d],
1737
1424
  "Others must terminate a path at its enabled ranking and cannot be a sort/rank target."
1738
1425
  );
1739
1426
  }
1740
1427
  });
1741
1428
  }
1742
- function wt(e, t, i, a) {
1743
- w(t.map(kt), i, a), t.forEach((o, s) => {
1744
- const l = [...a, s], d = e[o.axis].findIndex((c) => c.id === o.levelId);
1745
- if (d < 0 && g(i, l, "Sort level is not on its axis."), o.scope.kind === "branch" && ($(
1429
+ function ct(e, t, i, s) {
1430
+ w(t.map(ut), i, s), t.forEach((l, n) => {
1431
+ const o = [...s, n], d = e[l.axis].findIndex((p) => p.id === l.levelId);
1432
+ if (d < 0 && h(i, o, "Sort level is not on its axis."), l.scope.kind === "branch" && (L(
1746
1433
  e,
1747
- o.axis,
1748
- o.scope.parent,
1434
+ l.axis,
1435
+ l.scope.parent,
1749
1436
  i,
1750
- [...l, "scope", "parent"],
1437
+ [...o, "scope", "parent"],
1751
1438
  !0
1752
- ), o.scope.parent.length !== d && g(
1439
+ ), l.scope.parent.length !== d && h(
1753
1440
  i,
1754
- l,
1441
+ o,
1755
1442
  "Branch sort must name the immediate parent of its level."
1756
- )), o.target.kind === "measure") {
1757
- const c = o.target.measureId;
1758
- e.measures.some((p) => p.id === c) || g(i, l, "Unknown sort measure."), $(
1443
+ )), l.target.kind === "measure") {
1444
+ const p = l.target.measureId;
1445
+ e.measures.some((m) => m.id === p) || h(i, o, "Unknown sort measure."), L(
1759
1446
  e,
1760
- o.axis === "rows" ? "columns" : "rows",
1761
- o.target.oppositePath,
1447
+ l.axis === "rows" ? "columns" : "rows",
1448
+ l.target.oppositePath,
1762
1449
  i,
1763
- [...l, "target", "oppositePath"],
1450
+ [...o, "target", "oppositePath"],
1764
1451
  !0
1765
1452
  );
1766
1453
  }
1767
1454
  });
1768
1455
  }
1769
- function L(e, t, i, a) {
1770
- e && (e.kind !== t.kind || e.kind === "semantic" && t.kind === "semantic" && e.domainId !== t.domainId || e.kind === "physical" && t.kind === "physical" && e.connectionId !== t.connectionId) && g(
1456
+ function Y(e, t, i, s) {
1457
+ e && (e.kind !== t.kind || e.kind === "semantic" && t.kind === "semantic" && e.domainId !== t.domainId || e.kind === "physical" && t.kind === "physical" && e.connectionId !== t.connectionId) && h(
1771
1458
  i,
1772
- a,
1459
+ s,
1773
1460
  "Field source must belong to the same semantic domain or physical connection."
1774
1461
  );
1775
1462
  }
1776
- function ee(e, t, i) {
1777
- (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && g(t, i, "This measure semantic requires a later capability.");
1463
+ function Q(e, t, i) {
1464
+ (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && h(t, i, "This measure semantic requires a later capability.");
1778
1465
  }
1779
- function At(e, t) {
1466
+ function pt(e, t) {
1780
1467
  w(
1781
- [...e.rows, ...e.columns, ...e.measures].map((s) => s.id),
1468
+ [...e.rows, ...e.columns, ...e.measures].map((n) => n.id),
1782
1469
  t,
1783
1470
  []
1784
1471
  ), w(
1785
- e.rankings.map((s) => s.id),
1472
+ e.rankings.map((n) => n.id),
1786
1473
  t,
1787
1474
  ["rankings"]
1788
1475
  ), w(
1789
- e.rankings.map((s) => JSON.stringify([s.axis, s.levelId])),
1476
+ e.rankings.map((n) => JSON.stringify([n.axis, n.levelId])),
1790
1477
  t,
1791
1478
  ["rankings"]
1792
1479
  );
1793
- for (const s of ["rows", "columns"])
1794
- e[s].forEach((l, d) => {
1795
- l.grain && l.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(l.field.dataType) && g(t, [s, d, "grain"], "Grain requires a temporal field.");
1480
+ for (const n of ["rows", "columns"])
1481
+ e[n].forEach((o, d) => {
1482
+ o.grain && o.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(o.field.dataType) && h(t, [n, d, "grain"], "Grain requires a temporal field.");
1796
1483
  });
1797
1484
  const i = [
1798
1485
  ...e.rows,
1799
1486
  ...e.columns,
1800
- ...e.measures.filter((s) => s.kind === "aggregate")
1487
+ ...e.measures.filter((n) => n.kind === "aggregate")
1801
1488
  ];
1802
- for (const s of i)
1803
- if (L(s.field.source, e.source, t, [
1804
- s.id,
1489
+ for (const n of i)
1490
+ if (Y(n.field.source, e.source, t, [
1491
+ n.id,
1805
1492
  "field",
1806
1493
  "source"
1807
- ]), s.field.derivedField) {
1808
- s.field.derivedField.computeStage !== "row" && g(
1494
+ ]), n.field.derivedField) {
1495
+ n.field.derivedField.computeStage !== "row" && h(
1809
1496
  t,
1810
- [s.id],
1497
+ [n.id],
1811
1498
  "Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
1812
- ), ee(s.field.derivedField, t, [s.id]);
1813
- for (const l of Object.values(s.field.derivedField.inputs))
1814
- L(l.field.source, e.source, t, [s.id, "inputs"]);
1499
+ ), Q(n.field.derivedField, t, [n.id]);
1500
+ for (const o of Object.values(n.field.derivedField.inputs))
1501
+ Y(o.field.source, e.source, t, [n.id, "inputs"]);
1815
1502
  }
1816
- for (const s of e.measures)
1817
- if (s.kind === "calculated") {
1818
- (s.definition.computeStage !== "aggregate" || s.definition.resultRole !== "measure") && g(
1503
+ for (const n of e.measures)
1504
+ if (n.kind === "calculated") {
1505
+ (n.definition.computeStage !== "aggregate" || n.definition.resultRole !== "measure") && h(
1819
1506
  t,
1820
- [s.id],
1507
+ [n.id],
1821
1508
  "Calculated measures require aggregate stage and measure role."
1822
- ), ee(s.definition, t, [s.id]);
1823
- for (const l of Object.values(s.definition.inputs))
1824
- L(l.field.source, e.source, t, [
1825
- s.id,
1509
+ ), Q(n.definition, t, [n.id]);
1510
+ for (const o of Object.values(n.definition.inputs))
1511
+ Y(o.field.source, e.source, t, [
1512
+ n.id,
1826
1513
  "inputs"
1827
1514
  ]);
1828
1515
  }
1829
- const a = (s) => {
1830
- const l = (d, c) => {
1831
- var p, u;
1832
- if ((d.aggregate || ((p = d.derivedField) == null ? void 0 : p.computeStage) === "aggregate") && g(t, c, "Aggregate/HAVING filters are not supported."), d.derivedField) {
1833
- ee(d.derivedField, t, c);
1834
- for (const h of Object.values(d.derivedField.inputs))
1835
- L(h.field.source, e.source, t, c);
1516
+ const s = (n) => {
1517
+ const o = (d, p) => {
1518
+ var m, u;
1519
+ if ((d.aggregate || ((m = d.derivedField) == null ? void 0 : m.computeStage) === "aggregate") && h(t, p, "Aggregate/HAVING filters are not supported."), d.derivedField) {
1520
+ Q(d.derivedField, t, p);
1521
+ for (const g of Object.values(d.derivedField.inputs))
1522
+ Y(g.field.source, e.source, t, p);
1836
1523
  }
1837
- for (const h of ((u = d.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
1838
- l(h, c);
1524
+ for (const g of ((u = d.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
1525
+ o(g, p);
1839
1526
  };
1840
- for (const d of s.conditions)
1841
- l(d.field, ["filters", d.id]);
1842
- s.groups.forEach(a);
1527
+ for (const d of n.conditions)
1528
+ o(d.field, ["filters", d.id]);
1529
+ n.groups.forEach(s);
1843
1530
  };
1844
- if (e.filters && a(e.filters), e.joinPlan) {
1845
- const s = [
1531
+ if (e.filters && s(e.filters), e.joinPlan) {
1532
+ const n = [
1846
1533
  e.joinPlan.baseEntity,
1847
- ...e.joinPlan.joins.flatMap((l) => [l.source, l.target])
1534
+ ...e.joinPlan.joins.flatMap((o) => [o.source, o.target])
1848
1535
  ];
1849
- (new Set(s.map((l) => l.connectionId)).size > 1 || e.source.kind === "physical" && s[0].connectionId !== e.source.connectionId) && g(t, ["joinPlan"], "Joins must stay within the source connection."), w(
1850
- e.joinPlan.joins.map((l) => l.id),
1536
+ (new Set(n.map((o) => o.connectionId)).size > 1 || e.source.kind === "physical" && n[0].connectionId !== e.source.connectionId) && h(t, ["joinPlan"], "Joins must stay within the source connection."), w(
1537
+ e.joinPlan.joins.map((o) => o.id),
1851
1538
  t,
1852
1539
  ["joinPlan", "joins"]
1853
1540
  );
1854
1541
  }
1855
- wt(e, e.sorts, t, ["sorts"]);
1856
- const o = e.measureFilters ?? [];
1857
- w(o.map((s) => s.id), t, ["measureFilters"]), w(
1858
- o.map((s) => JSON.stringify([s.axis, s.levelId])),
1542
+ ct(e, e.sorts, t, ["sorts"]);
1543
+ const l = e.measureFilters ?? [];
1544
+ w(l.map((n) => n.id), t, ["measureFilters"]), w(
1545
+ l.map((n) => JSON.stringify([n.axis, n.levelId])),
1859
1546
  t,
1860
1547
  ["measureFilters"]
1861
- ), o.forEach((s, l) => {
1862
- (!e[s.axis].some((d) => d.id === s.levelId) || !e.measures.some((d) => d.id === s.measureId)) && g(t, ["measureFilters", l], "Unknown measure filter level or measure.");
1863
- }), e.rankings.forEach((s, l) => {
1864
- (!e[s.axis].some((d) => d.id === s.levelId) || !e.measures.some((d) => d.id === s.measureId)) && g(t, ["rankings", l], "Unknown ranking level or measure."), $(
1548
+ ), l.forEach((n, o) => {
1549
+ (!e[n.axis].some((d) => d.id === n.levelId) || !e.measures.some((d) => d.id === n.measureId)) && h(t, ["measureFilters", o], "Unknown measure filter level or measure.");
1550
+ }), e.rankings.forEach((n, o) => {
1551
+ (!e[n.axis].some((d) => d.id === n.levelId) || !e.measures.some((d) => d.id === n.measureId)) && h(t, ["rankings", o], "Unknown ranking level or measure."), L(
1865
1552
  e,
1866
- s.axis === "rows" ? "columns" : "rows",
1867
- s.oppositePath,
1553
+ n.axis === "rows" ? "columns" : "rows",
1554
+ n.oppositePath,
1868
1555
  t,
1869
- ["rankings", l, "oppositePath"],
1556
+ ["rankings", o, "oppositePath"],
1870
1557
  !0
1871
1558
  );
1872
1559
  });
1873
1560
  }
1874
- const P = St.superRefine(At), bn = St.extend({
1875
- rows: n.array(re).readonly(),
1876
- measures: n.array(vt).readonly()
1877
- }), _n = bn.superRefine(At), yn = P.innerType().extend({ kind: n.literal("matrix") }), vn = yn.superRefine(({ kind: e, ...t }, i) => {
1878
- const a = P.safeParse(t);
1879
- a.success || a.error.issues.forEach((o) => i.addIssue(o));
1880
- }), In = "{member}", Ee = n.object({
1881
- visible: n.boolean(),
1882
- position: n.enum(["before", "after"]),
1561
+ const j = dt.superRefine(pt), ji = dt.extend({
1562
+ rows: a.array(ee).readonly(),
1563
+ measures: a.array(ot).readonly()
1564
+ }), Yi = ji.superRefine(pt), Oi = j.innerType().extend({ kind: a.literal("matrix") }), Pi = Oi.superRefine(({ kind: e, ...t }, i) => {
1565
+ const s = j.safeParse(t);
1566
+ s.success || s.error.issues.forEach((l) => i.addIssue(l));
1567
+ }), qi = "{member}", xe = a.object({
1568
+ visible: a.boolean(),
1569
+ position: a.enum(["before", "after"]),
1883
1570
  /** As written; a subtotal's `{member}` becomes its member's name. */
1884
- label: n.string().optional()
1885
- }).strict(), Ce = n.object({
1886
- grand: Ee,
1887
- levels: n.record(v, Ee).readonly(),
1571
+ label: a.string().optional()
1572
+ }).strict(), Fe = a.object({
1573
+ grand: xe,
1574
+ levels: a.record(b, xe).readonly(),
1888
1575
  /**
1889
1576
  * Skip a subtotal that only repeats one row: an expanded group with
1890
1577
  * exactly one child shows no subtotal. Off when absent.
1891
1578
  */
1892
- skipRedundant: n.boolean().optional()
1893
- }).strict(), je = bt.shape.rules.element, Sn = bt.extend({
1894
- rules: n.array(je.extend({
1895
- target: je.shape.target.extend({
1896
- rowRoles: n.array(Ai).optional()
1897
- })
1898
- }))
1899
- }).superRefine((e, t) => {
1900
- var i;
1901
- w(e.rules.map((a) => a.id), t, ["rules"]);
1902
- for (const a of e.rules) {
1903
- const o = a.condition;
1904
- o.kind === "topBottom" && g(
1905
- t,
1906
- ["rules", a.id],
1907
- "Relative highlighting is deferred."
1908
- ), (o.kind === "dataBar" || o.kind === "colorScale") && ((o.range !== "manual" || o.min === void 0 || o.max === void 0 || o.min >= o.max) && g(
1909
- t,
1910
- ["rules", a.id],
1911
- "Explicit increasing range endpoints are required."
1912
- ), o.kind === "colorScale" && o.mid !== void 0 && (o.mid <= o.min || o.mid >= o.max) && g(
1913
- t,
1914
- ["rules", a.id],
1915
- "Midpoint must be inside the range."
1916
- )), (i = a.style) != null && i.dataBar && g(
1917
- t,
1918
- ["rules", a.id],
1919
- "Use an explicit-range dataBar condition."
1920
- );
1921
- }
1922
- });
1923
- function kn(e, t, i, a, o = []) {
1924
- for (const s of e.rules) {
1925
- const l = [...o, "rules", s.id], d = s.target.matrix;
1926
- d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(a, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && $(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, a, [...l, "target", "matrix", "oppositePath"])), nn(s).validationRefs.some((c) => !i.has(c)) && g(a, l, "Conditional rules must reference displayed measures.");
1927
- }
1928
- }
1929
- const wn = {
1930
- layout: n.discriminatedUnion("kind", [
1931
- n.object({ kind: n.literal("compact") }).strict(),
1932
- n.object({ kind: n.literal("tabular"), repeatLabels: n.boolean() }).strict()
1579
+ skipRedundant: a.boolean().optional()
1580
+ }).strict(), Li = {
1581
+ layout: a.discriminatedUnion("kind", [
1582
+ a.object({ kind: a.literal("compact") }).strict(),
1583
+ a.object({ kind: a.literal("tabular"), repeatLabels: a.boolean() }).strict()
1933
1584
  ]),
1934
- absence: n.object({ emptyText: n.string(), nullText: n.string() }).strict(),
1935
- levelLabels: n.record(v, n.string()).readonly(),
1936
- measureLabels: n.record(v, n.string()).readonly(),
1937
- levelFormats: n.record(v, Fe).readonly(),
1938
- measureFormats: n.record(v, Fe).readonly(),
1939
- totals: n.object({ rows: Ce, columns: Ce }).strict(),
1940
- conditionalFormatting: Sn.optional()
1941
- }, Ie = n.object(wn).strict(), An = n.object({
1942
- depth: n.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1943
- overrides: n.array(
1944
- n.object({ path: F, expanded: n.boolean() }).strict()
1585
+ absence: a.object({ emptyText: a.string(), nullText: a.string() }).strict(),
1586
+ levelLabels: a.record(b, a.string()).readonly(),
1587
+ measureLabels: a.record(b, a.string()).readonly(),
1588
+ levelFormats: a.record(b, O).readonly(),
1589
+ measureFormats: a.record(b, O).readonly(),
1590
+ totals: a.object({ rows: Fe, columns: Fe }).strict()
1591
+ }, ge = a.object(Li).strict(), Bi = a.object({
1592
+ depth: a.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1593
+ overrides: a.array(
1594
+ a.object({ path: A, expanded: a.boolean() }).strict()
1945
1595
  ).readonly()
1946
- }).strict(), $e = An.superRefine(
1596
+ }).strict(), De = Bi.superRefine(
1947
1597
  (e, t) => w(
1948
- e.overrides.map((i) => st(i.path)),
1598
+ e.overrides.map((i) => Qe(i.path)),
1949
1599
  t,
1950
1600
  ["overrides"]
1951
1601
  )
1952
- ), xn = { rows: $e, columns: $e }, K = n.object(xn).strict(), Fn = K.extend({ sorts: n.array(It).readonly() }).strict(), Dn = Fn.superRefine(
1953
- (e, t) => w(e.sorts.map(kt), t, ["sorts"])
1602
+ ), Hi = { rows: De, columns: De }, H = a.object(Hi).strict(), Vi = H.extend({ sorts: a.array(lt).readonly() }).strict(), Ui = Vi.superRefine(
1603
+ (e, t) => w(e.sorts.map(ut), t, ["sorts"])
1954
1604
  );
1955
- function X(e, t) {
1956
- var c, p;
1957
- const { spec: i, presentation: a, defaults: o, session: s } = e, l = new Set([...i.rows, ...i.columns].map((u) => u.id)), d = new Set(i.measures.map((u) => u.id));
1605
+ function V(e, t) {
1606
+ var p, m;
1607
+ const { spec: i, presentation: s, defaults: l, session: n } = e, o = new Set([...i.rows, ...i.columns].map((u) => u.id)), d = new Set(i.measures.map((u) => u.id));
1958
1608
  for (const u of [
1959
1609
  "levelLabels",
1960
1610
  "levelFormats",
1961
1611
  "measureLabels",
1962
1612
  "measureFormats"
1963
1613
  ]) {
1964
- const h = u.startsWith("level") ? l : d;
1965
- for (const _ of Object.keys(a[u]))
1966
- h.has(_) || g(
1614
+ const g = u.startsWith("level") ? o : d;
1615
+ for (const y of Object.keys(s[u]))
1616
+ g.has(y) || h(
1967
1617
  t,
1968
- ["presentation", u, _],
1618
+ ["presentation", u, y],
1969
1619
  "Unknown presentation reference."
1970
1620
  );
1971
1621
  }
1972
- for (const [u, h] of Object.entries(a.measureFormats))
1973
- h.type === "temporal_bucket" && g(
1622
+ for (const [u, g] of Object.entries(s.measureFormats))
1623
+ g.type === "temporal_bucket" && h(
1974
1624
  t,
1975
1625
  ["presentation", "measureFormats", u],
1976
1626
  "Measures cannot own temporal bucket formats."
1977
1627
  );
1978
- for (const [u, h] of Object.entries(a.levelFormats))
1979
- h.type === "temporal_bucket" && !((c = [...i.rows, ...i.columns].find((_) => _.id === u)) != null && c.grain) && g(
1628
+ for (const [u, g] of Object.entries(s.levelFormats))
1629
+ g.type === "temporal_bucket" && !((p = [...i.rows, ...i.columns].find((y) => y.id === u)) != null && p.grain) && h(
1980
1630
  t,
1981
1631
  ["presentation", "levelFormats", u],
1982
1632
  "Temporal bucket formats require a grain."
1983
1633
  );
1984
1634
  for (const u of ["rows", "columns"]) {
1985
- (p = a.totals[u].grand.label) != null && p.includes(
1986
- In
1987
- ) && g(
1635
+ (m = s.totals[u].grand.label) != null && m.includes(
1636
+ qi
1637
+ ) && h(
1988
1638
  t,
1989
1639
  ["presentation", "totals", u, "grand", "label"],
1990
1640
  "The grand total has no member, so its label cannot use {member}."
1991
1641
  );
1992
- const h = Object.keys(a.totals[u].levels);
1993
- (h.length !== i[u].length || h.some((_) => !i[u].some((S) => S.id === _))) && g(
1642
+ const g = Object.keys(s.totals[u].levels);
1643
+ (g.length !== i[u].length || g.some((y) => !i[u].some((I) => I.id === y))) && h(
1994
1644
  t,
1995
1645
  ["presentation", "totals", u],
1996
1646
  "Subtotal map must contain exactly the current axis levels."
1997
1647
  );
1998
- for (const _ of [o, ...s ? [s] : []])
1999
- for (const S of _[u].overrides)
2000
- $(
1648
+ for (const y of [l, ...n ? [n] : []])
1649
+ for (const I of y[u].overrides)
1650
+ L(
2001
1651
  i,
2002
1652
  u,
2003
- S.path,
1653
+ I.path,
2004
1654
  t,
2005
1655
  [u, "overrides"],
2006
1656
  !0
2007
- ), S.path.length || g(
1657
+ ), I.path.length || h(
2008
1658
  t,
2009
1659
  [u, "overrides"],
2010
1660
  "Use depth to expand/collapse the root."
2011
1661
  );
2012
1662
  }
2013
- s && wt(i, s.sorts, t, ["session", "sorts"]), a.conditionalFormatting && kn(
2014
- a.conditionalFormatting,
2015
- i,
2016
- d,
2017
- t,
2018
- ["presentation", "conditionalFormatting"]
2019
- );
2020
- }
2021
- const Mn = n.object({
2022
- spec: P,
2023
- presentation: Ie,
2024
- defaults: K,
2025
- session: Dn.optional()
2026
- }).strict(), Xa = Mn.superRefine(X), Rn = n.object({
2027
- version: n.literal(1),
2028
- spec: P,
2029
- presentation: Ie,
2030
- defaultView: K
2031
- }).strict(), Nn = Rn.superRefine(
2032
- (e, t) => X({ ...e, defaults: e.defaultView }, t)
2033
- ), Tn = Nn.innerType().extend({
2034
- spec: _n
2035
- }), Wa = Tn.superRefine((e, t) => X({ ...e, defaults: e.defaultView }, t)), Oe = n.object({ spec: P, presentation: Ie }).strict(), En = n.union([
2036
- Oe.extend({
2037
- mode: n.literal("layout"),
2038
- format: n.enum(["csv", "xlsx", "pdf"]),
2039
- expansion: n.union([
2040
- K.extend({ kind: n.literal("current") }).strict(),
2041
- n.object({ kind: n.literal("all") }).strict()
1663
+ n && ct(i, n.sorts, t, ["session", "sorts"]);
1664
+ }
1665
+ const zi = a.object({
1666
+ spec: j,
1667
+ presentation: ge,
1668
+ defaults: H,
1669
+ session: Ui.optional()
1670
+ }).strict(), dn = zi.superRefine(V), Gi = a.object({
1671
+ version: a.literal(1),
1672
+ spec: j,
1673
+ presentation: ge,
1674
+ defaultView: H
1675
+ }).strict(), Qi = Gi.superRefine(
1676
+ (e, t) => V({ ...e, defaults: e.defaultView }, t)
1677
+ ), Ki = Qi.innerType().extend({
1678
+ spec: Yi
1679
+ }), un = Ki.superRefine((e, t) => V({ ...e, defaults: e.defaultView }, t)), Me = a.object({ spec: j, presentation: ge }).strict(), Xi = a.union([
1680
+ Me.extend({
1681
+ mode: a.literal("layout"),
1682
+ format: a.enum(["csv", "xlsx", "pdf"]),
1683
+ expansion: a.union([
1684
+ H.extend({ kind: a.literal("current") }).strict(),
1685
+ a.object({ kind: a.literal("all") }).strict()
2042
1686
  ])
2043
1687
  }).strict(),
2044
- Oe.extend({ mode: n.literal("flat"), format: n.enum(["csv", "xlsx"]) }).strict()
2045
- ]), Za = En.superRefine(
2046
- (e, t) => X(
1688
+ Me.extend({ mode: a.literal("flat"), format: a.enum(["csv", "xlsx"]) }).strict()
1689
+ ]), cn = Xi.superRefine(
1690
+ (e, t) => V(
2047
1691
  {
2048
1692
  ...e,
2049
1693
  defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
@@ -2054,44 +1698,44 @@ const Mn = n.object({
2054
1698
  t
2055
1699
  )
2056
1700
  );
2057
- function Ja(e) {
1701
+ function pn(e) {
2058
1702
  return e && "id" in e ? e.id : void 0;
2059
1703
  }
2060
- const Cn = "SUM";
2061
- function A(e) {
1704
+ const Zi = "SUM";
1705
+ function k(e) {
2062
1706
  return typeof e == "string" && e.trim().length > 0;
2063
1707
  }
2064
- function E(e) {
2065
- return A(e) ? e.trim().toLowerCase() : "";
1708
+ function T(e) {
1709
+ return k(e) ? e.trim().toLowerCase() : "";
2066
1710
  }
2067
- function es(e) {
2068
- const t = A(e.id) ? e.id.trim() : void 0;
1711
+ function mn(e) {
1712
+ const t = k(e.id) ? e.id.trim() : void 0;
2069
1713
  if (!t) return;
2070
- const i = E(t), a = A(e.table) ? e.table.trim() : void 0;
2071
- if (!(i === E(e.name) || a && i === E(a)))
1714
+ const i = T(t), s = k(e.table) ? e.table.trim() : void 0;
1715
+ if (!(i === T(e.name) || s && i === T(s)))
2072
1716
  return t;
2073
1717
  }
2074
- function M(e) {
2075
- const t = A(e.datasetId) ? e.datasetId.trim() : void 0;
1718
+ function F(e) {
1719
+ const t = k(e.datasetId) ? e.datasetId.trim() : void 0;
2076
1720
  if (t)
2077
- return E(t) === E(e.datasetName) ? void 0 : t;
1721
+ return T(t) === T(e.datasetName) ? void 0 : t;
2078
1722
  }
2079
- function xt(e) {
1723
+ function mt(e) {
2080
1724
  if (e.kind !== "semantic") return e;
2081
- const t = M(e), { datasetId: i, ...a } = e;
1725
+ const t = F(e), { datasetId: i, ...s } = e;
2082
1726
  return {
2083
- ...a,
1727
+ ...s,
2084
1728
  ...t ? { datasetId: t } : {}
2085
1729
  };
2086
1730
  }
2087
- function ts(e) {
2088
- return e ? e.kind === "semantic" ? !!(A(e.domainId) && (A(e.datasetId) || A(e.datasetName))) : e.kind === "physical" ? A(e.connectionId) && A(e.tableName) : A(e.connectionId) : !1;
1731
+ function fn(e) {
1732
+ return e ? e.kind === "semantic" ? !!(k(e.domainId) && (k(e.datasetId) || k(e.datasetName))) : e.kind === "physical" ? k(e.connectionId) && k(e.tableName) : k(e.connectionId) : !1;
2089
1733
  }
2090
- function le(e) {
1734
+ function te(e) {
2091
1735
  if (!e)
2092
1736
  return "";
2093
1737
  if (e.kind === "semantic") {
2094
- const t = M(e);
1738
+ const t = F(e);
2095
1739
  return [
2096
1740
  e.kind,
2097
1741
  e.domainId,
@@ -2111,7 +1755,7 @@ function le(e) {
2111
1755
  e.label || ""
2112
1756
  ].join(":");
2113
1757
  }
2114
- function Se(e, t) {
1758
+ function he(e, t) {
2115
1759
  if (!e || !t)
2116
1760
  return e === t;
2117
1761
  if (e.kind !== t.kind)
@@ -2119,89 +1763,89 @@ function Se(e, t) {
2119
1763
  if (e.kind === "semantic" && t.kind === "semantic") {
2120
1764
  if (e.domainId !== t.domainId)
2121
1765
  return !1;
2122
- const i = M(e), a = M(t);
2123
- return i && a ? i === a : e.datasetName === t.datasetName;
1766
+ const i = F(e), s = F(t);
1767
+ return i && s ? i === s : e.datasetName === t.datasetName;
2124
1768
  }
2125
- return le(e) === le(t);
1769
+ return te(e) === te(t);
2126
1770
  }
2127
- function Ft(e, t) {
2128
- return e.kind !== "semantic" || t.kind !== "semantic" ? e : xt({
1771
+ function ft(e, t) {
1772
+ return e.kind !== "semantic" || t.kind !== "semantic" ? e : mt({
2129
1773
  ...e,
2130
1774
  datasetName: e.datasetName || t.datasetName,
2131
- datasetId: M(e) || M(t),
1775
+ datasetId: F(e) || F(t),
2132
1776
  label: e.label || t.label,
2133
1777
  connectionId: e.connectionId || t.connectionId
2134
1778
  });
2135
1779
  }
2136
- function is(e) {
1780
+ function gn(e) {
2137
1781
  const t = [];
2138
1782
  for (const i of e) {
2139
- const a = xt(
1783
+ const s = mt(
2140
1784
  i
2141
- ), o = t.findIndex(
2142
- (s) => Se(s, a)
1785
+ ), l = t.findIndex(
1786
+ (n) => he(n, s)
2143
1787
  );
2144
- if (o === -1) {
2145
- t.push(a);
1788
+ if (l === -1) {
1789
+ t.push(s);
2146
1790
  continue;
2147
1791
  }
2148
- t[o] = Ft(
2149
- t[o],
2150
- a
1792
+ t[l] = ft(
1793
+ t[l],
1794
+ s
2151
1795
  );
2152
1796
  }
2153
1797
  return t;
2154
1798
  }
2155
- function jn(e, t) {
2156
- return e.name === t.name && Se(e.source, t.source);
1799
+ function Ji(e, t) {
1800
+ return e.name === t.name && he(e.source, t.source);
2157
1801
  }
2158
- function ns(e) {
1802
+ function hn(e) {
2159
1803
  return [
2160
- e.source ? le(e.source) : "unknown",
2161
- Dt(e),
1804
+ e.source ? te(e.source) : "unknown",
1805
+ gt(e),
2162
1806
  e.name
2163
1807
  ].filter(Boolean).join(":");
2164
1808
  }
2165
- function Dt(e) {
2166
- return $n(
2167
- e.aggregate || Cn
1809
+ function gt(e) {
1810
+ return Wi(
1811
+ e.aggregate || Zi
2168
1812
  );
2169
1813
  }
2170
- function $n(e) {
1814
+ function Wi(e) {
2171
1815
  return e.trim().toUpperCase();
2172
1816
  }
2173
- function as(e, t) {
1817
+ function _n(e, t) {
2174
1818
  return {
2175
1819
  ...e,
2176
1820
  label: e.label || t.label,
2177
1821
  role: e.role || t.role,
2178
1822
  dataType: e.dataType || t.dataType,
2179
- source: e.source && t.source ? Ft(e.source, t.source) : e.source || t.source
1823
+ source: e.source && t.source ? ft(e.source, t.source) : e.source || t.source
2180
1824
  };
2181
1825
  }
2182
- function On(e) {
1826
+ function ea(e) {
2183
1827
  for (let t = 0; t < e.length; t += 1) {
2184
1828
  const i = e[t];
2185
1829
  if (e.some(
2186
- (a, o) => o !== t && Rt(a, i)
1830
+ (s, l) => l !== t && _t(s, i)
2187
1831
  ))
2188
1832
  return !1;
2189
1833
  }
2190
1834
  return !0;
2191
1835
  }
2192
- function Mt(e, t) {
2193
- return jn(e, t);
1836
+ function ht(e, t) {
1837
+ return Ji(e, t);
2194
1838
  }
2195
- function Rt(e, t) {
2196
- return Mt(e, t) && O(e) === O(t);
1839
+ function _t(e, t) {
1840
+ return ht(e, t) && $(e) === $(t);
2197
1841
  }
2198
- function Pn(e) {
2199
- return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${O(e)}). Use different aggregates to request both, or remove one entry.`;
1842
+ function ta(e) {
1843
+ return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${$(e)}). Use different aggregates to request both, or remove one entry.`;
2200
1844
  }
2201
- function Pe(e) {
1845
+ function Ee(e) {
2202
1846
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
2203
1847
  }
2204
- function Yn(e, t, i) {
1848
+ function ia(e, t, i) {
2205
1849
  if (e !== void 0) {
2206
1850
  if (!e || typeof e != "object" || Array.isArray(e)) {
2207
1851
  i.push(
@@ -2213,89 +1857,89 @@ function Yn(e, t, i) {
2213
1857
  );
2214
1858
  return;
2215
1859
  }
2216
- Object.entries(e).forEach(([a, o]) => {
2217
- if (!a.trim()) {
1860
+ Object.entries(e).forEach(([s, l]) => {
1861
+ if (!s.trim()) {
2218
1862
  i.push(
2219
1863
  r(
2220
1864
  "invalid_sql_default_parameter_name",
2221
1865
  "SQL defaultParameters names must be non-empty strings.",
2222
- `${t}.${a}`
1866
+ `${t}.${s}`
2223
1867
  )
2224
1868
  );
2225
1869
  return;
2226
1870
  }
2227
- (Array.isArray(o) ? o.every(Pe) : Pe(o)) || i.push(
1871
+ (Array.isArray(l) ? l.every(Ee) : Ee(l)) || i.push(
2228
1872
  r(
2229
1873
  "invalid_sql_default_parameter_value",
2230
1874
  "SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
2231
- `${t}.${a}`
1875
+ `${t}.${s}`
2232
1876
  )
2233
1877
  );
2234
1878
  });
2235
1879
  }
2236
1880
  }
2237
- function qn(e, t) {
2238
- return ke(e, t).length === 1;
1881
+ function aa(e, t) {
1882
+ return _e(e, t).length === 1;
2239
1883
  }
2240
- function Ln(e, t) {
2241
- return ke(e, t).length === 1;
1884
+ function na(e, t) {
1885
+ return _e(e, t).length === 1;
2242
1886
  }
2243
- function ke(e, t) {
1887
+ function _e(e, t) {
2244
1888
  return t.filter(
2245
- (a) => Bn(e, a)
1889
+ (s) => sa(e, s)
2246
1890
  );
2247
1891
  }
2248
- function Bn(e, t) {
2249
- return Vn(e, t) ? e.source ? Mt(t, e) : !0 : !1;
1892
+ function sa(e, t) {
1893
+ return ra(e, t) ? e.source ? ht(t, e) : !0 : !1;
2250
1894
  }
2251
- function Vn(e, t) {
2252
- return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || Un(e, t) && O(t) !== O(e));
1895
+ function ra(e, t) {
1896
+ return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || oa(e, t) && $(t) !== $(e));
2253
1897
  }
2254
- function Un(e, t) {
1898
+ function oa(e, t) {
2255
1899
  return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
2256
1900
  }
2257
- function O(e) {
2258
- return Dt(e);
1901
+ function $(e) {
1902
+ return gt(e);
2259
1903
  }
2260
- const Hn = /^(\d{4})-(\d{2})-(\d{2})$/, Nt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
2261
- function de(e) {
1904
+ const la = /^(\d{4})-(\d{2})-(\d{2})$/, yt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
1905
+ function ie(e) {
2262
1906
  if (typeof e != "string")
2263
1907
  return null;
2264
- const t = e.trim(), i = Hn.exec(t);
1908
+ const t = e.trim(), i = la.exec(t);
2265
1909
  if (i) {
2266
- const [, _, S, b] = i;
2267
- return Ye(_, S, b) ? new Date(Date.UTC(Number(_), Number(S) - 1, Number(b))) : null;
1910
+ const [, y, I, S] = i;
1911
+ return Te(y, I, S) ? new Date(Date.UTC(Number(y), Number(I) - 1, Number(S))) : null;
2268
1912
  }
2269
- const a = Nt.exec(t);
2270
- if (!a)
1913
+ const s = yt.exec(t);
1914
+ if (!s)
2271
1915
  return null;
2272
- const [, o, s, l, d, c, p = "00", , u] = a;
2273
- if (!Ye(o, s, l) || !C(d, 0, 23) || !C(c, 0, 59) || !C(p, 0, 59) || !zn(u))
1916
+ const [, l, n, o, d, p, m = "00", , u] = s;
1917
+ if (!Te(l, n, o) || !N(d, 0, 23) || !N(p, 0, 59) || !N(m, 0, 59) || !da(u))
2274
1918
  return null;
2275
- const h = new Date(t);
2276
- return Number.isFinite(h.getTime()) ? h : null;
1919
+ const g = new Date(t);
1920
+ return Number.isFinite(g.getTime()) ? g : null;
2277
1921
  }
2278
- function ss(e) {
2279
- return typeof e != "string" || !Nt.test(e.trim()) ? null : de(e);
1922
+ function yn(e) {
1923
+ return typeof e != "string" || !yt.test(e.trim()) ? null : ie(e);
2280
1924
  }
2281
- function Ye(e, t, i) {
2282
- const a = Number(e), o = Number(t), s = Number(i);
2283
- if (!Number.isInteger(a) || !Number.isInteger(o) || !Number.isInteger(s) || o < 1 || o > 12)
1925
+ function Te(e, t, i) {
1926
+ const s = Number(e), l = Number(t), n = Number(i);
1927
+ if (!Number.isInteger(s) || !Number.isInteger(l) || !Number.isInteger(n) || l < 1 || l > 12)
2284
1928
  return !1;
2285
- const l = new Date(Date.UTC(a, o - 1, s));
2286
- return l.getUTCFullYear() === a && l.getUTCMonth() === o - 1 && l.getUTCDate() === s;
1929
+ const o = new Date(Date.UTC(s, l - 1, n));
1930
+ return o.getUTCFullYear() === s && o.getUTCMonth() === l - 1 && o.getUTCDate() === n;
2287
1931
  }
2288
- function C(e, t, i) {
2289
- const a = Number(e);
2290
- return Number.isInteger(a) && a >= t && a <= i;
1932
+ function N(e, t, i) {
1933
+ const s = Number(e);
1934
+ return Number.isInteger(s) && s >= t && s <= i;
2291
1935
  }
2292
- function zn(e) {
1936
+ function da(e) {
2293
1937
  if (e === "Z")
2294
1938
  return !0;
2295
1939
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
2296
- return !!(t && C(t[2], 0, 23) && C(t[3], 0, 59));
1940
+ return !!(t && N(t[2], 0, 23) && N(t[3], 0, 59));
2297
1941
  }
2298
- function qe(e, t, i) {
1942
+ function Ne(e, t, i) {
2299
1943
  if (e !== void 0) {
2300
1944
  if (!f(e)) {
2301
1945
  i.push(
@@ -2322,7 +1966,7 @@ function qe(e, t, i) {
2322
1966
  );
2323
1967
  }
2324
1968
  }
2325
- function Le(e) {
1969
+ function Re(e) {
2326
1970
  const t = /* @__PURE__ */ new Set();
2327
1971
  for (const i of e) {
2328
1972
  if (t.has(i))
@@ -2331,7 +1975,7 @@ function Le(e) {
2331
1975
  }
2332
1976
  return null;
2333
1977
  }
2334
- function Gn(e, t, i) {
1978
+ function ua(e, t, i) {
2335
1979
  if (!f(e)) {
2336
1980
  i.push(
2337
1981
  r(
@@ -2342,7 +1986,7 @@ function Gn(e, t, i) {
2342
1986
  );
2343
1987
  return;
2344
1988
  }
2345
- m(e.inputId) || i.push(
1989
+ c(e.inputId) || i.push(
2346
1990
  r(
2347
1991
  "invalid_input_binding",
2348
1992
  "Input bindings need a non-empty inputId.",
@@ -2354,13 +1998,13 @@ function Gn(e, t, i) {
2354
1998
  "Input binding kind must be filter or control.",
2355
1999
  `${t}.kind`
2356
2000
  )
2357
- ), e.field !== void 0 && y(e.field, `${t}.field`, i), e.relationshipHint !== void 0 && we(
2001
+ ), e.field !== void 0 && _(e.field, `${t}.field`, i), e.relationshipHint !== void 0 && ye(
2358
2002
  e.relationshipHint,
2359
2003
  `${t}.relationshipHint`,
2360
2004
  i
2361
2005
  );
2362
2006
  }
2363
- function we(e, t, i) {
2007
+ function ye(e, t, i) {
2364
2008
  if (!f(e)) {
2365
2009
  i.push(
2366
2010
  r(
@@ -2371,7 +2015,7 @@ function we(e, t, i) {
2371
2015
  );
2372
2016
  return;
2373
2017
  }
2374
- e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((a) => !m(a))) && i.push(
2018
+ e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((s) => !c(s))) && i.push(
2375
2019
  r(
2376
2020
  "invalid_relationship_hint",
2377
2021
  "Relationship hint relationshipIds must be non-empty strings.",
@@ -2379,15 +2023,15 @@ function we(e, t, i) {
2379
2023
  )
2380
2024
  );
2381
2025
  }
2382
- function Qn(e, t) {
2383
- var a, o;
2384
- if (((a = e.source) == null ? void 0 : a.kind) !== "semantic" && ((o = e.source) == null ? void 0 : o.kind) !== "physical" && t.push(
2026
+ function ca(e, t) {
2027
+ var s, l;
2028
+ if (((s = e.source) == null ? void 0 : s.kind) !== "semantic" && ((l = e.source) == null ? void 0 : l.kind) !== "physical" && t.push(
2385
2029
  r(
2386
2030
  "invalid_input_options_source",
2387
2031
  "Input options must use a semantic or physical source.",
2388
2032
  "source"
2389
2033
  )
2390
- ), m(e.inputId) || t.push(
2034
+ ), c(e.inputId) || t.push(
2391
2035
  r(
2392
2036
  "missing_input_options_input_id",
2393
2037
  "Input options intent needs the inputId it populates.",
@@ -2400,9 +2044,9 @@ function Qn(e, t) {
2400
2044
  "search"
2401
2045
  )
2402
2046
  ), e.matchValues !== void 0) {
2403
- const s = Lt(e.matchValues);
2404
- s.ok || t.push(
2405
- r("invalid_input_options_match_values", s.error, "matchValues")
2047
+ const n = Et(e.matchValues);
2048
+ n.ok || t.push(
2049
+ r("invalid_input_options_match_values", n.error, "matchValues")
2406
2050
  ), typeof e.search == "string" && e.search.trim() && t.push(
2407
2051
  r(
2408
2052
  "invalid_input_options_match_values",
@@ -2417,26 +2061,26 @@ function Qn(e, t) {
2417
2061
  "Input options limit must be a positive finite number.",
2418
2062
  "limit"
2419
2063
  )
2420
- ), (!e.labelField || !m(e.labelField.name)) && t.push(
2064
+ ), (!e.labelField || !c(e.labelField.name)) && t.push(
2421
2065
  r(
2422
2066
  "missing_input_options_label_field",
2423
2067
  "Input options intent needs a labelField.",
2424
2068
  "labelField"
2425
2069
  )
2426
- ), y(e.labelField, "labelField", t, {
2070
+ ), _(e.labelField, "labelField", t, {
2427
2071
  required: !0
2428
- }), (!e.valueField || !m(e.valueField.name)) && t.push(
2072
+ }), (!e.valueField || !c(e.valueField.name)) && t.push(
2429
2073
  r(
2430
2074
  "missing_input_options_value_field",
2431
2075
  "Input options intent needs a valueField.",
2432
2076
  "valueField"
2433
2077
  )
2434
- ), y(e.valueField, "valueField", t, {
2078
+ ), _(e.valueField, "valueField", t, {
2435
2079
  required: !0
2436
- }), e.searchField !== void 0 && y(e.searchField, "searchField", t, {
2080
+ }), e.searchField !== void 0 && _(e.searchField, "searchField", t, {
2437
2081
  required: !0
2438
- }), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((s, l) => {
2439
- y(s, `disambiguationFields.${l}`, t, {
2082
+ }), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((n, o) => {
2083
+ _(n, `disambiguationFields.${o}`, t, {
2440
2084
  required: !0
2441
2085
  });
2442
2086
  }) : t.push(
@@ -2449,27 +2093,27 @@ function Qn(e, t) {
2449
2093
  { field: e.labelField, path: "labelField" },
2450
2094
  { field: e.valueField, path: "valueField" },
2451
2095
  ...e.searchField ? [{ field: e.searchField, path: "searchField" }] : [],
2452
- ...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((s, l) => ({
2453
- field: s,
2454
- path: `disambiguationFields.${l}`
2096
+ ...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((n, o) => ({
2097
+ field: n,
2098
+ path: `disambiguationFields.${o}`
2455
2099
  })) : []
2456
- ].forEach(({ field: s, path: l }) => {
2457
- s != null && s.source && !Se(s.source, e.source) && t.push(
2100
+ ].forEach(({ field: n, path: o }) => {
2101
+ n != null && n.source && !he(n.source, e.source) && t.push(
2458
2102
  r(
2459
2103
  "input_options_field_source_mismatch",
2460
2104
  "Input option fields must belong to the declared option source.",
2461
- `${l}.source`
2105
+ `${o}.source`
2462
2106
  )
2463
2107
  );
2464
2108
  }), e.dependencies !== void 0) {
2465
- const s = Xn(
2109
+ const n = ma(
2466
2110
  e.dependencies
2467
2111
  );
2468
- t.push(...s.errors), s.ok && Zn(e, t);
2112
+ t.push(...n.errors), n.ok && ga(e, t);
2469
2113
  }
2470
2114
  if (e.population !== void 0) {
2471
- const s = e.population;
2472
- if (!f(s))
2115
+ const n = e.population;
2116
+ if (!f(n))
2473
2117
  t.push(
2474
2118
  r(
2475
2119
  "invalid_input_options_population",
@@ -2478,38 +2122,38 @@ function Qn(e, t) {
2478
2122
  )
2479
2123
  );
2480
2124
  else {
2481
- const l = s.kind;
2482
- l !== "option_source" && l !== "related_population" && t.push(
2125
+ const o = n.kind;
2126
+ o !== "option_source" && o !== "related_population" && t.push(
2483
2127
  r(
2484
2128
  "invalid_input_options_population",
2485
2129
  "Input options population kind must be option_source or related_population.",
2486
2130
  "population.kind"
2487
2131
  )
2488
- ), l === "option_source" && s.baseSource !== void 0 && t.push(
2132
+ ), o === "option_source" && n.baseSource !== void 0 && t.push(
2489
2133
  r(
2490
2134
  "invalid_input_options_population",
2491
2135
  "Input options population baseSource is only valid for related_population.",
2492
2136
  "population.baseSource"
2493
2137
  )
2494
- ), l === "option_source" && s.relationshipHint !== void 0 && t.push(
2138
+ ), o === "option_source" && n.relationshipHint !== void 0 && t.push(
2495
2139
  r(
2496
2140
  "invalid_input_options_population",
2497
2141
  "Input options population relationshipHint is only valid for related_population.",
2498
2142
  "population.relationshipHint"
2499
2143
  )
2500
- ), l === "related_population" && (pe(
2501
- s.baseSource,
2144
+ ), o === "related_population" && (se(
2145
+ n.baseSource,
2502
2146
  "population.baseSource",
2503
2147
  t
2504
- ), s.relationshipHint !== void 0 && we(
2505
- s.relationshipHint,
2148
+ ), n.relationshipHint !== void 0 && ye(
2149
+ n.relationshipHint,
2506
2150
  "population.relationshipHint",
2507
2151
  t
2508
2152
  ));
2509
2153
  }
2510
2154
  }
2511
2155
  }
2512
- function Kn(e, t) {
2156
+ function pa(e, t) {
2513
2157
  if (!(!("inputs" in e) || e.inputs === void 0)) {
2514
2158
  if (!Array.isArray(e.inputs)) {
2515
2159
  t.push(
@@ -2522,11 +2166,11 @@ function Kn(e, t) {
2522
2166
  return;
2523
2167
  }
2524
2168
  e.inputs.forEach(
2525
- (i, a) => Gn(i, `inputs.${a}`, t)
2169
+ (i, s) => ua(i, `inputs.${s}`, t)
2526
2170
  );
2527
2171
  }
2528
2172
  }
2529
- function Xn(e, t = "protocol") {
2173
+ function ma(e, t = "protocol") {
2530
2174
  const i = [];
2531
2175
  if (!f(e))
2532
2176
  return i.push(
@@ -2536,39 +2180,39 @@ function Xn(e, t = "protocol") {
2536
2180
  "dependencies"
2537
2181
  )
2538
2182
  ), { ok: !1, errors: i, warnings: [] };
2539
- const a = e, o = a.mode;
2540
- if (o !== void 0 && o !== "independent" && o !== "explicit" && o !== "all_applicable" && i.push(
2183
+ const s = e, l = s.mode;
2184
+ if (l !== void 0 && l !== "independent" && l !== "explicit" && l !== "all_applicable" && i.push(
2541
2185
  r(
2542
2186
  "invalid_input_options_dependencies",
2543
2187
  "Input options dependencies mode must be independent, explicit, or all_applicable.",
2544
2188
  "dependencies.mode"
2545
2189
  )
2546
- ), te(
2547
- a.includeInputIds,
2190
+ ), K(
2191
+ s.includeInputIds,
2548
2192
  "dependencies.includeInputIds",
2549
2193
  i,
2550
2194
  "Input options includeInputIds must be non-empty strings."
2551
- ), te(
2552
- a.excludeInputIds,
2195
+ ), K(
2196
+ s.excludeInputIds,
2553
2197
  "dependencies.excludeInputIds",
2554
2198
  i,
2555
2199
  "Input options excludeInputIds must be non-empty strings."
2556
- ), o === "all_applicable" && a.includeInputIds !== void 0 && i.push(
2200
+ ), l === "all_applicable" && s.includeInputIds !== void 0 && i.push(
2557
2201
  r(
2558
2202
  "invalid_input_options_dependencies",
2559
2203
  "All applicable dependencies cannot specify includeInputIds.",
2560
2204
  "dependencies.includeInputIds"
2561
2205
  )
2562
- ), te(
2563
- a.omitInputIds,
2206
+ ), K(
2207
+ s.omitInputIds,
2564
2208
  "dependencies.omitInputIds",
2565
2209
  i,
2566
2210
  "Input options omitInputIds must be non-empty strings."
2567
- ), Array.isArray(a.omitInputIds)) {
2568
- const s = new Set(
2569
- Array.isArray(a.includeInputIds) ? a.includeInputIds : []
2211
+ ), Array.isArray(s.omitInputIds)) {
2212
+ const n = new Set(
2213
+ Array.isArray(s.includeInputIds) ? s.includeInputIds : []
2570
2214
  );
2571
- (o !== "explicit" || new Set(a.omitInputIds).size !== a.omitInputIds.length || a.omitInputIds.some((l) => !s.has(l))) && i.push(
2215
+ (l !== "explicit" || new Set(s.omitInputIds).size !== s.omitInputIds.length || s.omitInputIds.some((o) => !n.has(o))) && i.push(
2572
2216
  r(
2573
2217
  "invalid_input_options_dependencies",
2574
2218
  "A browse override may only omit unique ids from an explicit includeInputIds list.",
@@ -2576,10 +2220,10 @@ function Xn(e, t = "protocol") {
2576
2220
  )
2577
2221
  );
2578
2222
  }
2579
- return t === "dashboard" && Wn(a, i), { ok: i.length === 0, errors: i, warnings: [] };
2223
+ return t === "dashboard" && fa(s, i), { ok: i.length === 0, errors: i, warnings: [] };
2580
2224
  }
2581
- function Wn(e, t) {
2582
- const { mode: i, includeInputIds: a, excludeInputIds: o } = e;
2225
+ function fa(e, t) {
2226
+ const { mode: i, includeInputIds: s, excludeInputIds: l } = e;
2583
2227
  i === void 0 && t.push(
2584
2228
  r(
2585
2229
  "invalid_input_options_dependencies",
@@ -2587,24 +2231,24 @@ function Wn(e, t) {
2587
2231
  "dependencies.mode"
2588
2232
  )
2589
2233
  );
2590
- for (const [s, l] of [
2591
- ["dependencies.includeInputIds", a],
2592
- ["dependencies.excludeInputIds", o]
2234
+ for (const [n, o] of [
2235
+ ["dependencies.includeInputIds", s],
2236
+ ["dependencies.excludeInputIds", l]
2593
2237
  ])
2594
- Array.isArray(l) && new Set(l).size !== l.length && t.push(
2238
+ Array.isArray(o) && new Set(o).size !== o.length && t.push(
2595
2239
  r(
2596
2240
  "invalid_input_options_dependencies",
2597
2241
  "Dashboard option dependency input IDs must be unique.",
2598
- s
2242
+ n
2599
2243
  )
2600
2244
  );
2601
- i === "independent" && (a !== void 0 || o !== void 0) && t.push(
2245
+ i === "independent" && (s !== void 0 || l !== void 0) && t.push(
2602
2246
  r(
2603
2247
  "invalid_input_options_dependencies",
2604
2248
  "Independent dashboard dependencies cannot specify input IDs.",
2605
2249
  "dependencies"
2606
2250
  )
2607
- ), i === "explicit" && (!Array.isArray(a) || a.length === 0 || o !== void 0) && t.push(
2251
+ ), i === "explicit" && (!Array.isArray(s) || s.length === 0 || l !== void 0) && t.push(
2608
2252
  r(
2609
2253
  "invalid_input_options_dependencies",
2610
2254
  "Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
@@ -2612,20 +2256,20 @@ function Wn(e, t) {
2612
2256
  )
2613
2257
  );
2614
2258
  }
2615
- function Zn(e, t) {
2616
- var o, s, l;
2259
+ function ga(e, t) {
2260
+ var l, n, o;
2617
2261
  const i = new Set(
2618
2262
  Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
2619
- ), a = new Set(((o = e.dependencies) == null ? void 0 : o.omitInputIds) || []);
2620
- for (const d of ((s = e.dependencies) == null ? void 0 : s.includeInputIds) || [])
2621
- !i.has(d) && !a.has(d) && t.push(
2263
+ ), s = new Set(((l = e.dependencies) == null ? void 0 : l.omitInputIds) || []);
2264
+ for (const d of ((n = e.dependencies) == null ? void 0 : n.includeInputIds) || [])
2265
+ !i.has(d) && !s.has(d) && t.push(
2622
2266
  r(
2623
2267
  "invalid_input_options_dependencies",
2624
2268
  `Input options dependency "${d}" is not declared in inputs.`,
2625
2269
  "dependencies.includeInputIds"
2626
2270
  )
2627
2271
  );
2628
- for (const d of ((l = e.dependencies) == null ? void 0 : l.excludeInputIds) || [])
2272
+ for (const d of ((o = e.dependencies) == null ? void 0 : o.excludeInputIds) || [])
2629
2273
  d !== e.inputId && !i.has(d) && t.push(
2630
2274
  r(
2631
2275
  "invalid_input_options_dependencies",
@@ -2634,11 +2278,11 @@ function Zn(e, t) {
2634
2278
  )
2635
2279
  );
2636
2280
  }
2637
- function te(e, t, i, a) {
2638
- e !== void 0 && (!Array.isArray(e) || e.some((o) => !m(o))) && i.push(r("invalid_input_options_dependencies", a, t));
2281
+ function K(e, t, i, s) {
2282
+ e !== void 0 && (!Array.isArray(e) || e.some((l) => !c(l))) && i.push(r("invalid_input_options_dependencies", s, t));
2639
2283
  }
2640
- const Jn = new Set(ze);
2641
- function ea(e, t, i) {
2284
+ const ha = new Set(Ye);
2285
+ function _a(e, t, i) {
2642
2286
  if (f(e) && e.type === "temporal_bucket") {
2643
2287
  i.push(
2644
2288
  r(
@@ -2649,9 +2293,9 @@ function ea(e, t, i) {
2649
2293
  );
2650
2294
  return;
2651
2295
  }
2652
- Qe(e, t, i);
2296
+ Pe(e, t, i);
2653
2297
  }
2654
- function Be(e, t, i) {
2298
+ function Ce(e, t, i) {
2655
2299
  if (!f(e)) {
2656
2300
  i.push(
2657
2301
  r(
@@ -2662,8 +2306,8 @@ function Be(e, t, i) {
2662
2306
  );
2663
2307
  return;
2664
2308
  }
2665
- const a = m(e.columnKey), o = f(e.field);
2666
- if (a === o) {
2309
+ const s = c(e.columnKey), l = f(e.field);
2310
+ if (s === l) {
2667
2311
  i.push(
2668
2312
  r(
2669
2313
  "invalid_result_column_ref",
@@ -2673,11 +2317,11 @@ function Be(e, t, i) {
2673
2317
  );
2674
2318
  return;
2675
2319
  }
2676
- o && y(e.field, `${t}.field`, i, {
2320
+ l && _(e.field, `${t}.field`, i, {
2677
2321
  required: !0
2678
2322
  });
2679
2323
  }
2680
- function ta(e, t, i) {
2324
+ function ya(e, t, i) {
2681
2325
  if (!f(e)) {
2682
2326
  i.push(
2683
2327
  r(
@@ -2688,21 +2332,21 @@ function ta(e, t, i) {
2688
2332
  );
2689
2333
  return;
2690
2334
  }
2691
- m(e.key) || i.push(
2335
+ c(e.key) || i.push(
2692
2336
  r(
2693
2337
  "invalid_result_calculation_output",
2694
2338
  "Result calculation output needs a stable key.",
2695
2339
  `${t}.key`
2696
2340
  )
2697
- ), e.dataType !== void 0 && (typeof e.dataType != "string" || !Ge.has(e.dataType)) && i.push(
2341
+ ), e.dataType !== void 0 && (typeof e.dataType != "string" || !Oe.has(e.dataType)) && i.push(
2698
2342
  r(
2699
2343
  "invalid_result_calculation_output",
2700
2344
  "Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
2701
2345
  `${t}.dataType`
2702
2346
  )
2703
- ), ea(e.format, `${t}.format`, i);
2347
+ ), _a(e.format, `${t}.format`, i);
2704
2348
  }
2705
- function ia(e, t) {
2349
+ function ba(e, t) {
2706
2350
  if (e.analysis === void 0)
2707
2351
  return;
2708
2352
  if (!f(e.analysis)) {
@@ -2745,17 +2389,17 @@ function ia(e, t) {
2745
2389
  )
2746
2390
  );
2747
2391
  const { timeWindow: i } = e.analysis;
2748
- i !== void 0 && ue(i, "analysis.timeWindow", t);
2749
- }
2750
- const na = new Set(
2751
- Bt
2752
- ), aa = new Set(
2753
- Vt
2754
- ), sa = new Set(
2755
- Ut
2392
+ i !== void 0 && ae(i, "analysis.timeWindow", t);
2393
+ }
2394
+ const va = new Set(
2395
+ Tt
2396
+ ), Ia = new Set(
2397
+ Nt
2398
+ ), Sa = new Set(
2399
+ Rt
2756
2400
  );
2757
- function oa(e, t, i) {
2758
- na.has(e.unit) || i.push(
2401
+ function ka(e, t, i) {
2402
+ va.has(e.unit) || i.push(
2759
2403
  r(
2760
2404
  "invalid_time_window",
2761
2405
  "Calendar time window unit must be one of: day, week, month, quarter, year.",
@@ -2781,7 +2425,7 @@ function oa(e, t, i) {
2781
2425
  )
2782
2426
  );
2783
2427
  }
2784
- function ue(e, t, i) {
2428
+ function ae(e, t, i) {
2785
2429
  if (!f(e)) {
2786
2430
  i.push(
2787
2431
  r(
@@ -2799,37 +2443,37 @@ function ue(e, t, i) {
2799
2443
  `${t}.kind`
2800
2444
  )
2801
2445
  ), e.kind === "calendar") {
2802
- oa(e, t, i);
2446
+ ka(e, t, i);
2803
2447
  return;
2804
2448
  }
2805
2449
  if (e.kind === "absolute") {
2806
- if (m(e.start) || i.push(
2450
+ if (c(e.start) || i.push(
2807
2451
  r(
2808
2452
  "invalid_time_window",
2809
2453
  "Absolute time window start must be a non-empty ISO date or timestamp string.",
2810
2454
  `${t}.start`
2811
2455
  )
2812
- ), m(e.end) || i.push(
2456
+ ), c(e.end) || i.push(
2813
2457
  r(
2814
2458
  "invalid_time_window",
2815
2459
  "Absolute time window end must be a non-empty ISO date or timestamp string.",
2816
2460
  `${t}.end`
2817
2461
  )
2818
- ), m(e.start) && m(e.end)) {
2819
- const a = de(e.start), o = de(e.end);
2820
- a || i.push(
2462
+ ), c(e.start) && c(e.end)) {
2463
+ const s = ie(e.start), l = ie(e.end);
2464
+ s || i.push(
2821
2465
  r(
2822
2466
  "invalid_time_window",
2823
2467
  "Absolute time window start must be a valid ISO date or timestamp.",
2824
2468
  `${t}.start`
2825
2469
  )
2826
- ), o || i.push(
2470
+ ), l || i.push(
2827
2471
  r(
2828
2472
  "invalid_time_window",
2829
2473
  "Absolute time window end must be a valid ISO date or timestamp.",
2830
2474
  `${t}.end`
2831
2475
  )
2832
- ), a && o && a.getTime() > o.getTime() && i.push(
2476
+ ), s && l && s.getTime() > l.getTime() && i.push(
2833
2477
  r(
2834
2478
  "invalid_time_window",
2835
2479
  "Absolute time window start must be before or equal to end.",
@@ -2839,10 +2483,10 @@ function ue(e, t, i) {
2839
2483
  }
2840
2484
  return;
2841
2485
  }
2842
- (typeof e.unit != "string" || !Jn.has(e.unit)) && i.push(
2486
+ (typeof e.unit != "string" || !ha.has(e.unit)) && i.push(
2843
2487
  r(
2844
2488
  "invalid_time_window",
2845
- `Time window unit must be one of: ${ze.join(", ")}.`,
2489
+ `Time window unit must be one of: ${Ye.join(", ")}.`,
2846
2490
  `${t}.unit`
2847
2491
  )
2848
2492
  ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && i.push(
@@ -2851,13 +2495,13 @@ function ue(e, t, i) {
2851
2495
  "Time window value must be a positive number.",
2852
2496
  `${t}.value`
2853
2497
  )
2854
- ), e.anchor !== void 0 && !aa.has(e.anchor) && i.push(
2498
+ ), e.anchor !== void 0 && !Ia.has(e.anchor) && i.push(
2855
2499
  r(
2856
2500
  "invalid_time_window",
2857
2501
  "Time window anchor must be now or latest_available.",
2858
2502
  `${t}.anchor`
2859
2503
  )
2860
- ), e.completeness !== void 0 && !sa.has(e.completeness) && i.push(
2504
+ ), e.completeness !== void 0 && !Sa.has(e.completeness) && i.push(
2861
2505
  r(
2862
2506
  "invalid_time_window",
2863
2507
  "Time window completeness must be include_partial or complete_periods.",
@@ -2865,7 +2509,7 @@ function ue(e, t, i) {
2865
2509
  )
2866
2510
  );
2867
2511
  }
2868
- function ce(e, t, i) {
2512
+ function ne(e, t, i) {
2869
2513
  if (e !== void 0) {
2870
2514
  if (!Array.isArray(e)) {
2871
2515
  i.push(
@@ -2877,92 +2521,92 @@ function ce(e, t, i) {
2877
2521
  );
2878
2522
  return;
2879
2523
  }
2880
- e.forEach((a, o) => {
2881
- var c;
2882
- const s = `${t}.${o}`;
2883
- if (!f(a)) {
2524
+ e.forEach((s, l) => {
2525
+ var p;
2526
+ const n = `${t}.${l}`;
2527
+ if (!f(s)) {
2884
2528
  i.push(
2885
2529
  r(
2886
2530
  "invalid_analytics_filter",
2887
2531
  "Analytics filter must be a structured object.",
2888
- s
2532
+ n
2889
2533
  )
2890
2534
  );
2891
2535
  return;
2892
2536
  }
2893
- const l = a;
2894
- y(l.field, `${s}.field`, i, {
2537
+ const o = s;
2538
+ _(o.field, `${n}.field`, i, {
2895
2539
  required: !0
2896
- }), l.scope !== void 0 && l.scope !== "row" && l.scope !== "aggregate" && i.push(
2540
+ }), o.scope !== void 0 && o.scope !== "row" && o.scope !== "aggregate" && i.push(
2897
2541
  r(
2898
2542
  "invalid_analytics_filter_scope",
2899
2543
  "Analytics filter scope must be row or aggregate.",
2900
- `${s}.scope`
2544
+ `${n}.scope`
2901
2545
  )
2902
- ), l.scope === "aggregate" && ((c = l.field) == null ? void 0 : c.role) !== void 0 && l.field.role !== "measure" && i.push(
2546
+ ), o.scope === "aggregate" && ((p = o.field) == null ? void 0 : p.role) !== void 0 && o.field.role !== "measure" && i.push(
2903
2547
  r(
2904
2548
  "invalid_analytics_filter_scope",
2905
2549
  "Aggregate-scope analytics filters must target a measure field.",
2906
- `${s}.scope`
2550
+ `${n}.scope`
2907
2551
  )
2908
2552
  );
2909
- const d = l.operator === "is_null" || l.operator === "is_not_null";
2910
- if (l.operator !== void 0 && l.operator !== "=" && l.operator !== "!=" && l.operator !== "in" && l.operator !== "not_in" && l.operator !== "contains" && l.operator !== "not_contains" && l.operator !== "between" && l.operator !== "not_between" && l.operator !== ">" && l.operator !== ">=" && l.operator !== "<" && l.operator !== "<=" && l.operator !== "is_null" && l.operator !== "is_not_null" && i.push(
2553
+ const d = o.operator === "is_null" || o.operator === "is_not_null";
2554
+ if (o.operator !== void 0 && o.operator !== "=" && o.operator !== "!=" && o.operator !== "in" && o.operator !== "not_in" && o.operator !== "contains" && o.operator !== "not_contains" && o.operator !== "between" && o.operator !== "not_between" && o.operator !== ">" && o.operator !== ">=" && o.operator !== "<" && o.operator !== "<=" && o.operator !== "is_null" && o.operator !== "is_not_null" && i.push(
2911
2555
  r(
2912
2556
  "invalid_analytics_filter_operator",
2913
2557
  "Analytics filter operator is not supported.",
2914
- `${s}.operator`
2558
+ `${n}.operator`
2915
2559
  )
2916
- ), l.values === void 0 && !d && i.push(
2560
+ ), o.values === void 0 && !d && i.push(
2917
2561
  r(
2918
2562
  "missing_analytics_filter_value",
2919
2563
  "Analytics filter needs values unless it is a null check.",
2920
- s
2564
+ n
2921
2565
  )
2922
- ), d && l.values !== void 0) {
2566
+ ), d && o.values !== void 0) {
2923
2567
  i.push(
2924
2568
  r(
2925
2569
  "invalid_analytics_filter_values",
2926
2570
  "Null-check analytics filters must not include values.",
2927
- `${s}.values`
2571
+ `${n}.values`
2928
2572
  )
2929
2573
  );
2930
2574
  return;
2931
2575
  }
2932
- if (l.values !== void 0 && !Array.isArray(l.values)) {
2576
+ if (o.values !== void 0 && !Array.isArray(o.values)) {
2933
2577
  i.push(
2934
2578
  r(
2935
2579
  "invalid_analytics_filter_values",
2936
2580
  "Analytics filter values must be an array when provided.",
2937
- `${s}.values`
2581
+ `${n}.values`
2938
2582
  )
2939
2583
  );
2940
2584
  return;
2941
2585
  }
2942
- if (l.values !== void 0) {
2943
- const p = l.values.length;
2944
- if (l.operator === "between" || l.operator === "not_between") {
2945
- p !== 2 && i.push(
2586
+ if (o.values !== void 0) {
2587
+ const m = o.values.length;
2588
+ if (o.operator === "between" || o.operator === "not_between") {
2589
+ m !== 2 && i.push(
2946
2590
  r(
2947
2591
  "invalid_analytics_filter_values",
2948
2592
  "Between analytics filters must include exactly two values.",
2949
- `${s}.values`
2593
+ `${n}.values`
2950
2594
  )
2951
2595
  );
2952
2596
  return;
2953
2597
  }
2954
- (l.operator === "contains" || l.operator === "not_contains" || l.operator === "=" || l.operator === "!=" || l.operator === ">" || l.operator === ">=" || l.operator === "<" || l.operator === "<=" || l.operator === void 0) && p !== 1 && i.push(
2598
+ (o.operator === "contains" || o.operator === "not_contains" || o.operator === "=" || o.operator === "!=" || o.operator === ">" || o.operator === ">=" || o.operator === "<" || o.operator === "<=" || o.operator === void 0) && m !== 1 && i.push(
2955
2599
  r(
2956
2600
  "invalid_analytics_filter_values",
2957
2601
  "Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
2958
- `${s}.values`
2602
+ `${n}.values`
2959
2603
  )
2960
2604
  );
2961
2605
  }
2962
2606
  });
2963
2607
  }
2964
2608
  }
2965
- function os(e) {
2609
+ function bn(e) {
2966
2610
  const t = [];
2967
2611
  if (!f(e))
2968
2612
  return t.push(
@@ -2971,13 +2615,13 @@ function os(e) {
2971
2615
  "Result calculation must be a structured object."
2972
2616
  )
2973
2617
  ), { ok: !1, errors: t, warnings: [] };
2974
- if (m(e.id) || t.push(
2618
+ if (c(e.id) || t.push(
2975
2619
  r(
2976
2620
  "invalid_result_calculation_id",
2977
2621
  "Result calculation needs an id.",
2978
2622
  "id"
2979
2623
  )
2980
- ), m(e.label) || t.push(
2624
+ ), c(e.label) || t.push(
2981
2625
  r(
2982
2626
  "invalid_result_calculation_label",
2983
2627
  "Result calculation needs a label.",
@@ -2989,11 +2633,11 @@ function os(e) {
2989
2633
  "Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
2990
2634
  "kind"
2991
2635
  )
2992
- ), Be(e.input, "input", t), ta(e.output, "output", t), e.kind === "percent_of_total") {
2636
+ ), Ce(e.input, "input", t), ya(e.output, "output", t), e.kind === "percent_of_total") {
2993
2637
  const i = e.denominator;
2994
- i !== void 0 && (f(i) ? i.scope === "population" ? (y(i.metric, "denominator.metric", t, {
2638
+ i !== void 0 && (f(i) ? i.scope === "population" ? (_(i.metric, "denominator.metric", t, {
2995
2639
  required: !0
2996
- }), ce(
2640
+ }), ne(
2997
2641
  i.filters,
2998
2642
  "denominator.filters",
2999
2643
  t
@@ -3017,10 +2661,10 @@ function os(e) {
3017
2661
  "Rank result calculation order must be asc or desc.",
3018
2662
  "order"
3019
2663
  )
3020
- ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && Be(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
2664
+ ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && Ce(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
3021
2665
  }
3022
- function Tt(e) {
3023
- var a;
2666
+ function bt(e) {
2667
+ var s;
3024
2668
  const t = [], i = [];
3025
2669
  if (!e || typeof e != "object")
3026
2670
  return {
@@ -3040,8 +2684,8 @@ function Tt(e) {
3040
2684
  ]
3041
2685
  };
3042
2686
  if (e.kind === "matrix") {
3043
- const o = vn.safeParse(e);
3044
- return o.success || t.push(...o.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: i, repairHints: Ve(t) };
2687
+ const l = Pi.safeParse(e);
2688
+ return l.success || t.push(...l.error.issues.map((n) => r("invalid_matrix_intent", n.message, n.path.join(".")))), { ok: t.length === 0, errors: t, warnings: i, repairHints: $e(t) };
3045
2689
  }
3046
2690
  if (e.version !== void 0 && e.version !== 1 && t.push(
3047
2691
  r(
@@ -3049,13 +2693,13 @@ function Tt(e) {
3049
2693
  "Analytics intent version must be 1.",
3050
2694
  "version"
3051
2695
  )
3052
- ), pe(e.source, "source", t), ra(e, t), Kn(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && we(
2696
+ ), se(e.source, "source", t), wa(e, t), pa(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && ye(
3053
2697
  e.relationshipHint,
3054
2698
  "relationshipHint",
3055
2699
  t
3056
2700
  ), e.kind === "metric") {
3057
- const o = Array.isArray(e.measures) ? e.measures.filter(
3058
- (s) => f(s) && m(s.name)
2701
+ const l = Array.isArray(e.measures) ? e.measures.filter(
2702
+ (n) => f(n) && c(n.name)
3059
2703
  ) : [];
3060
2704
  if (!Array.isArray(e.measures) || e.measures.length === 0 ? t.push(
3061
2705
  r(
@@ -3064,45 +2708,45 @@ function Tt(e) {
3064
2708
  "measures"
3065
2709
  )
3066
2710
  ) : e.measures.some(
3067
- (s) => !f(s) || !m(s.name)
2711
+ (n) => !f(n) || !c(n.name)
3068
2712
  ) && t.push(
3069
2713
  r(
3070
2714
  "invalid_measure_list",
3071
2715
  "Metric intent measures must be an array of field references with names.",
3072
2716
  "measures"
3073
2717
  )
3074
- ), o.forEach((s, l) => {
3075
- y(s, `measures.${l}`, t, {
2718
+ ), l.forEach((n, o) => {
2719
+ _(n, `measures.${o}`, t, {
3076
2720
  required: !0
3077
2721
  });
3078
- }), o.length > 0 && !On(o)) {
3079
- const s = o.find(
3080
- (l, d) => o.some(
3081
- (c, p) => p !== d && Rt(c, l)
2722
+ }), l.length > 0 && !ea(l)) {
2723
+ const n = l.find(
2724
+ (o, d) => l.some(
2725
+ (p, m) => m !== d && _t(p, o)
3082
2726
  )
3083
2727
  );
3084
- s && t.push(
2728
+ n && t.push(
3085
2729
  r(
3086
2730
  "duplicate_measure",
3087
- Pn(s),
2731
+ ta(n),
3088
2732
  "measures"
3089
2733
  )
3090
2734
  );
3091
2735
  }
3092
- if (f(e.primaryMeasure) && m(e.primaryMeasure.name) && ke(
2736
+ if (f(e.primaryMeasure) && c(e.primaryMeasure.name) && _e(
3093
2737
  e.primaryMeasure,
3094
- o
2738
+ l
3095
2739
  ).length > 1 && t.push(
3096
2740
  r(
3097
2741
  "ambiguous_primary_measure",
3098
2742
  "Metric intent primaryMeasure must identify exactly one selected measure.",
3099
2743
  "primaryMeasure"
3100
2744
  )
3101
- ), e.primaryMeasure !== void 0 && (y(e.primaryMeasure, "primaryMeasure", t, {
2745
+ ), e.primaryMeasure !== void 0 && (_(e.primaryMeasure, "primaryMeasure", t, {
3102
2746
  required: !0
3103
- }), f(e.primaryMeasure) && m(e.primaryMeasure.name) && o.length > 0 && !qn(
2747
+ }), f(e.primaryMeasure) && c(e.primaryMeasure.name) && l.length > 0 && !aa(
3104
2748
  e.primaryMeasure,
3105
- o
2749
+ l
3106
2750
  ) && t.push(
3107
2751
  r(
3108
2752
  "invalid_primary_measure",
@@ -3116,21 +2760,21 @@ function Tt(e) {
3116
2760
  "dimensions"
3117
2761
  )
3118
2762
  ) : Array.isArray(e.dimensions) && e.dimensions.some(
3119
- (s) => !f(s) || !m(s.name)
2763
+ (n) => !f(n) || !c(n.name)
3120
2764
  ) && t.push(
3121
2765
  r(
3122
2766
  "invalid_measure_dimensions",
3123
2767
  "Metric intent dimensions must be an array of field references with names.",
3124
2768
  "dimensions"
3125
2769
  )
3126
- ), e.dateField !== void 0 && y(e.dateField, "dateField", t), e.timeWindow !== void 0 && (ue(e.timeWindow, "timeWindow", t), e.dateField || t.push(
2770
+ ), e.dateField !== void 0 && _(e.dateField, "dateField", t), e.timeWindow !== void 0 && (ae(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3127
2771
  r(
3128
2772
  "missing_time_window_date_field",
3129
2773
  "Metric timeWindow needs a dateField.",
3130
2774
  "dateField"
3131
2775
  )
3132
- )), ce(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
3133
- y(s, `dimensions.${l}`, t);
2776
+ )), ne(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((n, o) => {
2777
+ _(n, `dimensions.${o}`, t);
3134
2778
  }), e.orderBy !== void 0) {
3135
2779
  if (!f(e.orderBy))
3136
2780
  t.push(
@@ -3140,7 +2784,7 @@ function Tt(e) {
3140
2784
  "orderBy"
3141
2785
  )
3142
2786
  );
3143
- else if (y(e.orderBy.field, "orderBy.field", t, {
2787
+ else if (_(e.orderBy.field, "orderBy.field", t, {
3144
2788
  required: !0
3145
2789
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
3146
2790
  r(
@@ -3148,17 +2792,17 @@ function Tt(e) {
3148
2792
  "Metric intent orderBy direction must be asc or desc.",
3149
2793
  "orderBy.direction"
3150
2794
  )
3151
- ), f(e.orderBy.field) && m(e.orderBy.field.name)) {
3152
- const s = [
3153
- ...o,
2795
+ ), f(e.orderBy.field) && c(e.orderBy.field.name)) {
2796
+ const n = [
2797
+ ...l,
3154
2798
  ...e.timeGrain && e.dateField && f(e.dateField) ? [e.dateField] : [],
3155
2799
  ...Array.isArray(e.dimensions) ? e.dimensions.filter(
3156
- (l) => f(l) && m(l.name)
2800
+ (o) => f(o) && c(o.name)
3157
2801
  ) : []
3158
2802
  ];
3159
- s.length > 0 && !Ln(
2803
+ n.length > 0 && !na(
3160
2804
  e.orderBy.field,
3161
- s
2805
+ n
3162
2806
  ) && t.push(
3163
2807
  r(
3164
2808
  "invalid_measure_order_by",
@@ -3168,7 +2812,7 @@ function Tt(e) {
3168
2812
  );
3169
2813
  }
3170
2814
  }
3171
- ia(e, t);
2815
+ ba(e, t);
3172
2816
  } else if (e.kind === "records") {
3173
2817
  if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
3174
2818
  r(
@@ -3177,30 +2821,30 @@ function Tt(e) {
3177
2821
  "fields"
3178
2822
  )
3179
2823
  ) : e.fields.some(
3180
- (o) => !f(o) || !m(o.name)
2824
+ (l) => !f(l) || !c(l.name)
3181
2825
  ) && t.push(
3182
2826
  r(
3183
2827
  "invalid_record_fields",
3184
2828
  "Records intent fields must be field references with names.",
3185
2829
  "fields"
3186
2830
  )
3187
- ), Array.isArray(e.fields) && e.fields.forEach((o, s) => {
3188
- y(o, `fields.${s}`, t);
3189
- }), e.dateField !== void 0 && y(e.dateField, "dateField", t), qe(e.pagination, "pagination", t), e.timeWindow !== void 0 && (ue(e.timeWindow, "timeWindow", t), e.dateField || t.push(
2831
+ ), Array.isArray(e.fields) && e.fields.forEach((l, n) => {
2832
+ _(l, `fields.${n}`, t);
2833
+ }), e.dateField !== void 0 && _(e.dateField, "dateField", t), Ne(e.pagination, "pagination", t), e.timeWindow !== void 0 && (ae(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3190
2834
  r(
3191
2835
  "missing_time_window_date_field",
3192
2836
  "Records timeWindow needs a dateField.",
3193
2837
  "dateField"
3194
2838
  )
3195
- )), ce(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((o, s) => {
3196
- f(o) && o.scope === "aggregate" && t.push(
2839
+ )), ne(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((l, n) => {
2840
+ f(l) && l.scope === "aggregate" && t.push(
3197
2841
  r(
3198
2842
  "unsupported_record_filter_scope",
3199
2843
  "Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
3200
- `filters.${s}.scope`
2844
+ `filters.${n}.scope`
3201
2845
  )
3202
2846
  );
3203
- }), e.orderBy !== void 0 && (f(e.orderBy) ? (y(e.orderBy.field, "orderBy.field", t, {
2847
+ }), e.orderBy !== void 0 && (f(e.orderBy) ? (_(e.orderBy.field, "orderBy.field", t, {
3204
2848
  required: !0
3205
2849
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
3206
2850
  r(
@@ -3231,40 +2875,40 @@ function Tt(e) {
3231
2875
  "totals.mode"
3232
2876
  )
3233
2877
  );
3234
- const o = e.totals.measures;
3235
- !Array.isArray(o) || o.length === 0 ? t.push(
2878
+ const l = e.totals.measures;
2879
+ !Array.isArray(l) || l.length === 0 ? t.push(
3236
2880
  r(
3237
2881
  "missing_records_totals_measures",
3238
2882
  "Records server totals need at least one measure.",
3239
2883
  "totals.measures"
3240
2884
  )
3241
- ) : o.forEach((s, l) => {
3242
- y(s, `totals.measures.${l}`, t, {
2885
+ ) : l.forEach((n, o) => {
2886
+ _(n, `totals.measures.${o}`, t, {
3243
2887
  required: !0
3244
- }), (!f(s) || s.role !== "measure") && t.push(
2888
+ }), (!f(n) || n.role !== "measure") && t.push(
3245
2889
  r(
3246
2890
  "invalid_records_totals_measure",
3247
2891
  "Records server totals measures must be measure field references.",
3248
- `totals.measures.${l}.role`
2892
+ `totals.measures.${o}.role`
3249
2893
  )
3250
2894
  );
3251
2895
  });
3252
2896
  }
3253
- } else e.kind === "inputOptions" ? Qn(e, t) : e.kind === "sql" ? (((a = e.source) == null ? void 0 : a.kind) !== "sql" && t.push(
2897
+ } else e.kind === "inputOptions" ? ca(e, t) : e.kind === "sql" ? (((s = e.source) == null ? void 0 : s.kind) !== "sql" && t.push(
3254
2898
  r(
3255
2899
  "invalid_sql_source",
3256
2900
  "SQL analytics intent must use a SQL execution source.",
3257
2901
  "source"
3258
2902
  )
3259
- ), m(e.sql) || t.push(
2903
+ ), c(e.sql) || t.push(
3260
2904
  r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
3261
- ), Yn(
2905
+ ), ia(
3262
2906
  e.defaultParameters,
3263
2907
  "defaultParameters",
3264
2908
  t
3265
- ), Array.isArray(e.fields) && e.fields.forEach((o, s) => {
3266
- y(o, `fields.${s}`, t);
3267
- }), qe(e.pagination, "pagination", t)) : t.push(
2909
+ ), Array.isArray(e.fields) && e.fields.forEach((l, n) => {
2910
+ _(l, `fields.${n}`, t);
2911
+ }), Ne(e.pagination, "pagination", t)) : t.push(
3268
2912
  r(
3269
2913
  "invalid_analytics_kind",
3270
2914
  "Analytics kind is not supported.",
@@ -3275,10 +2919,10 @@ function Tt(e) {
3275
2919
  ok: t.length === 0,
3276
2920
  errors: t,
3277
2921
  warnings: i,
3278
- repairHints: Ve(t)
2922
+ repairHints: $e(t)
3279
2923
  };
3280
2924
  }
3281
- function ra(e, t) {
2925
+ function wa(e, t) {
3282
2926
  if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
3283
2927
  if (!Array.isArray(e.derivedFields)) {
3284
2928
  t.push(
@@ -3290,19 +2934,19 @@ function ra(e, t) {
3290
2934
  );
3291
2935
  return;
3292
2936
  }
3293
- e.derivedFields.forEach((i, a) => {
3294
- fe(
2937
+ e.derivedFields.forEach((i, s) => {
2938
+ oe(
3295
2939
  i
3296
- ).errors.forEach((s) => {
2940
+ ).errors.forEach((n) => {
3297
2941
  t.push({
3298
- ...s,
3299
- path: s.path ? `derivedFields.${a}.${s.path}` : `derivedFields.${a}`
2942
+ ...n,
2943
+ path: n.path ? `derivedFields.${s}.${n.path}` : `derivedFields.${s}`
3300
2944
  });
3301
2945
  });
3302
2946
  });
3303
2947
  }
3304
2948
  }
3305
- function la(e) {
2949
+ function Aa(e) {
3306
2950
  const t = [], i = [];
3307
2951
  if (!e || typeof e != "object")
3308
2952
  return {
@@ -3334,33 +2978,33 @@ function la(e) {
3334
2978
  "Answer-obligations operation intent needs at least one obligation.",
3335
2979
  "obligations"
3336
2980
  )
3337
- ) : e.obligations.forEach((a, o) => {
3338
- m(a.id) || t.push(
2981
+ ) : e.obligations.forEach((s, l) => {
2982
+ c(s.id) || t.push(
3339
2983
  r(
3340
2984
  "missing_obligation_id",
3341
2985
  "Each analytics obligation needs an id.",
3342
- `obligations.${o}.id`
2986
+ `obligations.${l}.id`
3343
2987
  )
3344
- ), m(a.prompt) || t.push(
2988
+ ), c(s.prompt) || t.push(
3345
2989
  r(
3346
2990
  "missing_obligation_prompt",
3347
2991
  "Each analytics obligation needs a prompt.",
3348
- `obligations.${o}.prompt`
2992
+ `obligations.${l}.prompt`
3349
2993
  )
3350
2994
  );
3351
2995
  });
3352
2996
  else if (e.kind === "dashboard_change") {
3353
- if (m(e.instruction) || t.push(
2997
+ if (c(e.instruction) || t.push(
3354
2998
  r(
3355
2999
  "missing_instruction",
3356
3000
  "Change operation intent needs an instruction.",
3357
3001
  "instruction"
3358
3002
  )
3359
3003
  ), e.analyticsIntent) {
3360
- const a = Tt(
3004
+ const s = bt(
3361
3005
  e.analyticsIntent
3362
3006
  );
3363
- t.push(...a.errors), i.push(...a.warnings);
3007
+ t.push(...s.errors), i.push(...s.warnings);
3364
3008
  }
3365
3009
  } else
3366
3010
  t.push(
@@ -3374,10 +3018,10 @@ function la(e) {
3374
3018
  ok: t.length === 0,
3375
3019
  errors: t,
3376
3020
  warnings: i,
3377
- repairHints: Et(t)
3021
+ repairHints: vt(t)
3378
3022
  };
3379
3023
  }
3380
- function rs(e) {
3024
+ function vn(e) {
3381
3025
  const t = [], i = [];
3382
3026
  if (!e || typeof e != "object")
3383
3027
  return {
@@ -3405,10 +3049,10 @@ function rs(e) {
3405
3049
  "kind"
3406
3050
  )
3407
3051
  );
3408
- const a = la(
3052
+ const s = Aa(
3409
3053
  e.operationIntent
3410
3054
  );
3411
- return t.push(...a.errors), i.push(...a.warnings), Array.isArray(e.plannedToolCalls) || t.push(
3055
+ return t.push(...s.errors), i.push(...s.warnings), Array.isArray(e.plannedToolCalls) || t.push(
3412
3056
  r(
3413
3057
  "invalid_planned_tool_calls",
3414
3058
  "Recovery plan plannedToolCalls must be an array.",
@@ -3418,16 +3062,16 @@ function rs(e) {
3418
3062
  ok: t.length === 0,
3419
3063
  errors: t,
3420
3064
  warnings: i,
3421
- repairHints: Et(t)
3065
+ repairHints: vt(t)
3422
3066
  };
3423
3067
  }
3424
- function Et(e) {
3068
+ function vt(e) {
3425
3069
  return e.map((t) => ({
3426
3070
  code: t.code,
3427
3071
  recommendedNextStep: t.code === "missing_obligations" ? "Normalize the user request into one or more typed analytics obligations before recovery planning." : "Correct the operation/recovery contract shape before planning execution."
3428
3072
  }));
3429
3073
  }
3430
- function Ve(e) {
3074
+ function $e(e) {
3431
3075
  return e.map((t) => {
3432
3076
  switch (t.code) {
3433
3077
  case "invalid_matrix_intent":
@@ -3515,14 +3159,14 @@ function Ve(e) {
3515
3159
  }
3516
3160
  }).filter((t) => !!t);
3517
3161
  }
3518
- function da(e, t, i, a) {
3162
+ function xa(e, t, i, s) {
3519
3163
  if (!e || typeof e != "object") {
3520
3164
  i.push(
3521
3165
  r("invalid_view", "Dashboard view must be an object.", t)
3522
3166
  );
3523
3167
  return;
3524
3168
  }
3525
- if (m(e.title) || i.push(
3169
+ if (c(e.title) || i.push(
3526
3170
  r("missing_view_title", "Dashboard view needs a title.", t)
3527
3171
  ), !e.presentation || typeof e.presentation != "object") {
3528
3172
  i.push(
@@ -3535,7 +3179,7 @@ function da(e, t, i, a) {
3535
3179
  return;
3536
3180
  }
3537
3181
  if (e.presentation.kind === "text") {
3538
- m(e.text) || a.push(
3182
+ c(e.text) || s.push(
3539
3183
  r(
3540
3184
  "missing_text_content",
3541
3185
  "Text views should include text content.",
@@ -3561,25 +3205,25 @@ function da(e, t, i, a) {
3561
3205
  `${t}.analytics.kind`
3562
3206
  )
3563
3207
  );
3564
- const o = Tt(e.analytics);
3565
- for (const s of o.errors)
3208
+ const l = bt(e.analytics);
3209
+ for (const n of l.errors)
3566
3210
  i.push(
3567
3211
  r(
3568
- s.code,
3569
- s.message,
3570
- `${t}.analytics${s.path ? `.${s.path}` : ""}`
3212
+ n.code,
3213
+ n.message,
3214
+ `${t}.analytics${n.path ? `.${n.path}` : ""}`
3571
3215
  )
3572
3216
  );
3573
- for (const s of o.warnings)
3574
- a.push(
3217
+ for (const n of l.warnings)
3218
+ s.push(
3575
3219
  r(
3576
- s.code,
3577
- s.message,
3578
- `${t}.analytics${s.path ? `.${s.path}` : ""}`
3220
+ n.code,
3221
+ n.message,
3222
+ `${t}.analytics${n.path ? `.${n.path}` : ""}`
3579
3223
  )
3580
3224
  );
3581
3225
  }
3582
- function ls(e) {
3226
+ function In(e) {
3583
3227
  const t = [], i = [];
3584
3228
  if (!e || typeof e != "object")
3585
3229
  return {
@@ -3596,46 +3240,46 @@ function ls(e) {
3596
3240
  r("invalid_version", "Dashboard intent version must be 1.")
3597
3241
  ), e.kind !== "dashboard" && t.push(
3598
3242
  r("invalid_kind", "Experience intent kind must be dashboard.")
3599
- ), m(e.title) || t.push(
3243
+ ), c(e.title) || t.push(
3600
3244
  r("missing_title", "Dashboard intent needs a title.", "title")
3601
3245
  );
3602
- const a = Array.isArray(e.inputs) ? e.inputs : [], o = Le(
3603
- a.filter(f).map((c) => c.id).filter((c) => typeof c == "string")
3246
+ const s = Array.isArray(e.inputs) ? e.inputs : [], l = Re(
3247
+ s.filter(f).map((p) => p.id).filter((p) => typeof p == "string")
3604
3248
  );
3605
- o && t.push(
3249
+ l && t.push(
3606
3250
  r(
3607
3251
  "duplicate_input_id",
3608
- `Duplicate input id: ${o}.`,
3252
+ `Duplicate input id: ${l}.`,
3609
3253
  "inputs"
3610
3254
  )
3611
3255
  );
3612
- for (const [c, p] of a.entries()) {
3613
- const u = `inputs.${c}`;
3614
- if (!f(p)) {
3256
+ for (const [p, m] of s.entries()) {
3257
+ const u = `inputs.${p}`;
3258
+ if (!f(m)) {
3615
3259
  t.push(
3616
3260
  r("invalid_input", "Dashboard input must be an object.", u)
3617
3261
  );
3618
3262
  continue;
3619
3263
  }
3620
- m(p.id) || t.push(
3264
+ c(m.id) || t.push(
3621
3265
  r("missing_input_id", "Input needs an id.", `${u}.id`)
3622
- ), m(p.label) || t.push(
3266
+ ), c(m.label) || t.push(
3623
3267
  r("missing_input_label", "Input needs a label.", `${u}.label`)
3624
- ), !p.field || !m(p.field.name) ? t.push(
3268
+ ), !m.field || !c(m.field.name) ? t.push(
3625
3269
  r("missing_input_field", "Input needs a field.", `${u}.field`)
3626
- ) : y(p.field, `${u}.field`, t);
3270
+ ) : _(m.field, `${u}.field`, t);
3627
3271
  }
3628
- const s = Array.isArray(e.sections) ? e.sections : [];
3629
- s.length === 0 && t.push(
3272
+ const n = Array.isArray(e.sections) ? e.sections : [];
3273
+ n.length === 0 && t.push(
3630
3274
  r(
3631
3275
  "missing_sections",
3632
3276
  "Dashboard intent needs at least one section.",
3633
3277
  "sections"
3634
3278
  )
3635
3279
  );
3636
- const l = s.flatMap(
3637
- (c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(f).map((p) => p.id).filter((p) => !!p) : []
3638
- ), d = Le(l);
3280
+ const o = n.flatMap(
3281
+ (p) => p && typeof p == "object" && Array.isArray(p.views) ? p.views.filter(f).map((m) => m.id).filter((m) => !!m) : []
3282
+ ), d = Re(o);
3639
3283
  d && t.push(
3640
3284
  r(
3641
3285
  "duplicate_view_id",
@@ -3643,9 +3287,9 @@ function ls(e) {
3643
3287
  "sections"
3644
3288
  )
3645
3289
  );
3646
- for (const [c, p] of s.entries()) {
3647
- const u = `sections.${c}`;
3648
- if (!p || typeof p != "object") {
3290
+ for (const [p, m] of n.entries()) {
3291
+ const u = `sections.${p}`;
3292
+ if (!m || typeof m != "object") {
3649
3293
  t.push(
3650
3294
  r(
3651
3295
  "invalid_section",
@@ -3655,13 +3299,13 @@ function ls(e) {
3655
3299
  );
3656
3300
  continue;
3657
3301
  }
3658
- if (m(p.title) || t.push(
3302
+ if (c(m.title) || t.push(
3659
3303
  r(
3660
3304
  "missing_section_title",
3661
3305
  "Dashboard section needs a title.",
3662
3306
  u
3663
3307
  )
3664
- ), !Array.isArray(p.views) || p.views.length === 0) {
3308
+ ), !Array.isArray(m.views) || m.views.length === 0) {
3665
3309
  t.push(
3666
3310
  r(
3667
3311
  "missing_section_views",
@@ -3671,10 +3315,10 @@ function ls(e) {
3671
3315
  );
3672
3316
  continue;
3673
3317
  }
3674
- for (const [h, _] of p.views.entries())
3675
- da(
3676
- _,
3677
- `${u}.views.${h}`,
3318
+ for (const [g, y] of m.views.entries())
3319
+ xa(
3320
+ y,
3321
+ `${u}.views.${g}`,
3678
3322
  t,
3679
3323
  i
3680
3324
  );
@@ -3682,145 +3326,128 @@ function ls(e) {
3682
3326
  return { ok: t.length === 0, errors: t, warnings: i };
3683
3327
  }
3684
3328
  export {
3685
- Ie as $,
3686
- Ei as A,
3687
- Da as B,
3688
- ne as C,
3689
- Mi as D,
3690
- es as E,
3691
- Ra as F,
3692
- ts as G,
3693
- le as H,
3694
- ht as I,
3695
- Ai as J,
3696
- G as K,
3697
- Fi as L,
3698
- dn as M,
3699
- yt as N,
3700
- re as O,
3701
- vt as P,
3702
- xi as Q,
3703
- F as R,
3704
- va as S,
3705
- mn as T,
3706
- It as U,
3707
- gn as V,
3708
- hn as W,
3709
- kt as X,
3710
- P as Y,
3711
- Ee as Z,
3712
- In as _,
3713
- Dt as a,
3714
- Fe as a$,
3715
- $e as a0,
3716
- K as a1,
3717
- Dn as a2,
3718
- Xa as a3,
3719
- Za as a4,
3720
- ge as a5,
3721
- qt as a6,
3722
- Lt as a7,
3723
- de as a8,
3724
- Xn as a9,
3725
- M as aA,
3726
- xt as aB,
3727
- Se as aC,
3728
- Ft as aD,
3729
- ns as aE,
3730
- Yi as aF,
3731
- Li as aG,
3732
- Bt as aH,
3733
- pa as aI,
3734
- Vt as aJ,
3735
- Ut as aK,
3736
- ma as aL,
3737
- Ht as aM,
3738
- N as aN,
3739
- zt as aO,
3740
- fa as aP,
3741
- Qt as aQ,
3742
- ga as aR,
3743
- Kt as aS,
3744
- at as aT,
3745
- B as aU,
3746
- wi as aV,
3747
- U as aW,
3748
- ya as aX,
3749
- x as aY,
3750
- Ii as aZ,
3751
- $ as a_,
3752
- os as aa,
3753
- Tt as ab,
3754
- la as ac,
3755
- rs as ad,
3756
- ls as ae,
3757
- fe as af,
3758
- be as ag,
3759
- mi as ah,
3760
- fi as ai,
3761
- _e as aj,
3762
- yi as ak,
3763
- vi as al,
3764
- Je as am,
3765
- et as an,
3766
- Me as ao,
3767
- it as ap,
3768
- ha as aq,
3769
- ba as ar,
3770
- rt as as,
3771
- ve as at,
3772
- Na as au,
3773
- Ta as av,
3774
- ja as aw,
3775
- $a as ax,
3776
- Oa as ay,
3777
- Ja as az,
3778
- Sa as b,
3779
- _a as b0,
3780
- nt as b1,
3781
- _n as b2,
3782
- nn as b3,
3783
- he as b4,
3784
- Wt as b5,
3785
- Te as b6,
3786
- Sn as b7,
3787
- Ba as b8,
3788
- Wi as b9,
3789
- Ka as ba,
3790
- Qa as bb,
3791
- Va as bc,
3792
- Ua as bd,
3793
- tn as be,
3794
- an as bf,
3795
- za as bg,
3796
- Ha as bh,
3797
- Ga as bi,
3798
- qa as bj,
3799
- oe as bk,
3800
- La as bl,
3801
- kn as bm,
3802
- Ri as c,
3803
- ot as d,
3804
- wa as e,
3805
- Aa as f,
3806
- Di as g,
3807
- xa as h,
3808
- Ia as i,
3809
- Fa as j,
3810
- ae as k,
3811
- Wa as l,
3812
- vn as m,
3813
- ka as n,
3814
- Nn as o,
3815
- as as p,
3816
- is as q,
3817
- ss as r,
3818
- jn as s,
3819
- st as t,
3820
- Pa as u,
3821
- Ya as v,
3822
- Ea as w,
3823
- Ca as x,
3824
- Ma as y,
3825
- Ni as z
3329
+ ge as $,
3330
+ mi as A,
3331
+ Xa as B,
3332
+ Z as C,
3333
+ di as D,
3334
+ mn as E,
3335
+ Ja as F,
3336
+ fn as G,
3337
+ te as H,
3338
+ st as I,
3339
+ La as J,
3340
+ me as K,
3341
+ oi as L,
3342
+ Di as M,
3343
+ rt as N,
3344
+ ee as O,
3345
+ ot as P,
3346
+ ri as Q,
3347
+ A as R,
3348
+ Ba as S,
3349
+ Ni as T,
3350
+ lt as U,
3351
+ Ci as V,
3352
+ $i as W,
3353
+ ut as X,
3354
+ j as Y,
3355
+ xe as Z,
3356
+ qi as _,
3357
+ gt as a,
3358
+ Ya as a$,
3359
+ De as a0,
3360
+ H as a1,
3361
+ Ui as a2,
3362
+ dn as a3,
3363
+ cn as a4,
3364
+ le as a5,
3365
+ Mt as a6,
3366
+ Et as a7,
3367
+ ie as a8,
3368
+ ma as a9,
3369
+ F as aA,
3370
+ mt as aB,
3371
+ he as aC,
3372
+ ft as aD,
3373
+ hn as aE,
3374
+ bi as aF,
3375
+ Ii as aG,
3376
+ Tt as aH,
3377
+ Ma as aI,
3378
+ Nt as aJ,
3379
+ Rt as aK,
3380
+ Ea as aL,
3381
+ Ct as aM,
3382
+ M as aN,
3383
+ $t as aO,
3384
+ Ta as aP,
3385
+ Yt as aQ,
3386
+ Na as aR,
3387
+ Ot as aS,
3388
+ Ge as aT,
3389
+ ni as aU,
3390
+ si as aV,
3391
+ Pa as aW,
3392
+ qa as aX,
3393
+ R as aY,
3394
+ $a as aZ,
3395
+ L as a_,
3396
+ bn as aa,
3397
+ bt as ab,
3398
+ Aa as ac,
3399
+ vn as ad,
3400
+ In as ae,
3401
+ oe as af,
3402
+ ue as ag,
3403
+ Kt as ah,
3404
+ Xt as ai,
3405
+ ce as aj,
3406
+ ti as ak,
3407
+ ii as al,
3408
+ He as am,
3409
+ Ve as an,
3410
+ Se as ao,
3411
+ ze as ap,
3412
+ Ra as aq,
3413
+ Ca as ar,
3414
+ Xe as as,
3415
+ fe as at,
3416
+ Wa as au,
3417
+ en as av,
3418
+ nn as aw,
3419
+ sn as ax,
3420
+ rn as ay,
3421
+ pn as az,
3422
+ Va as b,
3423
+ ja as b0,
3424
+ Oa as b1,
3425
+ Yi as b2,
3426
+ de as b3,
3427
+ qt as b4,
3428
+ Ae as b5,
3429
+ ui as c,
3430
+ Ke as d,
3431
+ za as e,
3432
+ Ga as f,
3433
+ li as g,
3434
+ Qa as h,
3435
+ Ha as i,
3436
+ Ka as j,
3437
+ J as k,
3438
+ un as l,
3439
+ Pi as m,
3440
+ Ua as n,
3441
+ Qi as o,
3442
+ _n as p,
3443
+ gn as q,
3444
+ yn as r,
3445
+ Ji as s,
3446
+ Qe as t,
3447
+ on as u,
3448
+ ln as v,
3449
+ tn as w,
3450
+ an as x,
3451
+ Za as y,
3452
+ ci as z
3826
3453
  };