react-semaphor 0.1.537 → 0.1.538

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 (173) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-FpONU8QV.js} +683 -686
  26. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  27. package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
  28. package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-CHHoWhil.js} +65586 -62749
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
  101. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  102. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  103. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  104. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  105. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  106. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  107. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  108. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  109. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  110. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  111. package/dist/types/lib/types/token-types.d.ts +11 -0
  112. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  113. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  114. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  115. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  116. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  117. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  118. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  119. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  120. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  121. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  122. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  123. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  124. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  125. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  126. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  127. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  128. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  129. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  130. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  131. package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
  132. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  133. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  134. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  135. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  136. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  137. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  138. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  140. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  141. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  142. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  143. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  144. package/dist/types/shared/format-utils/index.d.ts +3 -0
  145. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  146. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  147. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  148. package/dist/types/shared/layouts/index.d.ts +1 -0
  149. package/package.json +12 -2
  150. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  151. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  152. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  153. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  154. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  155. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  156. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  157. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  158. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  159. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  160. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  161. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  162. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  163. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  164. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  165. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  166. package/dist/chunks/save-kO6cIaob.js +0 -34
  167. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  168. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  169. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  170. package/dist/chunks/x-CXDkqdur.js +0 -149
  171. package/dist/types/lib/class-utils.d.ts +0 -2
  172. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  173. package/dist/types/lib/utils.d.ts +0 -51
