react-semaphor 0.1.600 → 0.1.602

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 (83) hide show
  1. package/dist/analytics-protocol/index.js +9 -9
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +48 -45
  5. package/dist/chunks/{assistant-chat-BULOkG9j.js → assistant-chat-BWF3GYip.js} +12 -12
  6. package/dist/chunks/{bookmark-impact-kdvXke8n.js → bookmark-impact-BF3iRx5a.js} +3 -3
  7. package/dist/chunks/{bookmark-state-h1OLXVjE.js → bookmark-state-CBSTdW6q.js} +4 -4
  8. package/dist/chunks/{card-filter-builder-CSCdSQQy.js → card-filter-builder-B8XHwMY6.js} +394 -394
  9. package/dist/chunks/comparison-window-caption-W83qB4V5.js +741 -0
  10. package/dist/chunks/{dashboard-y9ON19ge.js → dashboard-DG5EIYYB.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-9YwUclHA.js → dashboard-briefing-launcher-CBSrhyWZ.js} +727 -718
  12. package/dist/chunks/{dashboard-controls-O6PNXMCp.js → dashboard-controls-D6ECO4N1.js} +15 -15
  13. package/dist/chunks/{dashboard-json-Bxf91TYq.js → dashboard-json-DrJftBSL.js} +4 -4
  14. package/dist/chunks/{dates-DPTbpNxK.js → dates-Bz-qM5px.js} +10 -10
  15. package/dist/chunks/{edit-dashboard-visual-CKwaW8H_.js → edit-dashboard-visual-BDYAJIbb.js} +1569 -1548
  16. package/dist/chunks/filter-line-BXT6y303.js +703 -0
  17. package/dist/chunks/{filter-reach-copy-ClzNcNhP.js → filter-reach-copy-BukhZmzm.js} +1688 -1806
  18. package/dist/chunks/{filter-value-text-CXyuLW9Q.js → filter-value-text-D3-bf3_b.js} +6 -6
  19. package/dist/chunks/{index-CRo5--Y6.js → index-BW0yozjs.js} +386 -360
  20. package/dist/chunks/{layout-grid-DSrBSfPM.js → layout-grid-Ds0diMeY.js} +1 -1
  21. package/dist/chunks/{matrix-analytical-definition-i9PQY066.js → matrix-analytical-definition-CgQgVeeI.js} +35 -35
  22. package/dist/chunks/{matrix-member-presentation-B_2beBc0.js → matrix-member-presentation-DSBIIudt.js} +1 -1
  23. package/dist/chunks/{matrix-operation-contract-DdK0J_KU.js → matrix-operation-contract--DkNCOzd.js} +517 -514
  24. package/dist/chunks/{metric-comparison-Bhz0V841.js → metric-comparison-zMylnIkc.js} +3 -3
  25. package/dist/chunks/{paintbrush-1UiU-uTz.js → paintbrush-CX8pao1j.js} +1 -1
  26. package/dist/chunks/{palette-DFIFf_-m.js → palette-CuA0HlzF.js} +1 -1
  27. package/dist/chunks/{pivot-result-contract-expectations-Dk7WFR_u.js → pivot-result-contract-expectations-C8KL7hPx.js} +14 -14
  28. package/dist/chunks/{pivot-result-identity-CzzrJpEm.js → pivot-result-identity-C1AOH1PS.js} +1 -1
  29. package/dist/chunks/{raw-temporal-value-BLvdaMng.js → raw-temporal-value-E416F-0L.js} +16 -16
  30. package/dist/chunks/{report-preferences-dialog-DiDsYpng.js → report-preferences-dialog-CbuVNDGi.js} +13 -13
  31. package/dist/chunks/{report-runtime-context-CEGluufW.js → report-runtime-context-E7USjN7E.js} +1 -1
  32. package/dist/chunks/{resolve-dashboard-input-context-BAv33KGg.js → resolve-dashboard-input-context-CULCE_hM.js} +8419 -7054
  33. package/dist/chunks/{save-CWQ02kHo.js → save-BKHlDONy.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-CvzYqADe.js → saved-dashboard-context-C1WlOx5z.js} +24 -24
  35. package/dist/chunks/{selection-filter-compiler-SwrBvyyJ.js → selection-filter-compiler-ifT8JCXS.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-1PRI9Yh2.js → semaphor-ready-indicator-CBIRcDWs.js} +33810 -32067
  37. package/dist/chunks/{shelf-drop-preview-context-BLk5Nc6K.js → shelf-drop-preview-context-xR69SMA8.js} +53 -53
  38. package/dist/chunks/{stored-dashboard-xhYYKBsO.js → stored-dashboard-BuM8vnWf.js} +679 -657
  39. package/dist/chunks/{style-sheet-parts-BX7d7-2-.js → style-sheet-parts-Bt9ZNre8.js} +2 -2
  40. package/dist/chunks/{table-export-sheet-BWSVTclx.js → table-export-sheet-DVljtHkG.js} +1 -1
  41. package/dist/chunks/{token-types-CnlEiAdS.js → token-types-D_xKgyVS.js} +1 -1
  42. package/dist/chunks/{upload-DsqUSS8l.js → upload-Dll_M7XQ.js} +1 -1
  43. package/dist/chunks/{validators-D2Hm57lJ.js → validators-ClWHpYql.js} +80 -80
  44. package/dist/chunks/{variable-draft-DcKj8T1b.js → variable-draft-CDGGl53R.js} +27 -28
  45. package/dist/dashboard/index.js +2 -2
  46. package/dist/dashboard-authoring/index.js +3086 -2573
  47. package/dist/format-utils/index.js +238 -237
  48. package/dist/index.js +71 -73
  49. package/dist/report-runtime-context/index.js +1 -1
  50. package/dist/style.css +1 -1
  51. package/dist/surfboard/index.js +2 -2
  52. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  53. package/dist/types/briefings/attachments.d.ts +45 -4
  54. package/dist/types/briefings/index.d.ts +1 -1
  55. package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
  56. package/dist/types/index.js +5 -5
  57. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  58. package/dist/types/lib/export-utils.d.ts +72 -0
  59. package/dist/types/lib/formatters/dashboard-temporal-presentation.d.ts +10 -0
  60. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  61. package/dist/types/lib/stores/dashboard-store.d.ts +30 -0
  62. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  63. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  64. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  65. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  66. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  67. package/dist/types/shared/dashboard-authoring/card-data-file.d.ts +31 -0
  68. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  69. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +144 -2
  70. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +21 -2
  71. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  72. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  73. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  74. package/dist/types/shared/dashboard-authoring/index.d.ts +10 -1
  75. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +133 -0
  76. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  77. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +18 -5
  78. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  79. package/dist/types/shared/usage-events/details.d.ts +2 -2
  80. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  81. package/package.json +1 -1
  82. package/dist/chunks/comparison-window-caption-DJDwP9XO.js +0 -1309
  83. package/dist/chunks/filter-line-Dkg3yuOX.js +0 -134
@@ -1,6 +1,6 @@
1
1
  import { z as t } from "zod";
