react-semaphor 0.1.601 → 0.1.603

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