@@ -1,65 +1,24 @@
1
- import { z as i } from "zod";
2
- const Gt = [
3
- "missing_dependency",
4
- "missing_relationship",
5
- "population_required",
6
- "ambiguous_relationship"
7
- ];
8
- function Ia(e) {
9
- return Gt.includes(
10
- e
11
- );
12
- }
13
- const je = 200, z = [
14
- "second",
15
- "minute",
16
- "hour",
17
- "day",
18
- "week",
19
- "month",
20
- "quarter",
21
- "year"
22
- ];
23
- function wa(e) {
24
- return typeof e == "string" && z.includes(e);
25
- }
26
- const zt = [
27
- "week_of_short",
28
- "week_of_long",
29
- "quarter_short",
30
- "quarter_long",
31
- "fiscal_quarter_short",
32
- "fiscal_year"
33
- ], ka = {
34
- invalidMetadata: "invalid_raw_temporal_metadata"
35
- };
36
- function Wt(e) {
37
- return e === "second" || e === "minute" || e === "hour" ? "datetime" : "date";
38
- }
39
- const Aa = {
40
- missingMetadata: "missing_temporal_bucket_metadata",
41
- invalidMetadata: "invalid_temporal_bucket_metadata",
42
- invalidValue: "invalid_temporal_bucket_value"
43
- }, xa = "__auto_count__";
44
- function Kt(e) {
1
+ import { M as Ie, j as q, l as Pe, m as Mt, o as Dt, q as Rt, v as Et, g as Be, h as X, t as Tt, b as Le } from "./analytics-base-schemas-BFAoRlkU.js";
2
+ import { z as n } from "zod";
3
+ function Nt(e) {
45
4
  return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
46
5
  }
47
- function Qt(e) {
48
- return !Array.isArray(e) || e.length === 0 || e.length > je || !e.every(Kt) ? {
6
+ function $t(e) {
7
+ return !Array.isArray(e) || e.length === 0 || e.length > Ie || !e.every(Nt) ? {
49
8
  ok: !1,
50
- error: `matchValues must be 1 to ${je} string, number or boolean values.`
9
+ error: `matchValues must be 1 to ${Ie} string, number or boolean values.`
51
10
  } : { ok: !0, values: e };
52
11
  }
53
- const Xt = [
12
+ const jt = [
54
13
  "day",
55
14
  "week",
56
15
  "month",
57
16
  "quarter",
58
17
  "year"
59
- ], Ra = ["this", "previous"], Zt = ["now", "latest_available"], Jt = [
18
+ ], Gn = ["this", "previous"], Ct = ["now", "latest_available"], Ot = [
60
19
  "include_partial",
61
20
  "complete_periods"
62
- ], Fa = {
21
+ ], zn = {
63
22
  second: 31536e4,
64
23
  minute: 5256e3,
65
24
  hour: 87600,
@@ -69,411 +28,25 @@ const Xt = [
69
28
  quarter: 40,
70
29
  year: 10
71
30
  };
72
- function Ta(e) {
31
+ function Wn(e) {
73
32
  return e.anchor ?? "latest_available";
74
33
  }
75
- function ei(e) {
76
- try {
77
- return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
78
- } catch {
79
- return !1;
80
- }
81
- }
82
- const ti = i.record(i.string(), i.unknown()), O = i.array(ti), F = i.enum([
83
- "SUM",
84
- "COUNT",
85
- "AVG",
86
- "MIN",
87
- "MAX",
88
- "MEDIAN",
89
- "DISTINCT"
90
- ]), W = i.enum([
91
- "postgres",
92
- "mysql",
93
- "mssql",
94
- "snowflake",
95
- "clickhouse",
96
- "bigquery",
97
- "redshift",
98
- "duckdb",
99
- "sqlite",
100
- "unknown"
101
- ]), U = i.enum(z), K = i.enum([
102
- "dimension",
103
- "measure",
104
- "date",
105
- "id",
106
- "unknown"
107
- ]), Q = i.enum([
108
- "string",
109
- "number",
110
- "boolean",
111
- "date",
112
- "datetime",
113
- "unknown"
114
- ]), ie = i.union([i.number(), i.string(), i.null()]), ne = i.enum([
115
- "millisecond",
116
- "second",
117
- "minute",
118
- "hour",
119
- "day"
120
- ]), ii = i.enum(zt), ni = i.discriminatedUnion("mode", [
121
- i.object({ mode: i.literal("auto") }).strict(),
122
- i.object({
123
- mode: i.literal("preset"),
124
- preset: ii
125
- }).strict(),
126
- i.object({
127
- mode: i.literal("pattern"),
128
- pattern: i.string().min(1)
129
- }).strict()
130
- ]), X = i.object({
131
- type: i.literal("temporal_bucket"),
132
- presentation: ni
133
- }).strict(), ai = i.object({
134
- tz: i.string().min(1).refine(ei, {
135
- message: "tz must be a valid IANA timezone"
136
- }),
137
- weekStart: i.number().int().min(0).max(6),
138
- fiscalCalendar: i.object({
139
- kind: i.literal("month_aligned"),
140
- yearStartMonth: i.number().int().min(1).max(12)
141
- }).strict().optional()
142
- }).strict(), le = i.object({
143
- kind: i.literal("temporal_bucket"),
144
- granularity: U,
145
- calendar: ai
146
- }).strict(), oi = i.object({
147
- kind: i.literal("raw_temporal"),
148
- valueKind: i.enum(["date", "wall_datetime", "instant"])
149
- }).strict(), be = i.union([
150
- i.object({
151
- type: i.enum([
152
- "number",
153
- "currency",
154
- "percent",
155
- "percentage",
156
- "scientific"
157
- ]),
158
- locale: i.string().optional(),
159
- minimumFractionDigits: i.number().optional(),
160
- maximumFractionDigits: i.number().optional(),
161
- useGrouping: i.boolean().optional(),
162
- prefix: i.string().optional(),
163
- suffix: i.string().optional(),
164
- negativeStyle: i.enum(["minus", "parentheses"]).optional(),
165
- compact: i.boolean().optional(),
166
- scale: i.number().optional(),
167
- currency: i.string().optional(),
168
- percentValueMode: i.enum(["fraction", "whole"]).optional()
169
- }).passthrough().superRefine((e, t) => {
170
- "locale" in e && t.addIssue({
171
- code: i.ZodIssueCode.custom,
172
- path: ["locale"],
173
- message: "Numeric semantic formats inherit locale from viewer preferences."
174
- });
175
- }),
176
- i.object({
177
- type: i.enum(["date", "datetime"]),
178
- locale: i.string().optional(),
179
- pattern: i.string().optional(),
180
- relative: i.boolean().optional(),
181
- timezone: i.string().optional(),
182
- sourceTimezone: i.string().optional(),
183
- prefix: i.string().optional(),
184
- suffix: i.string().optional()
185
- }).passthrough(),
186
- i.object({
187
- type: i.literal("duration"),
188
- inputUnit: ne.optional(),
189
- outputStyle: i.enum(["compact", "digital", "long"]).optional(),
190
- largestUnit: ne.optional(),
191
- smallestUnit: ne.optional(),
192
- maxUnits: i.number().optional(),
193
- prefix: i.string().optional(),
194
- suffix: i.string().optional(),
195
- negativeStyle: i.enum(["minus", "parentheses"]).optional()
196
- }).passthrough(),
197
- i.object({
198
- type: i.literal("string"),
199
- prefix: i.string().optional(),
200
- suffix: i.string().optional()
201
- }).passthrough()
202
- ]);
203
- function si(e, t) {
204
- return i.object(e).passthrough().superRefine((n, o) => {
205
- for (const a of t)
206
- Object.prototype.hasOwnProperty.call(n, a) || o.addIssue({
207
- code: "custom",
208
- path: [a],
209
- message: `Required field "${a}" is missing.`
210
- });
211
- });
212
- }
213
- const ye = i.object({
214
- kind: i.literal("semantic"),
215
- domainId: i.string(),
216
- datasetName: i.string(),
217
- datasetId: i.string().optional(),
218
- label: i.string().optional(),
219
- connectionId: i.string().optional()
220
- }).passthrough(), Je = i.object({
221
- kind: i.literal("physical"),
222
- connectionId: i.string(),
223
- connectionType: i.string().optional(),
224
- tableName: i.string(),
225
- databaseName: i.string().optional(),
226
- schemaName: i.string().optional(),
227
- label: i.string().optional(),
228
- dialect: W.optional()
229
- }).passthrough(), ri = i.object({
230
- kind: i.literal("sql"),
231
- connectionId: i.string(),
232
- dialect: W.optional(),
233
- label: i.string().optional()
234
- }).passthrough(), et = i.union([
235
- ye,
236
- Je,
237
- ri
238
- ]), tt = i.object({
239
- name: i.string(),
240
- label: i.string().optional(),
241
- role: K.optional(),
242
- dataType: Q.optional(),
243
- source: et.optional(),
244
- aggregate: F.optional()
245
- }).passthrough(), it = tt, li = i.object({
246
- kind: i.literal("field"),
247
- field: it,
248
- aggregate: F.optional()
249
- }).passthrough(), nt = i.object({
250
- kind: i.literal("derived_field"),
251
- name: i.string(),
252
- label: i.string(),
253
- description: i.string().optional(),
254
- resultRole: K,
255
- dataType: Q,
256
- computeStage: i.enum(["row", "aggregate"]),
257
- expression: i.string(),
258
- expressionLanguage: i.literal("semaphor_sql_template").optional(),
259
- inputs: i.record(li),
260
- defaultAggregate: F.optional(),
261
- aggregationBehavior: i.enum([
262
- "additive",
263
- "non_additive",
264
- "ratio_of_sums",
265
- "weighted",
266
- "pre_aggregated",
267
- "snapshot"
268
- ]).optional(),
269
- aggregationStrategy: i.enum([
270
- "default",
271
- "symmetric_aggregate",
272
- "aggregate_then_join",
273
- "weighted"
274
- ]).optional(),
275
- format: be.optional(),
276
- tags: i.array(i.string()).optional()
277
- }).passthrough(), at = nt, Da = it.and(
278
- i.object({
279
- derivedField: at.optional()
280
- }).passthrough()
281
- ), di = ye, ui = i.object({
282
- kind: i.literal("physical"),
283
- connectionId: i.string().optional(),
284
- connectionType: i.string().optional(),
285
- tableName: i.string(),
286
- databaseName: i.string().optional(),
287
- schemaName: i.string().optional(),
288
- label: i.string().optional(),
289
- dialect: W.optional()
290
- }).passthrough(), ci = i.object({
291
- kind: i.literal("sql"),
292
- connectionId: i.string().optional(),
293
- dialect: W.optional(),
294
- label: i.string().optional()
295
- }).passthrough(), pi = i.union([
296
- di,
297
- ui,
298
- ci
299
- ]), Ma = i.object({
300
- key: i.string().optional(),
301
- name: i.string(),
302
- label: i.string().optional(),
303
- role: K.optional(),
304
- dataType: Q.optional(),
305
- source: pi.optional(),
306
- aggregate: F.optional(),
307
- derivedField: i.never().optional()
308
- }).passthrough(), j = i.object({
309
- key: i.string(),
310
- name: i.string(),
311
- label: i.string(),
312
- role: K.optional(),
313
- dataType: Q.optional(),
314
- aggregate: F.optional(),
315
- source: et.optional(),
316
- derivedField: at.optional(),
317
- temporalBucket: le.optional(),
318
- rawTemporal: oi.optional(),
319
- pivotIdentity: i.object({
320
- metricId: i.string().min(1),
321
- metricAlias: i.string().min(1),
322
- members: i.array(
323
- i.object({
324
- fieldId: i.string().min(1),
325
- value: i.string().nullable(),
326
- temporalBucket: le.optional()
327
- }).strict()
328
- )
329
- }).strict().optional()
330
- }).passthrough().superRefine((e, t) => {
331
- if (e.temporalBucket && e.rawTemporal && t.addIssue({
332
- code: i.ZodIssueCode.custom,
333
- path: ["rawTemporal"],
334
- message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
335
- }), e.temporalBucket) {
336
- const n = Wt(
337
- e.temporalBucket.granularity
338
- );
339
- e.dataType !== n && t.addIssue({
340
- code: i.ZodIssueCode.custom,
341
- path: ["dataType"],
342
- message: `${e.temporalBucket.granularity} temporal buckets require dataType ${n}.`
343
- });
344
- }
345
- if (e.rawTemporal) {
346
- const n = e.rawTemporal.valueKind === "date" ? "date" : "datetime";
347
- e.dataType !== n && t.addIssue({
348
- code: i.ZodIssueCode.custom,
349
- path: ["dataType"],
350
- message: `${e.rawTemporal.valueKind} raw temporal values require dataType ${n}.`
351
- });
352
- }
353
- }), Ea = i.object({
354
- records: O,
355
- columns: i.array(j).optional()
356
- }).passthrough(), Na = i.object({
357
- records: O,
358
- columns: i.array(j)
359
- }).passthrough(), ot = i.object({
360
- code: i.string(),
361
- message: i.string().optional(),
362
- invalidField: i.string().optional(),
363
- fieldRole: i.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
364
- validMeasureCandidates: i.array(i.string()).optional(),
365
- validDateCandidates: i.array(i.string()).optional(),
366
- validDimensionCandidates: i.array(i.string()).optional(),
367
- recommendedNextStep: i.string()
368
- }).passthrough(), Ce = i.object({
369
- code: i.string(),
370
- message: i.string(),
371
- path: i.string().optional(),
372
- fieldRole: i.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
373
- repairHint: ot.optional()
374
- }).passthrough(), ja = i.object({
375
- ok: i.boolean(),
376
- errors: i.array(Ce),
377
- warnings: i.array(Ce),
378
- repairHints: i.array(ot)
379
- }).passthrough(), mi = i.object({
380
- page: i.number(),
381
- pageSize: i.number(),
382
- pageCount: i.number(),
383
- totalCount: i.number(),
384
- hasNextPage: i.boolean(),
385
- hasPrevPage: i.boolean()
386
- }).passthrough(), Z = {
387
- intentId: i.string().optional(),
388
- queryPath: i.enum(["query_spec", "sql", "sql_python"]),
389
- warnings: i.array(i.string()).optional(),
390
- rowCount: i.number().optional(),
391
- rowLimitExceeded: i.boolean().optional(),
392
- limit: i.number().optional(),
393
- pagination: mi.optional()
394
- }, Ca = i.object({
395
- ...Z,
396
- kind: i.literal("metric"),
397
- primaryValue: ie,
398
- measures: i.record(ie).optional(),
399
- missingMeasures: i.array(i.string()).optional(),
400
- comparison: i.object({
401
- kind: i.enum(["previous_period", "previous_year", "target"]),
402
- value: ie.optional(),
403
- delta: i.union([i.number(), i.null()]).optional(),
404
- deltaPercent: i.union([i.number(), i.null()]).optional()
405
- }).passthrough().optional(),
406
- records: O.optional()
407
- }).passthrough(), $a = i.object({
408
- ...Z,
409
- kind: i.literal("records"),
410
- columns: i.array(j),
411
- records: O,
412
- totals: i.object({
413
- mode: i.literal("server"),
414
- scope: i.literal("filtered_result"),
415
- row: i.record(i.string(), i.unknown()),
416
- columns: i.array(j).optional()
417
- }).passthrough().optional()
418
- }).passthrough(), fi = i.object({
419
- inputId: i.string().min(1),
420
- status: i.enum(["applied", "inactive", "skipped", "overridden", "error"]),
421
- reason: i.enum([
422
- "unrelated",
423
- "population_required",
424
- "missing_dependency",
425
- "missing_relationship",
426
- "ambiguous_relationship",
427
- "invalid_metadata",
428
- "unsupported_dependency",
429
- "override_not_eligible"
430
- ]).optional()
431
- }), gi = i.object({
432
- complete: i.boolean(),
433
- reason: i.enum(["unsupported", "truncated"]).optional()
434
- }), Oa = i.object({
435
- ...Z,
436
- kind: i.literal("inputOptions"),
437
- dependencyOutcomes: i.array(fi).optional(),
438
- match: gi.optional(),
439
- options: i.array(
440
- si(
441
- {
442
- label: i.string(),
443
- value: i.unknown(),
444
- count: i.number().optional(),
445
- disambiguation: i.array(i.string()).optional()
446
- },
447
- ["value"]
448
- )
449
- )
450
- }).passthrough(), Pa = i.object({
451
- ...Z,
452
- kind: i.literal("sql"),
453
- columns: i.array(j),
454
- records: O,
455
- sqlShape: i.object({
456
- statementType: i.string().optional(),
457
- explicitLimit: i.number().optional(),
458
- hasPythonCode: i.boolean().optional()
459
- }).passthrough().optional()
460
- }).passthrough();
461
- function r(e, t, n) {
462
- return n ? { code: e, message: t, path: n } : { code: e, message: t };
34
+ function r(e, t, i) {
35
+ return i ? { code: e, message: t, path: i } : { code: e, message: t };
463
36
  }
464
37
  function m(e) {
465
38
  return typeof e == "string" && e.trim().length > 0;
466
39
  }
467
- function hi(e) {
40
+ function Yt(e) {
468
41
  const t = /* @__PURE__ */ new Set();
469
- return _i(e, (n) => (t.add(n), `{${n}}`)), Array.from(t);
42
+ return Pt(e, (i) => (t.add(i), `{${i}}`)), Array.from(t);
470
43
  }
471
- function _i(e, t) {
472
- let n = "", o = 0, a = 0;
44
+ function Pt(e, t) {
45
+ let i = "", o = 0, a = 0;
473
46
  for (; a < e.length; ) {
474
47
  const s = e[a];
475
48
  if (s === "'" || s === '"') {
476
- a = bi(e, a);
49
+ a = Bt(e, a);
477
50
  continue;
478
51
  }
479
52
  if (s === "{") {
@@ -483,19 +56,19 @@ function _i(e, t) {
483
56
  continue;
484
57
  }
485
58
  const d = e.slice(a + 1, l);
486
- /^[A-Za-z_][A-Za-z0-9_]*$/.test(d) && (n += e.slice(o, a) + t(d), o = l + 1), a = l + 1;
59
+ /^[A-Za-z_][A-Za-z0-9_]*$/.test(d) && (i += e.slice(o, a) + t(d), o = l + 1), a = l + 1;
487
60
  continue;
488
61
  }
489
62
  a += 1;
490
63
  }
491
- return n + e.slice(o);
64
+ return i + e.slice(o);
492
65
  }
493
- function bi(e, t) {
494
- const n = e[t];
66
+ function Bt(e, t) {
67
+ const i = e[t];
495
68
  let o = t + 1;
496
69
  for (; o < e.length; ) {
497
- if (e[o] === n) {
498
- if (e[o + 1] === n) {
70
+ if (e[o] === i) {
71
+ if (e[o + 1] === i) {
499
72
  o += 2;
500
73
  continue;
501
74
  }
@@ -508,7 +81,7 @@ function bi(e, t) {
508
81
  function f(e) {
509
82
  return !!(e && typeof e == "object" && !Array.isArray(e));
510
83
  }
511
- const yi = /* @__PURE__ */ new Set([
84
+ const Lt = /* @__PURE__ */ new Set([
512
85
  "SUM",
513
86
  "COUNT",
514
87
  "AVG",
@@ -517,21 +90,21 @@ const yi = /* @__PURE__ */ new Set([
517
90
  "MEDIAN",
518
91
  "DISTINCT"
519
92
  ]);
520
- function ve(e, t, n) {
93
+ function re(e, t, i) {
521
94
  if (!e || typeof e != "object") {
522
- n.push(
95
+ i.push(
523
96
  r("missing_source", "Analytics intent needs a source.", t)
524
97
  );
525
98
  return;
526
99
  }
527
100
  if (e.kind === "semantic") {
528
- m(e.domainId) || n.push(
101
+ m(e.domainId) || i.push(
529
102
  r(
530
103
  "missing_semantic_domain",
531
104
  "Semantic source needs a domainId.",
532
105
  `${t}.domainId`
533
106
  )
534
- ), m(e.datasetName) || n.push(
107
+ ), m(e.datasetName) || i.push(
535
108
  r(
536
109
  "missing_dataset_name",
537
110
  "Semantic source needs a datasetName.",
@@ -541,13 +114,13 @@ function ve(e, t, n) {
541
114
  return;
542
115
  }
543
116
  if (e.kind === "physical") {
544
- m(e.connectionId) || n.push(
117
+ m(e.connectionId) || i.push(
545
118
  r(
546
119
  "missing_connection_id",
547
120
  "Physical source needs a connectionId.",
548
121
  `${t}.connectionId`
549
122
  )
550
- ), m(e.tableName) || n.push(
123
+ ), m(e.tableName) || i.push(
551
124
  r(
552
125
  "missing_table_name",
553
126
  "Physical source needs a tableName.",
@@ -557,7 +130,7 @@ function ve(e, t, n) {
557
130
  return;
558
131
  }
559
132
  if (e.kind === "sql") {
560
- m(e.connectionId) || n.push(
133
+ m(e.connectionId) || i.push(
561
134
  r(
562
135
  "missing_connection_id",
563
136
  "SQL source needs a connectionId.",
@@ -566,27 +139,27 @@ function ve(e, t, n) {
566
139
  );
567
140
  return;
568
141
  }
569
- n.push(
142
+ i.push(
570
143
  r("invalid_source_kind", "Source kind is not supported.", t)
571
144
  );
572
145
  }
573
- function y(e, t, n, o = {}) {
146
+ function b(e, t, i, o = {}) {
574
147
  if (!e || !f(e)) {
575
- o.required && n.push(
148
+ o.required && i.push(
576
149
  r("missing_field_ref", "Field reference needs a name.", t)
577
150
  );
578
151
  return;
579
152
  }
580
- m(e.name) || n.push(
153
+ m(e.name) || i.push(
581
154
  r(
582
155
  "missing_field_ref",
583
156
  "Field reference needs a name.",
584
157
  `${t}.name`
585
158
  )
586
- ), e.source !== void 0 && ve(e.source, `${t}.source`, n), Se(e.aggregate, `${t}.aggregate`, n);
159
+ ), e.source !== void 0 && re(e.source, `${t}.source`, i), le(e.aggregate, `${t}.aggregate`, i);
587
160
  }
588
- function Se(e, t, n) {
589
- e !== void 0 && (typeof e != "string" || !yi.has(e)) && n.push(
161
+ function le(e, t, i) {
162
+ e !== void 0 && (typeof e != "string" || !Lt.has(e)) && i.push(
590
163
  r(
591
164
  "invalid_aggregate",
592
165
  "Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
@@ -594,20 +167,20 @@ function Se(e, t, n) {
594
167
  )
595
168
  );
596
169
  }
597
- const vi = /* @__PURE__ */ new Set([
170
+ const Vt = /* @__PURE__ */ new Set([
598
171
  "measure",
599
172
  "dimension",
600
173
  "date",
601
174
  "id",
602
175
  "unknown"
603
- ]), Si = /* @__PURE__ */ new Set(["row", "aggregate"]), st = /* @__PURE__ */ new Set([
176
+ ]), qt = /* @__PURE__ */ new Set(["row", "aggregate"]), Ve = /* @__PURE__ */ new Set([
604
177
  "string",
605
178
  "number",
606
179
  "boolean",
607
180
  "date",
608
181
  "datetime",
609
182
  "unknown"
610
- ]), Ii = /* @__PURE__ */ new Set([
183
+ ]), Ut = /* @__PURE__ */ new Set([
611
184
  "number",
612
185
  "currency",
613
186
  "percent",
@@ -618,18 +191,18 @@ const vi = /* @__PURE__ */ new Set([
618
191
  "duration",
619
192
  "string",
620
193
  "temporal_bucket"
621
- ]), wi = /* @__PURE__ */ new Set([
194
+ ]), Ht = /* @__PURE__ */ new Set([
622
195
  "millisecond",
623
196
  "second",
624
197
  "minute",
625
198
  "hour",
626
199
  "day"
627
- ]), ki = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
628
- function rt(e, t, n) {
200
+ ]), Gt = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
201
+ function qe(e, t, i) {
629
202
  if (e === void 0)
630
203
  return;
631
204
  if (!f(e)) {
632
- n.push(
205
+ i.push(
633
206
  r(
634
207
  "invalid_value_format",
635
208
  "Value format must be a structured object.",
@@ -639,45 +212,45 @@ function rt(e, t, n) {
639
212
  return;
640
213
  }
641
214
  const o = e;
642
- (typeof o.type != "string" || !Ii.has(o.type)) && n.push(
215
+ (typeof o.type != "string" || !Ut.has(o.type)) && i.push(
643
216
  r(
644
217
  "invalid_value_format_type",
645
218
  "Value format type must be number, currency, percent, percentage, scientific, date, datetime, duration, string, or temporal_bucket.",
646
219
  `${t}.type`
647
220
  )
648
- ), o.type === "temporal_bucket" && !X.safeParse(e).success && n.push(
221
+ ), o.type === "temporal_bucket" && !q.safeParse(e).success && i.push(
649
222
  r(
650
223
  "invalid_temporal_bucket_format",
651
224
  "Temporal bucket format must contain a valid auto, preset, or pattern presentation.",
652
225
  t
653
226
  )
654
- ), (o.type === "number" || o.type === "currency" || o.type === "percent" || o.type === "percentage" || o.type === "scientific") && Object.prototype.hasOwnProperty.call(e, "locale") && n.push(
227
+ ), (o.type === "number" || o.type === "currency" || o.type === "percent" || o.type === "percentage" || o.type === "scientific") && Object.prototype.hasOwnProperty.call(e, "locale") && i.push(
655
228
  r(
656
229
  "invalid_value_format",
657
230
  "Numeric value formats cannot define viewer locale.",
658
231
  `${t}.locale`
659
232
  )
660
- ), B(
233
+ ), O(
661
234
  e.minimumFractionDigits,
662
235
  `${t}.minimumFractionDigits`,
663
- n
664
- ), B(
236
+ i
237
+ ), O(
665
238
  e.maximumFractionDigits,
666
239
  `${t}.maximumFractionDigits`,
667
- n
668
- ), B(e.scale, `${t}.scale`, n), B(e.maxUnits, `${t}.maxUnits`, n), e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" && n.push(
240
+ i
241
+ ), O(e.scale, `${t}.scale`, i), O(e.maxUnits, `${t}.maxUnits`, i), e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" && i.push(
669
242
  r(
670
243
  "invalid_value_format_use_grouping",
671
244
  "Value format useGrouping must be boolean.",
672
245
  `${t}.useGrouping`
673
246
  )
674
- ), e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && n.push(
247
+ ), e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && i.push(
675
248
  r(
676
249
  "invalid_value_format_negative_style",
677
250
  "Value format negativeStyle must be minus or parentheses.",
678
251
  `${t}.negativeStyle`
679
252
  )
680
- ), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && n.push(
253
+ ), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && i.push(
681
254
  r(
682
255
  "invalid_value_format_percent_mode",
683
256
  "Value format percentValueMode must be fraction or whole.",
@@ -686,7 +259,7 @@ function rt(e, t, n) {
686
259
  );
687
260
  for (const a of ["inputUnit", "largestUnit", "smallestUnit"]) {
688
261
  const s = e[a];
689
- s !== void 0 && (typeof s != "string" || !wi.has(s)) && n.push(
262
+ s !== void 0 && (typeof s != "string" || !Ht.has(s)) && i.push(
690
263
  r(
691
264
  "invalid_value_format_duration_unit",
692
265
  "Duration format units must be millisecond, second, minute, hour, or day.",
@@ -694,7 +267,7 @@ function rt(e, t, n) {
694
267
  )
695
268
  );
696
269
  }
697
- e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !ki.has(e.outputStyle)) && n.push(
270
+ e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !Gt.has(e.outputStyle)) && i.push(
698
271
  r(
699
272
  "invalid_value_format_duration_style",
700
273
  "Duration format outputStyle must be compact, digital, or long.",
@@ -702,8 +275,8 @@ function rt(e, t, n) {
702
275
  )
703
276
  );
704
277
  }
705
- function B(e, t, n) {
706
- e !== void 0 && (typeof e != "number" || !Number.isFinite(e)) && n.push(
278
+ function O(e, t, i) {
279
+ e !== void 0 && (typeof e != "number" || !Number.isFinite(e)) && i.push(
707
280
  r(
708
281
  "invalid_value_format_number",
709
282
  "Value format numeric options must be finite numbers.",
@@ -711,22 +284,22 @@ function B(e, t, n) {
711
284
  )
712
285
  );
713
286
  }
714
- const Ai = /* @__PURE__ */ new Set([
287
+ const zt = /* @__PURE__ */ new Set([
715
288
  "additive",
716
289
  "non_additive",
717
290
  "ratio_of_sums",
718
291
  "weighted",
719
292
  "pre_aggregated",
720
293
  "snapshot"
721
- ]), xi = /* @__PURE__ */ new Set([
294
+ ]), Wt = /* @__PURE__ */ new Set([
722
295
  "default",
723
296
  "symmetric_aggregate",
724
297
  "aggregate_then_join",
725
298
  "weighted"
726
299
  ]);
727
- function Ri(e, t, n) {
300
+ function Qt(e, t, i) {
728
301
  if (!e || !f(e)) {
729
- n.push(
302
+ i.push(
730
303
  r(
731
304
  "invalid_derived_field_input",
732
305
  "Derived field inputs must be structured input references.",
@@ -736,10 +309,10 @@ function Ri(e, t, n) {
736
309
  return;
737
310
  }
738
311
  if (e.kind === "field") {
739
- y(e.field, `${t}.field`, n, { required: !0 }), Se(e.aggregate, `${t}.aggregate`, n);
312
+ b(e.field, `${t}.field`, i, { required: !0 }), le(e.aggregate, `${t}.aggregate`, i);
740
313
  return;
741
314
  }
742
- n.push(
315
+ i.push(
743
316
  r(
744
317
  "invalid_derived_field_input",
745
318
  "Derived field input kind must be field.",
@@ -747,7 +320,7 @@ function Ri(e, t, n) {
747
320
  )
748
321
  );
749
322
  }
750
- function Ie(e) {
323
+ function de(e) {
751
324
  const t = [];
752
325
  if (!f(e))
753
326
  return t.push(
@@ -774,19 +347,19 @@ function Ie(e) {
774
347
  "Derived field needs a label.",
775
348
  "label"
776
349
  )
777
- ), vi.has(e.resultRole) || t.push(
350
+ ), Vt.has(e.resultRole) || t.push(
778
351
  r(
779
352
  "invalid_derived_field_role",
780
353
  "Derived field resultRole must be measure, dimension, date, id, or unknown.",
781
354
  "resultRole"
782
355
  )
783
- ), st.has(e.dataType) || t.push(
356
+ ), Ve.has(e.dataType) || t.push(
784
357
  r(
785
358
  "invalid_derived_field_data_type",
786
359
  "Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
787
360
  "dataType"
788
361
  )
789
- ), Si.has(e.computeStage) || t.push(
362
+ ), qt.has(e.computeStage) || t.push(
790
363
  r(
791
364
  "invalid_derived_field_compute_stage",
792
365
  "Derived field computeStage must be row or aggregate.",
@@ -810,11 +383,11 @@ function Ie(e) {
810
383
  "Row-stage measure derived fields must declare defaultAggregate so row results have explicit rollup semantics.",
811
384
  "defaultAggregate"
812
385
  )
813
- ), Se(
386
+ ), le(
814
387
  e.defaultAggregate,
815
388
  "defaultAggregate",
816
389
  t
817
- ), e.aggregationBehavior !== void 0 && !Ai.has(
390
+ ), e.aggregationBehavior !== void 0 && !zt.has(
818
391
  e.aggregationBehavior
819
392
  ) && t.push(
820
393
  r(
@@ -822,7 +395,7 @@ function Ie(e) {
822
395
  "Derived field aggregationBehavior is not supported.",
823
396
  "aggregationBehavior"
824
397
  )
825
- ), e.aggregationStrategy !== void 0 && !xi.has(
398
+ ), e.aggregationStrategy !== void 0 && !Wt.has(
826
399
  e.aggregationStrategy
827
400
  ) && t.push(
828
401
  r(
@@ -859,13 +432,13 @@ function Ie(e) {
859
432
  );
860
433
  return;
861
434
  }
862
- Ri(
435
+ Qt(
863
436
  a,
864
437
  `inputs.${o}`,
865
438
  t
866
439
  );
867
440
  }), m(e.expression) && f(e.inputs)) {
868
- const o = hi(
441
+ const o = Yt(
869
442
  e.expression
870
443
  ), a = new Set(o), s = Object.keys(e.inputs).filter(
871
444
  (l) => m(l)
@@ -888,14 +461,14 @@ function Ie(e) {
888
461
  );
889
462
  });
890
463
  }
891
- const n = e.format;
892
- return f(n) && n.type === "temporal_bucket" ? t.push(
464
+ const i = e.format;
465
+ return f(i) && i.type === "temporal_bucket" ? t.push(
893
466
  r(
894
467
  "invalid_derived_field_format",
895
468
  "Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
896
469
  "format"
897
470
  )
898
- ) : rt(n, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((o) => !m(o))) && t.push(
471
+ ) : qe(i, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((o) => !m(o))) && t.push(
899
472
  r(
900
473
  "invalid_derived_field_tags",
901
474
  "Derived field tags must be non-empty strings.",
@@ -903,55 +476,55 @@ function Ie(e) {
903
476
  )
904
477
  ), { ok: t.length === 0, errors: t, warnings: [] };
905
478
  }
906
- const D = i.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [Fi, Ti, Di, Mi] = be.options, lt = i.union([
907
- Fi.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
908
- const { minimumFractionDigits: n = 0, maximumFractionDigits: o = 2 } = e;
909
- (![n, o].every((a) => Number.isInteger(a) && a >= 0 && a <= 20) || n > o) && t.addIssue({
479
+ const D = n.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [Kt, Xt, Zt, Jt] = Pe.options, Ue = n.union([
480
+ Kt.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
481
+ const { minimumFractionDigits: i = 0, maximumFractionDigits: o = 2 } = e;
482
+ (![i, o].every((a) => Number.isInteger(a) && a >= 0 && a <= 20) || i > o) && t.addIssue({
910
483
  code: "custom",
911
484
  message: "Fraction digits must be integers from 0 to 20 with minimum <= maximum."
912
485
  }), e.scale !== void 0 && !Number.isFinite(e.scale) && t.addIssue({ code: "custom", message: "Scale must be finite." });
913
486
  }),
914
- Ti.strict(),
915
- Di.strict(),
916
- Mi.strict()
917
- ]), $e = i.union([
918
- lt,
919
- X
920
- ]), we = i.union([
921
- ye.extend({ domainId: D, datasetName: D }).strict(),
922
- Je.extend({ connectionId: D, tableName: D }).strict()
923
- ]), dt = tt.extend({
487
+ Xt.strict(),
488
+ Zt.strict(),
489
+ Jt.strict()
490
+ ]), Se = n.union([
491
+ Ue,
492
+ q
493
+ ]), ue = n.union([
494
+ Mt.extend({ domainId: D, datasetName: D }).strict(),
495
+ Dt.extend({ connectionId: D, tableName: D }).strict()
496
+ ]), He = Rt.extend({
924
497
  name: D,
925
- source: we.optional()
926
- }).strict(), ke = nt.extend({
927
- format: lt.optional(),
928
- inputs: i.record(
929
- i.object({
930
- kind: i.literal("field"),
931
- field: dt,
932
- aggregate: F.optional()
498
+ source: ue.optional()
499
+ }).strict(), ce = Et.extend({
500
+ format: Ue.optional(),
501
+ inputs: n.record(
502
+ n.object({
503
+ kind: n.literal("field"),
504
+ field: He,
505
+ aggregate: Be.optional()
933
506
  }).strict()
934
507
  )
935
508
  }).strict().superRefine((e, t) => {
936
- var n;
937
- for (const o of Ie(e).errors)
509
+ var i;
510
+ for (const o of de(e).errors)
938
511
  t.addIssue({
939
512
  code: "custom",
940
- path: ((n = o.path) == null ? void 0 : n.split(".")) ?? [],
513
+ path: ((i = o.path) == null ? void 0 : i.split(".")) ?? [],
941
514
  message: o.message
942
515
  });
943
- }), Ei = dt.extend({
944
- derivedField: ke.optional()
516
+ }), ei = He.extend({
517
+ derivedField: ce.optional()
945
518
  }).strict();
946
- function Ae(e) {
519
+ function pe(e) {
947
520
  return typeof e == "string" ? e.trim().toLowerCase() : "";
948
521
  }
949
- function Ni(e) {
522
+ function ti(e) {
950
523
  return String(
951
524
  e.column_name || e.name || e.qualifiedFieldName || ""
952
525
  );
953
526
  }
954
- function ji(e) {
527
+ function ii(e) {
955
528
  return Array.from(
956
529
  new Set(
957
530
  [e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
@@ -960,11 +533,11 @@ function ji(e) {
960
533
  )
961
534
  );
962
535
  }
963
- function xe(e) {
964
- const t = ct(e);
965
- return t ? Oi(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
536
+ function me(e) {
537
+ const t = ze(e);
538
+ return t ? si(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
966
539
  }
967
- const ae = /* @__PURE__ */ new Map([
540
+ const z = /* @__PURE__ */ new Map([
968
541
  // Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
969
542
  ["int", "integer"],
970
543
  ["uint", "integer"],
@@ -987,81 +560,89 @@ const ae = /* @__PURE__ */ new Map([
987
560
  ["double", "float"],
988
561
  ["real", "float"],
989
562
  ["bfloat16", "float"],
990
- // Numeric for grounding; storage representation not established.
563
+ // Numeric for grounding; storage representation not established
564
+ // (`number(p, s)` with an explicit scale is resolved before this table).
991
565
  ["number", null],
992
566
  ["money", null],
993
567
  ["currency", null],
994
568
  ["percent", null]
995
- ]), Ci = ["int", "uint", "decimal", "float"];
996
- function $i(e) {
569
+ ]), ni = ["int", "uint", "decimal", "float"];
570
+ function ai(e) {
997
571
  return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
998
572
  }
999
- function ut(e) {
573
+ function oi(e) {
574
+ var i;
575
+ const t = (i = /^number\s*\(\s*\d+\s*,\s*(\d+)\s*\)$/.exec(e)) == null ? void 0 : i[1];
576
+ return t === void 0 ? null : Number(t) === 0 ? "integer" : "decimal";
577
+ }
578
+ function Ge(e) {
1000
579
  const t = e.split(/[\s(]/, 1)[0] || "";
1001
- if (ae.has(t))
1002
- return { numeric: !0, kind: ae.get(t) ?? null };
1003
- const n = Ci.find(
1004
- (o) => t.startsWith(o) && $i(t.slice(o.length))
580
+ if (t === "number")
581
+ return { numeric: !0, kind: oi(e) };
582
+ if (z.has(t))
583
+ return { numeric: !0, kind: z.get(t) ?? null };
584
+ const i = ni.find(
585
+ (o) => t.startsWith(o) && ai(t.slice(o.length))
1005
586
  );
1006
- return n ? { numeric: !0, kind: ae.get(n) ?? null } : { numeric: !1, kind: null };
587
+ return i ? { numeric: !0, kind: z.get(i) ?? null } : { numeric: !1, kind: null };
1007
588
  }
1008
- function Oi(e) {
1009
- return ut(e).numeric;
589
+ function si(e) {
590
+ return Ge(e).numeric;
1010
591
  }
1011
- function Pi(e) {
1012
- return ut(ct(e)).kind;
592
+ function ri(e) {
593
+ return Ge(ze(e)).kind;
1013
594
  }
1014
- function ct(e) {
1015
- let t = Ae(e), n = "";
1016
- for (; t && t !== n; )
1017
- n = t, t = Oe(t, "nullable"), t = Oe(t, "lowcardinality");
595
+ function ze(e) {
596
+ let t = pe(e), i = "";
597
+ for (; t && t !== i; )
598
+ i = t, t = we(t, "nullable"), t = we(t, "lowcardinality");
1018
599
  return t;
1019
600
  }
1020
- function Oe(e, t) {
1021
- const n = `${t}(`;
1022
- return !e.startsWith(n) || !e.endsWith(")") ? e : e.slice(n.length, -1).trim();
601
+ function we(e, t) {
602
+ const i = `${t}(`;
603
+ return !e.startsWith(i) || !e.endsWith(")") ? e : e.slice(i.length, -1).trim();
1023
604
  }
1024
- function Yi(e) {
1025
- const t = xe(e);
605
+ function li(e) {
606
+ const t = me(e);
1026
607
  return t === "date" || t === "datetime";
1027
608
  }
1028
- function pt(e) {
1029
- return Yi(e.dataType || e.data_type);
609
+ function We(e) {
610
+ return li(e.dataType || e.data_type);
1030
611
  }
1031
- function mt(e) {
1032
- const t = ft(e);
612
+ function Qe(e) {
613
+ const t = Ke(e);
1033
614
  return t === "id" || t === "row_id";
1034
615
  }
1035
- function Pe(e) {
1036
- const t = ft(e);
1037
- return mt(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
616
+ function ke(e) {
617
+ const t = Ke(e);
618
+ return Qe(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
1038
619
  }
1039
- function ft(e) {
1040
- return Ae(
1041
- Ni(e) || e.name || e.alias
620
+ function Ke(e) {
621
+ return pe(
622
+ ti(e) || e.name || e.alias
1042
623
  ).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
1043
624
  }
1044
- function gt(e, t = {}) {
1045
- const n = Ae(e.role);
1046
- return n === "metric" || n === "measure" ? !t.excludeIdentifiers || !Pe(e) : n === "groupby" || n === "dimension" || n === "date" || n === "id" ? !1 : xe(
625
+ function Xe(e, t = {}) {
626
+ const i = pe(e.role);
627
+ return i === "metric" || i === "measure" ? !t.excludeIdentifiers || !ke(e) : i === "groupby" || i === "dimension" || i === "date" || i === "id" ? !1 : me(
1047
628
  e.dataType || e.data_type
1048
- ) === "number" && (!t.excludeIdentifiers || !Pe(e));
629
+ ) === "number" && (!t.excludeIdentifiers || !ke(e));
1049
630
  }
1050
- function Ya(e) {
1051
- return !gt(e) && !pt(e);
631
+ function Qn(e) {
632
+ return !Xe(e) && !We(e);
1052
633
  }
1053
- function Ba(e) {
1054
- const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
634
+ function Kn(e) {
635
+ const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1055
636
  for (const a of e) {
1056
- if (mt(a))
637
+ if (Qe(a))
1057
638
  continue;
1058
- const s = ji(a);
639
+ const s = ii(a);
1059
640
  if (s.length !== 0) {
1060
- if (pt(a)) {
1061
- s.forEach((l) => n.add(l));
641
+ if (We(a)) {
642
+ s.forEach((l) => i.add(l));
1062
643
  continue;
1063
644
  }
1064
- if (gt(a, { excludeIdentifiers: !0 })) {
645
+ if (Xe(a, { excludeIdentifiers: !0 })) {
1065
646
  s.forEach((l) => t.add(l));
1066
647
  continue;
1067
648
  }
@@ -1070,12 +651,12 @@ function Ba(e) {
1070
651
  }
1071
652
  return {
1072
653
  validMeasureCandidates: Array.from(t).sort(),
1073
- validDateCandidates: Array.from(n).sort(),
654
+ validDateCandidates: Array.from(i).sort(),
1074
655
  validDimensionCandidates: Array.from(o).sort()
1075
656
  };
1076
657
  }
1077
- const M = 16 * 1024;
1078
- function V(e) {
658
+ const R = 16 * 1024;
659
+ function B(e) {
1079
660
  const t = /^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/.exec(e);
1080
661
  return t ? {
1081
662
  sign: t[1],
@@ -1084,91 +665,91 @@ function V(e) {
1084
665
  exponent: Number(t[5] ?? "0")
1085
666
  } : null;
1086
667
  }
1087
- function Ye(e) {
1088
- const { sign: t, whole: n, fraction: o = "", exponent: a } = e, s = (n + o).replace(/^0+/, ""), l = s.replace(/0+$/, ""), d = a - o.length + s.length - l.length;
668
+ function Ae(e) {
669
+ const { sign: t, whole: i, fraction: o = "", exponent: a } = e, s = (i + o).replace(/^0+/, ""), l = s.replace(/0+$/, ""), d = a - o.length + s.length - l.length;
1089
670
  return !Number.isSafeInteger(a) || !Number.isSafeInteger(d) ? null : l ? `${t === "-" ? "-" : ""}${l}e${d}` : "0";
1090
671
  }
1091
- function Bi(e) {
1092
- const t = V(e);
672
+ function di(e) {
673
+ const t = B(e);
1093
674
  if (!t) return null;
1094
- const n = t.sign === "+" ? e.slice(1) : e, o = Number(e);
1095
- if (!Number.isFinite(o)) return n;
1096
- const a = Ye(t), s = V(String(o));
1097
- return a !== null && s !== null && a === Ye(s) ? o : n;
675
+ const i = t.sign === "+" ? e.slice(1) : e, o = Number(e);
676
+ if (!Number.isFinite(o)) return i;
677
+ const a = Ae(t), s = B(String(o));
678
+ return a !== null && s !== null && a === Ae(s) ? o : i;
1098
679
  }
1099
- function qi(e) {
1100
- if (e.length > M)
680
+ function ui(e) {
681
+ if (e.length > R)
1101
682
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
1102
- const t = V(e);
683
+ const t = B(e);
1103
684
  if (!t) throw new TypeError("Expected finite decimal text.");
1104
- const { sign: n, whole: o, fraction: a, exponent: s } = t, l = `${n}${o || "0"}${a ? `.${a}` : ""}`;
685
+ const { sign: i, whole: o, fraction: a, exponent: s } = t, l = `${i}${o || "0"}${a ? `.${a}` : ""}`;
1105
686
  return x(`${l}e${s}`);
1106
687
  }
1107
688
  function x(e) {
1108
- if (e.length > M)
689
+ if (e.length > R)
1109
690
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
1110
- const t = V(e);
691
+ const t = B(e);
1111
692
  if (!t || t.whole === "" || t.fraction === "")
1112
693
  throw new TypeError("Expected finite decimal text.");
1113
- const { sign: n, whole: o, fraction: a = "", exponent: s } = t;
1114
- if (!Number.isSafeInteger(s) || Math.abs(s) > M)
694
+ const { sign: i, whole: o, fraction: a = "", exponent: s } = t;
695
+ if (!Number.isSafeInteger(s) || Math.abs(s) > R)
1115
696
  throw new RangeError("Exact numeric exponent exceeds the text budget.");
1116
697
  const l = o + a, d = o.length + s;
1117
- if (Math.max(l.length, d) + Math.max(0, -d) + 3 > M)
698
+ if (Math.max(l.length, d) + Math.max(0, -d) + 3 > R)
1118
699
  throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
1119
700
  let p;
1120
701
  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)}`;
1121
- const [u, _ = ""] = p.split("."), b = u.replace(/^0+(?=\d)/, ""), S = _.replace(/0+$/, ""), h = b + (S ? `.${S}` : "");
1122
- return n === "-" && h !== "0" ? `-${h}` : h;
702
+ const [u, _ = ""] = p.split("."), y = u.replace(/^0+(?=\d)/, ""), I = _.replace(/0+$/, ""), h = y + (I ? `.${I}` : "");
703
+ return i === "-" && h !== "0" ? `-${h}` : h;
1123
704
  }
1124
- function ht(e, t) {
1125
- const n = e.startsWith("-"), o = t.startsWith("-");
1126
- if (n !== o) return n ? -1 : 1;
1127
- const [a, s = ""] = (n ? e.slice(1) : e).split("."), [l, d = ""] = (o ? t.slice(1) : t).split(".");
705
+ function Ze(e, t) {
706
+ const i = e.startsWith("-"), o = t.startsWith("-");
707
+ if (i !== o) return i ? -1 : 1;
708
+ const [a, s = ""] = (i ? e.slice(1) : e).split("."), [l, d = ""] = (o ? t.slice(1) : t).split(".");
1128
709
  let c = Math.sign(a.length - l.length);
1129
710
  if (!c && a !== l && (c = a < l ? -1 : 1), !c) {
1130
711
  const p = Math.max(s.length, d.length), u = s.padEnd(p, "0"), _ = d.padEnd(p, "0");
1131
712
  c = u === _ ? 0 : u < _ ? -1 : 1;
1132
713
  }
1133
- return c === 0 ? 0 : n ? -c : c;
714
+ return c === 0 ? 0 : i ? -c : c;
1134
715
  }
1135
- function qa(e, t) {
716
+ function Xn(e, t) {
1136
717
  if (typeof t == "number" && !Number.isFinite(t))
1137
718
  throw new TypeError("Numeric scale must be finite.");
1138
- const n = [e, x(String(t))].map((s) => {
719
+ const i = [e, x(String(t))].map((s) => {
1139
720
  const [l, d = ""] = s.split(".");
1140
721
  return { coefficient: BigInt(l + d), digits: d.length };
1141
- }), o = n[0].coefficient * n[1].coefficient, a = n[0].digits + n[1].digits;
722
+ }), o = i[0].coefficient * i[1].coefficient, a = i[0].digits + i[1].digits;
1142
723
  return x(`${o}e-${a}`);
1143
724
  }
1144
- function Li(e) {
725
+ function ci(e) {
1145
726
  try {
1146
727
  return x(e) === e;
1147
728
  } catch {
1148
729
  return !1;
1149
730
  }
1150
731
  }
1151
- const _t = i.object({
1152
- kind: i.literal("exact_number"),
1153
- type: i.enum(["integer", "decimal"]),
1154
- value: i.string().max(M).refine(Li, "Expected canonical decimal text.")
732
+ const Je = n.object({
733
+ kind: n.literal("exact_number"),
734
+ type: n.enum(["integer", "decimal"]),
735
+ value: n.string().max(R).refine(ci, "Expected canonical decimal text.")
1155
736
  }).strict().superRefine((e, t) => {
1156
737
  e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
1157
- }), L = i.union([
1158
- i.null(),
1159
- i.string(),
1160
- i.boolean(),
1161
- i.number().finite(),
1162
- _t
738
+ }), P = n.union([
739
+ n.null(),
740
+ n.string(),
741
+ n.boolean(),
742
+ n.number().finite(),
743
+ Je
1163
744
  ]);
1164
- function Ui(e, t) {
1165
- return _t.parse({ kind: "exact_number", type: t, value: x(e) });
745
+ function pi(e, t) {
746
+ return Je.parse({ kind: "exact_number", type: t, value: x(e) });
1166
747
  }
1167
- function H(e) {
748
+ function L(e) {
1168
749
  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";
1169
750
  }
1170
- function La(e) {
1171
- const t = Pi(e.nativeDataType);
751
+ function Zn(e) {
752
+ const t = ri(e.nativeDataType);
1172
753
  if (!t) throw new TypeError("Numeric result type is not established.");
1173
754
  if (e.value === null) return null;
1174
755
  if (t === "float") {
@@ -1178,41 +759,41 @@ function La(e) {
1178
759
  }
1179
760
  if (e.exactText === void 0)
1180
761
  throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
1181
- return Ui(e.exactText, t);
762
+ return pi(e.exactText, t);
1182
763
  }
1183
- const Re = i.string().uuid(), Fe = i.enum(["rows", "columns"]), Vi = i.enum(["member", "subtotal", "grand_total", "others"]), Hi = i.discriminatedUnion("kind", [
1184
- i.object({ kind: i.literal("value"), value: L }).strict(),
1185
- i.object({ kind: i.literal("others"), rankingId: Re }).strict()
1186
- ]), R = i.array(i.object({ levelId: Re, member: Hi }).strict()).readonly().superRefine((e, t) => {
1187
- new Set(e.map((n) => n.levelId)).size !== e.length && t.addIssue({
764
+ const fe = n.string().uuid(), ge = n.enum(["rows", "columns"]), mi = n.enum(["member", "subtotal", "grand_total", "others"]), fi = n.discriminatedUnion("kind", [
765
+ n.object({ kind: n.literal("value"), value: P }).strict(),
766
+ n.object({ kind: n.literal("others"), rankingId: fe }).strict()
767
+ ]), F = n.array(n.object({ levelId: fe, member: fi }).strict()).readonly().superRefine((e, t) => {
768
+ new Set(e.map((i) => i.levelId)).size !== e.length && t.addIssue({
1188
769
  code: "custom",
1189
770
  path: [],
1190
771
  message: "Duplicate identity."
1191
772
  }), e.some(
1192
- (n, o) => n.member.kind === "others" && o !== e.length - 1
773
+ (i, o) => i.member.kind === "others" && o !== e.length - 1
1193
774
  ) && t.addIssue({
1194
775
  code: "custom",
1195
776
  path: [],
1196
777
  message: "Others is terminal."
1197
778
  });
1198
- }), Ua = i.object({
1199
- rowPath: R,
1200
- columnPath: R,
1201
- measureId: Re
779
+ }), Jn = n.object({
780
+ rowPath: F,
781
+ columnPath: F,
782
+ measureId: fe
1202
783
  }).strict();
1203
- function bt(e) {
784
+ function et(e) {
1204
785
  return JSON.stringify(
1205
- e.map(({ levelId: t, member: n }) => [
786
+ e.map(({ levelId: t, member: i }) => [
1206
787
  t,
1207
- n.kind === "others" ? ["others", n.rankingId] : typeof n.value == "object" && n.value !== null ? ["exact_number", n.value.value] : [typeof n.value, n.value]
788
+ i.kind === "others" ? ["others", i.rankingId] : typeof i.value == "object" && i.value !== null ? ["exact_number", i.value.value] : [typeof i.value, i.value]
1208
789
  ])
1209
790
  );
1210
791
  }
1211
- const de = "SEMAPHOR_CALCULATED_FIELD", Gi = "calculated_fields";
1212
- function zi(e) {
792
+ const Z = "SEMAPHOR_CALCULATED_FIELD", gi = "calculated_fields";
793
+ function hi(e) {
1213
794
  return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
1214
795
  }
1215
- const Wi = [
796
+ const _i = [
1216
797
  // Day granularity formats
1217
798
  "MM-DD-YYYY",
1218
799
  "YYYY-MM-DD",
@@ -1247,17 +828,17 @@ const Wi = [
1247
828
  // Custom format
1248
829
  "custom"
1249
830
  ];
1250
- function Va(e) {
831
+ function ea(e) {
1251
832
  return e.role === "metric" && "expression" in e && !!e.expression;
1252
833
  }
1253
- function Ha(e) {
834
+ function ta(e) {
1254
835
  return !!e.expression;
1255
836
  }
1256
- function Ki(e) {
1257
- return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || ue(e)));
837
+ function yi(e) {
838
+ return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || J(e)));
1258
839
  }
1259
- function yt(e) {
1260
- var _, b, S;
840
+ function tt(e) {
841
+ var _, y, I;
1261
842
  if (!e)
1262
843
  return {
1263
844
  representation: "physical",
@@ -1266,22 +847,22 @@ function yt(e) {
1266
847
  runtimeExecutable: !1,
1267
848
  legacyManual: !1
1268
849
  };
1269
- const t = e.fieldScope === "domain" ? "domain" : "local", n = ((_ = e.derivedField) == null ? void 0 : _.computeStage) || ((b = e.calculatedFormula) == null ? void 0 : b.computeStage), o = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((h) => {
1270
- const Y = h && zi(h);
1271
- return typeof Y == "string" && !!Y.trim();
850
+ const t = e.fieldScope === "domain" ? "domain" : "local", i = ((_ = e.derivedField) == null ? void 0 : _.computeStage) || ((y = e.calculatedFormula) == null ? void 0 : y.computeStage), o = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((h) => {
851
+ const C = h && hi(h);
852
+ return typeof C == "string" && !!C.trim();
1272
853
  }), a = typeof e.expression == "string" && !!e.expression.trim() && o, s = e.calculationRepresentation;
1273
854
  if (e.derivedField || s === "typed-derived") {
1274
- const h = e.derivedField !== void 0 && Ie(e.derivedField).ok;
855
+ const h = e.derivedField !== void 0 && de(e.derivedField).ok;
1275
856
  return {
1276
857
  representation: "typed-derived",
1277
858
  ownership: t,
1278
859
  completeness: (!s || s === "typed-derived") && h && (!e.expression && !e.calculatedFormula || a) ? "complete" : "incomplete",
1279
- computeStage: n,
860
+ computeStage: i,
1280
861
  runtimeExecutable: a,
1281
862
  legacyManual: !1
1282
863
  };
1283
864
  }
1284
- if (!(!!s || Ki(e)))
865
+ if (!(!!s || yi(e)))
1285
866
  return {
1286
867
  representation: "physical",
1287
868
  ownership: t,
@@ -1289,7 +870,7 @@ function yt(e) {
1289
870
  runtimeExecutable: !1,
1290
871
  legacyManual: !1
1291
872
  };
1292
- const d = n || (e.role === "groupby" || ((S = e.calculatedFieldOrigin) == null ? void 0 : S.role) === "groupby" ? "row" : void 0), c = t === "domain" || ue(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" && ue(e));
873
+ const d = i || (e.role === "groupby" || ((I = e.calculatedFieldOrigin) == null ? void 0 : I.role) === "groupby" ? "row" : void 0), c = t === "domain" || J(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" && J(e));
1293
874
  return {
1294
875
  representation: p,
1295
876
  ownership: t,
@@ -1299,89 +880,89 @@ function yt(e) {
1299
880
  legacyManual: p === "manual" && t === "local" && !d
1300
881
  };
1301
882
  }
1302
- function Ga(e) {
883
+ function ia(e) {
1303
884
  if (e.calculationRepresentation) return e;
1304
- const { representation: t } = yt(e);
885
+ const { representation: t } = tt(e);
1305
886
  return t === "physical" ? e : { ...e, calculationRepresentation: t };
1306
887
  }
1307
- function za(e) {
1308
- return yt(e).computeStage;
888
+ function na(e) {
889
+ return tt(e).computeStage;
1309
890
  }
1310
- function Wa(e, t) {
891
+ function aa(e, t) {
1311
892
  return e === "aggregate" && t === "default";
1312
893
  }
1313
- function Ka(e) {
1314
- var n, o;
894
+ function oa(e) {
895
+ var i, o;
1315
896
  const t = e;
1316
- return !!(t != null && t.expression && ((o = (n = t.calculatedFormula) == null ? void 0 : n.inputFields) != null && o.length));
897
+ return !!(t != null && t.expression && ((o = (i = t.calculatedFormula) == null ? void 0 : i.inputFields) != null && o.length));
1317
898
  }
1318
- function Qa(e) {
1319
- return !!(e && (e.entityName === de || e.entityId === de));
899
+ function sa(e) {
900
+ return !!(e && (e.entityName === Z || e.entityId === Z));
1320
901
  }
1321
- function ue(e) {
902
+ function J(e) {
1322
903
  return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
1323
- (t) => t === de || t === Gi
904
+ (t) => t === Z || t === gi
1324
905
  ) : !1;
1325
906
  }
1326
- var Qi = /* @__PURE__ */ ((e) => (e.SUBTOTAL = "__SUBTOTAL__", e.TOTAL = "__TOTAL__", e.ALL = "__ALL__", e))(Qi || {});
1327
- function Xa(e) {
907
+ var bi = /* @__PURE__ */ ((e) => (e.SUBTOTAL = "__SUBTOTAL__", e.TOTAL = "__TOTAL__", e.ALL = "__ALL__", e))(bi || {});
908
+ function ra(e) {
1328
909
  return typeof e == "object" && e !== null && e.mode === "last" && e.relativeTo === "latest_data";
1329
910
  }
1330
- function Xi(e) {
911
+ function vi(e) {
1331
912
  return e === "between" || e === "not between";
1332
913
  }
1333
- const J = i.enum(["day", "week", "month", "quarter", "year"]), Zi = i.enum(["minute", "hour"]), vt = i.number().int().positive(), Be = i.number().int(), St = i.object({
1334
- mode: i.literal("last"),
1335
- n: vt,
1336
- unit: Zi,
1337
- complete: i.literal(!1).optional(),
1338
- relativeTo: i.literal("latest_data").optional()
1339
- }), It = i.object({
1340
- mode: i.literal("last"),
1341
- n: vt,
1342
- unit: J,
1343
- complete: i.boolean().optional(),
1344
- relativeTo: i.literal("latest_data").optional()
1345
- }), wt = i.object({
1346
- mode: i.literal("this"),
1347
- unit: J,
1348
- toDate: i.boolean().optional(),
1349
- boundary: i.enum(["first_day", "last_day"]).optional()
1350
- }), kt = i.object({ mode: i.literal("previous"), unit: J }), At = i.object({
1351
- mode: i.literal("between"),
1352
- unit: J,
1353
- from: Be,
1354
- to: Be
1355
- }), ce = {
914
+ const U = n.enum(["day", "week", "month", "quarter", "year"]), Ii = n.enum(["minute", "hour"]), it = n.number().int().positive(), xe = n.number().int(), nt = n.object({
915
+ mode: n.literal("last"),
916
+ n: it,
917
+ unit: Ii,
918
+ complete: n.literal(!1).optional(),
919
+ relativeTo: n.literal("latest_data").optional()
920
+ }), at = n.object({
921
+ mode: n.literal("last"),
922
+ n: it,
923
+ unit: U,
924
+ complete: n.boolean().optional(),
925
+ relativeTo: n.literal("latest_data").optional()
926
+ }), ot = n.object({
927
+ mode: n.literal("this"),
928
+ unit: U,
929
+ toDate: n.boolean().optional(),
930
+ boundary: n.enum(["first_day", "last_day"]).optional()
931
+ }), st = n.object({ mode: n.literal("previous"), unit: U }), rt = n.object({
932
+ mode: n.literal("between"),
933
+ unit: U,
934
+ from: xe,
935
+ to: xe
936
+ }), ee = {
1356
937
  check: (e) => e.boundary === void 0 || e.unit === "month",
1357
938
  message: 'A month boundary requires unit "month".'
1358
- }, Ji = i.union([
1359
- St.strict(),
1360
- It.strict(),
1361
- wt.strict().refine(ce.check, {
1362
- message: ce.message,
939
+ }, Si = n.union([
940
+ nt.strict(),
941
+ at.strict(),
942
+ ot.strict().refine(ee.check, {
943
+ message: ee.message,
1363
944
  path: ["boundary"]
1364
945
  }),
1365
- kt.strict(),
1366
- At.strict()
1367
- ]), en = i.union([
1368
- St,
1369
- It,
1370
- wt.refine(ce.check),
1371
- kt,
1372
- At
946
+ st.strict(),
947
+ rt.strict()
948
+ ]), wi = n.union([
949
+ nt,
950
+ at,
951
+ ot.refine(ee.check),
952
+ st,
953
+ rt
1373
954
  ]);
1374
- function Za(e) {
1375
- const t = en.safeParse(e);
955
+ function la(e) {
956
+ const t = wi.safeParse(e);
1376
957
  return t.success ? t.data : void 0;
1377
958
  }
1378
- const [tn, nn, an, on] = be.options, sn = i.union([
1379
- tn.innerType().strict(),
1380
- nn.extend({ type: i.literal("date") }).strict(),
1381
- an.strict(),
1382
- on.strict(),
1383
- X
1384
- ]), v = i.string().min(1), qe = i.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), xt = i.enum([
959
+ const [ki, Ai, xi, Fi] = Pe.options, Mi = n.union([
960
+ ki.innerType().strict(),
961
+ Ai.extend({ type: n.literal("date") }).strict(),
962
+ xi.strict(),
963
+ Fi.strict(),
964
+ q
965
+ ]), v = n.string().min(1), Fe = n.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), lt = n.enum([
1385
966
  "table",
1386
967
  "view",
1387
968
  "materialized view",
@@ -1390,9 +971,9 @@ const [tn, nn, an, on] = be.options, sn = i.union([
1390
971
  "dataset",
1391
972
  "url",
1392
973
  "upload"
1393
- ]), oe = i.object({
974
+ ]), W = n.object({
1394
975
  connectionId: v,
1395
- connectionType: i.enum([
976
+ connectionType: n.enum([
1396
977
  "GoogleSheets",
1397
978
  "FileUpload",
1398
979
  "MySQL",
@@ -1406,20 +987,20 @@ const [tn, nn, an, on] = be.options, sn = i.union([
1406
987
  "API",
1407
988
  "none"
1408
989
  ]),
1409
- type: xt,
990
+ type: lt,
1410
991
  name: v,
1411
992
  // Grounded relationship plans retain semantic identity and display metadata.
1412
993
  // SQL stays server-resolved; it is not accepted inside a join entity.
1413
- alias: i.string().optional(),
994
+ alias: n.string().optional(),
1414
995
  id: v.optional(),
1415
996
  domainId: v.optional(),
1416
- datasetType: i.enum(["physical", "virtual"]).optional(),
1417
- label: i.string().optional(),
1418
- description: i.string().optional(),
1419
- dbObjectType: i.string().optional(),
1420
- database: i.string().optional(),
1421
- schema: i.string().optional(),
1422
- dialect: i.enum([
997
+ datasetType: n.enum(["physical", "virtual"]).optional(),
998
+ label: n.string().optional(),
999
+ description: n.string().optional(),
1000
+ dbObjectType: n.string().optional(),
1001
+ database: n.string().optional(),
1002
+ schema: n.string().optional(),
1003
+ dialect: n.enum([
1423
1004
  "mysql",
1424
1005
  "postgres",
1425
1006
  "bigquery",
@@ -1429,44 +1010,44 @@ const [tn, nn, an, on] = be.options, sn = i.union([
1429
1010
  "duckdb",
1430
1011
  "mssql"
1431
1012
  ]).optional()
1432
- }).strict(), G = i.lazy(
1433
- () => i.object({
1013
+ }).strict(), V = n.lazy(
1014
+ () => n.object({
1434
1015
  id: v,
1435
1016
  name: v,
1436
- label: i.string(),
1017
+ label: n.string(),
1437
1018
  /** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
1438
- derivedLabel: i.string().optional(),
1019
+ derivedLabel: n.string().optional(),
1439
1020
  qualifiedFieldName: v,
1440
1021
  dataType: v,
1441
1022
  entityId: v,
1442
1023
  entityName: v,
1443
- entityType: xt,
1444
- alias: i.string().optional(),
1445
- sourceField: i.string().optional(),
1446
- source: we.optional(),
1447
- nativeDataType: i.string().optional(),
1448
- description: i.string().optional(),
1449
- qualifiedEntityName: i.string().optional(),
1450
- dateFormat: i.enum(Wi).optional(),
1451
- customFormat: i.string().optional(),
1452
- granularity: U.optional(),
1453
- role: qe.optional(),
1454
- calculationRepresentation: i.enum(["inline-expression", "manual", "typed-derived"]).optional(),
1455
- calculatedFieldOrigin: i.object({ id: v, role: qe.optional() }).strict().optional(),
1456
- aggregateOrigin: i.enum(["default", "explicit"]).optional(),
1457
- labelOrigin: i.enum(["semantic", "override"]).optional(),
1458
- formatOrigin: i.enum(["semantic", "override"]).optional(),
1459
- expression: i.string().optional(),
1460
- derivedField: ke.optional(),
1461
- format: sn.optional(),
1462
- semanticTemporalPresentation: i.object({
1463
- granularity: U,
1464
- format: X
1024
+ entityType: lt,
1025
+ alias: n.string().optional(),
1026
+ sourceField: n.string().optional(),
1027
+ source: ue.optional(),
1028
+ nativeDataType: n.string().optional(),
1029
+ description: n.string().optional(),
1030
+ qualifiedEntityName: n.string().optional(),
1031
+ dateFormat: n.enum(_i).optional(),
1032
+ customFormat: n.string().optional(),
1033
+ granularity: X.optional(),
1034
+ role: Fe.optional(),
1035
+ calculationRepresentation: n.enum(["inline-expression", "manual", "typed-derived"]).optional(),
1036
+ calculatedFieldOrigin: n.object({ id: v, role: Fe.optional() }).strict().optional(),
1037
+ aggregateOrigin: n.enum(["default", "explicit"]).optional(),
1038
+ labelOrigin: n.enum(["semantic", "override"]).optional(),
1039
+ formatOrigin: n.enum(["semantic", "override"]).optional(),
1040
+ expression: n.string().optional(),
1041
+ derivedField: ce.optional(),
1042
+ format: Mi.optional(),
1043
+ semanticTemporalPresentation: n.object({
1044
+ granularity: X,
1045
+ format: q
1465
1046
  }).strict().optional(),
1466
- aggregate: F.optional(),
1467
- fieldScope: i.enum(["card", "sheet", "dashboard", "domain"]).optional(),
1468
- calculatedFormula: i.object({
1469
- operation: i.enum([
1047
+ aggregate: Be.optional(),
1048
+ fieldScope: n.enum(["card", "sheet", "dashboard", "domain"]).optional(),
1049
+ calculatedFormula: n.object({
1050
+ operation: n.enum([
1470
1051
  "sum",
1471
1052
  "difference",
1472
1053
  "product",
@@ -1476,21 +1057,21 @@ const [tn, nn, an, on] = be.options, sn = i.union([
1476
1057
  "scale",
1477
1058
  "custom"
1478
1059
  ]),
1479
- inputFields: i.array(G),
1480
- constant: i.number().finite().optional(),
1481
- computeStage: i.enum(["row", "aggregate"]).optional()
1060
+ inputFields: n.array(V),
1061
+ constant: n.number().finite().optional(),
1062
+ computeStage: n.enum(["row", "aggregate"]).optional()
1482
1063
  }).strict().optional()
1483
1064
  }).strict()
1484
- ), rn = i.union([
1485
- i.string(),
1486
- i.number().finite(),
1487
- i.boolean(),
1488
- i.date(),
1489
- i.null()
1490
- ]), ln = i.object({
1065
+ ), Di = n.union([
1066
+ n.string(),
1067
+ n.number().finite(),
1068
+ n.boolean(),
1069
+ n.date(),
1070
+ n.null()
1071
+ ]), Ri = n.object({
1491
1072
  id: v,
1492
- field: G,
1493
- operator: i.enum([
1073
+ field: V,
1074
+ operator: n.enum([
1494
1075
  "=",
1495
1076
  "!=",
1496
1077
  ">",
@@ -1509,189 +1090,189 @@ const [tn, nn, an, on] = be.options, sn = i.union([
1509
1090
  "isNull",
1510
1091
  "isNotNull"
1511
1092
  ]),
1512
- value: i.union([rn, i.array(i.string()), i.array(i.number().finite())]),
1513
- label: i.string().optional(),
1514
- temporalBucket: le.optional(),
1515
- relativeMeta: Ji.optional(),
1516
- latestValue: i.literal(!0).optional()
1093
+ value: n.union([Di, n.array(n.string()), n.array(n.number().finite())]),
1094
+ label: n.string().optional(),
1095
+ temporalBucket: Tt.optional(),
1096
+ relativeMeta: Si.optional(),
1097
+ latestValue: n.literal(!0).optional()
1517
1098
  }).strict().superRefine((e, t) => {
1518
- const { operator: n, value: o } = e;
1519
- if ((n === "between" || n === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
1099
+ const { operator: i, value: o } = e;
1100
+ if ((i === "between" || i === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
1520
1101
  code: "custom",
1521
1102
  path: ["value"],
1522
1103
  message: "Between requires two endpoints."
1523
- }), e.relativeMeta && !Xi(n) && t.addIssue({
1104
+ }), e.relativeMeta && !vi(i) && t.addIssue({
1524
1105
  code: "custom",
1525
1106
  path: ["relativeMeta"],
1526
1107
  message: "A relative date requires between or not between."
1527
1108
  }), e.latestValue) {
1528
- const s = [e.field.nativeDataType, e.field.dataType].map((l) => xe(l)).some((l) => l === "date" || l === "datetime");
1529
- (n !== "=" || !s) && t.addIssue({
1109
+ const s = [e.field.nativeDataType, e.field.dataType].map((l) => me(l)).some((l) => l === "date" || l === "datetime");
1110
+ (i !== "=" || !s) && t.addIssue({
1530
1111
  code: "custom",
1531
1112
  path: ["latestValue"],
1532
1113
  message: "Latest value requires = on a date or timestamp field."
1533
1114
  });
1534
1115
  }
1535
- (n === "in" || n === "not in") && !Array.isArray(o) && t.addIssue({
1116
+ (i === "in" || i === "not in") && !Array.isArray(o) && t.addIssue({
1536
1117
  code: "custom",
1537
1118
  path: ["value"],
1538
1119
  message: "Membership requires an array."
1539
1120
  });
1540
- }), Rt = i.lazy(
1541
- () => i.object({
1121
+ }), dt = n.lazy(
1122
+ () => n.object({
1542
1123
  id: v,
1543
- logicalOperator: i.enum(["AND", "OR"]),
1544
- negate: i.boolean(),
1545
- conditions: i.array(ln),
1546
- groups: i.array(Rt)
1124
+ logicalOperator: n.enum(["AND", "OR"]),
1125
+ negate: n.boolean(),
1126
+ conditions: n.array(Ri),
1127
+ groups: n.array(dt)
1547
1128
  }).strict()
1548
- ), dn = i.object({
1549
- baseEntity: oe,
1550
- joins: i.array(
1551
- i.object({
1129
+ ), Ei = n.object({
1130
+ baseEntity: W,
1131
+ joins: n.array(
1132
+ n.object({
1552
1133
  id: v,
1553
- source: oe,
1554
- target: oe,
1555
- joinType: i.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
1556
- sequence: i.number().int().nonnegative(),
1557
- autoResolved: i.boolean().optional(),
1558
- relationshipId: i.string().optional(),
1559
- relationshipName: i.string().optional(),
1560
- relationshipCardinality: i.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
1561
- relationshipTraversalDirection: i.enum(["forward", "reverse"]).optional(),
1562
- joinKeyGroups: i.array(
1563
- i.object({
1134
+ source: W,
1135
+ target: W,
1136
+ joinType: n.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
1137
+ sequence: n.number().int().nonnegative(),
1138
+ autoResolved: n.boolean().optional(),
1139
+ relationshipId: n.string().optional(),
1140
+ relationshipName: n.string().optional(),
1141
+ relationshipCardinality: n.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
1142
+ relationshipTraversalDirection: n.enum(["forward", "reverse"]).optional(),
1143
+ joinKeyGroups: n.array(
1144
+ n.object({
1564
1145
  id: v,
1565
- operator: i.enum(["AND", "OR"]),
1566
- keys: i.array(
1567
- i.object({
1568
- id: i.string().optional(),
1569
- source: G,
1570
- target: G,
1571
- operator: i.enum(["=", "!=", ">", ">=", "<", "<="])
1146
+ operator: n.enum(["AND", "OR"]),
1147
+ keys: n.array(
1148
+ n.object({
1149
+ id: n.string().optional(),
1150
+ source: V,
1151
+ target: V,
1152
+ operator: n.enum(["=", "!=", ">", ">=", "<", "<="])
1572
1153
  }).strict()
1573
1154
  ).min(1)
1574
1155
  }).strict()
1575
1156
  ).min(1)
1576
1157
  }).strict()
1577
1158
  )
1578
- }).strict(), un = i.object({
1579
- axis: Fe,
1580
- levelId: i.string().uuid().optional(),
1159
+ }).strict(), Ti = n.object({
1160
+ axis: ge,
1161
+ levelId: n.string().uuid().optional(),
1581
1162
  // Persisted table preferences are edited through Immer; runtime paths remain readonly.
1582
- oppositePath: R.transform((e) => [...e]).optional()
1583
- }).strict(), w = i.string().min(1), cn = i.array(
1584
- i.enum(["body", "header", "footer", "subtotal", "grandTotal"])
1585
- ), pn = i.enum(["normal", "medium", "semibold", "bold"]), mn = i.enum(["none", "underline", "line-through"]), Ft = i.object({
1586
- version: i.literal(1),
1587
- rules: i.array(
1588
- i.object({
1589
- id: i.string().min(1),
1590
- name: i.string().optional(),
1591
- enabled: i.boolean().optional(),
1592
- target: i.object({
1593
- level: i.enum(["cell", "row"]),
1594
- matrix: un.optional(),
1595
- columnIds: i.array(w).optional(),
1163
+ oppositePath: F.transform((e) => [...e]).optional()
1164
+ }).strict(), w = n.string().min(1), Ni = n.array(
1165
+ n.enum(["body", "header", "footer", "subtotal", "grandTotal"])
1166
+ ), $i = n.enum(["normal", "medium", "semibold", "bold"]), ji = n.enum(["none", "underline", "line-through"]), ut = n.object({
1167
+ version: n.literal(1),
1168
+ rules: n.array(
1169
+ n.object({
1170
+ id: n.string().min(1),
1171
+ name: n.string().optional(),
1172
+ enabled: n.boolean().optional(),
1173
+ target: n.object({
1174
+ level: n.enum(["cell", "row"]),
1175
+ matrix: Ti.optional(),
1176
+ columnIds: n.array(w).optional(),
1596
1177
  conditionColumnId: w.optional(),
1597
- applyToColumnIds: i.array(w).optional(),
1598
- tableParts: cn.optional(),
1599
- rowRoles: i.array(i.string()).optional(),
1600
- depth: i.number().int().nonnegative().optional(),
1601
- includeTotals: i.boolean().optional(),
1602
- includeSubtotals: i.boolean().optional()
1178
+ applyToColumnIds: n.array(w).optional(),
1179
+ tableParts: Ni.optional(),
1180
+ rowRoles: n.array(n.string()).optional(),
1181
+ depth: n.number().int().nonnegative().optional(),
1182
+ includeTotals: n.boolean().optional(),
1183
+ includeSubtotals: n.boolean().optional()
1603
1184
  }).strict(),
1604
- condition: i.discriminatedUnion("kind", [
1605
- i.object({
1606
- kind: i.literal("comparison"),
1185
+ condition: n.discriminatedUnion("kind", [
1186
+ n.object({
1187
+ kind: n.literal("comparison"),
1607
1188
  columnId: w,
1608
- operator: i.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
1609
- value: L
1189
+ operator: n.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
1190
+ value: P
1610
1191
  }).strict(),
1611
- i.object({
1612
- kind: i.literal("between"),
1192
+ n.object({
1193
+ kind: n.literal("between"),
1613
1194
  columnId: w,
1614
- min: L,
1615
- max: L,
1616
- inclusive: i.boolean().optional()
1195
+ min: P,
1196
+ max: P,
1197
+ inclusive: n.boolean().optional()
1617
1198
  }).strict(),
1618
- i.object({
1619
- kind: i.literal("blank"),
1199
+ n.object({
1200
+ kind: n.literal("blank"),
1620
1201
  columnId: w,
1621
- isBlank: i.boolean()
1202
+ isBlank: n.boolean()
1622
1203
  }).strict(),
1623
- i.object({
1624
- kind: i.literal("contains"),
1204
+ n.object({
1205
+ kind: n.literal("contains"),
1625
1206
  columnId: w,
1626
- value: i.string(),
1627
- caseSensitive: i.boolean().optional(),
1628
- exact: i.boolean().optional()
1207
+ value: n.string(),
1208
+ caseSensitive: n.boolean().optional(),
1209
+ exact: n.boolean().optional()
1629
1210
  }).strict(),
1630
- i.object({
1631
- kind: i.literal("topBottom"),
1211
+ n.object({
1212
+ kind: n.literal("topBottom"),
1632
1213
  columnId: w,
1633
- direction: i.enum(["top", "bottom"]),
1634
- count: i.number().int().positive()
1214
+ direction: n.enum(["top", "bottom"]),
1215
+ count: n.number().int().positive()
1635
1216
  }).strict(),
1636
- i.object({
1637
- kind: i.literal("colorScale"),
1217
+ n.object({
1218
+ kind: n.literal("colorScale"),
1638
1219
  columnId: w,
1639
- range: i.enum(["auto", "manual"]),
1640
- min: i.number().finite().optional(),
1641
- mid: i.number().finite().optional(),
1642
- max: i.number().finite().optional(),
1643
- colors: i.object({
1644
- min: i.string(),
1645
- mid: i.string().optional(),
1646
- max: i.string()
1220
+ range: n.enum(["auto", "manual"]),
1221
+ min: n.number().finite().optional(),
1222
+ mid: n.number().finite().optional(),
1223
+ max: n.number().finite().optional(),
1224
+ colors: n.object({
1225
+ min: n.string(),
1226
+ mid: n.string().optional(),
1227
+ max: n.string()
1647
1228
  }).strict()
1648
1229
  }).strict(),
1649
- i.object({
1650
- kind: i.literal("dataBar"),
1230
+ n.object({
1231
+ kind: n.literal("dataBar"),
1651
1232
  columnId: w,
1652
- range: i.enum(["auto", "manual"]),
1653
- min: i.number().finite().optional(),
1654
- max: i.number().finite().optional(),
1655
- color: i.string(),
1656
- showValue: i.boolean().optional()
1233
+ range: n.enum(["auto", "manual"]),
1234
+ min: n.number().finite().optional(),
1235
+ max: n.number().finite().optional(),
1236
+ color: n.string(),
1237
+ showValue: n.boolean().optional()
1657
1238
  }).strict()
1658
1239
  ]),
1659
- style: i.object({
1660
- backgroundColor: i.string().optional(),
1661
- textColor: i.string().optional(),
1662
- fontWeight: pn.optional(),
1663
- italic: i.boolean().optional(),
1664
- textDecoration: mn.optional(),
1665
- icon: i.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
1666
- dataBar: i.object({ color: i.string(), showValue: i.boolean() }).strict().optional()
1240
+ style: n.object({
1241
+ backgroundColor: n.string().optional(),
1242
+ textColor: n.string().optional(),
1243
+ fontWeight: $i.optional(),
1244
+ italic: n.boolean().optional(),
1245
+ textDecoration: ji.optional(),
1246
+ icon: n.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
1247
+ dataBar: n.object({ color: n.string(), showValue: n.boolean() }).strict().optional()
1667
1248
  }).strict().optional()
1668
1249
  }).strict()
1669
1250
  )
1670
1251
  }).strict();
1671
- function Ja(e, t) {
1672
- const n = (s) => {
1673
- if (H(s)) return s.value;
1674
- const l = typeof s == "string" ? Bi(s.trim()) ?? pe(s) : pe(s);
1252
+ function da(e, t) {
1253
+ const i = (s) => {
1254
+ if (L(s)) return s.value;
1255
+ const l = typeof s == "string" ? di(s.trim()) ?? te(s) : te(s);
1675
1256
  if (l === null) return null;
1676
1257
  try {
1677
- return qi(String(l));
1258
+ return ui(String(l));
1678
1259
  } catch {
1679
1260
  return null;
1680
1261
  }
1681
- }, o = n(e), a = n(t);
1682
- return o === null || a === null ? null : ht(o, a);
1262
+ }, o = i(e), a = i(t);
1263
+ return o === null || a === null ? null : Ze(o, a);
1683
1264
  }
1684
- function eo(e, t, n) {
1685
- const o = hn(e);
1265
+ function ua(e, t, i) {
1266
+ const o = Yi(e);
1686
1267
  if (o === null) return null;
1687
- if (typeof o == "number" && typeof t == "number" && typeof n == "number") {
1688
- const h = _n(o, t, n);
1268
+ if (typeof o == "number" && typeof t == "number" && typeof i == "number") {
1269
+ const h = Pi(o, t, i);
1689
1270
  return { ratio: h, midpointComparison: Math.sign(h - 0.5) };
1690
1271
  }
1691
- if ([t, n].some((h) => typeof h == "number" && !Number.isFinite(h))) return null;
1692
- const a = [o, t, n].map((h) => {
1693
- const Y = typeof h == "number" ? x(String(h)) : h.value, [Ht, Ne = ""] = Y.split(".");
1694
- return { coefficient: Ht + Ne, scale: Ne.length };
1272
+ if ([t, i].some((h) => typeof h == "number" && !Number.isFinite(h))) return null;
1273
+ const a = [o, t, i].map((h) => {
1274
+ const C = typeof h == "number" ? x(String(h)) : h.value, [Ft, ve = ""] = C.split(".");
1275
+ return { coefficient: Ft + ve, scale: ve.length };
1695
1276
  }), s = Math.max(...a.map((h) => h.scale)), [l, d, c] = a.map(
1696
1277
  (h) => BigInt(h.coefficient) * 10n ** BigInt(s - h.scale)
1697
1278
  ), p = c - d, u = l - d;
@@ -1700,23 +1281,23 @@ function eo(e, t, n) {
1700
1281
  ratio: l >= c ? 1 : 0,
1701
1282
  midpointComparison: l >= c ? 1 : -1
1702
1283
  };
1703
- const _ = u * 2n - p, b = _ < 0n ? -1 : _ > 0n ? 1 : 0;
1704
- return { ratio: u <= 0n ? 0 : u >= p ? 1 : Number(u * 1000000000n / p) / 1e9, midpointComparison: b };
1284
+ const _ = u * 2n - p, y = _ < 0n ? -1 : _ > 0n ? 1 : 0;
1285
+ return { ratio: u <= 0n ? 0 : u >= p ? 1 : Number(u * 1000000000n / p) / 1e9, midpointComparison: y };
1705
1286
  }
1706
- function to(e) {
1287
+ function ca(e) {
1707
1288
  return !!e && typeof e == "object" && !Array.isArray(e);
1708
1289
  }
1709
- function io(e) {
1290
+ function pa(e) {
1710
1291
  return e.enabled !== !1;
1711
1292
  }
1712
- function no(e) {
1293
+ function ma(e) {
1713
1294
  return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
1714
1295
  }
1715
- function fn(e) {
1296
+ function Ci(e) {
1716
1297
  return e.columnId;
1717
1298
  }
1718
- function gn(e) {
1719
- const t = [fn(e.condition)];
1299
+ function Oi(e) {
1300
+ const t = [Ci(e.condition)];
1720
1301
  return { validationRefs: [.../* @__PURE__ */ new Set([
1721
1302
  ...t,
1722
1303
  ...e.target.conditionColumnId === void 0 ? [] : [e.target.conditionColumnId],
@@ -1724,7 +1305,7 @@ function gn(e) {
1724
1305
  ...e.target.applyToColumnIds ?? []
1725
1306
  ])], evaluationInputs: t };
1726
1307
  }
1727
- function pe(e) {
1308
+ function te(e) {
1728
1309
  if (typeof e == "number")
1729
1310
  return Number.isFinite(e) ? e : null;
1730
1311
  if (typeof e == "string" && e.trim() !== "") {
@@ -1733,30 +1314,30 @@ function pe(e) {
1733
1314
  }
1734
1315
  return null;
1735
1316
  }
1736
- function hn(e) {
1737
- return H(e) ? e : pe(e);
1317
+ function Yi(e) {
1318
+ return L(e) ? e : te(e);
1738
1319
  }
1739
- function ao(e) {
1740
- const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
1320
+ function fa(e) {
1321
+ const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
1741
1322
  for (const o of e)
1742
- H(o) ? n.add(o.value) : t.add(o);
1323
+ L(o) ? i.add(o.value) : t.add(o);
1743
1324
  return {
1744
- has: (o) => H(o) ? n.has(o.value) : t.has(o)
1325
+ has: (o) => L(o) ? i.has(o.value) : t.has(o)
1745
1326
  };
1746
1327
  }
1747
- function oo(e, t) {
1748
- return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : ht(
1328
+ function ga(e, t) {
1329
+ return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : Ze(
1749
1330
  typeof e == "number" ? x(String(e)) : e.value,
1750
1331
  typeof t == "number" ? x(String(t)) : t.value
1751
1332
  );
1752
1333
  }
1753
- function so(e) {
1334
+ function ha(e) {
1754
1335
  return e == null || e === "";
1755
1336
  }
1756
- function _n(e, t, n) {
1757
- return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) ? 0 : n === t ? e >= n ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (n - t)));
1337
+ function Pi(e, t, i) {
1338
+ 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)));
1758
1339
  }
1759
- function bn(e) {
1340
+ function Bi(e) {
1760
1341
  switch (e) {
1761
1342
  case "bold":
1762
1343
  return 700;
@@ -1770,105 +1351,105 @@ function bn(e) {
1770
1351
  return;
1771
1352
  }
1772
1353
  }
1773
- function ro(e) {
1774
- return e ? Tt({
1775
- fontWeight: bn(e.fontWeight),
1354
+ function _a(e) {
1355
+ return e ? ct({
1356
+ fontWeight: Bi(e.fontWeight),
1776
1357
  fontStyle: e.italic ? "italic" : void 0,
1777
1358
  color: e.textColor,
1778
1359
  backgroundColor: e.backgroundColor,
1779
1360
  textDecoration: e.textDecoration
1780
1361
  }) : {};
1781
1362
  }
1782
- function lo(...e) {
1363
+ function ya(...e) {
1783
1364
  return Object.assign(
1784
1365
  {},
1785
- ...e.filter((t) => !!t).map(Tt)
1366
+ ...e.filter((t) => !!t).map(ct)
1786
1367
  );
1787
1368
  }
1788
- function Tt(e) {
1369
+ function ct(e) {
1789
1370
  return Object.fromEntries(
1790
1371
  Object.entries(e).filter(([, t]) => t !== void 0)
1791
1372
  );
1792
1373
  }
1793
- const I = i.string().uuid(), yn = i.string().min(1), vn = i.number().int().positive().max(Number.MAX_SAFE_INTEGER), Sn = i.enum([
1374
+ const S = n.string().uuid(), Li = n.string().min(1), Vi = n.number().int().positive().max(Number.MAX_SAFE_INTEGER), qi = n.enum([
1794
1375
  "SUM",
1795
1376
  "COUNT",
1796
1377
  "DISTINCT",
1797
1378
  "AVG",
1798
1379
  "MIN",
1799
1380
  "MAX"
1800
- ]), Dt = Ei.omit({
1381
+ ]), pt = ei.omit({
1801
1382
  aggregate: !0
1802
- }), In = {
1803
- id: I,
1804
- field: Dt,
1805
- grain: U.optional()
1806
- }, me = i.object(In).strict(), wn = i.object({
1807
- id: I,
1808
- kind: i.literal("aggregate"),
1809
- field: Dt,
1810
- aggregate: Sn
1811
- }).strict(), kn = i.object({
1812
- id: I,
1813
- kind: i.literal("calculated"),
1814
- definition: ke
1815
- }).strict(), Mt = i.discriminatedUnion("kind", [wn, kn]), An = i.discriminatedUnion("kind", [
1816
- i.object({ kind: i.literal("member") }).strict(),
1817
- i.object({
1818
- kind: i.literal("measure"),
1819
- measureId: I,
1820
- oppositePath: R
1383
+ }), Ui = {
1384
+ id: S,
1385
+ field: pt,
1386
+ grain: X.optional()
1387
+ }, ie = n.object(Ui).strict(), Hi = n.object({
1388
+ id: S,
1389
+ kind: n.literal("aggregate"),
1390
+ field: pt,
1391
+ aggregate: qi
1392
+ }).strict(), Gi = n.object({
1393
+ id: S,
1394
+ kind: n.literal("calculated"),
1395
+ definition: ce
1396
+ }).strict(), mt = n.discriminatedUnion("kind", [Hi, Gi]), zi = n.discriminatedUnion("kind", [
1397
+ n.object({ kind: n.literal("member") }).strict(),
1398
+ n.object({
1399
+ kind: n.literal("measure"),
1400
+ measureId: S,
1401
+ oppositePath: F
1821
1402
  }).strict()
1822
- ]), xn = {
1823
- axis: Fe,
1824
- levelId: I,
1825
- scope: i.discriminatedUnion("kind", [
1826
- i.object({ kind: i.literal("level") }).strict(),
1827
- i.object({ kind: i.literal("branch"), parent: R }).strict()
1403
+ ]), Wi = {
1404
+ axis: ge,
1405
+ levelId: S,
1406
+ scope: n.discriminatedUnion("kind", [
1407
+ n.object({ kind: n.literal("level") }).strict(),
1408
+ n.object({ kind: n.literal("branch"), parent: F }).strict()
1828
1409
  ]),
1829
- target: An,
1830
- direction: i.enum(["asc", "desc"]),
1831
- nulls: i.enum(["first", "last"])
1832
- }, Et = i.object(xn).strict(), Rn = i.object({
1833
- id: I,
1834
- axis: Fe,
1835
- levelId: I,
1836
- direction: i.enum(["top", "bottom"]),
1837
- count: vn,
1838
- measureId: I,
1839
- oppositePath: R,
1840
- others: i.boolean()
1841
- }).strict(), Nt = i.object({
1842
- source: we,
1843
- rows: i.array(me).min(1).readonly(),
1844
- columns: i.array(me).readonly(),
1845
- measures: i.array(Mt).min(1).readonly(),
1846
- filters: Rt.optional(),
1847
- joinPlan: dn.optional(),
1848
- relationshipHint: i.object({ relationshipIds: i.array(yn).optional() }).strict().optional(),
1849
- sorts: i.array(Et).readonly(),
1850
- rankings: i.array(Rn).readonly()
1410
+ target: zi,
1411
+ direction: n.enum(["asc", "desc"]),
1412
+ nulls: n.enum(["first", "last"])
1413
+ }, ft = n.object(Wi).strict(), Qi = n.object({
1414
+ id: S,
1415
+ axis: ge,
1416
+ levelId: S,
1417
+ direction: n.enum(["top", "bottom"]),
1418
+ count: Vi,
1419
+ measureId: S,
1420
+ oppositePath: F,
1421
+ others: n.boolean()
1422
+ }).strict(), gt = n.object({
1423
+ source: ue,
1424
+ rows: n.array(ie).min(1).readonly(),
1425
+ columns: n.array(ie).readonly(),
1426
+ measures: n.array(mt).min(1).readonly(),
1427
+ filters: dt.optional(),
1428
+ joinPlan: Ei.optional(),
1429
+ relationshipHint: n.object({ relationshipIds: n.array(Li).optional() }).strict().optional(),
1430
+ sorts: n.array(ft).readonly(),
1431
+ rankings: n.array(Qi).readonly()
1851
1432
  }).strict();
1852
- function jt(e) {
1433
+ function ht(e) {
1853
1434
  return JSON.stringify([
1854
1435
  e.axis,
1855
1436
  e.levelId,
1856
1437
  e.scope.kind,
1857
- e.scope.kind === "branch" ? bt(e.scope.parent) : null
1438
+ e.scope.kind === "branch" ? et(e.scope.parent) : null
1858
1439
  ]);
1859
1440
  }
1860
- function g(e, t, n) {
1861
- e.addIssue({ code: "custom", path: t, message: n });
1441
+ function g(e, t, i) {
1442
+ e.addIssue({ code: "custom", path: t, message: i });
1862
1443
  }
1863
- function A(e, t, n) {
1864
- new Set(e).size !== e.length && g(t, n, "Duplicate identity.");
1444
+ function A(e, t, i) {
1445
+ new Set(e).size !== e.length && g(t, i, "Duplicate identity.");
1865
1446
  }
1866
- function C(e, t, n, o, a, s = !1) {
1867
- n.length > e[t].length && g(o, a, "Path exceeds axis depth."), n.forEach((l, d) => {
1447
+ function N(e, t, i, o, a, s = !1) {
1448
+ i.length > e[t].length && g(o, a, "Path exceeds axis depth."), i.forEach((l, d) => {
1868
1449
  var c;
1869
1450
  if (l.levelId !== ((c = e[t][d]) == null ? void 0 : c.id) && g(o, [...a, d], "Path must be an ordered axis prefix."), l.member.kind === "others") {
1870
1451
  const p = l.member.rankingId;
1871
- (s || d !== n.length - 1 || !e.rankings.some(
1452
+ (s || d !== i.length - 1 || !e.rankings.some(
1872
1453
  (u) => u.id === p && u.others && u.axis === t && u.levelId === l.levelId
1873
1454
  )) && g(
1874
1455
  o,
@@ -1878,46 +1459,46 @@ function C(e, t, n, o, a, s = !1) {
1878
1459
  }
1879
1460
  });
1880
1461
  }
1881
- function Ct(e, t, n, o) {
1882
- A(t.map(jt), n, o), t.forEach((a, s) => {
1462
+ function _t(e, t, i, o) {
1463
+ A(t.map(ht), i, o), t.forEach((a, s) => {
1883
1464
  const l = [...o, s], d = e[a.axis].findIndex((c) => c.id === a.levelId);
1884
- if (d < 0 && g(n, l, "Sort level is not on its axis."), a.scope.kind === "branch" && (C(
1465
+ if (d < 0 && g(i, l, "Sort level is not on its axis."), a.scope.kind === "branch" && (N(
1885
1466
  e,
1886
1467
  a.axis,
1887
1468
  a.scope.parent,
1888
- n,
1469
+ i,
1889
1470
  [...l, "scope", "parent"],
1890
1471
  !0
1891
1472
  ), a.scope.parent.length !== d && g(
1892
- n,
1473
+ i,
1893
1474
  l,
1894
1475
  "Branch sort must name the immediate parent of its level."
1895
1476
  )), a.target.kind === "measure") {
1896
1477
  const c = a.target.measureId;
1897
- e.measures.some((p) => p.id === c) || g(n, l, "Unknown sort measure."), C(
1478
+ e.measures.some((p) => p.id === c) || g(i, l, "Unknown sort measure."), N(
1898
1479
  e,
1899
1480
  a.axis === "rows" ? "columns" : "rows",
1900
1481
  a.target.oppositePath,
1901
- n,
1482
+ i,
1902
1483
  [...l, "target", "oppositePath"],
1903
1484
  !0
1904
1485
  );
1905
1486
  }
1906
1487
  });
1907
1488
  }
1908
- function q(e, t, n, o) {
1489
+ function Y(e, t, i, o) {
1909
1490
  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(
1910
- n,
1491
+ i,
1911
1492
  o,
1912
1493
  "Field source must belong to the same semantic domain or physical connection."
1913
1494
  );
1914
1495
  }
1915
- function se(e, t, n) {
1496
+ function Q(e, t, i) {
1916
1497
  (e.defaultAggregate === "MEDIAN" || Object.values(e.inputs).some(
1917
1498
  (o) => o.aggregate === "MEDIAN" || o.field.aggregate === "MEDIAN"
1918
- )) && g(t, n, "MEDIAN dependencies are not supported at launch."), (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && g(t, n, "This measure semantic requires a later capability.");
1499
+ )) && g(t, i, "MEDIAN dependencies are not supported at launch."), (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && g(t, i, "This measure semantic requires a later capability.");
1919
1500
  }
1920
- function $t(e, t) {
1501
+ function yt(e, t) {
1921
1502
  A(
1922
1503
  [...e.rows, ...e.columns, ...e.measures].map((a) => a.id),
1923
1504
  t,
@@ -1935,13 +1516,13 @@ function $t(e, t) {
1935
1516
  e[a].forEach((s, l) => {
1936
1517
  s.grain && s.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(s.field.dataType) && g(t, [a, l, "grain"], "Grain requires a temporal field.");
1937
1518
  });
1938
- const n = [
1519
+ const i = [
1939
1520
  ...e.rows,
1940
1521
  ...e.columns,
1941
1522
  ...e.measures.filter((a) => a.kind === "aggregate")
1942
1523
  ];
1943
- for (const a of n)
1944
- if (q(a.field.source, e.source, t, [
1524
+ for (const a of i)
1525
+ if (Y(a.field.source, e.source, t, [
1945
1526
  a.id,
1946
1527
  "field",
1947
1528
  "source"
@@ -1950,9 +1531,9 @@ function $t(e, t) {
1950
1531
  t,
1951
1532
  [a.id],
1952
1533
  "Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
1953
- ), se(a.field.derivedField, t, [a.id]);
1534
+ ), Q(a.field.derivedField, t, [a.id]);
1954
1535
  for (const s of Object.values(a.field.derivedField.inputs))
1955
- q(s.field.source, e.source, t, [a.id, "inputs"]);
1536
+ Y(s.field.source, e.source, t, [a.id, "inputs"]);
1956
1537
  }
1957
1538
  for (const a of e.measures)
1958
1539
  if (a.kind === "calculated") {
@@ -1960,9 +1541,9 @@ function $t(e, t) {
1960
1541
  t,
1961
1542
  [a.id],
1962
1543
  "Calculated measures require aggregate stage and measure role."
1963
- ), se(a.definition, t, [a.id]);
1544
+ ), Q(a.definition, t, [a.id]);
1964
1545
  for (const s of Object.values(a.definition.inputs))
1965
- q(s.field.source, e.source, t, [
1546
+ Y(s.field.source, e.source, t, [
1966
1547
  a.id,
1967
1548
  "inputs"
1968
1549
  ]);
@@ -1971,9 +1552,9 @@ function $t(e, t) {
1971
1552
  const s = (l, d) => {
1972
1553
  var c, p;
1973
1554
  if ((l.aggregate || ((c = l.derivedField) == null ? void 0 : c.computeStage) === "aggregate") && g(t, d, "Aggregate/HAVING filters are not supported."), l.derivedField) {
1974
- se(l.derivedField, t, d);
1555
+ Q(l.derivedField, t, d);
1975
1556
  for (const u of Object.values(l.derivedField.inputs))
1976
- q(u.field.source, e.source, t, d);
1557
+ Y(u.field.source, e.source, t, d);
1977
1558
  }
1978
1559
  for (const u of ((p = l.calculatedFormula) == null ? void 0 : p.inputFields) ?? [])
1979
1560
  s(u, d);
@@ -1993,8 +1574,8 @@ function $t(e, t) {
1993
1574
  ["joinPlan", "joins"]
1994
1575
  );
1995
1576
  }
1996
- Ct(e, e.sorts, t, ["sorts"]), e.rankings.forEach((a, s) => {
1997
- (!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings", s], "Unknown ranking level or measure."), C(
1577
+ _t(e, e.sorts, t, ["sorts"]), e.rankings.forEach((a, s) => {
1578
+ (!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings", s], "Unknown ranking level or measure."), N(
1998
1579
  e,
1999
1580
  a.axis === "rows" ? "columns" : "rows",
2000
1581
  a.oppositePath,
@@ -2004,33 +1585,33 @@ function $t(e, t) {
2004
1585
  );
2005
1586
  });
2006
1587
  }
2007
- const P = Nt.superRefine($t), Fn = Nt.extend({
2008
- rows: i.array(me).readonly(),
2009
- measures: i.array(Mt).readonly()
2010
- }), Tn = Fn.superRefine($t), Dn = P.innerType().extend({ kind: i.literal("matrix") }), Mn = Dn.superRefine(({ kind: e, ...t }, n) => {
2011
- const o = P.safeParse(t);
2012
- o.success || o.error.issues.forEach((a) => n.addIssue(a));
2013
- }), En = "{member}", Le = i.object({
2014
- visible: i.boolean(),
2015
- position: i.enum(["before", "after"]),
1588
+ const j = gt.superRefine(yt), Ki = gt.extend({
1589
+ rows: n.array(ie).readonly(),
1590
+ measures: n.array(mt).readonly()
1591
+ }), Xi = Ki.superRefine(yt), Zi = j.innerType().extend({ kind: n.literal("matrix") }), Ji = Zi.superRefine(({ kind: e, ...t }, i) => {
1592
+ const o = j.safeParse(t);
1593
+ o.success || o.error.issues.forEach((a) => i.addIssue(a));
1594
+ }), en = "{member}", Me = n.object({
1595
+ visible: n.boolean(),
1596
+ position: n.enum(["before", "after"]),
2016
1597
  /** As written; a subtotal's `{member}` becomes its member's name. */
2017
- label: i.string().optional()
2018
- }).strict(), Ue = i.object({
2019
- grand: Le,
2020
- levels: i.record(I, Le).readonly(),
1598
+ label: n.string().optional()
1599
+ }).strict(), De = n.object({
1600
+ grand: Me,
1601
+ levels: n.record(S, Me).readonly(),
2021
1602
  /**
2022
1603
  * Skip a subtotal that only repeats one row: an expanded group with
2023
1604
  * exactly one child shows no subtotal. Off when absent.
2024
1605
  */
2025
- skipRedundant: i.boolean().optional()
2026
- }).strict(), Ve = Ft.shape.rules.element, Nn = Ft.extend({
2027
- rules: i.array(Ve.extend({
2028
- target: Ve.shape.target.extend({
2029
- rowRoles: i.array(Vi).optional()
1606
+ skipRedundant: n.boolean().optional()
1607
+ }).strict(), Re = ut.shape.rules.element, tn = ut.extend({
1608
+ rules: n.array(Re.extend({
1609
+ target: Re.shape.target.extend({
1610
+ rowRoles: n.array(mi).optional()
2030
1611
  })
2031
1612
  }))
2032
1613
  }).superRefine((e, t) => {
2033
- var n;
1614
+ var i;
2034
1615
  A(e.rules.map((o) => o.id), t, ["rules"]);
2035
1616
  for (const o of e.rules) {
2036
1617
  const a = o.condition;
@@ -2046,48 +1627,48 @@ const P = Nt.superRefine($t), Fn = Nt.extend({
2046
1627
  t,
2047
1628
  ["rules", o.id],
2048
1629
  "Midpoint must be inside the range."
2049
- )), (n = o.style) != null && n.dataBar && g(
1630
+ )), (i = o.style) != null && i.dataBar && g(
2050
1631
  t,
2051
1632
  ["rules", o.id],
2052
1633
  "Use an explicit-range dataBar condition."
2053
1634
  );
2054
1635
  }
2055
1636
  });
2056
- function jn(e, t, n, o, a = []) {
1637
+ function nn(e, t, i, o, a = []) {
2057
1638
  for (const s of e.rules) {
2058
1639
  const l = [...a, "rules", s.id], d = s.target.matrix;
2059
- d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && C(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])), gn(s).validationRefs.some((c) => !n.has(c)) && g(o, l, "Conditional rules must reference displayed measures.");
1640
+ d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && N(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])), Oi(s).validationRefs.some((c) => !i.has(c)) && g(o, l, "Conditional rules must reference displayed measures.");
2060
1641
  }
2061
1642
  }
2062
- const Cn = {
2063
- layout: i.discriminatedUnion("kind", [
2064
- i.object({ kind: i.literal("compact") }).strict(),
2065
- i.object({ kind: i.literal("tabular"), repeatLabels: i.boolean() }).strict()
1643
+ const an = {
1644
+ layout: n.discriminatedUnion("kind", [
1645
+ n.object({ kind: n.literal("compact") }).strict(),
1646
+ n.object({ kind: n.literal("tabular"), repeatLabels: n.boolean() }).strict()
2066
1647
  ]),
2067
- absence: i.object({ emptyText: i.string(), nullText: i.string() }).strict(),
2068
- levelLabels: i.record(I, i.string()).readonly(),
2069
- measureLabels: i.record(I, i.string()).readonly(),
2070
- levelFormats: i.record(I, $e).readonly(),
2071
- measureFormats: i.record(I, $e).readonly(),
2072
- totals: i.object({ rows: Ue, columns: Ue }).strict(),
2073
- conditionalFormatting: Nn.optional()
2074
- }, Te = i.object(Cn).strict(), $n = i.object({
2075
- depth: i.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
2076
- overrides: i.array(
2077
- i.object({ path: R, expanded: i.boolean() }).strict()
1648
+ absence: n.object({ emptyText: n.string(), nullText: n.string() }).strict(),
1649
+ levelLabels: n.record(S, n.string()).readonly(),
1650
+ measureLabels: n.record(S, n.string()).readonly(),
1651
+ levelFormats: n.record(S, Se).readonly(),
1652
+ measureFormats: n.record(S, Se).readonly(),
1653
+ totals: n.object({ rows: De, columns: De }).strict(),
1654
+ conditionalFormatting: tn.optional()
1655
+ }, he = n.object(an).strict(), on = n.object({
1656
+ depth: n.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1657
+ overrides: n.array(
1658
+ n.object({ path: F, expanded: n.boolean() }).strict()
2078
1659
  ).readonly()
2079
- }).strict(), He = $n.superRefine(
1660
+ }).strict(), Ee = on.superRefine(
2080
1661
  (e, t) => A(
2081
- e.overrides.map((n) => bt(n.path)),
1662
+ e.overrides.map((i) => et(i.path)),
2082
1663
  t,
2083
1664
  ["overrides"]
2084
1665
  )
2085
- ), On = { rows: He, columns: He }, ee = i.object(On).strict(), Pn = ee.extend({ sorts: i.array(Et).readonly() }).strict(), Yn = Pn.superRefine(
2086
- (e, t) => A(e.sorts.map(jt), t, ["sorts"])
1666
+ ), sn = { rows: Ee, columns: Ee }, H = n.object(sn).strict(), rn = H.extend({ sorts: n.array(ft).readonly() }).strict(), ln = rn.superRefine(
1667
+ (e, t) => A(e.sorts.map(ht), t, ["sorts"])
2087
1668
  );
2088
- function te(e, t) {
1669
+ function G(e, t) {
2089
1670
  var c, p;
2090
- const { spec: n, presentation: o, defaults: a, session: s } = e, l = new Set([...n.rows, ...n.columns].map((u) => u.id)), d = new Set(n.measures.map((u) => u.id));
1671
+ const { spec: i, presentation: o, defaults: a, session: s } = e, l = new Set([...i.rows, ...i.columns].map((u) => u.id)), d = new Set(i.measures.map((u) => u.id));
2091
1672
  for (const u of [
2092
1673
  "levelLabels",
2093
1674
  "levelFormats",
@@ -2095,10 +1676,10 @@ function te(e, t) {
2095
1676
  "measureFormats"
2096
1677
  ]) {
2097
1678
  const _ = u.startsWith("level") ? l : d;
2098
- for (const b of Object.keys(o[u]))
2099
- _.has(b) || g(
1679
+ for (const y of Object.keys(o[u]))
1680
+ _.has(y) || g(
2100
1681
  t,
2101
- ["presentation", u, b],
1682
+ ["presentation", u, y],
2102
1683
  "Unknown presentation reference."
2103
1684
  );
2104
1685
  }
@@ -2109,74 +1690,74 @@ function te(e, t) {
2109
1690
  "Measures cannot own temporal bucket formats."
2110
1691
  );
2111
1692
  for (const [u, _] of Object.entries(o.levelFormats))
2112
- _.type === "temporal_bucket" && !((c = [...n.rows, ...n.columns].find((b) => b.id === u)) != null && c.grain) && g(
1693
+ _.type === "temporal_bucket" && !((c = [...i.rows, ...i.columns].find((y) => y.id === u)) != null && c.grain) && g(
2113
1694
  t,
2114
1695
  ["presentation", "levelFormats", u],
2115
1696
  "Temporal bucket formats require a grain."
2116
1697
  );
2117
1698
  for (const u of ["rows", "columns"]) {
2118
1699
  (p = o.totals[u].grand.label) != null && p.includes(
2119
- En
1700
+ en
2120
1701
  ) && g(
2121
1702
  t,
2122
1703
  ["presentation", "totals", u, "grand", "label"],
2123
1704
  "The grand total has no member, so its label cannot use {member}."
2124
1705
  );
2125
1706
  const _ = Object.keys(o.totals[u].levels);
2126
- (_.length !== n[u].length || _.some((b) => !n[u].some((S) => S.id === b))) && g(
1707
+ (_.length !== i[u].length || _.some((y) => !i[u].some((I) => I.id === y))) && g(
2127
1708
  t,
2128
1709
  ["presentation", "totals", u],
2129
1710
  "Subtotal map must contain exactly the current axis levels."
2130
1711
  );
2131
- for (const b of [a, ...s ? [s] : []])
2132
- for (const S of b[u].overrides)
2133
- C(
2134
- n,
1712
+ for (const y of [a, ...s ? [s] : []])
1713
+ for (const I of y[u].overrides)
1714
+ N(
1715
+ i,
2135
1716
  u,
2136
- S.path,
1717
+ I.path,
2137
1718
  t,
2138
1719
  [u, "overrides"],
2139
1720
  !0
2140
- ), S.path.length || g(
1721
+ ), I.path.length || g(
2141
1722
  t,
2142
1723
  [u, "overrides"],
2143
1724
  "Use depth to expand/collapse the root."
2144
1725
  );
2145
1726
  }
2146
- s && Ct(n, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && jn(
1727
+ s && _t(i, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && nn(
2147
1728
  o.conditionalFormatting,
2148
- n,
1729
+ i,
2149
1730
  d,
2150
1731
  t,
2151
1732
  ["presentation", "conditionalFormatting"]
2152
1733
  );
2153
1734
  }
2154
- const Bn = i.object({
2155
- spec: P,
2156
- presentation: Te,
2157
- defaults: ee,
2158
- session: Yn.optional()
2159
- }).strict(), uo = Bn.superRefine(te), qn = i.object({
2160
- version: i.literal(1),
2161
- spec: P,
2162
- presentation: Te,
2163
- defaultView: ee
2164
- }).strict(), Ln = qn.superRefine(
2165
- (e, t) => te({ ...e, defaults: e.defaultView }, t)
2166
- ), Un = Ln.innerType().extend({
2167
- spec: Tn
2168
- }), co = Un.superRefine((e, t) => te({ ...e, defaults: e.defaultView }, t)), Ge = i.object({ spec: P, presentation: Te }).strict(), Vn = i.union([
2169
- Ge.extend({
2170
- mode: i.literal("layout"),
2171
- format: i.enum(["csv", "xlsx", "pdf"]),
2172
- expansion: i.union([
2173
- ee.extend({ kind: i.literal("current") }).strict(),
2174
- i.object({ kind: i.literal("all") }).strict()
1735
+ const dn = n.object({
1736
+ spec: j,
1737
+ presentation: he,
1738
+ defaults: H,
1739
+ session: ln.optional()
1740
+ }).strict(), ba = dn.superRefine(G), un = n.object({
1741
+ version: n.literal(1),
1742
+ spec: j,
1743
+ presentation: he,
1744
+ defaultView: H
1745
+ }).strict(), cn = un.superRefine(
1746
+ (e, t) => G({ ...e, defaults: e.defaultView }, t)
1747
+ ), pn = cn.innerType().extend({
1748
+ spec: Xi
1749
+ }), va = pn.superRefine((e, t) => G({ ...e, defaults: e.defaultView }, t)), Te = n.object({ spec: j, presentation: he }).strict(), mn = n.union([
1750
+ Te.extend({
1751
+ mode: n.literal("layout"),
1752
+ format: n.enum(["csv", "xlsx", "pdf"]),
1753
+ expansion: n.union([
1754
+ H.extend({ kind: n.literal("current") }).strict(),
1755
+ n.object({ kind: n.literal("all") }).strict()
2175
1756
  ])
2176
1757
  }).strict(),
2177
- Ge.extend({ mode: i.literal("flat"), format: i.literal("csv") }).strict()
2178
- ]), po = Vn.superRefine(
2179
- (e, t) => te(
1758
+ Te.extend({ mode: n.literal("flat"), format: n.literal("csv") }).strict()
1759
+ ]), Ia = mn.superRefine(
1760
+ (e, t) => G(
2180
1761
  {
2181
1762
  ...e,
2182
1763
  defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
@@ -2187,44 +1768,44 @@ const Bn = i.object({
2187
1768
  t
2188
1769
  )
2189
1770
  );
2190
- function mo(e) {
1771
+ function Sa(e) {
2191
1772
  return e && "id" in e ? e.id : void 0;
2192
1773
  }
2193
- const Hn = "SUM";
1774
+ const fn = "SUM";
2194
1775
  function k(e) {
2195
1776
  return typeof e == "string" && e.trim().length > 0;
2196
1777
  }
2197
1778
  function E(e) {
2198
1779
  return k(e) ? e.trim().toLowerCase() : "";
2199
1780
  }
2200
- function fo(e) {
1781
+ function wa(e) {
2201
1782
  const t = k(e.id) ? e.id.trim() : void 0;
2202
1783
  if (!t) return;
2203
- const n = E(t), o = k(e.table) ? e.table.trim() : void 0;
2204
- if (!(n === E(e.name) || o && n === E(o)))
1784
+ const i = E(t), o = k(e.table) ? e.table.trim() : void 0;
1785
+ if (!(i === E(e.name) || o && i === E(o)))
2205
1786
  return t;
2206
1787
  }
2207
- function T(e) {
1788
+ function M(e) {
2208
1789
  const t = k(e.datasetId) ? e.datasetId.trim() : void 0;
2209
1790
  if (t)
2210
1791
  return E(t) === E(e.datasetName) ? void 0 : t;
2211
1792
  }
2212
- function Ot(e) {
1793
+ function bt(e) {
2213
1794
  if (e.kind !== "semantic") return e;
2214
- const t = T(e), { datasetId: n, ...o } = e;
1795
+ const t = M(e), { datasetId: i, ...o } = e;
2215
1796
  return {
2216
1797
  ...o,
2217
1798
  ...t ? { datasetId: t } : {}
2218
1799
  };
2219
1800
  }
2220
- function go(e) {
1801
+ function ka(e) {
2221
1802
  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;
2222
1803
  }
2223
- function fe(e) {
1804
+ function ne(e) {
2224
1805
  if (!e)
2225
1806
  return "";
2226
1807
  if (e.kind === "semantic") {
2227
- const t = T(e);
1808
+ const t = M(e);
2228
1809
  return [
2229
1810
  e.kind,
2230
1811
  e.domainId,
@@ -2244,7 +1825,7 @@ function fe(e) {
2244
1825
  e.label || ""
2245
1826
  ].join(":");
2246
1827
  }
2247
- function De(e, t) {
1828
+ function _e(e, t) {
2248
1829
  if (!e || !t)
2249
1830
  return e === t;
2250
1831
  if (e.kind !== t.kind)
@@ -2252,92 +1833,92 @@ function De(e, t) {
2252
1833
  if (e.kind === "semantic" && t.kind === "semantic") {
2253
1834
  if (e.domainId !== t.domainId)
2254
1835
  return !1;
2255
- const n = T(e), o = T(t);
2256
- return n && o ? n === o : e.datasetName === t.datasetName;
1836
+ const i = M(e), o = M(t);
1837
+ return i && o ? i === o : e.datasetName === t.datasetName;
2257
1838
  }
2258
- return fe(e) === fe(t);
1839
+ return ne(e) === ne(t);
2259
1840
  }
2260
- function Pt(e, t) {
2261
- return e.kind !== "semantic" || t.kind !== "semantic" ? e : Ot({
1841
+ function vt(e, t) {
1842
+ return e.kind !== "semantic" || t.kind !== "semantic" ? e : bt({
2262
1843
  ...e,
2263
1844
  datasetName: e.datasetName || t.datasetName,
2264
- datasetId: T(e) || T(t),
1845
+ datasetId: M(e) || M(t),
2265
1846
  label: e.label || t.label,
2266
1847
  connectionId: e.connectionId || t.connectionId
2267
1848
  });
2268
1849
  }
2269
- function ho(e) {
1850
+ function Aa(e) {
2270
1851
  const t = [];
2271
- for (const n of e) {
2272
- const o = Ot(
2273
- n
1852
+ for (const i of e) {
1853
+ const o = bt(
1854
+ i
2274
1855
  ), a = t.findIndex(
2275
- (s) => De(s, o)
1856
+ (s) => _e(s, o)
2276
1857
  );
2277
1858
  if (a === -1) {
2278
1859
  t.push(o);
2279
1860
  continue;
2280
1861
  }
2281
- t[a] = Pt(
1862
+ t[a] = vt(
2282
1863
  t[a],
2283
1864
  o
2284
1865
  );
2285
1866
  }
2286
1867
  return t;
2287
1868
  }
2288
- function Gn(e, t) {
2289
- return e.name === t.name && De(e.source, t.source);
1869
+ function gn(e, t) {
1870
+ return e.name === t.name && _e(e.source, t.source);
2290
1871
  }
2291
- function _o(e) {
1872
+ function xa(e) {
2292
1873
  return [
2293
- e.source ? fe(e.source) : "unknown",
2294
- Yt(e),
1874
+ e.source ? ne(e.source) : "unknown",
1875
+ It(e),
2295
1876
  e.name
2296
1877
  ].filter(Boolean).join(":");
2297
1878
  }
2298
- function Yt(e) {
2299
- return zn(
2300
- e.aggregate || Hn
1879
+ function It(e) {
1880
+ return hn(
1881
+ e.aggregate || fn
2301
1882
  );
2302
1883
  }
2303
- function zn(e) {
1884
+ function hn(e) {
2304
1885
  return e.trim().toUpperCase();
2305
1886
  }
2306
- function bo(e, t) {
1887
+ function Fa(e, t) {
2307
1888
  return {
2308
1889
  ...e,
2309
1890
  label: e.label || t.label,
2310
1891
  role: e.role || t.role,
2311
1892
  dataType: e.dataType || t.dataType,
2312
- source: e.source && t.source ? Pt(e.source, t.source) : e.source || t.source
1893
+ source: e.source && t.source ? vt(e.source, t.source) : e.source || t.source
2313
1894
  };
2314
1895
  }
2315
- function Wn(e) {
1896
+ function _n(e) {
2316
1897
  for (let t = 0; t < e.length; t += 1) {
2317
- const n = e[t];
1898
+ const i = e[t];
2318
1899
  if (e.some(
2319
- (o, a) => a !== t && qt(o, n)
1900
+ (o, a) => a !== t && wt(o, i)
2320
1901
  ))
2321
1902
  return !1;
2322
1903
  }
2323
1904
  return !0;
2324
1905
  }
2325
- function Bt(e, t) {
2326
- return Gn(e, t);
1906
+ function St(e, t) {
1907
+ return gn(e, t);
2327
1908
  }
2328
- function qt(e, t) {
2329
- return Bt(e, t) && $(e) === $(t);
1909
+ function wt(e, t) {
1910
+ return St(e, t) && $(e) === $(t);
2330
1911
  }
2331
- function Kn(e) {
1912
+ function yn(e) {
2332
1913
  return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${$(e)}). Use different aggregates to request both, or remove one entry.`;
2333
1914
  }
2334
- function ze(e) {
1915
+ function Ne(e) {
2335
1916
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
2336
1917
  }
2337
- function Qn(e, t, n) {
1918
+ function bn(e, t, i) {
2338
1919
  if (e !== void 0) {
2339
1920
  if (!e || typeof e != "object" || Array.isArray(e)) {
2340
- n.push(
1921
+ i.push(
2341
1922
  r(
2342
1923
  "invalid_sql_default_parameters",
2343
1924
  "SQL defaultParameters must be an object keyed by parameter name.",
@@ -2348,7 +1929,7 @@ function Qn(e, t, n) {
2348
1929
  }
2349
1930
  Object.entries(e).forEach(([o, a]) => {
2350
1931
  if (!o.trim()) {
2351
- n.push(
1932
+ i.push(
2352
1933
  r(
2353
1934
  "invalid_sql_default_parameter_name",
2354
1935
  "SQL defaultParameters names must be non-empty strings.",
@@ -2357,7 +1938,7 @@ function Qn(e, t, n) {
2357
1938
  );
2358
1939
  return;
2359
1940
  }
2360
- (Array.isArray(a) ? a.every(ze) : ze(a)) || n.push(
1941
+ (Array.isArray(a) ? a.every(Ne) : Ne(a)) || i.push(
2361
1942
  r(
2362
1943
  "invalid_sql_default_parameter_value",
2363
1944
  "SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
@@ -2367,71 +1948,71 @@ function Qn(e, t, n) {
2367
1948
  });
2368
1949
  }
2369
1950
  }
2370
- function Xn(e, t) {
2371
- return Me(e, t).length === 1;
1951
+ function vn(e, t) {
1952
+ return ye(e, t).length === 1;
2372
1953
  }
2373
- function Zn(e, t) {
2374
- return Me(e, t).length === 1;
1954
+ function In(e, t) {
1955
+ return ye(e, t).length === 1;
2375
1956
  }
2376
- function Me(e, t) {
1957
+ function ye(e, t) {
2377
1958
  return t.filter(
2378
- (o) => Jn(e, o)
1959
+ (o) => Sn(e, o)
2379
1960
  );
2380
1961
  }
2381
- function Jn(e, t) {
2382
- return ea(e, t) ? e.source ? Bt(t, e) : !0 : !1;
1962
+ function Sn(e, t) {
1963
+ return wn(e, t) ? e.source ? St(t, e) : !0 : !1;
2383
1964
  }
2384
- function ea(e, t) {
2385
- return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || ta(e, t) && $(t) !== $(e));
1965
+ function wn(e, t) {
1966
+ return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || kn(e, t) && $(t) !== $(e));
2386
1967
  }
2387
- function ta(e, t) {
1968
+ function kn(e, t) {
2388
1969
  return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
2389
1970
  }
2390
1971
  function $(e) {
2391
- return Yt(e);
1972
+ return It(e);
2392
1973
  }
2393
- const ia = /^(\d{4})-(\d{2})-(\d{2})$/, Lt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
2394
- function ge(e) {
1974
+ const An = /^(\d{4})-(\d{2})-(\d{2})$/, kt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
1975
+ function ae(e) {
2395
1976
  if (typeof e != "string")
2396
1977
  return null;
2397
- const t = e.trim(), n = ia.exec(t);
2398
- if (n) {
2399
- const [, b, S, h] = n;
2400
- return We(b, S, h) ? new Date(Date.UTC(Number(b), Number(S) - 1, Number(h))) : null;
1978
+ const t = e.trim(), i = An.exec(t);
1979
+ if (i) {
1980
+ const [, y, I, h] = i;
1981
+ return $e(y, I, h) ? new Date(Date.UTC(Number(y), Number(I) - 1, Number(h))) : null;
2401
1982
  }
2402
- const o = Lt.exec(t);
1983
+ const o = kt.exec(t);
2403
1984
  if (!o)
2404
1985
  return null;
2405
1986
  const [, a, s, l, d, c, p = "00", , u] = o;
2406
- if (!We(a, s, l) || !N(d, 0, 23) || !N(c, 0, 59) || !N(p, 0, 59) || !na(u))
1987
+ if (!$e(a, s, l) || !T(d, 0, 23) || !T(c, 0, 59) || !T(p, 0, 59) || !xn(u))
2407
1988
  return null;
2408
1989
  const _ = new Date(t);
2409
1990
  return Number.isFinite(_.getTime()) ? _ : null;
2410
1991
  }
2411
- function yo(e) {
2412
- return typeof e != "string" || !Lt.test(e.trim()) ? null : ge(e);
1992
+ function Ma(e) {
1993
+ return typeof e != "string" || !kt.test(e.trim()) ? null : ae(e);
2413
1994
  }
2414
- function We(e, t, n) {
2415
- const o = Number(e), a = Number(t), s = Number(n);
1995
+ function $e(e, t, i) {
1996
+ const o = Number(e), a = Number(t), s = Number(i);
2416
1997
  if (!Number.isInteger(o) || !Number.isInteger(a) || !Number.isInteger(s) || a < 1 || a > 12)
2417
1998
  return !1;
2418
1999
  const l = new Date(Date.UTC(o, a - 1, s));
2419
2000
  return l.getUTCFullYear() === o && l.getUTCMonth() === a - 1 && l.getUTCDate() === s;
2420
2001
  }
2421
- function N(e, t, n) {
2002
+ function T(e, t, i) {
2422
2003
  const o = Number(e);
2423
- return Number.isInteger(o) && o >= t && o <= n;
2004
+ return Number.isInteger(o) && o >= t && o <= i;
2424
2005
  }
2425
- function na(e) {
2006
+ function xn(e) {
2426
2007
  if (e === "Z")
2427
2008
  return !0;
2428
2009
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
2429
- return !!(t && N(t[2], 0, 23) && N(t[3], 0, 59));
2010
+ return !!(t && T(t[2], 0, 23) && T(t[3], 0, 59));
2430
2011
  }
2431
- function Ke(e, t, n) {
2012
+ function je(e, t, i) {
2432
2013
  if (e !== void 0) {
2433
2014
  if (!f(e)) {
2434
- n.push(
2015
+ i.push(
2435
2016
  r(
2436
2017
  "invalid_pagination",
2437
2018
  "Pagination must be an object with positive integer page and pageSize.",
@@ -2440,13 +2021,13 @@ function Ke(e, t, n) {
2440
2021
  );
2441
2022
  return;
2442
2023
  }
2443
- (!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && n.push(
2024
+ (!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && i.push(
2444
2025
  r(
2445
2026
  "invalid_pagination_page",
2446
2027
  "Pagination page must be a positive integer.",
2447
2028
  `${t}.page`
2448
2029
  )
2449
- ), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && n.push(
2030
+ ), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && i.push(
2450
2031
  r(
2451
2032
  "invalid_pagination_page_size",
2452
2033
  "Pagination pageSize must be a positive integer.",
@@ -2455,18 +2036,18 @@ function Ke(e, t, n) {
2455
2036
  );
2456
2037
  }
2457
2038
  }
2458
- function Qe(e) {
2039
+ function Ce(e) {
2459
2040
  const t = /* @__PURE__ */ new Set();
2460
- for (const n of e) {
2461
- if (t.has(n))
2462
- return n;
2463
- t.add(n);
2041
+ for (const i of e) {
2042
+ if (t.has(i))
2043
+ return i;
2044
+ t.add(i);
2464
2045
  }
2465
2046
  return null;
2466
2047
  }
2467
- function aa(e, t, n) {
2048
+ function Fn(e, t, i) {
2468
2049
  if (!f(e)) {
2469
- n.push(
2050
+ i.push(
2470
2051
  r(
2471
2052
  "invalid_input_binding",
2472
2053
  "Input bindings must be structured objects.",
@@ -2475,27 +2056,27 @@ function aa(e, t, n) {
2475
2056
  );
2476
2057
  return;
2477
2058
  }
2478
- m(e.inputId) || n.push(
2059
+ m(e.inputId) || i.push(
2479
2060
  r(
2480
2061
  "invalid_input_binding",
2481
2062
  "Input bindings need a non-empty inputId.",
2482
2063
  `${t}.inputId`
2483
2064
  )
2484
- ), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && n.push(
2065
+ ), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && i.push(
2485
2066
  r(
2486
2067
  "invalid_input_binding",
2487
2068
  "Input binding kind must be filter or control.",
2488
2069
  `${t}.kind`
2489
2070
  )
2490
- ), e.field !== void 0 && y(e.field, `${t}.field`, n), e.relationshipHint !== void 0 && Ee(
2071
+ ), e.field !== void 0 && b(e.field, `${t}.field`, i), e.relationshipHint !== void 0 && be(
2491
2072
  e.relationshipHint,
2492
2073
  `${t}.relationshipHint`,
2493
- n
2074
+ i
2494
2075
  );
2495
2076
  }
2496
- function Ee(e, t, n) {
2077
+ function be(e, t, i) {
2497
2078
  if (!f(e)) {
2498
- n.push(
2079
+ i.push(
2499
2080
  r(
2500
2081
  "invalid_relationship_hint",
2501
2082
  "Relationship hints must be structured objects.",
@@ -2504,7 +2085,7 @@ function Ee(e, t, n) {
2504
2085
  );
2505
2086
  return;
2506
2087
  }
2507
- e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((o) => !m(o))) && n.push(
2088
+ e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((o) => !m(o))) && i.push(
2508
2089
  r(
2509
2090
  "invalid_relationship_hint",
2510
2091
  "Relationship hint relationshipIds must be non-empty strings.",
@@ -2512,7 +2093,7 @@ function Ee(e, t, n) {
2512
2093
  )
2513
2094
  );
2514
2095
  }
2515
- function oa(e, t) {
2096
+ function Mn(e, t) {
2516
2097
  var o, a;
2517
2098
  if (((o = e.source) == null ? void 0 : o.kind) !== "semantic" && ((a = e.source) == null ? void 0 : a.kind) !== "physical" && t.push(
2518
2099
  r(
@@ -2533,7 +2114,7 @@ function oa(e, t) {
2533
2114
  "search"
2534
2115
  )
2535
2116
  ), e.matchValues !== void 0) {
2536
- const s = Qt(e.matchValues);
2117
+ const s = $t(e.matchValues);
2537
2118
  s.ok || t.push(
2538
2119
  r("invalid_input_options_match_values", s.error, "matchValues")
2539
2120
  ), typeof e.search == "string" && e.search.trim() && t.push(
@@ -2556,7 +2137,7 @@ function oa(e, t) {
2556
2137
  "Input options intent needs a labelField.",
2557
2138
  "labelField"
2558
2139
  )
2559
- ), y(e.labelField, "labelField", t, {
2140
+ ), b(e.labelField, "labelField", t, {
2560
2141
  required: !0
2561
2142
  }), (!e.valueField || !m(e.valueField.name)) && t.push(
2562
2143
  r(
@@ -2564,12 +2145,12 @@ function oa(e, t) {
2564
2145
  "Input options intent needs a valueField.",
2565
2146
  "valueField"
2566
2147
  )
2567
- ), y(e.valueField, "valueField", t, {
2148
+ ), b(e.valueField, "valueField", t, {
2568
2149
  required: !0
2569
- }), e.searchField !== void 0 && y(e.searchField, "searchField", t, {
2150
+ }), e.searchField !== void 0 && b(e.searchField, "searchField", t, {
2570
2151
  required: !0
2571
2152
  }), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((s, l) => {
2572
- y(s, `disambiguationFields.${l}`, t, {
2153
+ b(s, `disambiguationFields.${l}`, t, {
2573
2154
  required: !0
2574
2155
  });
2575
2156
  }) : t.push(
@@ -2587,7 +2168,7 @@ function oa(e, t) {
2587
2168
  path: `disambiguationFields.${l}`
2588
2169
  })) : []
2589
2170
  ].forEach(({ field: s, path: l }) => {
2590
- s != null && s.source && !De(s.source, e.source) && t.push(
2171
+ s != null && s.source && !_e(s.source, e.source) && t.push(
2591
2172
  r(
2592
2173
  "input_options_field_source_mismatch",
2593
2174
  "Input option fields must belong to the declared option source.",
@@ -2595,10 +2176,10 @@ function oa(e, t) {
2595
2176
  )
2596
2177
  );
2597
2178
  }), e.dependencies !== void 0) {
2598
- const s = ra(
2179
+ const s = Rn(
2599
2180
  e.dependencies
2600
2181
  );
2601
- t.push(...s.errors), s.ok && da(e, t);
2182
+ t.push(...s.errors), s.ok && Tn(e, t);
2602
2183
  }
2603
2184
  if (e.population !== void 0) {
2604
2185
  const s = e.population;
@@ -2630,11 +2211,11 @@ function oa(e, t) {
2630
2211
  "Input options population relationshipHint is only valid for related_population.",
2631
2212
  "population.relationshipHint"
2632
2213
  )
2633
- ), l === "related_population" && (ve(
2214
+ ), l === "related_population" && (re(
2634
2215
  s.baseSource,
2635
2216
  "population.baseSource",
2636
2217
  t
2637
- ), s.relationshipHint !== void 0 && Ee(
2218
+ ), s.relationshipHint !== void 0 && be(
2638
2219
  s.relationshipHint,
2639
2220
  "population.relationshipHint",
2640
2221
  t
@@ -2642,7 +2223,7 @@ function oa(e, t) {
2642
2223
  }
2643
2224
  }
2644
2225
  }
2645
- function sa(e, t) {
2226
+ function Dn(e, t) {
2646
2227
  if (!(!("inputs" in e) || e.inputs === void 0)) {
2647
2228
  if (!Array.isArray(e.inputs)) {
2648
2229
  t.push(
@@ -2655,53 +2236,53 @@ function sa(e, t) {
2655
2236
  return;
2656
2237
  }
2657
2238
  e.inputs.forEach(
2658
- (n, o) => aa(n, `inputs.${o}`, t)
2239
+ (i, o) => Fn(i, `inputs.${o}`, t)
2659
2240
  );
2660
2241
  }
2661
2242
  }
2662
- function ra(e, t = "protocol") {
2663
- const n = [];
2243
+ function Rn(e, t = "protocol") {
2244
+ const i = [];
2664
2245
  if (!f(e))
2665
- return n.push(
2246
+ return i.push(
2666
2247
  r(
2667
2248
  "invalid_input_options_dependencies",
2668
2249
  "Input options dependencies must be a structured object.",
2669
2250
  "dependencies"
2670
2251
  )
2671
- ), { ok: !1, errors: n, warnings: [] };
2252
+ ), { ok: !1, errors: i, warnings: [] };
2672
2253
  const o = e, a = o.mode;
2673
- if (a !== void 0 && a !== "independent" && a !== "explicit" && a !== "all_applicable" && n.push(
2254
+ if (a !== void 0 && a !== "independent" && a !== "explicit" && a !== "all_applicable" && i.push(
2674
2255
  r(
2675
2256
  "invalid_input_options_dependencies",
2676
2257
  "Input options dependencies mode must be independent, explicit, or all_applicable.",
2677
2258
  "dependencies.mode"
2678
2259
  )
2679
- ), re(
2260
+ ), K(
2680
2261
  o.includeInputIds,
2681
2262
  "dependencies.includeInputIds",
2682
- n,
2263
+ i,
2683
2264
  "Input options includeInputIds must be non-empty strings."
2684
- ), re(
2265
+ ), K(
2685
2266
  o.excludeInputIds,
2686
2267
  "dependencies.excludeInputIds",
2687
- n,
2268
+ i,
2688
2269
  "Input options excludeInputIds must be non-empty strings."
2689
- ), a === "all_applicable" && o.includeInputIds !== void 0 && n.push(
2270
+ ), a === "all_applicable" && o.includeInputIds !== void 0 && i.push(
2690
2271
  r(
2691
2272
  "invalid_input_options_dependencies",
2692
2273
  "All applicable dependencies cannot specify includeInputIds.",
2693
2274
  "dependencies.includeInputIds"
2694
2275
  )
2695
- ), re(
2276
+ ), K(
2696
2277
  o.omitInputIds,
2697
2278
  "dependencies.omitInputIds",
2698
- n,
2279
+ i,
2699
2280
  "Input options omitInputIds must be non-empty strings."
2700
2281
  ), Array.isArray(o.omitInputIds)) {
2701
2282
  const s = new Set(
2702
2283
  Array.isArray(o.includeInputIds) ? o.includeInputIds : []
2703
2284
  );
2704
- (a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !s.has(l))) && n.push(
2285
+ (a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !s.has(l))) && i.push(
2705
2286
  r(
2706
2287
  "invalid_input_options_dependencies",
2707
2288
  "A browse override may only omit unique ids from an explicit includeInputIds list.",
@@ -2709,11 +2290,11 @@ function ra(e, t = "protocol") {
2709
2290
  )
2710
2291
  );
2711
2292
  }
2712
- return t === "dashboard" && la(o, n), { ok: n.length === 0, errors: n, warnings: [] };
2293
+ return t === "dashboard" && En(o, i), { ok: i.length === 0, errors: i, warnings: [] };
2713
2294
  }
2714
- function la(e, t) {
2715
- const { mode: n, includeInputIds: o, excludeInputIds: a } = e;
2716
- n === void 0 && t.push(
2295
+ function En(e, t) {
2296
+ const { mode: i, includeInputIds: o, excludeInputIds: a } = e;
2297
+ i === void 0 && t.push(
2717
2298
  r(
2718
2299
  "invalid_input_options_dependencies",
2719
2300
  "Dashboard option dependencies must declare a mode.",
@@ -2731,13 +2312,13 @@ function la(e, t) {
2731
2312
  s
2732
2313
  )
2733
2314
  );
2734
- n === "independent" && (o !== void 0 || a !== void 0) && t.push(
2315
+ i === "independent" && (o !== void 0 || a !== void 0) && t.push(
2735
2316
  r(
2736
2317
  "invalid_input_options_dependencies",
2737
2318
  "Independent dashboard dependencies cannot specify input IDs.",
2738
2319
  "dependencies"
2739
2320
  )
2740
- ), n === "explicit" && (!Array.isArray(o) || o.length === 0 || a !== void 0) && t.push(
2321
+ ), i === "explicit" && (!Array.isArray(o) || o.length === 0 || a !== void 0) && t.push(
2741
2322
  r(
2742
2323
  "invalid_input_options_dependencies",
2743
2324
  "Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
@@ -2745,13 +2326,13 @@ function la(e, t) {
2745
2326
  )
2746
2327
  );
2747
2328
  }
2748
- function da(e, t) {
2329
+ function Tn(e, t) {
2749
2330
  var a, s, l;
2750
- const n = new Set(
2331
+ const i = new Set(
2751
2332
  Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
2752
2333
  ), o = new Set(((a = e.dependencies) == null ? void 0 : a.omitInputIds) || []);
2753
2334
  for (const d of ((s = e.dependencies) == null ? void 0 : s.includeInputIds) || [])
2754
- !n.has(d) && !o.has(d) && t.push(
2335
+ !i.has(d) && !o.has(d) && t.push(
2755
2336
  r(
2756
2337
  "invalid_input_options_dependencies",
2757
2338
  `Input options dependency "${d}" is not declared in inputs.`,
@@ -2759,7 +2340,7 @@ function da(e, t) {
2759
2340
  )
2760
2341
  );
2761
2342
  for (const d of ((l = e.dependencies) == null ? void 0 : l.excludeInputIds) || [])
2762
- d !== e.inputId && !n.has(d) && t.push(
2343
+ d !== e.inputId && !i.has(d) && t.push(
2763
2344
  r(
2764
2345
  "invalid_input_options_dependencies",
2765
2346
  `Input options dependency exclusion "${d}" is not the populated inputId and is not declared in inputs.`,
@@ -2767,13 +2348,13 @@ function da(e, t) {
2767
2348
  )
2768
2349
  );
2769
2350
  }
2770
- function re(e, t, n, o) {
2771
- e !== void 0 && (!Array.isArray(e) || e.some((a) => !m(a))) && n.push(r("invalid_input_options_dependencies", o, t));
2351
+ function K(e, t, i, o) {
2352
+ e !== void 0 && (!Array.isArray(e) || e.some((a) => !m(a))) && i.push(r("invalid_input_options_dependencies", o, t));
2772
2353
  }
2773
- const ua = new Set(z);
2774
- function ca(e, t, n) {
2354
+ const Nn = new Set(Le);
2355
+ function $n(e, t, i) {
2775
2356
  if (f(e) && e.type === "temporal_bucket") {
2776
- n.push(
2357
+ i.push(
2777
2358
  r(
2778
2359
  "invalid_scalar_value_format",
2779
2360
  "Scalar and measure slots cannot own temporal bucket presentation; declare it with grain on a grouped field or axis.",
@@ -2782,11 +2363,11 @@ function ca(e, t, n) {
2782
2363
  );
2783
2364
  return;
2784
2365
  }
2785
- rt(e, t, n);
2366
+ qe(e, t, i);
2786
2367
  }
2787
- function Xe(e, t, n) {
2368
+ function Oe(e, t, i) {
2788
2369
  if (!f(e)) {
2789
- n.push(
2370
+ i.push(
2790
2371
  r(
2791
2372
  "invalid_result_column_ref",
2792
2373
  "Result calculation references must use columnKey or field.",
@@ -2797,7 +2378,7 @@ function Xe(e, t, n) {
2797
2378
  }
2798
2379
  const o = m(e.columnKey), a = f(e.field);
2799
2380
  if (o === a) {
2800
- n.push(
2381
+ i.push(
2801
2382
  r(
2802
2383
  "invalid_result_column_ref",
2803
2384
  "Result calculation references must identify exactly one of columnKey or field.",
@@ -2806,13 +2387,13 @@ function Xe(e, t, n) {
2806
2387
  );
2807
2388
  return;
2808
2389
  }
2809
- a && y(e.field, `${t}.field`, n, {
2390
+ a && b(e.field, `${t}.field`, i, {
2810
2391
  required: !0
2811
2392
  });
2812
2393
  }
2813
- function pa(e, t, n) {
2394
+ function jn(e, t, i) {
2814
2395
  if (!f(e)) {
2815
- n.push(
2396
+ i.push(
2816
2397
  r(
2817
2398
  "invalid_result_calculation_output",
2818
2399
  "Result calculation output must be a structured object.",
@@ -2821,21 +2402,21 @@ function pa(e, t, n) {
2821
2402
  );
2822
2403
  return;
2823
2404
  }
2824
- m(e.key) || n.push(
2405
+ m(e.key) || i.push(
2825
2406
  r(
2826
2407
  "invalid_result_calculation_output",
2827
2408
  "Result calculation output needs a stable key.",
2828
2409
  `${t}.key`
2829
2410
  )
2830
- ), e.dataType !== void 0 && (typeof e.dataType != "string" || !st.has(e.dataType)) && n.push(
2411
+ ), e.dataType !== void 0 && (typeof e.dataType != "string" || !Ve.has(e.dataType)) && i.push(
2831
2412
  r(
2832
2413
  "invalid_result_calculation_output",
2833
2414
  "Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
2834
2415
  `${t}.dataType`
2835
2416
  )
2836
- ), ca(e.format, `${t}.format`, n);
2417
+ ), $n(e.format, `${t}.format`, i);
2837
2418
  }
2838
- function ma(e, t) {
2419
+ function Cn(e, t) {
2839
2420
  if (e.analysis === void 0)
2840
2421
  return;
2841
2422
  if (!f(e.analysis)) {
@@ -2877,36 +2458,36 @@ function ma(e, t) {
2877
2458
  "analysis.orderBy"
2878
2459
  )
2879
2460
  );
2880
- const { timeWindow: n } = e.analysis;
2881
- n !== void 0 && he(n, "analysis.timeWindow", t);
2882
- }
2883
- const fa = new Set(
2884
- Xt
2885
- ), ga = new Set(
2886
- Zt
2887
- ), ha = new Set(
2888
- Jt
2461
+ const { timeWindow: i } = e.analysis;
2462
+ i !== void 0 && oe(i, "analysis.timeWindow", t);
2463
+ }
2464
+ const On = new Set(
2465
+ jt
2466
+ ), Yn = new Set(
2467
+ Ct
2468
+ ), Pn = new Set(
2469
+ Ot
2889
2470
  );
2890
- function _a(e, t, n) {
2891
- fa.has(e.unit) || n.push(
2471
+ function Bn(e, t, i) {
2472
+ On.has(e.unit) || i.push(
2892
2473
  r(
2893
2474
  "invalid_time_window",
2894
2475
  "Calendar time window unit must be one of: day, week, month, quarter, year.",
2895
2476
  `${t}.unit`
2896
2477
  )
2897
- ), e.period !== "this" && e.period !== "previous" && n.push(
2478
+ ), e.period !== "this" && e.period !== "previous" && i.push(
2898
2479
  r(
2899
2480
  "invalid_time_window",
2900
2481
  "Calendar time window period must be this or previous.",
2901
2482
  `${t}.period`
2902
2483
  )
2903
- ), e.toDate !== void 0 && typeof e.toDate != "boolean" ? n.push(
2484
+ ), e.toDate !== void 0 && typeof e.toDate != "boolean" ? i.push(
2904
2485
  r(
2905
2486
  "invalid_time_window",
2906
2487
  "Calendar time window toDate must be a boolean.",
2907
2488
  `${t}.toDate`
2908
2489
  )
2909
- ) : e.toDate === !0 && e.period !== "this" && n.push(
2490
+ ) : e.toDate === !0 && e.period !== "this" && i.push(
2910
2491
  r(
2911
2492
  "invalid_time_window",
2912
2493
  "Calendar time window toDate is only allowed with period this.",
@@ -2914,9 +2495,9 @@ function _a(e, t, n) {
2914
2495
  )
2915
2496
  );
2916
2497
  }
2917
- function he(e, t, n) {
2498
+ function oe(e, t, i) {
2918
2499
  if (!f(e)) {
2919
- n.push(
2500
+ i.push(
2920
2501
  r(
2921
2502
  "invalid_time_window",
2922
2503
  "Time window must be a structured object.",
@@ -2925,44 +2506,44 @@ function he(e, t, n) {
2925
2506
  );
2926
2507
  return;
2927
2508
  }
2928
- if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "calendar" && e.kind !== "absolute" && n.push(
2509
+ if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "calendar" && e.kind !== "absolute" && i.push(
2929
2510
  r(
2930
2511
  "invalid_time_window",
2931
2512
  "Time window kind must be relative, calendar or absolute.",
2932
2513
  `${t}.kind`
2933
2514
  )
2934
2515
  ), e.kind === "calendar") {
2935
- _a(e, t, n);
2516
+ Bn(e, t, i);
2936
2517
  return;
2937
2518
  }
2938
2519
  if (e.kind === "absolute") {
2939
- if (m(e.start) || n.push(
2520
+ if (m(e.start) || i.push(
2940
2521
  r(
2941
2522
  "invalid_time_window",
2942
2523
  "Absolute time window start must be a non-empty ISO date or timestamp string.",
2943
2524
  `${t}.start`
2944
2525
  )
2945
- ), m(e.end) || n.push(
2526
+ ), m(e.end) || i.push(
2946
2527
  r(
2947
2528
  "invalid_time_window",
2948
2529
  "Absolute time window end must be a non-empty ISO date or timestamp string.",
2949
2530
  `${t}.end`
2950
2531
  )
2951
2532
  ), m(e.start) && m(e.end)) {
2952
- const o = ge(e.start), a = ge(e.end);
2953
- o || n.push(
2533
+ const o = ae(e.start), a = ae(e.end);
2534
+ o || i.push(
2954
2535
  r(
2955
2536
  "invalid_time_window",
2956
2537
  "Absolute time window start must be a valid ISO date or timestamp.",
2957
2538
  `${t}.start`
2958
2539
  )
2959
- ), a || n.push(
2540
+ ), a || i.push(
2960
2541
  r(
2961
2542
  "invalid_time_window",
2962
2543
  "Absolute time window end must be a valid ISO date or timestamp.",
2963
2544
  `${t}.end`
2964
2545
  )
2965
- ), o && a && o.getTime() > a.getTime() && n.push(
2546
+ ), o && a && o.getTime() > a.getTime() && i.push(
2966
2547
  r(
2967
2548
  "invalid_time_window",
2968
2549
  "Absolute time window start must be before or equal to end.",
@@ -2972,25 +2553,25 @@ function he(e, t, n) {
2972
2553
  }
2973
2554
  return;
2974
2555
  }
2975
- (typeof e.unit != "string" || !ua.has(e.unit)) && n.push(
2556
+ (typeof e.unit != "string" || !Nn.has(e.unit)) && i.push(
2976
2557
  r(
2977
2558
  "invalid_time_window",
2978
- `Time window unit must be one of: ${z.join(", ")}.`,
2559
+ `Time window unit must be one of: ${Le.join(", ")}.`,
2979
2560
  `${t}.unit`
2980
2561
  )
2981
- ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && n.push(
2562
+ ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && i.push(
2982
2563
  r(
2983
2564
  "invalid_time_window",
2984
2565
  "Time window value must be a positive number.",
2985
2566
  `${t}.value`
2986
2567
  )
2987
- ), e.anchor !== void 0 && !ga.has(e.anchor) && n.push(
2568
+ ), e.anchor !== void 0 && !Yn.has(e.anchor) && i.push(
2988
2569
  r(
2989
2570
  "invalid_time_window",
2990
2571
  "Time window anchor must be now or latest_available.",
2991
2572
  `${t}.anchor`
2992
2573
  )
2993
- ), e.completeness !== void 0 && !ha.has(e.completeness) && n.push(
2574
+ ), e.completeness !== void 0 && !Pn.has(e.completeness) && i.push(
2994
2575
  r(
2995
2576
  "invalid_time_window",
2996
2577
  "Time window completeness must be include_partial or complete_periods.",
@@ -2998,10 +2579,10 @@ function he(e, t, n) {
2998
2579
  )
2999
2580
  );
3000
2581
  }
3001
- function _e(e, t, n) {
2582
+ function se(e, t, i) {
3002
2583
  if (e !== void 0) {
3003
2584
  if (!Array.isArray(e)) {
3004
- n.push(
2585
+ i.push(
3005
2586
  r(
3006
2587
  "invalid_analytics_filters",
3007
2588
  "Analytics filters must be an array.",
@@ -3014,7 +2595,7 @@ function _e(e, t, n) {
3014
2595
  var c;
3015
2596
  const s = `${t}.${a}`;
3016
2597
  if (!f(o)) {
3017
- n.push(
2598
+ i.push(
3018
2599
  r(
3019
2600
  "invalid_analytics_filter",
3020
2601
  "Analytics filter must be a structured object.",
@@ -3024,15 +2605,15 @@ function _e(e, t, n) {
3024
2605
  return;
3025
2606
  }
3026
2607
  const l = o;
3027
- y(l.field, `${s}.field`, n, {
2608
+ b(l.field, `${s}.field`, i, {
3028
2609
  required: !0
3029
- }), l.scope !== void 0 && l.scope !== "row" && l.scope !== "aggregate" && n.push(
2610
+ }), l.scope !== void 0 && l.scope !== "row" && l.scope !== "aggregate" && i.push(
3030
2611
  r(
3031
2612
  "invalid_analytics_filter_scope",
3032
2613
  "Analytics filter scope must be row or aggregate.",
3033
2614
  `${s}.scope`
3034
2615
  )
3035
- ), l.scope === "aggregate" && ((c = l.field) == null ? void 0 : c.role) !== void 0 && l.field.role !== "measure" && n.push(
2616
+ ), l.scope === "aggregate" && ((c = l.field) == null ? void 0 : c.role) !== void 0 && l.field.role !== "measure" && i.push(
3036
2617
  r(
3037
2618
  "invalid_analytics_filter_scope",
3038
2619
  "Aggregate-scope analytics filters must target a measure field.",
@@ -3040,20 +2621,20 @@ function _e(e, t, n) {
3040
2621
  )
3041
2622
  );
3042
2623
  const d = l.operator === "is_null" || l.operator === "is_not_null";
3043
- 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" && n.push(
2624
+ 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(
3044
2625
  r(
3045
2626
  "invalid_analytics_filter_operator",
3046
2627
  "Analytics filter operator is not supported.",
3047
2628
  `${s}.operator`
3048
2629
  )
3049
- ), l.values === void 0 && !d && n.push(
2630
+ ), l.values === void 0 && !d && i.push(
3050
2631
  r(
3051
2632
  "missing_analytics_filter_value",
3052
2633
  "Analytics filter needs values unless it is a null check.",
3053
2634
  s
3054
2635
  )
3055
2636
  ), d && l.values !== void 0) {
3056
- n.push(
2637
+ i.push(
3057
2638
  r(
3058
2639
  "invalid_analytics_filter_values",
3059
2640
  "Null-check analytics filters must not include values.",
@@ -3063,7 +2644,7 @@ function _e(e, t, n) {
3063
2644
  return;
3064
2645
  }
3065
2646
  if (l.values !== void 0 && !Array.isArray(l.values)) {
3066
- n.push(
2647
+ i.push(
3067
2648
  r(
3068
2649
  "invalid_analytics_filter_values",
3069
2650
  "Analytics filter values must be an array when provided.",
@@ -3075,7 +2656,7 @@ function _e(e, t, n) {
3075
2656
  if (l.values !== void 0) {
3076
2657
  const p = l.values.length;
3077
2658
  if (l.operator === "between" || l.operator === "not_between") {
3078
- p !== 2 && n.push(
2659
+ p !== 2 && i.push(
3079
2660
  r(
3080
2661
  "invalid_analytics_filter_values",
3081
2662
  "Between analytics filters must include exactly two values.",
@@ -3084,7 +2665,7 @@ function _e(e, t, n) {
3084
2665
  );
3085
2666
  return;
3086
2667
  }
3087
- (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 && n.push(
2668
+ (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(
3088
2669
  r(
3089
2670
  "invalid_analytics_filter_values",
3090
2671
  "Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
@@ -3095,7 +2676,7 @@ function _e(e, t, n) {
3095
2676
  });
3096
2677
  }
3097
2678
  }
3098
- function vo(e) {
2679
+ function Da(e) {
3099
2680
  const t = [];
3100
2681
  if (!f(e))
3101
2682
  return t.push(
@@ -3122,15 +2703,15 @@ function vo(e) {
3122
2703
  "Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
3123
2704
  "kind"
3124
2705
  )
3125
- ), Xe(e.input, "input", t), pa(e.output, "output", t), e.kind === "percent_of_total") {
3126
- const n = e.denominator;
3127
- n !== void 0 && (f(n) ? n.scope === "population" ? (y(n.metric, "denominator.metric", t, {
2706
+ ), Oe(e.input, "input", t), jn(e.output, "output", t), e.kind === "percent_of_total") {
2707
+ const i = e.denominator;
2708
+ i !== void 0 && (f(i) ? i.scope === "population" ? (b(i.metric, "denominator.metric", t, {
3128
2709
  required: !0
3129
- }), _e(
3130
- n.filters,
2710
+ }), se(
2711
+ i.filters,
3131
2712
  "denominator.filters",
3132
2713
  t
3133
- )) : n.scope !== "returned_result" && t.push(
2714
+ )) : i.scope !== "returned_result" && t.push(
3134
2715
  r(
3135
2716
  "invalid_result_calculation_denominator",
3136
2717
  "Percent-of-total denominator scope must be returned_result or population.",
@@ -3150,11 +2731,11 @@ function vo(e) {
3150
2731
  "Rank result calculation order must be asc or desc.",
3151
2732
  "order"
3152
2733
  )
3153
- ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && Xe(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
2734
+ ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && Oe(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
3154
2735
  }
3155
- function Ut(e) {
2736
+ function At(e) {
3156
2737
  var o;
3157
- const t = [], n = [];
2738
+ const t = [], i = [];
3158
2739
  if (!e || typeof e != "object")
3159
2740
  return {
3160
2741
  ok: !1,
@@ -3164,7 +2745,7 @@ function Ut(e) {
3164
2745
  "Analytics intent must be a structured object."
3165
2746
  )
3166
2747
  ],
3167
- warnings: n,
2748
+ warnings: i,
3168
2749
  repairHints: [
3169
2750
  {
3170
2751
  code: "invalid_analytics_intent",
@@ -3173,8 +2754,8 @@ function Ut(e) {
3173
2754
  ]
3174
2755
  };
3175
2756
  if (e.kind === "matrix") {
3176
- const a = Mn.safeParse(e);
3177
- return a.success || t.push(...a.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: n, repairHints: Ze(t) };
2757
+ const a = Ji.safeParse(e);
2758
+ return a.success || t.push(...a.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: i, repairHints: Ye(t) };
3178
2759
  }
3179
2760
  if (e.version !== void 0 && e.version !== 1 && t.push(
3180
2761
  r(
@@ -3182,7 +2763,7 @@ function Ut(e) {
3182
2763
  "Analytics intent version must be 1.",
3183
2764
  "version"
3184
2765
  )
3185
- ), ve(e.source, "source", t), ba(e, t), sa(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Ee(
2766
+ ), re(e.source, "source", t), Ln(e, t), Dn(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && be(
3186
2767
  e.relationshipHint,
3187
2768
  "relationshipHint",
3188
2769
  t
@@ -3205,24 +2786,24 @@ function Ut(e) {
3205
2786
  "measures"
3206
2787
  )
3207
2788
  ), a.forEach((s, l) => {
3208
- y(s, `measures.${l}`, t, {
2789
+ b(s, `measures.${l}`, t, {
3209
2790
  required: !0
3210
2791
  });
3211
- }), a.length > 0 && !Wn(a)) {
2792
+ }), a.length > 0 && !_n(a)) {
3212
2793
  const s = a.find(
3213
2794
  (l, d) => a.some(
3214
- (c, p) => p !== d && qt(c, l)
2795
+ (c, p) => p !== d && wt(c, l)
3215
2796
  )
3216
2797
  );
3217
2798
  s && t.push(
3218
2799
  r(
3219
2800
  "duplicate_measure",
3220
- Kn(s),
2801
+ yn(s),
3221
2802
  "measures"
3222
2803
  )
3223
2804
  );
3224
2805
  }
3225
- if (f(e.primaryMeasure) && m(e.primaryMeasure.name) && Me(
2806
+ if (f(e.primaryMeasure) && m(e.primaryMeasure.name) && ye(
3226
2807
  e.primaryMeasure,
3227
2808
  a
3228
2809
  ).length > 1 && t.push(
@@ -3231,9 +2812,9 @@ function Ut(e) {
3231
2812
  "Metric intent primaryMeasure must identify exactly one selected measure.",
3232
2813
  "primaryMeasure"
3233
2814
  )
3234
- ), e.primaryMeasure !== void 0 && (y(e.primaryMeasure, "primaryMeasure", t, {
2815
+ ), e.primaryMeasure !== void 0 && (b(e.primaryMeasure, "primaryMeasure", t, {
3235
2816
  required: !0
3236
- }), f(e.primaryMeasure) && m(e.primaryMeasure.name) && a.length > 0 && !Xn(
2817
+ }), f(e.primaryMeasure) && m(e.primaryMeasure.name) && a.length > 0 && !vn(
3237
2818
  e.primaryMeasure,
3238
2819
  a
3239
2820
  ) && t.push(
@@ -3256,14 +2837,14 @@ function Ut(e) {
3256
2837
  "Metric intent dimensions must be an array of field references with names.",
3257
2838
  "dimensions"
3258
2839
  )
3259
- ), e.dateField !== void 0 && y(e.dateField, "dateField", t), e.timeWindow !== void 0 && (he(e.timeWindow, "timeWindow", t), e.dateField || t.push(
2840
+ ), e.dateField !== void 0 && b(e.dateField, "dateField", t), e.timeWindow !== void 0 && (oe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3260
2841
  r(
3261
2842
  "missing_time_window_date_field",
3262
2843
  "Metric timeWindow needs a dateField.",
3263
2844
  "dateField"
3264
2845
  )
3265
- )), _e(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
3266
- y(s, `dimensions.${l}`, t);
2846
+ )), se(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
2847
+ b(s, `dimensions.${l}`, t);
3267
2848
  }), e.orderBy !== void 0) {
3268
2849
  if (!f(e.orderBy))
3269
2850
  t.push(
@@ -3273,7 +2854,7 @@ function Ut(e) {
3273
2854
  "orderBy"
3274
2855
  )
3275
2856
  );
3276
- else if (y(e.orderBy.field, "orderBy.field", t, {
2857
+ else if (b(e.orderBy.field, "orderBy.field", t, {
3277
2858
  required: !0
3278
2859
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
3279
2860
  r(
@@ -3289,7 +2870,7 @@ function Ut(e) {
3289
2870
  (l) => f(l) && m(l.name)
3290
2871
  ) : []
3291
2872
  ];
3292
- s.length > 0 && !Zn(
2873
+ s.length > 0 && !In(
3293
2874
  e.orderBy.field,
3294
2875
  s
3295
2876
  ) && t.push(
@@ -3301,7 +2882,7 @@ function Ut(e) {
3301
2882
  );
3302
2883
  }
3303
2884
  }
3304
- ma(e, t);
2885
+ Cn(e, t);
3305
2886
  } else if (e.kind === "records") {
3306
2887
  if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
3307
2888
  r(
@@ -3318,14 +2899,14 @@ function Ut(e) {
3318
2899
  "fields"
3319
2900
  )
3320
2901
  ), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
3321
- y(a, `fields.${s}`, t);
3322
- }), e.dateField !== void 0 && y(e.dateField, "dateField", t), Ke(e.pagination, "pagination", t), e.timeWindow !== void 0 && (he(e.timeWindow, "timeWindow", t), e.dateField || t.push(
2902
+ b(a, `fields.${s}`, t);
2903
+ }), e.dateField !== void 0 && b(e.dateField, "dateField", t), je(e.pagination, "pagination", t), e.timeWindow !== void 0 && (oe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3323
2904
  r(
3324
2905
  "missing_time_window_date_field",
3325
2906
  "Records timeWindow needs a dateField.",
3326
2907
  "dateField"
3327
2908
  )
3328
- )), _e(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
2909
+ )), se(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
3329
2910
  f(a) && a.scope === "aggregate" && t.push(
3330
2911
  r(
3331
2912
  "unsupported_record_filter_scope",
@@ -3333,7 +2914,7 @@ function Ut(e) {
3333
2914
  `filters.${s}.scope`
3334
2915
  )
3335
2916
  );
3336
- }), e.orderBy !== void 0 && (f(e.orderBy) ? (y(e.orderBy.field, "orderBy.field", t, {
2917
+ }), e.orderBy !== void 0 && (f(e.orderBy) ? (b(e.orderBy.field, "orderBy.field", t, {
3337
2918
  required: !0
3338
2919
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
3339
2920
  r(
@@ -3372,7 +2953,7 @@ function Ut(e) {
3372
2953
  "totals.measures"
3373
2954
  )
3374
2955
  ) : a.forEach((s, l) => {
3375
- y(s, `totals.measures.${l}`, t, {
2956
+ b(s, `totals.measures.${l}`, t, {
3376
2957
  required: !0
3377
2958
  }), (!f(s) || s.role !== "measure") && t.push(
3378
2959
  r(
@@ -3383,7 +2964,7 @@ function Ut(e) {
3383
2964
  );
3384
2965
  });
3385
2966
  }
3386
- } else e.kind === "inputOptions" ? oa(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
2967
+ } else e.kind === "inputOptions" ? Mn(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
3387
2968
  r(
3388
2969
  "invalid_sql_source",
3389
2970
  "SQL analytics intent must use a SQL execution source.",
@@ -3391,13 +2972,13 @@ function Ut(e) {
3391
2972
  )
3392
2973
  ), m(e.sql) || t.push(
3393
2974
  r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
3394
- ), Qn(
2975
+ ), bn(
3395
2976
  e.defaultParameters,
3396
2977
  "defaultParameters",
3397
2978
  t
3398
2979
  ), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
3399
- y(a, `fields.${s}`, t);
3400
- }), Ke(e.pagination, "pagination", t)) : t.push(
2980
+ b(a, `fields.${s}`, t);
2981
+ }), je(e.pagination, "pagination", t)) : t.push(
3401
2982
  r(
3402
2983
  "invalid_analytics_kind",
3403
2984
  "Analytics kind is not supported.",
@@ -3407,11 +2988,11 @@ function Ut(e) {
3407
2988
  return {
3408
2989
  ok: t.length === 0,
3409
2990
  errors: t,
3410
- warnings: n,
3411
- repairHints: Ze(t)
2991
+ warnings: i,
2992
+ repairHints: Ye(t)
3412
2993
  };
3413
2994
  }
3414
- function ba(e, t) {
2995
+ function Ln(e, t) {
3415
2996
  if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
3416
2997
  if (!Array.isArray(e.derivedFields)) {
3417
2998
  t.push(
@@ -3423,9 +3004,9 @@ function ba(e, t) {
3423
3004
  );
3424
3005
  return;
3425
3006
  }
3426
- e.derivedFields.forEach((n, o) => {
3427
- Ie(
3428
- n
3007
+ e.derivedFields.forEach((i, o) => {
3008
+ de(
3009
+ i
3429
3010
  ).errors.forEach((s) => {
3430
3011
  t.push({
3431
3012
  ...s,
@@ -3435,8 +3016,8 @@ function ba(e, t) {
3435
3016
  });
3436
3017
  }
3437
3018
  }
3438
- function ya(e) {
3439
- const t = [], n = [];
3019
+ function Vn(e) {
3020
+ const t = [], i = [];
3440
3021
  if (!e || typeof e != "object")
3441
3022
  return {
3442
3023
  ok: !1,
@@ -3446,7 +3027,7 @@ function ya(e) {
3446
3027
  "Operation intent must be a structured object."
3447
3028
  )
3448
3029
  ],
3449
- warnings: n,
3030
+ warnings: i,
3450
3031
  repairHints: [
3451
3032
  {
3452
3033
  code: "invalid_operation_intent",
@@ -3490,10 +3071,10 @@ function ya(e) {
3490
3071
  "instruction"
3491
3072
  )
3492
3073
  ), e.analyticsIntent) {
3493
- const o = Ut(
3074
+ const o = At(
3494
3075
  e.analyticsIntent
3495
3076
  );
3496
- t.push(...o.errors), n.push(...o.warnings);
3077
+ t.push(...o.errors), i.push(...o.warnings);
3497
3078
  }
3498
3079
  } else
3499
3080
  t.push(
@@ -3506,12 +3087,12 @@ function ya(e) {
3506
3087
  return {
3507
3088
  ok: t.length === 0,
3508
3089
  errors: t,
3509
- warnings: n,
3510
- repairHints: Vt(t)
3090
+ warnings: i,
3091
+ repairHints: xt(t)
3511
3092
  };
3512
3093
  }
3513
- function So(e) {
3514
- const t = [], n = [];
3094
+ function Ra(e) {
3095
+ const t = [], i = [];
3515
3096
  if (!e || typeof e != "object")
3516
3097
  return {
3517
3098
  ok: !1,
@@ -3521,7 +3102,7 @@ function So(e) {
3521
3102
  "Analytics recovery plan must be a structured object."
3522
3103
  )
3523
3104
  ],
3524
- warnings: n,
3105
+ warnings: i,
3525
3106
  repairHints: [
3526
3107
  {
3527
3108
  code: "invalid_recovery_plan",
@@ -3538,10 +3119,10 @@ function So(e) {
3538
3119
  "kind"
3539
3120
  )
3540
3121
  );
3541
- const o = ya(
3122
+ const o = Vn(
3542
3123
  e.operationIntent
3543
3124
  );
3544
- return t.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || t.push(
3125
+ return t.push(...o.errors), i.push(...o.warnings), Array.isArray(e.plannedToolCalls) || t.push(
3545
3126
  r(
3546
3127
  "invalid_planned_tool_calls",
3547
3128
  "Recovery plan plannedToolCalls must be an array.",
@@ -3550,17 +3131,17 @@ function So(e) {
3550
3131
  ), {
3551
3132
  ok: t.length === 0,
3552
3133
  errors: t,
3553
- warnings: n,
3554
- repairHints: Vt(t)
3134
+ warnings: i,
3135
+ repairHints: xt(t)
3555
3136
  };
3556
3137
  }
3557
- function Vt(e) {
3138
+ function xt(e) {
3558
3139
  return e.map((t) => ({
3559
3140
  code: t.code,
3560
3141
  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."
3561
3142
  }));
3562
3143
  }
3563
- function Ze(e) {
3144
+ function Ye(e) {
3564
3145
  return e.map((t) => {
3565
3146
  switch (t.code) {
3566
3147
  case "invalid_matrix_intent":
@@ -3648,17 +3229,17 @@ function Ze(e) {
3648
3229
  }
3649
3230
  }).filter((t) => !!t);
3650
3231
  }
3651
- function va(e, t, n, o) {
3232
+ function qn(e, t, i, o) {
3652
3233
  if (!e || typeof e != "object") {
3653
- n.push(
3234
+ i.push(
3654
3235
  r("invalid_view", "Dashboard view must be an object.", t)
3655
3236
  );
3656
3237
  return;
3657
3238
  }
3658
- if (m(e.title) || n.push(
3239
+ if (m(e.title) || i.push(
3659
3240
  r("missing_view_title", "Dashboard view needs a title.", t)
3660
3241
  ), !e.presentation || typeof e.presentation != "object") {
3661
- n.push(
3242
+ i.push(
3662
3243
  r(
3663
3244
  "missing_presentation",
3664
3245
  "Dashboard view needs a presentation.",
@@ -3678,7 +3259,7 @@ function va(e, t, n, o) {
3678
3259
  return;
3679
3260
  }
3680
3261
  if (!e.analytics) {
3681
- n.push(
3262
+ i.push(
3682
3263
  r(
3683
3264
  "missing_view_analytics",
3684
3265
  "Non-text dashboard views need analytics intent.",
@@ -3687,16 +3268,16 @@ function va(e, t, n, o) {
3687
3268
  );
3688
3269
  return;
3689
3270
  }
3690
- e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && n.push(
3271
+ e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && i.push(
3691
3272
  r(
3692
3273
  "invalid_matrix_view_analytics",
3693
3274
  "Matrix table views need matrix analytics intent.",
3694
3275
  `${t}.analytics.kind`
3695
3276
  )
3696
3277
  );
3697
- const a = Ut(e.analytics);
3278
+ const a = At(e.analytics);
3698
3279
  for (const s of a.errors)
3699
- n.push(
3280
+ i.push(
3700
3281
  r(
3701
3282
  s.code,
3702
3283
  s.message,
@@ -3712,8 +3293,8 @@ function va(e, t, n, o) {
3712
3293
  )
3713
3294
  );
3714
3295
  }
3715
- function Io(e) {
3716
- const t = [], n = [];
3296
+ function Ea(e) {
3297
+ const t = [], i = [];
3717
3298
  if (!e || typeof e != "object")
3718
3299
  return {
3719
3300
  ok: !1,
@@ -3723,7 +3304,7 @@ function Io(e) {
3723
3304
  "Dashboard intent must be a structured object."
3724
3305
  )
3725
3306
  ],
3726
- warnings: n
3307
+ warnings: i
3727
3308
  };
3728
3309
  e.version !== 1 && t.push(
3729
3310
  r("invalid_version", "Dashboard intent version must be 1.")
@@ -3732,7 +3313,7 @@ function Io(e) {
3732
3313
  ), m(e.title) || t.push(
3733
3314
  r("missing_title", "Dashboard intent needs a title.", "title")
3734
3315
  );
3735
- const o = Array.isArray(e.inputs) ? e.inputs : [], a = Qe(
3316
+ const o = Array.isArray(e.inputs) ? e.inputs : [], a = Ce(
3736
3317
  o.filter(f).map((c) => c.id).filter((c) => typeof c == "string")
3737
3318
  );
3738
3319
  a && t.push(
@@ -3756,7 +3337,7 @@ function Io(e) {
3756
3337
  r("missing_input_label", "Input needs a label.", `${u}.label`)
3757
3338
  ), !p.field || !m(p.field.name) ? t.push(
3758
3339
  r("missing_input_field", "Input needs a field.", `${u}.field`)
3759
- ) : y(p.field, `${u}.field`, t);
3340
+ ) : b(p.field, `${u}.field`, t);
3760
3341
  }
3761
3342
  const s = Array.isArray(e.sections) ? e.sections : [];
3762
3343
  s.length === 0 && t.push(
@@ -3768,7 +3349,7 @@ function Io(e) {
3768
3349
  );
3769
3350
  const l = s.flatMap(
3770
3351
  (c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(f).map((p) => p.id).filter((p) => !!p) : []
3771
- ), d = Qe(l);
3352
+ ), d = Ce(l);
3772
3353
  d && t.push(
3773
3354
  r(
3774
3355
  "duplicate_view_id",
@@ -3804,176 +3385,135 @@ function Io(e) {
3804
3385
  );
3805
3386
  continue;
3806
3387
  }
3807
- for (const [_, b] of p.views.entries())
3808
- va(
3809
- b,
3388
+ for (const [_, y] of p.views.entries())
3389
+ qn(
3390
+ y,
3810
3391
  `${u}.views.${_}`,
3811
3392
  t,
3812
- n
3393
+ i
3813
3394
  );
3814
3395
  }
3815
- return { ok: t.length === 0, errors: t, warnings: n };
3396
+ return { ok: t.length === 0, errors: t, warnings: i };
3816
3397
  }
3817
3398
  export {
3818
- Fe as $,
3819
- yo as A,
3820
- xe as B,
3821
- de as C,
3822
- Wi as D,
3823
- bt as E,
3824
- Ae as F,
3825
- De as G,
3826
- Ut as H,
3827
- mo as I,
3828
- fo as J,
3829
- qa as K,
3830
- Gi as L,
3831
- ht as M,
3832
- go as N,
3833
- Jt as O,
3834
- Qi as P,
3835
- Zt as Q,
3836
- ka as R,
3837
- xa as S,
3838
- Aa as T,
3839
- z as U,
3840
- Fa as V,
3841
- Ra as W,
3842
- Xt as X,
3843
- ge as Y,
3844
- Rt as Z,
3845
- Vi as _,
3846
- Yt as a,
3847
- ja as a$,
3848
- Sn as a0,
3849
- Dt as a1,
3850
- me as a2,
3851
- Mt as a3,
3852
- Hi as a4,
3853
- R as a5,
3854
- Ua as a6,
3855
- An as a7,
3856
- Et as a8,
3857
- Rn as a9,
3858
- pt as aA,
3859
- mt as aB,
3860
- Pe as aC,
3861
- gt as aD,
3862
- Ya as aE,
3863
- Ba as aF,
3864
- ti as aG,
3865
- O as aH,
3866
- F as aI,
3867
- U as aJ,
3868
- ie as aK,
3869
- oi as aL,
3870
- be as aM,
3871
- ye as aN,
3872
- Je as aO,
3873
- ri as aP,
3874
- et as aQ,
3875
- tt as aR,
3876
- it as aS,
3877
- nt as aT,
3878
- at as aU,
3879
- Da as aV,
3880
- Ma as aW,
3881
- j as aX,
3882
- Ea as aY,
3883
- Na as aZ,
3884
- Ce as a_,
3885
- P as aa,
3886
- Le as ab,
3887
- En as ac,
3888
- Te as ad,
3889
- He as ae,
3890
- ee as af,
3891
- Yn as ag,
3892
- po as ah,
3893
- we as ai,
3894
- Gt as aj,
3895
- Ia as ak,
3896
- je as al,
3897
- wa as am,
3898
- zt as an,
3899
- Kt as ao,
3900
- Qt as ap,
3901
- ra as aq,
3902
- vo as ar,
3903
- ya as as,
3904
- So as at,
3905
- Io as au,
3906
- Ie as av,
3907
- Ni as aw,
3908
- ji as ax,
3909
- Pi as ay,
3910
- Yi as az,
3911
- Va as b,
3912
- Ca as b0,
3913
- $a as b1,
3914
- fi as b2,
3915
- gi as b3,
3916
- Oa as b4,
3917
- Pa as b5,
3918
- T as b6,
3919
- Ot as b7,
3920
- Pt as b8,
3921
- _o as b9,
3922
- so as bA,
3923
- Ja as bB,
3924
- pe as bC,
3925
- eo as bD,
3926
- jn as bE,
3927
- ke as bF,
3928
- _i as bG,
3929
- Xa as ba,
3930
- Xi as bb,
3931
- Ji as bc,
3932
- Za as bd,
3933
- Ta as be,
3934
- _t as bf,
3935
- L as bg,
3936
- Ui as bh,
3937
- H as bi,
3938
- La as bj,
3939
- x as bk,
3940
- Bi as bl,
3941
- C as bm,
3942
- $e as bn,
3943
- gn as bo,
3944
- Nn as bp,
3945
- to as bq,
3946
- un as br,
3947
- lo as bs,
3948
- ro as bt,
3949
- io as bu,
3950
- no as bv,
3951
- fn as bw,
3952
- hn as bx,
3953
- oo as by,
3954
- ao as bz,
3955
- Ha as c,
3956
- Ki as d,
3957
- yt as e,
3958
- za as f,
3959
- zi as g,
3960
- Wa as h,
3961
- ei as i,
3962
- Ka as j,
3963
- Qa as k,
3964
- ue as l,
3965
- Mn as m,
3966
- Ga as n,
3967
- jt as o,
3968
- bo as p,
3969
- fe as q,
3970
- co as r,
3971
- Gn as s,
3972
- Ln as t,
3973
- ho as u,
3974
- X as v,
3975
- le as w,
3976
- Wt as x,
3977
- Tn as y,
3978
- uo as z
3399
+ zi as $,
3400
+ la as A,
3401
+ pe as B,
3402
+ Z as C,
3403
+ _i as D,
3404
+ _e as E,
3405
+ At as F,
3406
+ Sa as G,
3407
+ wa as H,
3408
+ ka as I,
3409
+ Ct as J,
3410
+ zn as K,
3411
+ gi as L,
3412
+ Gn as M,
3413
+ jt as N,
3414
+ ae as O,
3415
+ bi as P,
3416
+ dt as Q,
3417
+ mi as R,
3418
+ Ot as S,
3419
+ ge as T,
3420
+ qi as U,
3421
+ pt as V,
3422
+ ie as W,
3423
+ mt as X,
3424
+ fi as Y,
3425
+ F as Z,
3426
+ Jn as _,
3427
+ It as a,
3428
+ te as a$,
3429
+ ft as a0,
3430
+ Qi as a1,
3431
+ j as a2,
3432
+ Me as a3,
3433
+ en as a4,
3434
+ he as a5,
3435
+ Ee as a6,
3436
+ H as a7,
3437
+ ln as a8,
3438
+ Ia as a9,
3439
+ Je as aA,
3440
+ P as aB,
3441
+ pi as aC,
3442
+ L as aD,
3443
+ Zn as aE,
3444
+ x as aF,
3445
+ di as aG,
3446
+ N as aH,
3447
+ Se as aI,
3448
+ Oi as aJ,
3449
+ Xn as aK,
3450
+ Ze as aL,
3451
+ ce as aM,
3452
+ Pt as aN,
3453
+ tn as aO,
3454
+ ca as aP,
3455
+ Ti as aQ,
3456
+ ya as aR,
3457
+ _a as aS,
3458
+ pa as aT,
3459
+ ma as aU,
3460
+ Ci as aV,
3461
+ Yi as aW,
3462
+ ga as aX,
3463
+ fa as aY,
3464
+ ha as aZ,
3465
+ da as a_,
3466
+ ue as aa,
3467
+ Nt as ab,
3468
+ $t as ac,
3469
+ Rn as ad,
3470
+ Da as ae,
3471
+ Vn as af,
3472
+ Ra as ag,
3473
+ Ea as ah,
3474
+ de as ai,
3475
+ ti as aj,
3476
+ ii as ak,
3477
+ ri as al,
3478
+ li as am,
3479
+ We as an,
3480
+ Qe as ao,
3481
+ ke as ap,
3482
+ Xe as aq,
3483
+ Qn as ar,
3484
+ Kn as as,
3485
+ M as at,
3486
+ bt as au,
3487
+ vt as av,
3488
+ xa as aw,
3489
+ vi as ax,
3490
+ Si as ay,
3491
+ Wn as az,
3492
+ ta as b,
3493
+ ua as b0,
3494
+ nn as b1,
3495
+ yi as c,
3496
+ tt as d,
3497
+ na as e,
3498
+ aa as f,
3499
+ hi as g,
3500
+ oa as h,
3501
+ ea as i,
3502
+ sa as j,
3503
+ J as k,
3504
+ me as l,
3505
+ Ji as m,
3506
+ ia as n,
3507
+ ht as o,
3508
+ Fa as p,
3509
+ ne as q,
3510
+ va as r,
3511
+ gn as s,
3512
+ cn as t,
3513
+ Aa as u,
3514
+ Ma as v,
3515
+ et as w,
3516
+ Xi as x,
3517
+ ba as y,
3518
+ ra as z
3979
3519
  };