2
- import { z as Le, P as De, X as Ue, Y as qe, a0 as Me, a1 as Be, s as D, L as $, n as Ge, V as ze, W as ce, g as Ve, r as We, N as Xe, E as Ke, F as $e, o as le, b as ue, I as Ze } from "./analytics-base-schemas-DevrgqQb.js";
3
- import { E as k, w as de, M as G, b0 as ee, m as A, F as Ye, aV as Z, x as He, q as Qe, t as me, a4 as Je, p as et, a7 as tt, a$ as nt } from "./validators-D2Hm57lJ.js";
2
+ import { z as Ue, P as De, X as qe, Y as Me, a0 as Be, a1 as Ge, s as U, L as $, n as ze, V as Ve, W as le, g as We, r as Ke, N as Xe, E as $e, F as Ze, o as ue, b as de, I as Ye } from "./analytics-base-schemas-DevrgqQb.js";
3
+ import { B as v, v as me, K as G, b0 as te, m as _, E as He, aV as Z, w as Qe, o as Je, q as pe, a3 as et, p as tt, a6 as nt, a$ as at } from "./validators-ClWHpYql.js";
4
4
  const Y = {
5
5
  answerSummary: "string",
6
6
  responseDetail: "responseDetail",
@@ -41,7 +41,7 @@ const Y = {
41
41
  periodRows: "recordArray",
42
42
  sql: "unknown",
43
43
  omitted: "stringArray"
44
- }, pe = [
44
+ }, he = [
45
45
  /** The request can't run as asked (no specific validation code applies). */
46
46
  "invalid_request",
47
47
  /** No authored relationship connects the requested datasets. */
@@ -61,7 +61,7 @@ const Y = {
61
61
  "timeout",
62
62
  "budget_exceeded",
63
63
  "cancelled"
64
- ], at = {
64
+ ], rt = {
65
65
  invalid_request: 400,
66
66
  missing_relationship: 400,
67
67
  ambiguous_relationship: 400,
@@ -74,29 +74,29 @@ const Y = {
74
74
  timeout: 504,
75
75
  budget_exceeded: 413,
76
76
  cancelled: 499
77
- }, rt = /* @__PURE__ */ new Set(["execution_failed", "timeout"]);
78
- function st(e) {
79
- return typeof e == "string" && pe.includes(e);
77
+ }, st = /* @__PURE__ */ new Set(["execution_failed", "timeout"]);
78
+ function ot(e) {
79
+ return typeof e == "string" && he.includes(e);
80
80
  }
81
- function ot(e, n, a = {}) {
81
+ function it(e, n, a = {}) {
82
82
  return {
83
83
  code: e,
84
84
  message: n,
85
85
  ...a.details ? { details: a.details } : {},
86
86
  ...a.nextStep ? { nextStep: a.nextStep } : {},
87
- retryable: rt.has(e),
88
- status: a.status ?? at[e]
87
+ retryable: st.has(e),
88
+ status: a.status ?? rt[e]
89
89
  };
90
90
  }
91
- function un(e) {
91
+ function dn(e) {
92
92
  if (!e || typeof e != "object") return;
93
93
  const n = e.refusal ?? e;
94
94
  if (!n || typeof n != "object") return;
95
95
  const { code: a, message: r } = n;
96
- if (!(!st(a) || typeof r != "string"))
96
+ if (!(!ot(a) || typeof r != "string"))
97
97
  return n;
98
98
  }
99
- const it = {
99
+ const ct = {
100
100
  invalid_request: { message: "This query configuration cannot run.", nextStep: "Check the selected fields, filters and parameters." },
101
101
  missing_relationship: { message: "The selected data is not connected.", nextStep: "Choose related datasets or ask the owner to add a relationship." },
102
102
  ambiguous_relationship: { message: "The selected data has more than one relationship path.", nextStep: "Choose the relationship to use." },
@@ -110,48 +110,48 @@ const it = {
110
110
  budget_exceeded: { message: "The query exceeds this view’s limits.", nextStep: "Request fewer rows, columns or measures." },
111
111
  cancelled: { message: "The query was cancelled.", nextStep: "Reload the view when ready." }
112
112
  };
113
- function dn(e) {
114
- const n = it[e.code], a = ot(e.code, n.message, { nextStep: n.nextStep, status: e.status }), r = e.retryable ?? a.retryable;
113
+ function mn(e) {
114
+ const n = ct[e.code], a = it(e.code, n.message, { nextStep: n.nextStep, status: e.status }), r = e.retryable ?? a.retryable;
115
115
  return {
116
116
  ...a,
117
117
  retryable: r,
118
118
  ...!r && a.retryable ? { nextStep: "Ask the owner to check the query." } : {}
119
119
  };
120
120
  }
121
- const ct = [
122
- ...pe,
121
+ const lt = [
122
+ ...he,
123
123
  "stale_cursor",
124
124
  "source_truncated"
125
- ], mn = Object.freeze({
125
+ ], pn = Object.freeze({
126
126
  coordinates: 2e4,
127
127
  responseBytes: 5 * 1024 * 1024
128
- }), O = t.string().uuid(), y = t.string().min(1), lt = t.number().int().positive().max(Number.MAX_SAFE_INTEGER);
128
+ }), P = t.string().uuid(), b = t.string().min(1), ut = t.number().int().positive().max(Number.MAX_SAFE_INTEGER);
129
129
  function f(e, n, a) {
130
130
  e.addIssue({ code: "custom", path: n, message: a });
131
131
  }
132
132
  function T(e, n, a) {
133
133
  new Set(e).size !== e.length && f(n, a, "Duplicate identity.");
134
134
  }
135
- const ut = t.object({
136
- id: y,
137
- axis: de,
138
- parent: k,
135
+ const dt = t.object({
136
+ id: b,
137
+ axis: me,
138
+ parent: v,
139
139
  position: t.union([
140
140
  t.object({ kind: t.literal("first") }).strict(),
141
- t.object({ kind: t.enum(["after", "before"]), cursor: y }).strict()
141
+ t.object({ kind: t.enum(["after", "before"]), cursor: b }).strict()
142
142
  ]),
143
- size: lt
144
- }).strict(), te = t.object({
145
- paths: t.array(k).readonly(),
146
- pageIds: t.array(y).readonly()
147
- }).strict(), dt = t.object({
148
- id: y,
149
- rows: te,
150
- columns: te,
151
- measureIds: t.array(O).min(1).readonly()
152
- }).strict(), he = t.object({
153
- pages: t.array(ut).readonly(),
154
- blocks: t.array(dt).readonly()
143
+ size: ut
144
+ }).strict(), ne = t.object({
145
+ paths: t.array(v).readonly(),
146
+ pageIds: t.array(b).readonly()
147
+ }).strict(), mt = t.object({
148
+ id: b,
149
+ rows: ne,
150
+ columns: ne,
151
+ measureIds: t.array(P).min(1).readonly()
152
+ }).strict(), fe = t.object({
153
+ pages: t.array(dt).readonly(),
154
+ blocks: t.array(mt).readonly()
155
155
  }).strict().superRefine((e, n) => {
156
156
  !e.pages.length && !e.blocks.length && f(n, [], "Request at least one page or block."), T(
157
157
  [...e.pages, ...e.blocks].map((a) => a.id),
@@ -170,9 +170,9 @@ const ut = t.object({
170
170
  "Page reference must name a page on this axis in this operation."
171
171
  );
172
172
  }
173
- }), pn = t.object({ spec: G, request: he }).strict().superRefine(({ spec: e, request: n }, a) => {
173
+ }), hn = t.object({ spec: G, request: fe }).strict().superRefine(({ spec: e, request: n }, a) => {
174
174
  for (const r of n.pages)
175
- ee(
175
+ te(
176
176
  e,
177
177
  r.axis,
178
178
  r.parent,
@@ -188,15 +188,15 @@ const ut = t.object({
188
188
  r.measureIds.some((s) => !e.measures.some((c) => c.id === s)) && f(a, ["blocks", r.id], "Unknown block measure.");
189
189
  for (const s of ["rows", "columns"])
190
190
  for (const c of r[s].paths)
191
- ee(e, s, c, a, ["blocks", r.id, s]);
191
+ te(e, s, c, a, ["blocks", r.id, s]);
192
192
  }
193
- }), mt = t.object({
194
- requestId: y,
195
- axis: de,
196
- parent: k,
197
- members: t.array(t.object({ path: k }).strict()).readonly(),
198
- before: y.nullable(),
199
- after: y.nullable(),
193
+ }), pt = t.object({
194
+ requestId: b,
195
+ axis: me,
196
+ parent: v,
197
+ members: t.array(t.object({ path: v }).strict()).readonly(),
198
+ before: b.nullable(),
199
+ after: b.nullable(),
200
200
  exactCount: t.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
201
201
  }).strict().superRefine((e, n) => {
202
202
  e.parent.some((r) => r.member.kind === "others") && f(n, ["parent"], "Others has no children.");
@@ -214,139 +214,139 @@ const ut = t.object({
214
214
  }
215
215
  )
216
216
  ).size > 1 && f(n, ["members"], "One page must contain one child level."), T(
217
- e.members.map((r) => A(r.path)),
217
+ e.members.map((r) => _(r.path)),
218
218
  n,
219
219
  ["members"]
220
220
  );
221
221
  for (const r of e.members)
222
- (r.path.length !== e.parent.length + 1 || A(r.path.slice(0, -1)) !== A(e.parent)) && f(n, ["members"], "Page members must be immediate children.");
223
- }), fe = t.object({
224
- rowPaths: t.array(k).readonly(),
225
- columnPaths: t.array(k).readonly(),
226
- measureIds: t.array(O).readonly()
222
+ (r.path.length !== e.parent.length + 1 || _(r.path.slice(0, -1)) !== _(e.parent)) && f(n, ["members"], "Page members must be immediate children.");
223
+ }), ge = t.object({
224
+ rowPaths: t.array(v).readonly(),
225
+ columnPaths: t.array(v).readonly(),
226
+ measureIds: t.array(P).readonly()
227
227
  }).strict();
228
- function ge(e, n) {
229
- const a = e.rowPaths.map(A), r = e.columnPaths.map(A);
228
+ function ye(e, n) {
229
+ const a = e.rowPaths.map(_), r = e.columnPaths.map(_);
230
230
  return T(a, n, ["coverage", "rowPaths"]), T(r, n, ["coverage", "columnPaths"]), T(e.measureIds, n, ["coverage", "measureIds"]), { rows: a, columns: r };
231
231
  }
232
- const pt = t.object({
233
- requestId: y,
234
- coverage: fe,
232
+ const ht = t.object({
233
+ requestId: b,
234
+ coverage: ge,
235
235
  cells: t.array(
236
- Ye.extend({ value: Z }).strict()
236
+ He.extend({ value: Z }).strict()
237
237
  ).readonly()
238
238
  }).strict().superRefine((e, n) => {
239
- const { rows: a, columns: r } = ge(e.coverage, n), s = new Set(a), c = new Set(r), i = new Set(e.coverage.measureIds);
239
+ const { rows: a, columns: r } = ye(e.coverage, n), s = new Set(a), c = new Set(r), o = new Set(e.coverage.measureIds);
240
240
  T(
241
241
  e.cells.map(
242
- (l) => JSON.stringify([
243
- A(l.rowPath),
244
- A(l.columnPath),
245
- l.measureId
242
+ (m) => JSON.stringify([
243
+ _(m.rowPath),
244
+ _(m.columnPath),
245
+ m.measureId
246
246
  ])
247
247
  ),
248
248
  n,
249
249
  ["cells"]
250
250
  );
251
- for (const l of e.cells)
252
- (!s.has(A(l.rowPath)) || !c.has(A(l.columnPath)) || !i.has(l.measureId)) && f(n, ["cells"], "Cell is outside certified coverage.");
253
- }), U = t.number().int().nonnegative(), ht = t.object({
254
- requestId: y,
255
- coverage: fe,
251
+ for (const m of e.cells)
252
+ (!s.has(_(m.rowPath)) || !c.has(_(m.columnPath)) || !o.has(m.measureId)) && f(n, ["cells"], "Cell is outside certified coverage.");
253
+ }), D = t.number().int().nonnegative(), ft = t.object({
254
+ requestId: b,
255
+ coverage: ge,
256
256
  values: t.array(
257
- t.tuple([U, U, U, Z]).readonly()
257
+ t.tuple([D, D, D, Z]).readonly()
258
258
  ).readonly()
259
259
  }).strict().superRefine((e, n) => {
260
- ge(e.coverage, n);
260
+ ye(e.coverage, n);
261
261
  const { rowPaths: a, columnPaths: r, measureIds: s } = e.coverage, c = /* @__PURE__ */ new Set();
262
- for (const [i, l, m] of e.values) {
263
- if (i >= a.length || l >= r.length || m >= s.length) {
262
+ for (const [o, m, d] of e.values) {
263
+ if (o >= a.length || m >= r.length || d >= s.length) {
264
264
  f(n, ["values"], "Cell is outside certified coverage.");
265
265
  continue;
266
266
  }
267
- const o = `${i},${l},${m}`;
268
- c.has(o) && f(n, ["values"], "Duplicate identity."), c.add(o);
267
+ const i = `${o},${m},${d}`;
268
+ c.has(i) && f(n, ["values"], "Duplicate identity."), c.add(i);
269
269
  }
270
- }), ne = t.object({
271
- id: O,
270
+ }), ae = t.object({
271
+ id: P,
272
272
  column: De,
273
- nativeDataType: y,
274
- semanticFormat: Le.optional()
275
- }).strict(), ye = t.object({
276
- levels: t.array(ne).readonly(),
277
- measures: t.array(ne).readonly()
273
+ nativeDataType: b,
274
+ semanticFormat: Ue.optional()
275
+ }).strict(), Se = t.object({
276
+ levels: t.array(ae).readonly(),
277
+ measures: t.array(ae).readonly()
278
278
  }).strict(), H = t.object({
279
- code: t.enum(ct),
280
- message: y,
279
+ code: t.enum(lt),
280
+ message: b,
281
281
  /** Technical cause for dashboard owners; never shown as the primary copy. */
282
- detail: y.optional(),
282
+ detail: b.optional(),
283
283
  details: t.record(t.unknown()).optional(),
284
- nextStep: y.optional(),
284
+ nextStep: b.optional(),
285
285
  status: t.number().int().optional(),
286
286
  retryable: t.boolean(),
287
287
  scope: t.union([
288
288
  t.object({ kind: t.literal("operation") }).strict(),
289
- t.object({ kind: t.enum(["page", "block"]), requestId: y }).strict()
289
+ t.object({ kind: t.enum(["page", "block"]), requestId: b }).strict()
290
290
  ])
291
- }).strict(), ft = t.object({
291
+ }).strict(), gt = t.object({
292
292
  dialect: t.enum(["postgres", "clickhouse", "duckdb", "snowflake"]),
293
- aggregates: t.array(He).readonly()
293
+ aggregates: t.array(Qe).readonly()
294
294
  }).strict();
295
- function Se(e) {
295
+ function be(e) {
296
296
  return t.object({
297
- queryIdentity: y,
298
- descriptors: ye,
299
- capabilities: ft,
300
- pages: t.array(mt).readonly(),
297
+ queryIdentity: b,
298
+ descriptors: Se,
299
+ capabilities: gt,
300
+ pages: t.array(pt).readonly(),
301
301
  blocks: t.array(e).readonly(),
302
302
  failures: t.array(H).readonly()
303
303
  }).strict().superRefine((n, a) => {
304
304
  const r = new Set(
305
- n.descriptors.levels.map((i) => i.id)
305
+ n.descriptors.levels.map((o) => o.id)
306
306
  ), s = new Set(
307
- n.descriptors.measures.map((i) => i.id)
308
- ), c = n.pages.flatMap((i) => [
309
- i.parent,
310
- ...i.members.map((l) => l.path)
307
+ n.descriptors.measures.map((o) => o.id)
308
+ ), c = n.pages.flatMap((o) => [
309
+ o.parent,
310
+ ...o.members.map((m) => m.path)
311
311
  ]);
312
- for (const i of n.blocks)
313
- c.push(...i.coverage.rowPaths, ...i.coverage.columnPaths), i.coverage.measureIds.some((l) => !s.has(l)) && f(
312
+ for (const o of n.blocks)
313
+ c.push(...o.coverage.rowPaths, ...o.coverage.columnPaths), o.coverage.measureIds.some((m) => !s.has(m)) && f(
314
314
  a,
315
- ["blocks", i.requestId],
315
+ ["blocks", o.requestId],
316
316
  "Coverage references an unknown measure descriptor."
317
317
  );
318
- c.some((i) => i.some((l) => !r.has(l.levelId))) && f(
318
+ c.some((o) => o.some((m) => !r.has(m.levelId))) && f(
319
319
  a,
320
320
  ["descriptors"],
321
321
  "Acquired paths require level descriptors."
322
322
  ), T(
323
323
  [...n.descriptors.levels, ...n.descriptors.measures].map(
324
- (i) => i.id
324
+ (o) => o.id
325
325
  ),
326
326
  a,
327
327
  ["descriptors"]
328
328
  ), T(
329
- [...n.pages, ...n.blocks].map((i) => i.requestId),
329
+ [...n.pages, ...n.blocks].map((o) => o.requestId),
330
330
  a,
331
331
  []
332
332
  ), T(
333
333
  n.failures.map(
334
- (i) => i.scope.kind === "operation" ? "operation" : i.scope.requestId
334
+ (o) => o.scope.kind === "operation" ? "operation" : o.scope.requestId
335
335
  ),
336
336
  a,
337
337
  ["failures"]
338
338
  );
339
- for (const i of n.failures)
340
- if (i.scope.kind === "operation")
339
+ for (const o of n.failures)
340
+ if (o.scope.kind === "operation")
341
341
  f(
342
342
  a,
343
343
  ["failures"],
344
344
  "Operation failure cannot accompany acquired data."
345
345
  );
346
346
  else {
347
- const l = i.scope.requestId;
347
+ const m = o.scope.requestId;
348
348
  [...n.pages, ...n.blocks].some(
349
- (m) => m.requestId === l
349
+ (d) => d.requestId === m
350
350
  ) && f(
351
351
  a,
352
352
  ["failures"],
@@ -355,12 +355,12 @@ function Se(e) {
355
355
  }
356
356
  });
357
357
  }
358
- const be = Se(
359
- pt
360
- ), gt = Se(
358
+ const Ae = be(
361
359
  ht
360
+ ), yt = be(
361
+ ft
362
362
  );
363
- function Ae(e) {
363
+ function Ie(e) {
364
364
  return t.union([
365
365
  t.object({
366
366
  status: t.enum(["success", "partial"]),
@@ -378,63 +378,63 @@ function Ae(e) {
378
378
  ), r.status === "success" != (s.failures.length === 0) && f(a, ["status"], "Status must match failure coverage.");
379
379
  });
380
380
  }
381
- const hn = Ae(
382
- be
383
- ), fn = Ae(
384
- gt
381
+ const fn = Ie(
382
+ Ae
383
+ ), gn = Ie(
384
+ yt
385
385
  );
386
- function yt(e) {
387
- const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage, s = (m) => new Map(m.map((o, d) => [o, d])), c = s(n.map(A)), i = s(a.map(A)), l = s(r);
386
+ function St(e) {
387
+ const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage, s = (d) => new Map(d.map((i, l) => [i, l])), c = s(n.map(_)), o = s(a.map(_)), m = s(r);
388
388
  return {
389
389
  requestId: e.requestId,
390
390
  coverage: e.coverage,
391
- values: e.cells.map((m) => {
392
- const o = c.get(A(m.rowPath)), d = i.get(A(m.columnPath)), p = l.get(m.measureId);
393
- if (o === void 0 || d === void 0 || p === void 0)
391
+ values: e.cells.map((d) => {
392
+ const i = c.get(_(d.rowPath)), l = o.get(_(d.columnPath)), p = m.get(d.measureId);
393
+ if (i === void 0 || l === void 0 || p === void 0)
394
394
  throw new Error("Cell is outside certified coverage.");
395
- return [o, d, p, m.value];
395
+ return [i, l, p, d.value];
396
396
  })
397
397
  };
398
398
  }
399
- function St(e) {
399
+ function bt(e) {
400
400
  const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage;
401
401
  return {
402
402
  requestId: e.requestId,
403
403
  coverage: e.coverage,
404
- cells: e.values.map(([s, c, i, l]) => ({
404
+ cells: e.values.map(([s, c, o, m]) => ({
405
405
  rowPath: n[s],
406
406
  columnPath: a[c],
407
- measureId: r[i],
408
- value: l
407
+ measureId: r[o],
408
+ value: m
409
409
  }))
410
410
  };
411
411
  }
412
- function bt(e) {
413
- return { ...e, blocks: e.blocks.map(yt) };
414
- }
415
- function gn(e) {
412
+ function At(e) {
416
413
  return { ...e, blocks: e.blocks.map(St) };
417
414
  }
418
415
  function yn(e) {
419
- return e.status === "failed" ? e : { status: e.status, window: bt(e.window) };
416
+ return { ...e, blocks: e.blocks.map(bt) };
417
+ }
418
+ function Sn(e) {
419
+ return e.status === "failed" ? e : { status: e.status, window: At(e.window) };
420
420
  }
421
- const Ie = t.object({
421
+ const _e = t.object({
422
422
  kind: t.literal("matrix"),
423
- window: be
424
- }).strict(), _e = t.enum(["member", "subtotal", "grand_total"]), At = t.discriminatedUnion("kind", [
423
+ window: Ae
424
+ }).strict(), we = t.enum(["member", "subtotal", "grand_total"]), It = t.discriminatedUnion("kind", [
425
425
  t.object({ kind: t.literal("hierarchy"), label: t.string() }).strict(),
426
- t.object({ kind: t.literal("level"), levelId: O, label: t.string() }).strict(),
426
+ t.object({ kind: t.literal("level"), levelId: P, label: t.string() }).strict(),
427
427
  t.object({
428
428
  kind: t.literal("measure"),
429
- measureId: O,
430
- columnPath: k,
431
- role: _e,
429
+ measureId: P,
430
+ columnPath: v,
431
+ role: we,
432
432
  label: t.string()
433
433
  }).strict()
434
- ]), It = t.object({
435
- columns: t.array(At).readonly(),
436
- descriptors: ye
437
- }).strict(), ae = t.union([
434
+ ]), _t = t.object({
435
+ columns: t.array(It).readonly(),
436
+ descriptors: Se
437
+ }).strict(), re = t.union([
438
438
  t.object({
439
439
  kind: t.literal("value"),
440
440
  value: Z.refine(
@@ -442,37 +442,37 @@ const Ie = t.object({
442
442
  )
443
443
  }).strict(),
444
444
  t.object({ kind: t.enum(["null", "empty"]) }).strict()
445
- ]), _t = t.discriminatedUnion("kind", [
445
+ ]), wt = t.discriminatedUnion("kind", [
446
446
  t.object({
447
447
  kind: t.literal("layout"),
448
- rowPath: k,
449
- role: _e,
450
- values: t.array(ae).readonly()
448
+ rowPath: v,
449
+ role: we,
450
+ values: t.array(re).readonly()
451
451
  }).strict(),
452
452
  t.object({
453
453
  kind: t.literal("flat"),
454
- rowPath: k,
455
- columnPath: k,
456
- values: t.array(ae).readonly()
454
+ rowPath: v,
455
+ columnPath: v,
456
+ values: t.array(re).readonly()
457
457
  }).strict()
458
- ]), Sn = t.discriminatedUnion("kind", [
458
+ ]), bn = t.discriminatedUnion("kind", [
459
459
  t.object({
460
460
  kind: t.literal("layout"),
461
- layout: It,
462
- next: y
461
+ layout: _t,
462
+ next: b
463
463
  }).strict(),
464
464
  t.object({
465
465
  kind: t.literal("rows"),
466
- rows: t.array(_t).readonly(),
467
- next: y.nullable()
466
+ rows: t.array(wt).readonly(),
467
+ next: b.nullable()
468
468
  }).strict()
469
- ]), wt = t.union([
470
- Ue,
469
+ ]), kt = t.union([
471
470
  qe,
472
471
  Me,
473
472
  Be,
474
- Ie
475
- ]), kt = t.object({
473
+ Ge,
474
+ _e
475
+ ]), vt = t.object({
476
476
  status: t.enum([
477
477
  "not_required",
478
478
  "resolved",
@@ -481,22 +481,22 @@ const Ie = t.object({
481
481
  "fanout_risk",
482
482
  "unknown"
483
483
  ]),
484
- requiredSources: t.array(D).optional(),
484
+ requiredSources: t.array(U).optional(),
485
485
  relationshipsUsed: t.array(t.string()).optional(),
486
486
  missingSources: t.array(t.string()).optional(),
487
487
  warnings: t.array(t.string()).optional(),
488
488
  message: t.string().optional(),
489
489
  recommendedNextStep: t.string().optional(),
490
490
  joinPlanSummary: t.object({
491
- baseSource: D.optional(),
492
- joinedSources: t.array(D).optional(),
491
+ baseSource: U.optional(),
492
+ joinedSources: t.array(U).optional(),
493
493
  joinCount: t.number().optional()
494
494
  }).passthrough().optional(),
495
495
  fanoutRisk: t.object({
496
496
  status: t.enum(["none", "warning", "error", "unknown"]),
497
497
  message: t.string().optional()
498
498
  }).passthrough().optional()
499
- }).passthrough(), re = t.enum([
499
+ }).passthrough(), se = t.enum([
500
500
  "ambiguous_fields",
501
501
  "empty_result",
502
502
  "missing_grounded_fields",
@@ -506,7 +506,7 @@ const Ie = t.object({
506
506
  "presentation_incomplete",
507
507
  "query_validation_failed",
508
508
  "unsafe_join"
509
- ]), we = t.object({
509
+ ]), ke = t.object({
510
510
  version: t.literal(1),
511
511
  status: t.enum(["answered", "partial", "blocked"]),
512
512
  summary: t.string(),
@@ -523,7 +523,7 @@ const Ie = t.object({
523
523
  t.object({
524
524
  slotId: t.string().optional(),
525
525
  queryId: t.string().optional(),
526
- reasonCode: re,
526
+ reasonCode: se,
527
527
  message: t.string(),
528
528
  missingFields: t.array(t.string()).optional(),
529
529
  availableFields: t.array(t.string()).optional(),
@@ -536,19 +536,19 @@ const Ie = t.object({
536
536
  ),
537
537
  semanticModelRecommendations: t.array(
538
538
  t.object({
539
- reasonCode: re,
539
+ reasonCode: se,
540
540
  message: t.string(),
541
541
  recommendedNextStep: t.string().optional()
542
542
  }).passthrough()
543
543
  ).optional()
544
- }).passthrough(), ke = t.object({
544
+ }).passthrough(), ve = t.object({
545
545
  scope: t.literal("filtered_query"),
546
- measures: t.record(Ge)
546
+ measures: t.record(ze)
547
547
  }).passthrough(), Te = t.object({
548
548
  answeredObligations: t.array(t.string()),
549
549
  missingObligations: t.array(t.string()),
550
- warnings: t.array(ze).optional()
551
- }).passthrough(), ve = t.object({
550
+ warnings: t.array(Ve).optional()
551
+ }).passthrough(), Ee = t.object({
552
552
  intentId: t.string().optional(),
553
553
  queryId: t.string().optional(),
554
554
  status: t.enum(["answered", "partial", "failed"]),
@@ -564,17 +564,17 @@ const Ie = t.object({
564
564
  intent: t.unknown().optional(),
565
565
  compiledQuery: t.unknown().optional(),
566
566
  fieldsUsed: t.array($).optional(),
567
- result: wt.optional(),
568
- validation: ce,
567
+ result: kt.optional(),
568
+ validation: le,
569
569
  coverage: Te.optional(),
570
570
  missingFields: t.array(t.string()).optional(),
571
571
  warnings: t.array(t.string()).optional(),
572
- relationshipDiagnostics: kt.optional(),
573
- diagnosticFeedback: we.optional(),
574
- population: ke.optional(),
572
+ relationshipDiagnostics: vt.optional(),
573
+ diagnosticFeedback: ke.optional(),
574
+ population: ve.optional(),
575
575
  metadata: t.record(t.string(), t.unknown()).optional()
576
- }).passthrough(), Tt = ve;
577
- function vt(e) {
576
+ }).passthrough(), Tt = Ee;
577
+ function Et(e) {
578
578
  switch (e) {
579
579
  case "boolean":
580
580
  return t.boolean().optional();
@@ -583,7 +583,7 @@ function vt(e) {
583
583
  case "coverage":
584
584
  return Te.optional();
585
585
  case "diagnosticFeedback":
586
- return we.optional();
586
+ return ke.optional();
587
587
  case "executionFieldArray":
588
588
  return t.array($).optional();
589
589
  case "executionResult":
@@ -591,11 +591,11 @@ function vt(e) {
591
591
  case "number":
592
592
  return t.number().finite().optional();
593
593
  case "population":
594
- return ke.optional();
594
+ return ve.optional();
595
595
  case "record":
596
- return We.optional();
596
+ return Ke.optional();
597
597
  case "recordArray":
598
- return Ve.optional();
598
+ return We.optional();
599
599
  case "responseDetail":
600
600
  return t.enum(["compact", "standard", "debug"]).optional();
601
601
  case "string":
@@ -607,54 +607,54 @@ function vt(e) {
607
607
  case "unknownArray":
608
608
  return t.array(t.unknown()).optional();
609
609
  case "validationResult":
610
- return ce.optional();
610
+ return le.optional();
611
611
  }
612
612
  }
613
- const Et = Object.fromEntries(
613
+ const Rt = Object.fromEntries(
614
614
  Object.entries(Y).map(
615
- ([e, n]) => [e, vt(n)]
615
+ ([e, n]) => [e, Et(n)]
616
616
  )
617
- ), Rt = t.object(Et).strict(), Ct = new Set(
617
+ ), Ct = t.object(Rt).strict(), Nt = new Set(
618
618
  Object.keys(Y)
619
619
  );
620
- function bn() {
620
+ function An() {
621
621
  return Object.keys(
622
622
  Y
623
623
  );
624
624
  }
625
- function Nt(e) {
626
- return Ct.has(e);
625
+ function Ot(e) {
626
+ return Nt.has(e);
627
627
  }
628
- function An(e) {
628
+ function In(e) {
629
629
  if (!e || typeof e != "object" || Array.isArray(e))
630
630
  throw new Error("Semaphor analyze result must be an object.");
631
631
  const a = Object.keys(e).filter(
632
- (r) => !Nt(r)
632
+ (r) => !Ot(r)
633
633
  );
634
634
  if (a.length)
635
635
  throw new Error(
636
636
  `Semaphor analyze result contains unsupported top-level field(s): ${a.join(", ")}.`
637
637
  );
638
- return Rt.parse(e);
638
+ return Ct.parse(e);
639
639
  }
640
- const Ee = 100, j = "selection:";
641
- function Re(e) {
640
+ const Re = 100, L = "selection:";
641
+ function Ce(e) {
642
642
  return [
643
- me(e.source),
644
- Je(e.name),
643
+ pe(e.source),
644
+ et(e.name),
645
645
  e.sourceField ?? ""
646
646
  ].join("::");
647
647
  }
648
- function In(e) {
649
- return `${j}${e}`;
648
+ function _n(e) {
649
+ return `${L}${e}`;
650
650
  }
651
- function Ot(e) {
652
- return e.startsWith(j) && e.length > j.length;
651
+ function xt(e) {
652
+ return e.startsWith(L) && e.length > L.length;
653
653
  }
654
- function _n(e) {
655
- return Ot(e) ? e.slice(j.length) : void 0;
654
+ function wn(e) {
655
+ return xt(e) ? e.slice(L.length) : void 0;
656
656
  }
657
- function Ce(e) {
657
+ function Ne(e) {
658
658
  if (!e) return "";
659
659
  const n = e.calendar.fiscalCalendar;
660
660
  return JSON.stringify([
@@ -664,37 +664,37 @@ function Ce(e) {
664
664
  n ? [n.kind, n.yearStartMonth] : null
665
665
  ]);
666
666
  }
667
- function Ne(e) {
667
+ function Oe(e) {
668
668
  return e ? JSON.stringify([e.valueKind, e.tz]) : "";
669
669
  }
670
- function xt(e) {
670
+ function Pt(e) {
671
671
  return JSON.stringify([
672
- Re(e.field),
672
+ Ce(e.field),
673
673
  e.operator,
674
674
  e.operator === "isNull" ? null : e.value,
675
- Ce(e.temporalBucket),
676
- Ne(e.rawTemporal)
675
+ Ne(e.temporalBucket),
676
+ Oe(e.rawTemporal)
677
677
  ]);
678
678
  }
679
- function se(e) {
680
- return JSON.stringify(e.conditions.map(xt).sort());
679
+ function oe(e) {
680
+ return JSON.stringify(e.conditions.map(Pt).sort());
681
681
  }
682
682
  function z(e) {
683
683
  return JSON.stringify([
684
- me(e.field.source),
684
+ pe(e.field.source),
685
685
  e.field.name,
686
686
  e.operator,
687
687
  e.operator === "isNull" ? null : e.value,
688
- Ce(e.temporalBucket),
689
- Ne(e.rawTemporal)
688
+ Ne(e.temporalBucket),
689
+ Oe(e.rawTemporal)
690
690
  ]);
691
691
  }
692
- function oe(e) {
692
+ function ie(e) {
693
693
  return JSON.stringify(
694
694
  e.conditions.map(z).sort()
695
695
  );
696
696
  }
697
- function wn(e) {
697
+ function kn(e) {
698
698
  const n = e.map((a) => a.id);
699
699
  if (new Set(n).size !== n.length)
700
700
  throw new Error("Data App selections require one active selection per id.");
@@ -710,8 +710,8 @@ function wn(e) {
710
710
  )
711
711
  })).sort(
712
712
  (r, s) => q(
713
- oe(r),
714
- oe(s)
713
+ ie(r),
714
+ ie(s)
715
715
  )
716
716
  )
717
717
  })).sort((a, r) => q(a.id, r.id));
@@ -719,29 +719,29 @@ function wn(e) {
719
719
  function q(e, n) {
720
720
  return e < n ? -1 : e > n ? 1 : 0;
721
721
  }
722
- function kn(e, n) {
723
- return se(e) === se(n);
722
+ function vn(e, n) {
723
+ return oe(e) === oe(n);
724
724
  }
725
- const Pt = "(Blank)";
725
+ const jt = "(Blank)";
726
726
  function Tn(e) {
727
- return e.conditions.map((n) => n.label ? n.label : n.operator === "isNull" || n.value === null ? Pt : String(n.value)).join(" · ");
727
+ return e.conditions.map((n) => n.label ? n.label : n.operator === "isNull" || n.value === null ? jt : String(n.value)).join(" · ");
728
728
  }
729
729
  const Ft = t.union([
730
- Ke,
731
- $e
732
- ]), jt = t.object({
730
+ $e,
731
+ Ze
732
+ ]), Lt = t.object({
733
733
  name: t.string().min(1),
734
734
  source: Ft,
735
735
  dataType: t.enum(["string", "number", "boolean", "date", "datetime"]),
736
736
  sourceField: t.string().min(1).optional(),
737
737
  nativeDataType: t.string().min(1).optional()
738
- }).strict(), Lt = t.object({
739
- field: jt,
738
+ }).strict(), Ut = t.object({
739
+ field: Lt,
740
740
  operator: t.enum(["=", "isNull"]),
741
741
  value: t.union([t.string(), t.number().finite(), t.null()]),
742
742
  label: t.string().optional(),
743
- temporalBucket: ue.optional(),
744
- rawTemporal: le.optional()
743
+ temporalBucket: de.optional(),
744
+ rawTemporal: ue.optional()
745
745
  }).strict().superRefine((e, n) => {
746
746
  e.operator === "isNull" != (e.value === null) && n.addIssue({
747
747
  code: t.ZodIssueCode.custom,
@@ -749,47 +749,47 @@ const Ft = t.union([
749
749
  path: ["value"]
750
750
  });
751
751
  }), Dt = t.object({
752
- conditions: t.array(Lt).min(1)
752
+ conditions: t.array(Ut).min(1)
753
753
  }).strict().superRefine((e, n) => {
754
- const a = e.conditions.map((r) => Re(r.field));
754
+ const a = e.conditions.map((r) => Ce(r.field));
755
755
  new Set(a).size !== a.length && n.addIssue({
756
756
  code: t.ZodIssueCode.custom,
757
757
  message: "A tuple holds one condition per field.",
758
758
  path: ["conditions"]
759
759
  });
760
- }), vn = t.object({
760
+ }), En = t.object({
761
761
  kind: t.literal("selection"),
762
762
  sourceCardId: t.string().min(1),
763
- tuples: t.array(Dt).min(1).max(Ee)
764
- }).strict(), Ut = t.object({
765
- field: Ze,
763
+ tuples: t.array(Dt).min(1).max(Re)
764
+ }).strict(), qt = t.object({
765
+ field: Ye,
766
766
  operator: t.enum(["=", "isNull"]),
767
767
  value: t.union([t.string(), t.number().finite(), t.null()]),
768
- temporalBucket: ue.optional(),
769
- rawTemporal: le.optional()
768
+ temporalBucket: de.optional(),
769
+ rawTemporal: ue.optional()
770
770
  }).strict().superRefine((e, n) => {
771
771
  e.operator === "isNull" != (e.value === null) && n.addIssue({
772
772
  code: t.ZodIssueCode.custom,
773
773
  message: "isNull carries a null value, and only isNull does.",
774
774
  path: ["value"]
775
775
  });
776
- }), qt = t.object({
777
- conditions: t.array(Ut).min(1)
776
+ }), Mt = t.object({
777
+ conditions: t.array(qt).min(1)
778
778
  }).strict().superRefine((e, n) => {
779
779
  for (let a = 0; a < e.conditions.length; a += 1) {
780
780
  const r = e.conditions[a];
781
781
  e.conditions.findIndex(
782
- (c, i) => i < a && Qe(c.field, r.field)
782
+ (c, o) => o < a && Je(c.field, r.field)
783
783
  ) !== -1 && n.addIssue({
784
784
  code: t.ZodIssueCode.custom,
785
785
  message: "A selection tuple can contain only one condition per field.",
786
786
  path: ["conditions", a, "field"]
787
787
  });
788
788
  }
789
- }), En = t.object({
789
+ }), Rn = t.object({
790
790
  id: t.string().min(1),
791
- tuples: t.array(qt).min(1).max(Ee)
792
- }).strict(), Oe = {
791
+ tuples: t.array(Mt).min(1).max(Re)
792
+ }).strict(), xe = {
793
793
  COUNT: "count",
794
794
  COUNTIF: "count",
795
795
  COUNT_IF: "count",
@@ -853,16 +853,16 @@ const Ft = t.union([
853
853
  COLLECT_SET: "other",
854
854
  FIRST: "other",
855
855
  LAST: "other"
856
- }, Mt = /(?:_AGG$|^APPROX_[A-Z0-9_]+$|^COUNT_DISTINCT$|^HLL_(?:COUNT|ESTIMATE)$|^REGR_[A-Z_]+$)/;
857
- function Bt(e) {
856
+ }, Bt = /(?:_AGG$|^APPROX_[A-Z0-9_]+$|^COUNT_DISTINCT$|^HLL_(?:COUNT|ESTIMATE)$|^REGR_[A-Z_]+$)/;
857
+ function Gt(e) {
858
858
  const n = e.toUpperCase();
859
- return n in Oe || Mt.test(n);
859
+ return n in xe || Bt.test(n);
860
860
  }
861
- function xe(e, n = !1) {
862
- const a = Oe[e.toUpperCase()] ?? "other";
861
+ function Pe(e, n = !1) {
862
+ const a = xe[e.toUpperCase()] ?? "other";
863
863
  return n ? a === "count" || a === "count_distinct" ? "count_distinct" : a === "min" || a === "max" ? a : "repeat_safe_other" : a;
864
864
  }
865
- const Gt = /* @__PURE__ */ new Set([
865
+ const zt = /* @__PURE__ */ new Set([
866
866
  "NULLIF",
867
867
  "COALESCE",
868
868
  "IFNULL",
@@ -877,7 +877,7 @@ const Gt = /* @__PURE__ */ new Set([
877
877
  "CAST",
878
878
  "TRY_CAST",
879
879
  "SAFE_CAST"
880
- ]), zt = /* @__PURE__ */ new Set(["DECIMAL", "NUMERIC", "INTEGER", "INT", "BIGINT", "FLOAT", "DOUBLE", "REAL", "VARCHAR", "TEXT"]), ie = /[A-Za-z_]/, Vt = /[A-Za-z0-9_]/;
880
+ ]), Vt = /* @__PURE__ */ new Set(["DECIMAL", "NUMERIC", "INTEGER", "INT", "BIGINT", "FLOAT", "DOUBLE", "REAL", "VARCHAR", "TEXT"]), ce = /[A-Za-z_]/, Wt = /[A-Za-z0-9_]/;
881
881
  function V(e, n) {
882
882
  const a = e[n];
883
883
  let r = n + 1;
@@ -893,7 +893,7 @@ function V(e, n) {
893
893
  }
894
894
  return r;
895
895
  }
896
- function P(e, n) {
896
+ function x(e, n) {
897
897
  let a = 0, r = n;
898
898
  for (; r < e.length; ) {
899
899
  const s = e[r];
@@ -914,138 +914,141 @@ function F(e, n) {
914
914
  }
915
915
  function M(e, n) {
916
916
  let a = n + 1;
917
- for (; a < e.length && Vt.test(e[a]); ) a += 1;
917
+ for (; a < e.length && Wt.test(e[a]); ) a += 1;
918
918
  return a;
919
919
  }
920
- const Wt = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
920
+ const Kt = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
921
921
  function Xt(e) {
922
- return Array.from(e.matchAll(Wt), (n) => n[1]);
922
+ return Array.from(e.matchAll(Kt), (n) => n[1]);
923
923
  }
924
924
  function W(e, n = /* @__PURE__ */ new Set()) {
925
- const a = [], r = [];
926
- let s = !1, c = "", i = !0, l = 0;
927
- for (; l < e.length; ) {
928
- const m = e[l];
929
- if (m === "'" || m === '"') {
930
- const o = V(e, l);
931
- c += "'s'", m !== "'" && (i = !1), l = o;
925
+ const a = [], r = [], s = [];
926
+ let c = !1, o = "", m = !0, d = 0;
927
+ for (; d < e.length; ) {
928
+ const i = e[d];
929
+ if (i === "'" || i === '"') {
930
+ const l = V(e, d);
931
+ o += "'s'", i !== "'" && (m = !1), d = l;
932
932
  continue;
933
933
  }
934
- if (m === "{") {
935
- const o = e.indexOf("}", l);
936
- if (o > l) {
937
- const d = e.slice(l + 1, o);
938
- r.push(d), n.has(d) || (i = !1), c += `#${d}`, l = o + 1;
934
+ if (i === "{") {
935
+ const l = e.indexOf("}", d);
936
+ if (l > d) {
937
+ const p = e.slice(d + 1, l);
938
+ r.push(p), n.has(p) || (m = !1), o += `#${p}`, d = l + 1;
939
939
  continue;
940
940
  }
941
941
  }
942
- if (ie.test(m)) {
943
- const o = M(e, l), d = e.slice(l, o), p = F(e, o);
944
- if (e[p] === "(" && Bt(d)) {
945
- let g = P(e, p);
946
- const I = g - 1;
947
- let R = g;
948
- const v = e.slice(p + 1, g - 1);
949
- let x = v.trim() ? 1 : 0;
950
- for (let h = p + 1; h < R - 1; h++)
951
- e[h] === "'" || e[h] === '"' ? h = V(e, h) - 1 : e[h] === "(" ? h = P(e, h) - 1 : e[h] === "," && x++;
952
- const C = /^\s*DISTINCT\b/i.test(v);
953
- W(C ? v.replace(/^\s*DISTINCT\b/i, "") : v).calls.length > 0 && (s = !0);
954
- let b = !1, _ = !1;
942
+ if (ce.test(i)) {
943
+ const l = M(e, d), p = e.slice(d, l), y = F(e, l);
944
+ if (e[y] === "(" && Gt(p)) {
945
+ let g = x(e, y);
946
+ const j = g - 1;
947
+ let E = g;
948
+ const R = e.slice(y + 1, g - 1);
949
+ let O = R.trim() ? 1 : 0;
950
+ for (let S = y + 1; S < E - 1; S++)
951
+ e[S] === "'" || e[S] === '"' ? S = V(e, S) - 1 : e[S] === "(" ? S = x(e, S) - 1 : e[S] === "," && O++;
952
+ const A = /^\s*DISTINCT\b/i.test(R);
953
+ W(A ? R.replace(/^\s*DISTINCT\b/i, "") : R).calls.length > 0 && (c = !0);
954
+ let k = !1, w = !1;
955
+ const C = [];
955
956
  for (; ; ) {
956
- const h = F(e, g);
957
- if (!ie.test(e[h] || "")) break;
958
- const N = M(e, h), E = e.slice(h, N).toUpperCase(), u = F(e, N);
959
- if (E === "WITHIN") {
960
- const S = M(e, u), w = F(e, S);
961
- if (e.slice(u, S).toUpperCase() === "GROUP" && e[w] === "(") {
962
- g = P(e, w), R = g;
957
+ const S = F(e, g);
958
+ if (!ce.test(e[S] || "")) break;
959
+ const u = M(e, S), h = e.slice(S, u).toUpperCase(), I = F(e, u);
960
+ if (h === "WITHIN") {
961
+ const N = M(e, I), ee = F(e, N);
962
+ if (e.slice(I, N).toUpperCase() === "GROUP" && e[ee] === "(") {
963
+ g = x(e, ee), E = g;
963
964
  continue;
964
965
  }
965
966
  }
966
- if ((E === "FILTER" || E === "OVER") && e[u] === "(") {
967
- b = b || E === "OVER", _ = _ || E === "FILTER", g = P(e, u);
967
+ if ((h === "FILTER" || h === "OVER") && e[I] === "(") {
968
+ k = k || h === "OVER", w = w || h === "FILTER", g = x(e, I), C.push({ kind: h === "OVER" ? "over" : "filter", start: I + 1, end: g - 1 });
968
969
  continue;
969
970
  }
970
971
  break;
971
972
  }
972
973
  a.push({
973
- name: d.toUpperCase(),
974
- kind: xe(d, C),
975
- distinct: C,
976
- windowed: b,
977
- tokens: Xt(e.slice(p, g)),
978
- span: { start: l, end: R, argumentStart: p + 1, argumentEnd: I },
979
- argumentCount: x,
980
- filtered: _
981
- }), c += `@${a.length - 1}`, l = g;
974
+ name: p.toUpperCase(),
975
+ kind: Pe(p, A),
976
+ distinct: A,
977
+ windowed: k,
978
+ tokens: Xt(e.slice(y, g)),
979
+ span: { start: d, end: E, argumentStart: y + 1, argumentEnd: j },
980
+ argumentCount: O,
981
+ filtered: w,
982
+ suffixes: C
983
+ }), o += `@${a.length - 1}`, d = g;
982
984
  continue;
983
985
  }
984
- c += e.slice(l, o), l = o;
986
+ p.toUpperCase() === "OVER" && e[y] === "(" && s.push({ start: y + 1, end: x(e, y) - 1 }), o += e.slice(d, l), d = l;
985
987
  continue;
986
988
  }
987
- /[\s0-9.,()+*/%<>=!|&^-]/.test(m) || (i = !1), c += m, l += 1;
989
+ /[\s0-9.,()+*/%<>=!|&^-]/.test(i) || (m = !1), o += i, d += 1;
988
990
  }
989
991
  return {
990
992
  calls: a,
991
- nestedAggregate: s,
992
- windowed: a.some((m) => m.windowed),
993
+ nestedAggregate: c,
994
+ windowed: a.some((i) => i.windowed),
993
995
  tokensOutsideAggregates: r,
994
- aggregateInputsComplete: i && Kt(c, n),
995
- skeleton: c
996
+ windowClauses: s,
997
+ aggregateInputsComplete: m && $t(o, n),
998
+ skeleton: o
996
999
  };
997
1000
  }
998
- function Kt(e, n) {
999
- var m;
1001
+ function $t(e, n) {
1002
+ var d;
1000
1003
  const a = [];
1001
1004
  let r = 0;
1002
1005
  for (; r < e.length; ) {
1003
- const o = e.slice(r), d = (m = /^(\s+|@\d+|#field_\d+|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|'s'|[A-Za-z_][A-Za-z0-9_]*|<>|!=|<=|>=|[()+*/%,<>=-])/.exec(o)) == null ? void 0 : m[0];
1004
- if (!d) return !1;
1005
- if (r += d.length, d.startsWith("#")) {
1006
- if (!n.has(d.slice(1))) return !1;
1006
+ const i = e.slice(r), l = (d = /^(\s+|@\d+|#field_\d+|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|'s'|[A-Za-z_][A-Za-z0-9_]*|<>|!=|<=|>=|[()+*/%,<>=-])/.exec(i)) == null ? void 0 : d[0];
1007
+ if (!l) return !1;
1008
+ if (r += l.length, l.startsWith("#")) {
1009
+ if (!n.has(l.slice(1))) return !1;
1007
1010
  a.push("@input");
1008
- } else d.trim() && a.push(d.toUpperCase());
1011
+ } else l.trim() && a.push(l.toUpperCase());
1009
1012
  }
1010
1013
  let s = 0;
1011
- const c = (o) => a[s] === o && ++s > 0, i = () => {
1012
- if (!l()) return !1;
1014
+ const c = (i) => a[s] === i && ++s > 0, o = () => {
1015
+ if (!m()) return !1;
1013
1016
  for (; ["+", "-", "*", "/", "%", "<", ">", "<=", ">=", "=", "<>", "!=", "AND", "OR", "IS"].includes(a[s]); )
1014
- if (a[s++] === "IS" && c("NOT"), !l()) return !1;
1017
+ if (a[s++] === "IS" && c("NOT"), !m()) return !1;
1015
1018
  return !0;
1016
- }, l = () => {
1017
- const o = a[s];
1018
- if (!o) return !1;
1019
- if (["+", "-", "NOT"].includes(o))
1020
- return s++, l();
1021
- if (c("(")) return i() && c(")");
1019
+ }, m = () => {
1020
+ const i = a[s];
1021
+ if (!i) return !1;
1022
+ if (["+", "-", "NOT"].includes(i))
1023
+ return s++, m();
1024
+ if (c("(")) return o() && c(")");
1022
1025
  if (c("CASE")) {
1023
- if (a[s] !== "WHEN" && !i()) return !1;
1024
- let d = 0;
1026
+ if (a[s] !== "WHEN" && !o()) return !1;
1027
+ let l = 0;
1025
1028
  for (; c("WHEN"); ) {
1026
- if (!i() || !c("THEN") || !i()) return !1;
1027
- d++;
1029
+ if (!o() || !c("THEN") || !o()) return !1;
1030
+ l++;
1028
1031
  }
1029
- return c("ELSE") && !i() ? !1 : d > 0 && c("END");
1032
+ return c("ELSE") && !o() ? !1 : l > 0 && c("END");
1030
1033
  }
1031
- if (o.startsWith("@") || o === "'S'" || ["NULL", "TRUE", "FALSE"].includes(o) || /^[0-9.]/.test(o))
1034
+ if (i.startsWith("@") || i === "'S'" || ["NULL", "TRUE", "FALSE"].includes(i) || /^[0-9.]/.test(i))
1032
1035
  return s++, !0;
1033
- if (!Gt.has(o) || (s++, !c("(") || !i())) return !1;
1034
- if (["CAST", "TRY_CAST", "SAFE_CAST"].includes(o)) {
1035
- if (!c("AS") || !zt.has(a[s++]) || (c("PRECISION"), c("(") && (!/^\d+$/.test(a[s++] || "") || c(",") && !/^\d+$/.test(a[s++] || "") || !c(")"))))
1036
+ if (!zt.has(i) || (s++, !c("(") || !o())) return !1;
1037
+ if (["CAST", "TRY_CAST", "SAFE_CAST"].includes(i)) {
1038
+ if (!c("AS") || !Vt.has(a[s++]) || (c("PRECISION"), c("(") && (!/^\d+$/.test(a[s++] || "") || c(",") && !/^\d+$/.test(a[s++] || "") || !c(")"))))
1036
1039
  return !1;
1037
1040
  } else
1038
- for (; c(","); ) if (!i()) return !1;
1041
+ for (; c(","); ) if (!o()) return !1;
1039
1042
  return c(")");
1040
1043
  };
1041
- return i() && s === a.length;
1044
+ return o() && s === a.length;
1042
1045
  }
1043
- function Rn(e, n) {
1046
+ function Cn(e, n) {
1044
1047
  if (n.argumentCount !== 1 || n.windowed || n.filtered) return;
1045
1048
  const a = e.slice(n.span.argumentStart, n.span.argumentEnd).trim();
1046
1049
  return n.distinct ? a.replace(/^DISTINCT\s*/i, "") : a;
1047
1050
  }
1048
- function $t(e) {
1051
+ function Zt(e) {
1049
1052
  const n = [];
1050
1053
  let a = 0;
1051
1054
  for (; a < e.length; ) {
@@ -1089,78 +1092,78 @@ function $t(e) {
1089
1092
  }
1090
1093
  return n;
1091
1094
  }
1092
- function Zt(e) {
1093
- const n = $t(e), a = n.some((o) => o.type === "op" && o.value === "/");
1094
- if (n.some((o) => o.type === "other"))
1095
+ function Yt(e) {
1096
+ const n = Zt(e), a = n.some((i) => i.type === "op" && i.value === "/");
1097
+ if (n.some((i) => i.type === "other"))
1095
1098
  return { kind: "other", hasDivision: a };
1096
1099
  let r = 0, s = !0;
1097
1100
  const c = () => {
1098
- let o = [], d, p = !0;
1101
+ let i = [], l, p = !0;
1099
1102
  for (; ; ) {
1100
1103
  if (!p) {
1101
- const I = n[r];
1102
- if (!(I && I.type === "op" && (I.value === "+" || I.value === "-"))) break;
1104
+ const g = n[r];
1105
+ if (!(g && g.type === "op" && (g.value === "+" || g.value === "-"))) break;
1103
1106
  r += 1;
1104
1107
  }
1105
- const g = i();
1106
- if (!g) return null;
1107
- d === void 0 ? d = g.degree : d !== g.degree && (s = !1), o = o.concat(g.units), p = !1;
1108
+ const y = o();
1109
+ if (!y) return null;
1110
+ l === void 0 ? l = y.degree : l !== y.degree && (s = !1), i = i.concat(y.units), p = !1;
1108
1111
  }
1109
- return { degree: d ?? 0, units: o };
1110
- }, i = () => {
1111
- let o = l();
1112
- if (!o) return null;
1112
+ return { degree: l ?? 0, units: i };
1113
+ }, o = () => {
1114
+ let i = m();
1115
+ if (!i) return null;
1113
1116
  for (; ; ) {
1114
- const d = n[r];
1115
- if (!(d && d.type === "op" && (d.value === "*" || d.value === "/"))) break;
1117
+ const l = n[r];
1118
+ if (!(l && l.type === "op" && (l.value === "*" || l.value === "/"))) break;
1116
1119
  r += 1;
1117
- const p = l();
1120
+ const p = m();
1118
1121
  if (!p) return null;
1119
- d.value === "/" && p.degree > 0 && (s = !1), o.degree + p.degree > 1 && (s = !1), o = { degree: o.degree + p.degree, units: o.units.concat(p.units) };
1122
+ l.value === "/" && p.degree > 0 && (s = !1), i.degree + p.degree > 1 && (s = !1), i = { degree: i.degree + p.degree, units: i.units.concat(p.units) };
1120
1123
  }
1121
- return o;
1122
- }, l = () => {
1123
- var d;
1124
- const o = n[r];
1125
- if (!o) return null;
1126
- if (o.type === "op" && o.value === "-")
1127
- return r += 1, l();
1128
- if (o.type === "unit")
1129
- return r += 1, { degree: 1, units: [o.unit] };
1130
- if (o.type === "number")
1124
+ return i;
1125
+ }, m = () => {
1126
+ var l;
1127
+ const i = n[r];
1128
+ if (!i) return null;
1129
+ if (i.type === "op" && i.value === "-")
1130
+ return r += 1, m();
1131
+ if (i.type === "unit")
1132
+ return r += 1, { degree: 1, units: [i.unit] };
1133
+ if (i.type === "number")
1131
1134
  return r += 1, { degree: 0, units: [] };
1132
- if (o.type === "open") {
1135
+ if (i.type === "open") {
1133
1136
  r += 1;
1134
1137
  const p = c();
1135
- return !p || ((d = n[r]) == null ? void 0 : d.type) !== "close" ? null : (r += 1, p);
1138
+ return !p || ((l = n[r]) == null ? void 0 : l.type) !== "close" ? null : (r += 1, p);
1136
1139
  }
1137
1140
  return null;
1138
- }, m = c();
1139
- return !m || r !== n.length ? { kind: "other", hasDivision: a } : m.units.length === 1 && m.degree === 1 && s && !a && n.filter((d) => d.type !== "open" && d.type !== "close").length === 1 ? { kind: "single", unit: m.units[0] } : s && m.degree === 1 ? { kind: "linear", units: m.units } : { kind: "other", hasDivision: a };
1141
+ }, d = c();
1142
+ return !d || r !== n.length ? { kind: "other", hasDivision: a } : d.units.length === 1 && d.degree === 1 && s && !a && n.filter((l) => l.type !== "open" && l.type !== "close").length === 1 ? { kind: "single", unit: d.units[0] } : s && d.degree === 1 ? { kind: "linear", units: d.units } : { kind: "other", hasDivision: a };
1140
1143
  }
1141
- const Yt = t.object({ key: t.string().min(1), nativeText: t.string().nullable() }).strict(), Ht = t.object({
1142
- executionInstant: t.string().refine((e) => et(e) !== null, {
1144
+ const Ht = t.object({ key: t.string().min(1), nativeText: t.string().nullable() }).strict(), Qt = t.object({
1145
+ executionInstant: t.string().refine((e) => tt(e) !== null, {
1143
1146
  message: "executionInstant must be an ISO instant"
1144
1147
  }),
1145
- dataAnchors: t.array(Yt).default([])
1148
+ dataAnchors: t.array(Ht).default([])
1146
1149
  }).strict().refine(
1147
1150
  (e) => new Set(e.dataAnchors.map((n) => n.key)).size === e.dataAnchors.length,
1148
1151
  { message: "dataAnchors keys must be unique", path: ["dataAnchors"] }
1149
1152
  );
1150
- function Cn(e) {
1153
+ function Nn(e) {
1151
1154
  if (e == null) return;
1152
- const n = Ht.safeParse(e);
1155
+ const n = Qt.safeParse(e);
1153
1156
  return n.success ? n.data : void 0;
1154
1157
  }
1155
- const Pe = /* @__PURE__ */ new Set([
1158
+ const je = /* @__PURE__ */ new Set([
1156
1159
  "min",
1157
1160
  "max",
1158
1161
  "count_distinct",
1159
1162
  "repeat_safe_other"
1160
1163
  ]);
1161
- function X(e) {
1164
+ function K(e) {
1162
1165
  if (!(!e || !e.trim()))
1163
- return xe(e);
1166
+ return Pe(e);
1164
1167
  }
1165
1168
  function Fe(e) {
1166
1169
  switch (e) {
@@ -1180,7 +1183,7 @@ function Fe(e) {
1180
1183
  return { kind: "none", reason: "other" };
1181
1184
  }
1182
1185
  }
1183
- function Qt(e) {
1186
+ function Jt(e) {
1184
1187
  var n, a;
1185
1188
  return ((n = e.derivedField) == null ? void 0 : n.computeStage) || ((a = e.calculatedFormula) == null ? void 0 : a.computeStage);
1186
1189
  }
@@ -1193,14 +1196,14 @@ const Q = {
1193
1196
  outputType: "numeric",
1194
1197
  identity: "unresolved",
1195
1198
  unresolved: !0
1196
- }, je = { ...Q, stage: "row" };
1197
- function K(e) {
1199
+ }, Le = { ...Q, stage: "row" };
1200
+ function X(e) {
1198
1201
  return {
1199
1202
  stage: "row",
1200
1203
  outer: e,
1201
1204
  calls: [{ kind: e, distinct: e === "count_distinct" }],
1202
1205
  windowed: !1,
1203
- repeatSafe: Pe.has(e),
1206
+ repeatSafe: je.has(e),
1204
1207
  reaggregation: Fe(e),
1205
1208
  outputType: e === "min" || e === "max" ? "input" : "numeric",
1206
1209
  identity: e,
@@ -1212,198 +1215,198 @@ function B(e, n) {
1212
1215
  const a = (r = n.derivedField) == null ? void 0 : r.aggregationBehavior;
1213
1216
  return !a || e.unresolved ? e : a === "additive" ? e.reaggregation.kind === "additive" ? e : { ...e, reaggregation: { kind: "additive" } } : { ...e, reaggregation: { kind: "none", reason: "declared" } };
1214
1217
  }
1215
- function Jt(e, n) {
1218
+ function en(e, n) {
1216
1219
  if (!e) return Q;
1217
1220
  if (typeof e.expression == "string" && e.expression.trim()) {
1218
1221
  const r = J(e, n + 1);
1219
1222
  return r === "row_input" ? "raw" : r.unresolved || r.stage === "aggregate" || r.outer ? r : "raw";
1220
1223
  }
1221
- const a = X(e.aggregate);
1222
- return a ? K(a) : "raw";
1224
+ const a = K(e.aggregate);
1225
+ return a ? X(a) : "raw";
1223
1226
  }
1224
- const en = 12;
1227
+ const tn = 12;
1225
1228
  function J(e, n) {
1226
- var E;
1227
- if (n > en) return Q;
1229
+ var S;
1230
+ if (n > tn) return Q;
1228
1231
  const a = typeof e.expression == "string" ? e.expression.trim() : "";
1229
1232
  if (!a)
1230
1233
  return B(
1231
- K(X(e.aggregate) ?? "sum"),
1234
+ X(K(e.aggregate) ?? "sum"),
1232
1235
  e
1233
1236
  );
1234
- const r = W(a), s = ((E = e.calculatedFormula) == null ? void 0 : E.inputFields) || [], c = (u) => {
1235
- const S = /^field_(\d+)$/.exec(u);
1236
- return S ? s[Number(S[1])] : void 0;
1237
- }, i = /* @__PURE__ */ new Map();
1237
+ const r = W(a), s = ((S = e.calculatedFormula) == null ? void 0 : S.inputFields) || [], c = (u) => {
1238
+ const h = /^field_(\d+)$/.exec(u);
1239
+ return h ? s[Number(h[1])] : void 0;
1240
+ }, o = /* @__PURE__ */ new Map();
1238
1241
  for (const u of r.tokensOutsideAggregates)
1239
- i.has(u) || i.set(u, Jt(c(u), n));
1240
- const l = r.calls.some(
1241
- (u) => u.tokens.some((S) => {
1242
- const w = c(S);
1243
- if (!(w != null && w.expression)) return !1;
1244
- const L = J(w, n + 1);
1245
- return L !== "row_input" && (L.unresolved || L.stage === "aggregate");
1242
+ o.has(u) || o.set(u, en(c(u), n));
1243
+ const m = r.calls.some(
1244
+ (u) => u.tokens.some((h) => {
1245
+ const I = c(h);
1246
+ if (!(I != null && I.expression)) return !1;
1247
+ const N = J(I, n + 1);
1248
+ return N !== "row_input" && (N.unresolved || N.stage === "aggregate");
1246
1249
  })
1247
- ), m = Array.from(i.values()).filter(
1250
+ ), d = Array.from(o.values()).filter(
1248
1251
  (u) => u !== "raw"
1249
- ), o = Array.from(i.values()).some((u) => u === "raw"), d = r.calls.length > 0 || m.length > 0 || Qt(e) === "aggregate" || !!e.isPreAggregated, p = new Set(
1250
- [...i].filter(
1251
- ([u, S]) => S === "raw" ? !d && !!c(u) : !S.unresolved
1252
+ ), i = Array.from(o.values()).some((u) => u === "raw"), l = r.calls.length > 0 || d.length > 0 || Jt(e) === "aggregate" || !!e.isPreAggregated, p = new Set(
1253
+ [...o].filter(
1254
+ ([u, h]) => h === "raw" ? !l && !!c(u) : !h.unresolved
1252
1255
  ).map(([u]) => u)
1253
- ), g = W(a, p).aggregateInputsComplete;
1254
- if (!d) {
1255
- if (!g) return je;
1256
- const u = X(e.aggregate);
1257
- return u ? B(K(u), e) : "row_input";
1256
+ ), y = W(a, p).aggregateInputsComplete;
1257
+ if (!l) {
1258
+ if (!y) return Le;
1259
+ const u = K(e.aggregate);
1260
+ return u ? B(X(u), e) : "row_input";
1258
1261
  }
1259
- const I = !g || o || r.nestedAggregate || l || m.some((u) => u.unresolved) || r.calls.length === 0 && m.length === 0, R = [
1262
+ const g = !y || i || r.nestedAggregate || m || d.some((u) => u.unresolved) || r.calls.length === 0 && d.length === 0, j = [
1260
1263
  ...r.calls.map((u) => ({ kind: u.kind, distinct: u.distinct })),
1261
- ...m.flatMap((u) => u.calls)
1262
- ], v = r.windowed || m.some((u) => u.windowed), x = !I && !v && R.every((u) => Pe.has(u.kind)), C = (u) => {
1264
+ ...d.flatMap((u) => u.calls)
1265
+ ], E = r.windowed || d.some((u) => u.windowed), R = !g && !E && j.every((u) => je.has(u.kind)), O = (u) => {
1263
1266
  if (u.kind === "call") {
1264
- const w = r.calls[u.index];
1265
- return w ? Fe(w.kind) : { kind: "none", reason: "unresolved" };
1267
+ const I = r.calls[u.index];
1268
+ return I ? Fe(I.kind) : { kind: "none", reason: "unresolved" };
1266
1269
  }
1267
- const S = i.get(u.token);
1268
- return S && S !== "raw" ? S.reaggregation : { kind: "none", reason: "unresolved" };
1269
- }, b = Zt(r.skeleton);
1270
- let _, h, N = "numeric";
1271
- if (I)
1272
- _ = { kind: "none", reason: "unresolved" }, h = "unresolved";
1273
- else if (v)
1274
- _ = { kind: "none", reason: "window" }, h = "expression";
1275
- else if (b.kind === "single")
1276
- if (_ = C(b.unit), b.unit.kind === "call") {
1277
- const u = r.calls[b.unit.index];
1278
- h = u.kind, (u.kind === "min" || u.kind === "max") && (N = "input");
1270
+ const h = o.get(u.token);
1271
+ return h && h !== "raw" ? h.reaggregation : { kind: "none", reason: "unresolved" };
1272
+ }, A = Yt(r.skeleton);
1273
+ let k, w, C = "numeric";
1274
+ if (g)
1275
+ k = { kind: "none", reason: "unresolved" }, w = "unresolved";
1276
+ else if (E)
1277
+ k = { kind: "none", reason: "window" }, w = "expression";
1278
+ else if (A.kind === "single")
1279
+ if (k = O(A.unit), A.unit.kind === "call") {
1280
+ const u = r.calls[A.unit.index];
1281
+ w = u.kind, (u.kind === "min" || u.kind === "max") && (C = "input");
1279
1282
  } else {
1280
- const u = i.get(b.unit.token);
1281
- h = u.identity, N = u.outputType;
1283
+ const u = o.get(A.unit.token);
1284
+ w = u.identity, C = u.outputType;
1282
1285
  }
1283
- else b.kind === "linear" ? (_ = b.units.every((S) => C(S).kind === "additive") ? { kind: "additive" } : { kind: "none", reason: "other" }, h = "linear") : (_ = { kind: "none", reason: b.hasDivision ? "ratio" : "other" }, h = b.hasDivision ? "ratio" : "expression");
1286
+ else A.kind === "linear" ? (k = A.units.every((h) => O(h).kind === "additive") ? { kind: "additive" } : { kind: "none", reason: "other" }, w = "linear") : (k = { kind: "none", reason: A.hasDivision ? "ratio" : "other" }, w = A.hasDivision ? "ratio" : "expression");
1284
1287
  return B(
1285
1288
  {
1286
1289
  stage: "aggregate",
1287
- calls: R,
1288
- windowed: v,
1289
- repeatSafe: x,
1290
- reaggregation: _,
1291
- outputType: N,
1292
- identity: h,
1293
- unresolved: I
1290
+ calls: j,
1291
+ windowed: E,
1292
+ repeatSafe: R,
1293
+ reaggregation: k,
1294
+ outputType: C,
1295
+ identity: w,
1296
+ unresolved: g
1294
1297
  },
1295
1298
  e
1296
1299
  );
1297
1300
  }
1298
- function tn(e) {
1301
+ function nn(e) {
1299
1302
  const n = J(e, 0);
1300
- return n === "row_input" ? je : n;
1303
+ return n === "row_input" ? Le : n;
1301
1304
  }
1302
- function Nn(e) {
1303
- const n = tt((e == null ? void 0 : e.dataType) || "number");
1305
+ function On(e) {
1306
+ const n = nt((e == null ? void 0 : e.dataType) || "number");
1304
1307
  if (!e) return n;
1305
- const a = tn(e);
1308
+ const a = nn(e);
1306
1309
  return a.unresolved || a.outputType === "input" ? n : "number";
1307
1310
  }
1308
- const nn = t.object({
1309
- intent: nt,
1310
- matrixWindowRequest: he
1311
- }).strict(), an = t.object({
1311
+ const an = t.object({
1312
+ intent: at,
1313
+ matrixWindowRequest: fe
1314
+ }).strict(), rn = t.object({
1312
1315
  runtimeFilters: G.innerType().shape.filters,
1313
1316
  runtimeSorts: G.innerType().shape.sorts.optional()
1314
1317
  });
1315
- function On(e) {
1316
- return an.parse(e);
1318
+ function xn(e) {
1319
+ return rn.parse(e);
1317
1320
  }
1318
- const rn = {
1321
+ const sn = {
1319
1322
  // A window executes a governed statement set, not one compiled query.
1320
1323
  compiledQuery: t.never().optional(),
1321
- intent: nn.shape.intent,
1324
+ intent: an.shape.intent,
1322
1325
  resultShape: t.literal("matrix"),
1323
- result: Ie.optional(),
1326
+ result: _e.optional(),
1324
1327
  metadata: t.object({ rowLimitExceeded: t.boolean(), matrixFailure: H.optional() }).passthrough()
1325
- }, sn = ve.extend(rn), xn = sn.superRefine((e, n) => {
1328
+ }, on = Ee.extend(sn), Pn = on.superRefine((e, n) => {
1326
1329
  e.status === "failed" == !!e.result && n.addIssue({ code: "custom", message: "Only answered or partial Matrix execution carries a window." }), e.result && e.status === "partial" != e.result.window.failures.length > 0 && n.addIssue({ code: "custom", message: "Matrix execution status must match acquired window failures." });
1327
1330
  });
1328
1331
  export {
1329
- dt as $,
1332
+ mt as $,
1330
1333
  Tn as A,
1331
- jt as B,
1332
- Lt as C,
1334
+ Lt as B,
1335
+ Ut as C,
1333
1336
  Dt as D,
1334
- vn as E,
1335
- Ut as F,
1336
- qt as G,
1337
- En as H,
1338
- Ht as I,
1339
- Cn as J,
1340
- Bt as K,
1341
- xe as L,
1337
+ En as E,
1338
+ qt as F,
1339
+ Mt as G,
1340
+ Rn as H,
1341
+ Qt as I,
1342
+ Nn as J,
1343
+ Gt as K,
1344
+ Pe as L,
1342
1345
  W as M,
1343
- Rn as N,
1344
- Zt as O,
1345
- tn as P,
1346
- Nn as Q,
1347
- pe as R,
1346
+ Cn as N,
1347
+ Yt as O,
1348
+ nn as P,
1349
+ On as Q,
1350
+ he as R,
1348
1351
  Y as S,
1349
- st as T,
1350
- ot as U,
1351
- un as V,
1352
- dn as W,
1353
- ct as X,
1354
- mn as Y,
1355
- ut as Z,
1356
- te as _,
1357
- kt as a,
1358
- he as a0,
1359
- pn as a1,
1360
- mt as a2,
1361
- pt as a3,
1362
- ht as a4,
1363
- ne as a5,
1352
+ ot as T,
1353
+ it as U,
1354
+ dn as V,
1355
+ mn as W,
1356
+ lt as X,
1357
+ pn as Y,
1358
+ dt as Z,
1359
+ ne as _,
1360
+ vt as a,
1361
+ fe as a0,
1362
+ hn as a1,
1363
+ pt as a2,
1364
+ ht as a3,
1365
+ ft as a4,
1366
+ ae as a5,
1364
1367
  H as a6,
1365
- ft as a7,
1366
- be as a8,
1367
- gt as a9,
1368
- hn as aa,
1369
- fn as ab,
1370
- yt as ac,
1371
- St as ad,
1372
- bt as ae,
1373
- gn as af,
1374
- yn as ag,
1375
- At as ah,
1376
- It as ai,
1377
- ae as aj,
1378
- _t as ak,
1379
- Sn as al,
1380
- an as am,
1381
- On as an,
1382
- xn as ao,
1383
- nn as ap,
1384
- we as b,
1385
- ke as c,
1368
+ gt as a7,
1369
+ Ae as a8,
1370
+ yt as a9,
1371
+ fn as aa,
1372
+ gn as ab,
1373
+ St as ac,
1374
+ bt as ad,
1375
+ At as ae,
1376
+ yn as af,
1377
+ Sn as ag,
1378
+ It as ah,
1379
+ _t as ai,
1380
+ re as aj,
1381
+ wt as ak,
1382
+ bn as al,
1383
+ rn as am,
1384
+ xn as an,
1385
+ Pn as ao,
1386
+ an as ap,
1387
+ ke as b,
1388
+ ve as c,
1386
1389
  Te as d,
1387
- ve as e,
1390
+ Ee as e,
1388
1391
  Tt as f,
1389
- bn as g,
1390
- Et as h,
1391
- Nt as i,
1392
- Rt as j,
1393
- Ee as k,
1394
- Re as l,
1395
- Ie as m,
1396
- In as n,
1397
- Ot as o,
1398
- An as p,
1399
- _n as q,
1400
- Ne as r,
1401
- wt as s,
1402
- Ce as t,
1403
- xt as u,
1404
- se as v,
1392
+ An as g,
1393
+ Rt as h,
1394
+ Ot as i,
1395
+ Ct as j,
1396
+ Re as k,
1397
+ Ce as l,
1398
+ _e as m,
1399
+ _n as n,
1400
+ xt as o,
1401
+ In as p,
1402
+ wn as q,
1403
+ Oe as r,
1404
+ kt as s,
1405
+ Ne as t,
1406
+ Pt as u,
1407
+ oe as v,
1405
1408
  z as w,
1406
- oe as x,
1407
- wn as y,
1408
- kn as z
1409
+ ie as x,
1410
+ kn as y,
1411
+ vn as z
1409
1412
  };