react-semaphor 0.1.543 → 0.1.544

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 (66) hide show
  1. package/dist/activity/index.js +73 -0
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/briefings/index.js +51 -50
  4. package/dist/chunks/{apply-dashboard-operations-CG9S7MGt.js → apply-dashboard-operations-Bz4n1Lq6.js} +44 -44
  5. package/dist/chunks/{assistant-chat-BFMRUYoB.js → assistant-chat-BNLkCDml.js} +288 -288
  6. package/dist/chunks/{comparison-window-caption-Bv18samq.js → comparison-window-caption-BTkrN3W4.js} +467 -462
  7. package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +3725 -0
  8. package/dist/chunks/{dashboard-controls-UGpjOM2k.js → dashboard-controls-8RyBTQUO.js} +530 -525
  9. package/dist/chunks/dashboard-g5a4DKWq.js +14 -0
  10. package/dist/chunks/{dashboard-json-DG8dz0eX.js → dashboard-json-7qT9jmfL.js} +1 -1
  11. package/dist/chunks/{document-dashboard-inputs-OwqCbrVp.js → document-dashboard-inputs-BC6p-ESg.js} +4 -4
  12. package/dist/chunks/{document-sheet-utils-BTb3VZxV.js → document-sheet-utils-Duo9uLoH.js} +11 -11
  13. package/dist/chunks/{edit-dashboard-visual-CDpA4y5e.js → edit-dashboard-visual-BfJwnRIZ.js} +249 -248
  14. package/dist/chunks/export-file-format-C-tJsxsf.js +111 -0
  15. package/dist/chunks/{index-l5LclZvs.js → index-DkAyQvC6.js} +59 -58
  16. package/dist/chunks/{matrix-formatter-BnsTX90d.js → matrix-formatter-CxJLkztA.js} +1 -1
  17. package/dist/chunks/{numeric-presentation-F_-H6VAw.js → numeric-presentation-DESvLiu9.js} +1 -1
  18. package/dist/chunks/{pivot-result-lifecycle-DupbRk-R.js → pivot-result-lifecycle-DM4CyGKs.js} +285 -393
  19. package/dist/chunks/{raw-temporal-presentation-D-azM_98.js → raw-temporal-presentation-CLiVi90c.js} +2 -2
  20. package/dist/chunks/{report-preferences-dialog-CPwRwEJx.js → report-preferences-dialog-Df7VpRVW.js} +195 -195
  21. package/dist/chunks/{saved-dashboard-context-BKvMfRfC.js → saved-dashboard-context-B-mQ--nV.js} +3 -3
  22. package/dist/chunks/{semaphor-ready-indicator-CN2AHm2x.js → semaphor-ready-indicator-DDAxk8us.js} +39892 -39380
  23. package/dist/chunks/{shelf-drop-preview-context-BGl_rxcW.js → shelf-drop-preview-context-BSRPwaED.js} +414 -371
  24. package/dist/chunks/{table-export-sheet-BDRXLLdq.js → table-export-sheet-CPfGAQ9X.js} +1 -1
  25. package/dist/chunks/{use-create-flow-overlay-state-BnclfB2k.js → use-create-flow-overlay-state-BxzFviM-.js} +67 -78
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/dashboard-authoring/index.js +72 -72
  28. package/dist/data-app-sdk/index.js +1 -1
  29. package/dist/format-utils/index.js +226 -223
  30. package/dist/index.js +266 -271
  31. package/dist/style.css +1 -1
  32. package/dist/surfboard/index.js +1 -1
  33. package/dist/types/activity.d.ts +2 -0
  34. package/dist/types/components/activity/activity-bell.d.ts +11 -0
  35. package/dist/types/components/activity/activity-instance.d.ts +50 -0
  36. package/dist/types/components/activity/activity-notices.d.ts +7 -0
  37. package/dist/types/components/activity/activity-provider.d.ts +21 -0
  38. package/dist/types/components/activity/activity-types.d.ts +177 -0
  39. package/dist/types/components/activity/index.d.ts +6 -0
  40. package/dist/types/components/activity/use-activity.d.ts +20 -0
  41. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  42. package/dist/types/components/briefings/briefing-author.d.ts +14 -12
  43. package/dist/types/components/briefings/dashboard-briefing-launcher.d.ts +5 -0
  44. package/dist/types/components/briefings/use-briefing-run-detail.d.ts +34 -0
  45. package/dist/types/components/index.d.ts +1 -4
  46. package/dist/types/lib/activity-identity.d.ts +21 -0
  47. package/dist/types/lib/api/exports-api.d.ts +4 -4
  48. package/dist/types/lib/hooks/index.d.ts +1 -3
  49. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
  50. package/dist/types/shared/activity/activity-contract.d.ts +84 -0
  51. package/dist/types/shared/activity/index.d.ts +5 -0
  52. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +6 -0
  53. package/dist/types/shared/format-utils/export-policy.d.ts +12 -0
  54. package/package.json +5 -1
  55. package/dist/chunks/dashboard-B9mKTJoy.js +0 -14
  56. package/dist/chunks/dashboard-briefing-launcher-Bdmry_oG.js +0 -4248
  57. package/dist/types/components/briefings/briefing-author/run-ui.d.ts +0 -81
  58. package/dist/types/components/briefings/use-briefing-run-polling.d.ts +0 -34
  59. package/dist/types/components/notifications/export-notification-item.d.ts +0 -24
  60. package/dist/types/components/notifications/export-notification-list.d.ts +0 -8
  61. package/dist/types/components/notifications/index.d.ts +0 -3
  62. package/dist/types/components/notifications/notification-bell.d.ts +0 -13
  63. package/dist/types/lib/exports/bounded-request.d.ts +0 -12
  64. package/dist/types/lib/hooks/use-export-polling.d.ts +0 -32
  65. package/dist/types/lib/hooks/use-export-recovery.d.ts +0 -11
  66. package/dist/types/lib/stores/export-store.d.ts +0 -62
@@ -1,32 +1,33 @@
1
- var V = Object.defineProperty;
2
- var X = (e, t, o) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var p = (e, t, o) => X(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { N as z, O as q, P as y, q as Z, H as G, E as J, i as H } from "./temporal-bucket-D7NBrrtL.js";
1
+ var q = Object.defineProperty;
2
+ var B = (e, t, o) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var p = (e, t, o) => B(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { N, O, P as y, q as Y, H as L, E as X, i as Z } from "./temporal-bucket-D7NBrrtL.js";
5
5
  import { z as d } from "zod";
6
- import { aG as W, r as Q, a7 as ee, o as b, t as te } from "./validators-DMHTpf7a.js";
7
- import { b as oe } from "./report-runtime-context-Dq8XyODK.js";
8
- import { S as re } from "./analytics-base-schemas-BFAoRlkU.js";
6
+ import { E as U, l as P } from "./export-file-format-C-tJsxsf.js";
7
+ import { aG as G, r as H, a7 as J, o as b, t as W } from "./validators-DMHTpf7a.js";
8
+ import { b as V } from "./report-runtime-context-Dq8XyODK.js";
9
+ import { S as Q } from "./analytics-base-schemas-BFAoRlkU.js";
9
10
  import "./matrix-operation-contract-8OIO4gob.js";
10
- import { r as ne, i as se } from "./metric-comparison-DEwi9uc2.js";
11
- import { d as ie, P as ae } from "./pivot-result-identity-DJhXXcns.js";
12
- function wt(e, t) {
13
- const r = me(e);
11
+ import { r as ee, i as te } from "./metric-comparison-DEwi9uc2.js";
12
+ import { d as oe, P as re } from "./pivot-result-identity-DJhXXcns.js";
13
+ function nt(e, t) {
14
+ const r = ae(e);
14
15
  let n;
15
16
  if (r.date) {
16
- const l = fe(r.date, 2);
17
- n = ue(l.restDateString, l.year);
17
+ const l = ce(r.date, 2);
18
+ n = le(l.restDateString, l.year);
18
19
  }
19
20
  if (!n || isNaN(n.getTime()))
20
21
  return /* @__PURE__ */ new Date(NaN);
21
- const s = n.getTime();
22
- let i = 0, a;
23
- if (r.time && (i = pe(r.time), isNaN(i)))
22
+ const i = n.getTime();
23
+ let s = 0, a;
24
+ if (r.time && (s = de(r.time), isNaN(s)))
24
25
  return /* @__PURE__ */ new Date(NaN);
25
26
  if (r.timezone) {
26
- if (a = ye(r.timezone), isNaN(a))
27
+ if (a = me(r.timezone), isNaN(a))
27
28
  return /* @__PURE__ */ new Date(NaN);
28
29
  } else {
29
- const l = new Date(s + i), m = /* @__PURE__ */ new Date(0);
30
+ const l = new Date(i + s), m = /* @__PURE__ */ new Date(0);
30
31
  return m.setFullYear(
31
32
  l.getUTCFullYear(),
32
33
  l.getUTCMonth(),
@@ -38,14 +39,14 @@ function wt(e, t) {
38
39
  l.getUTCMilliseconds()
39
40
  ), m;
40
41
  }
41
- return new Date(s + i + a);
42
+ return new Date(i + s + a);
42
43
  }
43
44
  const x = {
44
45
  dateTimeDelimiter: /[T ]/,
45
46
  timeZoneDelimiter: /[Z ]/i,
46
47
  timezone: /([Z+-].*)$/
47
- }, ce = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, le = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, de = /^([+-])(\d{2})(?::?(\d{2}))?$/;
48
- function me(e) {
48
+ }, ne = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, ie = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, se = /^([+-])(\d{2})(?::?(\d{2}))?$/;
49
+ function ae(e) {
49
50
  const t = {}, o = e.split(x.dateTimeDelimiter);
50
51
  let r;
51
52
  if (o.length > 2)
@@ -59,197 +60,110 @@ function me(e) {
59
60
  }
60
61
  return t;
61
62
  }
62
- function fe(e, t) {
63
+ function ce(e, t) {
63
64
  const o = new RegExp(
64
65
  "^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
65
66
  ), r = e.match(o);
66
67
  if (!r) return { year: NaN, restDateString: "" };
67
- const n = r[1] ? parseInt(r[1]) : null, s = r[2] ? parseInt(r[2]) : null;
68
+ const n = r[1] ? parseInt(r[1]) : null, i = r[2] ? parseInt(r[2]) : null;
68
69
  return {
69
- year: s === null ? n : s * 100,
70
+ year: i === null ? n : i * 100,
70
71
  restDateString: e.slice((r[1] || r[2]).length)
71
72
  };
72
73
  }
73
- function ue(e, t) {
74
+ function le(e, t) {
74
75
  if (t === null) return /* @__PURE__ */ new Date(NaN);
75
- const o = e.match(ce);
76
+ const o = e.match(ne);
76
77
  if (!o) return /* @__PURE__ */ new Date(NaN);
77
- const r = !!o[4], n = v(o[1]), s = v(o[2]) - 1, i = v(o[3]), a = v(o[4]), l = v(o[5]) - 1;
78
+ const r = !!o[4], n = g(o[1]), i = g(o[2]) - 1, s = g(o[3]), a = g(o[4]), l = g(o[5]) - 1;
78
79
  if (r)
79
- return be(t, a, l) ? he(t, a, l) : /* @__PURE__ */ new Date(NaN);
80
+ return he(t, a, l) ? fe(t, a, l) : /* @__PURE__ */ new Date(NaN);
80
81
  {
81
82
  const m = /* @__PURE__ */ new Date(0);
82
- return !ge(t, s, i) || !ve(t, n) ? /* @__PURE__ */ new Date(NaN) : (m.setUTCFullYear(t, s, Math.max(n, i)), m);
83
+ return !pe(t, i, s) || !ye(t, n) ? /* @__PURE__ */ new Date(NaN) : (m.setUTCFullYear(t, i, Math.max(n, s)), m);
83
84
  }
84
85
  }
85
- function v(e) {
86
+ function g(e) {
86
87
  return e ? parseInt(e) : 1;
87
88
  }
88
- function pe(e) {
89
- const t = e.match(le);
89
+ function de(e) {
90
+ const t = e.match(ie);
90
91
  if (!t) return NaN;
91
- const o = _(t[1]), r = _(t[2]), n = _(t[3]);
92
- return xe(o, r, n) ? o * z + r * q + n * 1e3 : NaN;
92
+ const o = C(t[1]), r = C(t[2]), n = C(t[3]);
93
+ return we(o, r, n) ? o * N + r * O + n * 1e3 : NaN;
93
94
  }
94
- function _(e) {
95
+ function C(e) {
95
96
  return e && parseFloat(e.replace(",", ".")) || 0;
96
97
  }
97
- function ye(e) {
98
+ function me(e) {
98
99
  if (e === "Z") return 0;
99
- const t = e.match(de);
100
+ const t = e.match(se);
100
101
  if (!t) return 0;
101
102
  const o = t[1] === "+" ? -1 : 1, r = parseInt(t[2]), n = t[3] && parseInt(t[3]) || 0;
102
- return Ee(r, n) ? o * (r * z + n * q) : NaN;
103
+ return ve(r, n) ? o * (r * N + n * O) : NaN;
103
104
  }
104
- function he(e, t, o) {
105
+ function fe(e, t, o) {
105
106
  const r = /* @__PURE__ */ new Date(0);
106
107
  r.setUTCFullYear(e, 0, 4);
107
- const n = r.getUTCDay() || 7, s = (t - 1) * 7 + o + 1 - n;
108
- return r.setUTCDate(r.getUTCDate() + s), r;
108
+ const n = r.getUTCDay() || 7, i = (t - 1) * 7 + o + 1 - n;
109
+ return r.setUTCDate(r.getUTCDate() + i), r;
109
110
  }
110
- const we = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
111
- function B(e) {
111
+ const ue = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
112
+ function z(e) {
112
113
  return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
113
114
  }
114
- function ge(e, t, o) {
115
- return t >= 0 && t <= 11 && o >= 1 && o <= (we[t] || (B(e) ? 29 : 28));
115
+ function pe(e, t, o) {
116
+ return t >= 0 && t <= 11 && o >= 1 && o <= (ue[t] || (z(e) ? 29 : 28));
116
117
  }
117
- function ve(e, t) {
118
- return t >= 1 && t <= (B(e) ? 366 : 365);
118
+ function ye(e, t) {
119
+ return t >= 1 && t <= (z(e) ? 366 : 365);
119
120
  }
120
- function be(e, t, o) {
121
+ function he(e, t, o) {
121
122
  return t >= 1 && t <= 53 && o >= 0 && o <= 6;
122
123
  }
123
- function xe(e, t, o) {
124
+ function we(e, t, o) {
124
125
  return e === 24 ? t === 0 && o === 0 : o >= 0 && o < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
125
126
  }
126
- function Ee(e, t) {
127
+ function ve(e, t) {
127
128
  return t >= 0 && t <= 59;
128
129
  }
129
- const Ie = ["utf-8-bom", "utf-8"], Ce = "utf-8-bom", Re = [",", ";", " "], Se = `\r
130
- `, Te = "text/csv; charset=utf-8";
131
- function gt(e) {
132
- return e == null || typeof e == "string" || typeof e == "number" ? e : typeof e == "object" ? JSON.stringify(e) : String(e);
133
- }
134
- const ke = "\uFEFF";
135
- function K(e) {
136
- return Ie.find((t) => t === e);
137
- }
138
- function vt(e) {
139
- return Re.find((t) => t === e);
140
- }
141
- function bt(e) {
142
- return K(e.requested) ?? K(e.dashboardDefault) ?? Ce;
143
- }
144
- function Ae(e) {
145
- return e === "utf-8-bom" ? ke : "";
146
- }
147
- function xt(e) {
148
- const t = e.trimStart().charAt(0);
149
- return ["=", "+", "-", "@"].includes(t) || [" ", "\r", `
150
- `].includes(e.charAt(0)) ? `'${e}` : e;
151
- }
152
- function _e(e, t = ",") {
153
- if (e == null)
154
- return "";
155
- const o = String(e);
156
- return o.includes(t) || o.includes('"') || o.includes(`
157
- `) || o.includes("\r") ? `"${o.replace(/"/g, '""')}"` : o;
158
- }
159
- function L(e, t) {
160
- return e.map((o) => _e(o, t)).join(t) + Se;
161
- }
162
- function $e(e, t) {
163
- return e.map((o) => L(o, t)).join("");
164
- }
165
- function Et(e) {
166
- return Ae(e.encoding) + (e.header ? L(e.header, e.delimiter) : "") + $e(e.rows, e.delimiter);
167
- }
168
- const T = ["csv", "xlsx"], Fe = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", F = {
169
- csv: Object.freeze({
170
- format: "csv",
171
- extension: "csv",
172
- contentType: Te,
173
- partExtension: "csv",
174
- partContentType: "text/csv",
175
- compactedFileName: "export.csv.gz",
176
- storedEncoding: "gzip",
177
- storedValue: "CSV",
178
- label: "CSV"
179
- }),
180
- xlsx: Object.freeze({
181
- format: "xlsx",
182
- extension: "xlsx",
183
- contentType: Fe,
184
- partExtension: "xml",
185
- partContentType: "application/xml",
186
- compactedFileName: "export.xlsx",
187
- storedEncoding: "identity",
188
- storedValue: "XLSX",
189
- label: "Excel"
190
- })
191
- };
192
- function It(e) {
193
- return T.find((t) => t === e);
194
- }
195
- function Y(e) {
196
- return { ...F[e] };
197
- }
198
- function Ct(e) {
199
- return e === "XLSX" ? "xlsx" : "csv";
200
- }
201
- function j(e) {
202
- return e.split(";")[0].trim().toLowerCase();
203
- }
204
- function Rt(e) {
205
- if (!e) return;
206
- const t = j(e);
207
- return T.find(
208
- (o) => j(F[o].contentType) === t
209
- );
210
- }
211
- function St(e) {
212
- var r;
213
- const t = (((r = e.title) == null ? void 0 : r.trim()) || "export").replace(/[^a-z0-9]+/gi, "_").replace(/^_+|_+$/g, "") || "export", o = (e.at ?? /* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z").replace(/:/g, "-");
214
- return `${t}-${o}.${F[e.format].extension}`;
215
- }
216
- const Me = 5 * 1024 * 1024, Tt = 64 * 1024 * 1024, C = d.number().int().positive().max(Number.MAX_SAFE_INTEGER), I = d.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), R = I.refine((e) => e > 0), Ke = (e) => !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
130
+ const ge = 5 * 1024 * 1024, it = 64 * 1024 * 1024, E = d.number().int().positive().max(Number.MAX_SAFE_INTEGER), k = d.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), A = k.refine((e) => e > 0), be = (e) => !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
217
131
  function w(e, t) {
218
132
  const o = t.split("/");
219
- if (o.length !== 5 || o[0] !== "exports" || o[1] !== e || o[2] !== "attempts" || !o.every(Ke))
133
+ if (o.length !== 5 || o[0] !== "exports" || o[1] !== e || o[2] !== "attempts" || !o.every(be))
220
134
  throw new Error("Invalid Matrix export artifact namespace.");
221
135
  return { attemptId: o[3], filename: o[4] };
222
136
  }
223
- function kt(e, t, o) {
137
+ function st(e, t, o) {
224
138
  const r = `exports/${e}/attempts/${t}/${o}`;
225
139
  return w(e, r), r;
226
140
  }
227
- const At = d.object({
141
+ const at = d.object({
228
142
  acquisition: d.literal("continuation"),
229
143
  jobId: d.string().min(1),
230
- sequence: R,
231
- deadlineAt: C
232
- }), je = [
144
+ sequence: A,
145
+ deadlineAt: E
146
+ }), xe = [
233
147
  "application/json",
234
- ...T.map((e) => Y(e).partContentType)
235
- ], Ne = d.object({
148
+ ...U.map((e) => P(e).partContentType)
149
+ ], Ie = d.object({
236
150
  key: d.string(),
237
151
  content: d.string(),
238
- contentType: d.enum(je),
152
+ contentType: d.enum(xe),
239
153
  encoding: d.literal("gzip-base64").optional()
240
154
  // Transport-only compression: JSON (layout, sheet layout) and Excel rows. CSV travels as it always has.
241
- }).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType === Y("xlsx").partContentType, "Unsupported Matrix artifact encoding."), De = d.discriminatedUnion("kind", [
242
- d.object({ kind: d.literal("work"), sequence: R, checkpointKey: d.string(), objects: d.array(Ne).min(2).max(4), deadlineAt: C }),
243
- d.object({ kind: d.literal("committed"), sequence: R, done: d.boolean(), deadlineAt: C })
155
+ }).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType === P("xlsx").partContentType, "Unsupported Matrix artifact encoding."), ke = d.discriminatedUnion("kind", [
156
+ d.object({ kind: d.literal("work"), sequence: A, checkpointKey: d.string(), objects: d.array(Ie).min(2).max(4), deadlineAt: E }),
157
+ d.object({ kind: d.literal("committed"), sequence: A, done: d.boolean(), deadlineAt: E })
244
158
  ]);
245
- function Oe(e) {
159
+ function Ee(e) {
246
160
  const t = JSON.stringify(e);
247
- if (t === void 0 || new TextEncoder().encode(t).byteLength > Me)
161
+ if (t === void 0 || new TextEncoder().encode(t).byteLength > ge)
248
162
  throw new RangeError("Matrix export batch exceeds its transport byte limit.");
249
163
  }
250
- function _t(e, t) {
251
- const o = De.parse(e);
252
- if (Oe(e), o.deadlineAt !== t.deadlineAt) throw new Error("Matrix deadline does not match the job.");
164
+ function ct(e, t) {
165
+ const o = ke.parse(e);
166
+ if (Ee(e), o.deadlineAt !== t.deadlineAt) throw new Error("Matrix deadline does not match the job.");
253
167
  if (o.sequence !== t.sequence + (o.kind === "committed" ? 1 : 0))
254
168
  throw new Error("Invalid Matrix batch sequence.");
255
169
  if (o.kind === "work") {
@@ -259,38 +173,38 @@ function _t(e, t) {
259
173
  }
260
174
  return o;
261
175
  }
262
- const Ue = d.object({
176
+ const Ae = d.object({
263
177
  acquisition: d.literal("continuation"),
264
- deadlineAt: C,
265
- chunks: d.array(d.object({ chunkNumber: R, dataKey: d.string() })).min(1),
266
- totalRows: I,
267
- totalBytes: I,
178
+ deadlineAt: E,
179
+ chunks: d.array(d.object({ chunkNumber: A, dataKey: d.string() })).min(1),
180
+ totalRows: k,
181
+ totalBytes: k,
268
182
  fileKey: d.string().min(1).optional(),
269
- fileSize: I.optional(),
183
+ fileSize: k.optional(),
270
184
  /** The file the job writes; absent means CSV (manifests from before Excel). */
271
- format: d.enum(T).optional(),
185
+ format: d.enum(U).optional(),
272
186
  /** Excel only: the sheet layout the layout batch stored, which compaction wraps the rows in. */
273
187
  sheetKey: d.string().min(1).optional()
274
188
  }).refine((e) => e.fileKey === void 0 == (e.fileSize === void 0), "Incomplete published Matrix artifact.").refine((e) => e.format === "xlsx" == (e.sheetKey !== void 0), "An Excel Matrix manifest names its sheet layout, and only it does.");
275
- function $t(e, t, o) {
276
- const r = Ue.parse(e);
189
+ function lt(e, t, o) {
190
+ const r = Ae.parse(e);
277
191
  if (r.deadlineAt !== o) throw new Error("Matrix deadline does not match the job.");
278
- return r.chunks.forEach((n, s) => {
279
- if (n.chunkNumber !== s + 1) throw new Error("Invalid committed Matrix chunk order.");
192
+ return r.chunks.forEach((n, i) => {
193
+ if (n.chunkNumber !== i + 1) throw new Error("Invalid committed Matrix chunk order.");
280
194
  w(t, n.dataKey);
281
195
  }), r.fileKey !== void 0 && w(t, r.fileKey), r.sheetKey !== void 0 && w(t, r.sheetKey), r;
282
196
  }
283
- function Ft(e, t) {
197
+ function dt(e, t) {
284
198
  return t.levelLabels[e.id] ?? e.field.label ?? e.field.name;
285
199
  }
286
- function Mt(e, t) {
200
+ function mt(e, t) {
287
201
  return t.measureLabels[e.id] ?? (e.kind === "aggregate" ? e.field.label ?? e.field.name : e.definition.label);
288
202
  }
289
- function Kt(e) {
290
- return te.parse(Pe(e));
203
+ function ft(e) {
204
+ return W.parse(Re(e));
291
205
  }
292
- function Pe(e) {
293
- const t = W.parse(e), o = (r) => ({
206
+ function Re(e) {
207
+ const t = G.parse(e), o = (r) => ({
294
208
  grand: { visible: !0, position: "after" },
295
209
  levels: Object.fromEntries(
296
210
  r.map((n) => [
@@ -299,7 +213,7 @@ function Pe(e) {
299
213
  ])
300
214
  )
301
215
  });
302
- return Q.parse({
216
+ return H.parse({
303
217
  version: 1,
304
218
  spec: t,
305
219
  presentation: {
@@ -317,14 +231,14 @@ function Pe(e) {
317
231
  }
318
232
  });
319
233
  }
320
- function ze(e, t) {
234
+ function Te(e, t) {
321
235
  const o = new Map(e.map((r) => [b(r), r]));
322
236
  for (const r of t ?? []) o.set(b(r), r);
323
237
  return [...o.values()];
324
238
  }
325
- function jt(e) {
326
- const { spec: t, presentation: o, defaults: r, session: n } = ee.parse(e), s = new Map(
327
- ze(t.sorts, n == null ? void 0 : n.sorts).map((a) => [b(a), a])
239
+ function ut(e) {
240
+ const { spec: t, presentation: o, defaults: r, session: n } = J.parse(e), i = new Map(
241
+ Te(t.sorts, n == null ? void 0 : n.sorts).map((a) => [b(a), a])
328
242
  );
329
243
  for (const a of ["rows", "columns"])
330
244
  for (const l of t[a]) {
@@ -336,9 +250,9 @@ function jt(e) {
336
250
  direction: "asc",
337
251
  nulls: "last"
338
252
  };
339
- s.has(b(m)) || s.set(b(m), m);
253
+ i.has(b(m)) || i.set(b(m), m);
340
254
  }
341
- const i = (a, l) => ({
255
+ const s = (a, l) => ({
342
256
  depth: Math.min(a.depth, Math.max(0, l - 1)),
343
257
  // Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
344
258
  overrides: a.overrides.filter(
@@ -346,11 +260,11 @@ function jt(e) {
346
260
  )
347
261
  });
348
262
  return {
349
- spec: { ...t, sorts: [...s.values()] },
263
+ spec: { ...t, sorts: [...i.values()] },
350
264
  presentation: o,
351
265
  view: {
352
- rows: i((n == null ? void 0 : n.rows) ?? r.rows, t.rows.length),
353
- columns: i(
266
+ rows: s((n == null ? void 0 : n.rows) ?? r.rows, t.rows.length),
267
+ columns: s(
354
268
  (n == null ? void 0 : n.columns) ?? r.columns,
355
269
  t.columns.length
356
270
  ),
@@ -358,7 +272,7 @@ function jt(e) {
358
272
  }
359
273
  };
360
274
  }
361
- class N extends Error {
275
+ class _ extends Error {
362
276
  constructor(o) {
363
277
  super(
364
278
  `invalid_presentation_execution_snapshot: ${o} Resave this report before running it again.`
@@ -368,7 +282,7 @@ class N extends Error {
368
282
  this.name = "PresentationExecutionSnapshotError";
369
283
  }
370
284
  }
371
- class Nt extends Error {
285
+ class pt extends Error {
372
286
  constructor(o) {
373
287
  super(
374
288
  `missing_resolved_raw_temporal_format: Column "${o}" has no captured presentation. Resave this report before running it again.`
@@ -379,11 +293,11 @@ class Nt extends Error {
379
293
  }
380
294
  }
381
295
  function h(e, t, o) {
382
- const r = new Set(t), n = Object.keys(e).find((s) => !r.has(s));
296
+ const r = new Set(t), n = Object.keys(e).find((i) => !r.has(i));
383
297
  if (n)
384
298
  throw new Error(`${o} contains unknown property "${n}"`);
385
299
  }
386
- function qe(e, t = "scope") {
300
+ function $e(e, t = "scope") {
387
301
  if (!y(e))
388
302
  throw new Error(`${t} must be an object`);
389
303
  h(
@@ -408,7 +322,7 @@ function qe(e, t = "scope") {
408
322
  ...typeof n == "number" ? { attachmentIndex: n } : {}
409
323
  };
410
324
  }
411
- function g(e, t, o, r) {
325
+ function v(e, t, o, r) {
412
326
  if (e.kind !== t) return;
413
327
  h(e, ["kind", o], r);
414
328
  const n = e[o];
@@ -416,14 +330,14 @@ function g(e, t, o, r) {
416
330
  throw new Error(`${r}.${o} is required`);
417
331
  return n;
418
332
  }
419
- function $(e, t) {
333
+ function S(e, t) {
420
334
  if (!y(e))
421
335
  throw new Error(`${t} must be an object`);
422
- const o = g(e, "metric", "metricId", t);
336
+ const o = v(e, "metric", "metricId", t);
423
337
  if (o) return { kind: "metric", metricId: o };
424
- const r = g(e, "column", "columnKey", t);
338
+ const r = v(e, "column", "columnKey", t);
425
339
  if (r) return { kind: "column", columnKey: r };
426
- const n = g(
340
+ const n = v(
427
341
  e,
428
342
  "matrix_measure",
429
343
  "measureId",
@@ -432,7 +346,7 @@ function $(e, t) {
432
346
  if (n) return { kind: "matrix_measure", measureId: n };
433
347
  throw new Error(`${t} is not a valid numeric presentation target`);
434
348
  }
435
- const Be = [
349
+ const Ce = [
436
350
  "type",
437
351
  "inputUnit",
438
352
  "outputStyle",
@@ -443,12 +357,12 @@ const Be = [
443
357
  "suffix",
444
358
  "negativeStyle"
445
359
  ];
446
- function Le(e) {
360
+ function Se(e) {
447
361
  return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
448
362
  }
449
- const Ye = ["type", "locale", "pattern", "timezone", "sourceTimezone"];
450
- function Ve(e, t) {
451
- if (h(e, Ye, t), typeof e.locale != "string" || !e.locale.trim())
363
+ const Me = ["type", "locale", "pattern", "timezone", "sourceTimezone"];
364
+ function _e(e, t) {
365
+ if (h(e, Me, t), typeof e.locale != "string" || !e.locale.trim())
452
366
  throw new Error(`${t}.locale must be a non-empty string`);
453
367
  for (const o of ["pattern", "timezone", "sourceTimezone"])
454
368
  if (e[o] !== void 0 && typeof e[o] != "string")
@@ -461,20 +375,20 @@ function Ve(e, t) {
461
375
  ...typeof e.sourceTimezone == "string" ? { sourceTimezone: e.sourceTimezone } : {}
462
376
  };
463
377
  }
464
- function Xe(e, t) {
465
- h(e, Be, t);
466
- for (const s of ["inputUnit", "largestUnit", "smallestUnit"])
467
- if (e[s] !== void 0 && !Le(e[s]))
468
- throw new Error(`${t}.${s} must be a duration unit`);
378
+ function Ke(e, t) {
379
+ h(e, Ce, t);
380
+ for (const i of ["inputUnit", "largestUnit", "smallestUnit"])
381
+ if (e[i] !== void 0 && !Se(e[i]))
382
+ throw new Error(`${t}.${i} must be a duration unit`);
469
383
  const o = e.outputStyle;
470
384
  if (o !== void 0 && o !== "compact" && o !== "digital" && o !== "long")
471
385
  throw new Error(`${t}.outputStyle must be compact, digital, or long`);
472
386
  const r = e.maxUnits;
473
387
  if (r !== void 0 && (typeof r != "number" || !Number.isInteger(r) || r < 0 || r > 10))
474
388
  throw new Error(`${t}.maxUnits must be an integer from 0 to 10`);
475
- for (const s of ["prefix", "suffix"])
476
- if (e[s] !== void 0 && typeof e[s] != "string")
477
- throw new Error(`${t}.${s} must be a string`);
389
+ for (const i of ["prefix", "suffix"])
390
+ if (e[i] !== void 0 && typeof e[i] != "string")
391
+ throw new Error(`${t}.${i} must be a string`);
478
392
  const n = e.negativeStyle;
479
393
  if (n !== void 0 && n !== "minus" && n !== "parentheses")
480
394
  throw new Error(`${t}.negativeStyle must be minus or parentheses`);
@@ -490,7 +404,7 @@ function Xe(e, t) {
490
404
  ...n !== void 0 ? { negativeStyle: n } : {}
491
405
  };
492
406
  }
493
- function Ze(e, t) {
407
+ function Fe(e, t) {
494
408
  if (!y(e))
495
409
  throw new Error(`${t} must be an object`);
496
410
  if (e.kind === "field") {
@@ -498,18 +412,18 @@ function Ze(e, t) {
498
412
  const n = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
499
413
  if (!n)
500
414
  throw new Error(`${t}.fieldId is required`);
501
- const s = e.role;
502
- if (s !== void 0 && s !== "groupby" && s !== "pivotby")
415
+ const i = e.role;
416
+ if (i !== void 0 && i !== "groupby" && i !== "pivotby")
503
417
  throw new Error(`${t}.role must be groupby or pivotby`);
504
418
  return {
505
419
  kind: "field",
506
420
  fieldId: n,
507
- ...s ? { role: s } : {}
421
+ ...i ? { role: i } : {}
508
422
  };
509
423
  }
510
- const o = g(e, "column", "columnKey", t);
424
+ const o = v(e, "column", "columnKey", t);
511
425
  if (o) return { kind: "column", columnKey: o };
512
- const r = g(
426
+ const r = v(
513
427
  e,
514
428
  "matrix_axis",
515
429
  "axisInstanceId",
@@ -518,22 +432,22 @@ function Ze(e, t) {
518
432
  if (r) return { kind: "matrix_axis", axisInstanceId: r };
519
433
  throw new Error(`${t} is not a valid temporal bucket presentation target`);
520
434
  }
521
- function Ge(e, t) {
435
+ function je(e, t) {
522
436
  if (!y(e))
523
437
  throw new Error(`${t} must be an object`);
524
- const o = g(e, "column", "columnKey", t);
438
+ const o = v(e, "column", "columnKey", t);
525
439
  if (!o)
526
440
  throw new Error(`${t} must identify a column`);
527
441
  return { kind: "column", columnKey: o };
528
442
  }
529
- function Je(e) {
443
+ function De(e) {
530
444
  return [
531
445
  e.dashboardId,
532
446
  e.cardId ?? null,
533
447
  e.attachmentIndex ?? null
534
448
  ];
535
449
  }
536
- function S(e) {
450
+ function R(e) {
537
451
  switch (e.kind) {
538
452
  case "metric":
539
453
  return [e.kind, e.metricId];
@@ -547,14 +461,14 @@ function S(e) {
547
461
  return [e.kind, e.axisInstanceId];
548
462
  }
549
463
  }
550
- function k(e, t) {
464
+ function T(e, t) {
551
465
  return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === t.attachmentIndex;
552
466
  }
553
- function A(e, t) {
554
- const o = S(e), r = S(t);
555
- return o.length === r.length && o.every((n, s) => n === r[s]);
467
+ function $(e, t) {
468
+ const o = R(e), r = R(t);
469
+ return o.length === r.length && o.every((n, i) => n === r[i]);
556
470
  }
557
- function He(e) {
471
+ function Ne(e) {
558
472
  if (!Array.isArray(e))
559
473
  throw new Error("resolvedFormats must be an array");
560
474
  const t = /* @__PURE__ */ new Set();
@@ -564,63 +478,63 @@ function He(e) {
564
478
  if (!y(o))
565
479
  throw new Error(`${n} must be an object`);
566
480
  h(o, ["scope", "target", "format"], n);
567
- const s = qe(o.scope, `${n}.scope`);
481
+ const i = $e(o.scope, `${n}.scope`);
568
482
  if (!y(o.format))
569
483
  throw new Error(`${n}.format must be an object`);
570
- let i;
484
+ let s;
571
485
  switch (o.format.type) {
572
486
  case "temporal_bucket": {
573
- const f = J(o.format);
487
+ const f = X(o.format);
574
488
  if (!f.ok)
575
489
  throw new Error(
576
490
  `${n}.format is invalid: ${((l = f.issues[0]) == null ? void 0 : l.message) ?? "invalid value"}`
577
491
  );
578
- i = {
579
- scope: s,
580
- target: Ze(o.target, `${n}.target`),
492
+ s = {
493
+ scope: i,
494
+ target: Fe(o.target, `${n}.target`),
581
495
  format: f.value
582
496
  };
583
497
  break;
584
498
  }
585
499
  case "raw_temporal":
586
- i = {
587
- scope: s,
588
- target: Ge(o.target, `${n}.target`),
589
- format: G(o.format)
500
+ s = {
501
+ scope: i,
502
+ target: je(o.target, `${n}.target`),
503
+ format: L(o.format)
590
504
  };
591
505
  break;
592
506
  case "number":
593
507
  case "currency":
594
508
  case "percent":
595
509
  case "scientific": {
596
- const f = Z(o.format);
510
+ const f = Y(o.format);
597
511
  if (!f.ok)
598
512
  throw new Error(
599
513
  `${n}.format is invalid: ${((m = f.issues[0]) == null ? void 0 : m.message) ?? "invalid value"}`
600
514
  );
601
- i = {
602
- scope: s,
603
- target: $(o.target, `${n}.target`),
515
+ s = {
516
+ scope: i,
517
+ target: S(o.target, `${n}.target`),
604
518
  format: f.value
605
519
  };
606
520
  break;
607
521
  }
608
522
  case "date": {
609
- const f = $(o.target, `${n}.target`);
523
+ const f = S(o.target, `${n}.target`);
610
524
  if (f.kind !== "column")
611
525
  throw new Error(`${n}.target must identify a column for a date format`);
612
- i = {
613
- scope: s,
526
+ s = {
527
+ scope: i,
614
528
  target: f,
615
- format: Ve(o.format, `${n}.format`)
529
+ format: _e(o.format, `${n}.format`)
616
530
  };
617
531
  break;
618
532
  }
619
533
  case "duration":
620
- i = {
621
- scope: s,
622
- target: $(o.target, `${n}.target`),
623
- format: Xe(
534
+ s = {
535
+ scope: i,
536
+ target: S(o.target, `${n}.target`),
537
+ format: Ke(
624
538
  o.format,
625
539
  `${n}.format`
626
540
  )
@@ -630,17 +544,17 @@ function He(e) {
630
544
  throw new Error(`${n}.format.type is unsupported`);
631
545
  }
632
546
  const a = JSON.stringify([
633
- ...Je(i.scope),
634
- ...S(i.target)
547
+ ...De(s.scope),
548
+ ...R(s.target)
635
549
  ]);
636
550
  if (t.has(a))
637
551
  throw new Error(
638
552
  `${n} duplicates a scoped presentation target`
639
553
  );
640
- return t.add(a), i;
554
+ return t.add(a), s;
641
555
  });
642
556
  }
643
- function We(e) {
557
+ function Oe(e) {
644
558
  try {
645
559
  if (!y(e))
646
560
  throw new Error("presentation execution snapshot must be an object");
@@ -650,7 +564,7 @@ function We(e) {
650
564
  "presentation execution snapshot"
651
565
  ), e.version !== 1)
652
566
  throw new Error("presentation execution snapshot version must be 1");
653
- const t = oe(e.reportContext);
567
+ const t = V(e.reportContext);
654
568
  if (!t.ok) {
655
569
  const o = t.issues[0];
656
570
  throw new Error(
@@ -660,91 +574,91 @@ function We(e) {
660
574
  return {
661
575
  version: 1,
662
576
  reportContext: t.value,
663
- resolvedFormats: He(e.resolvedFormats)
577
+ resolvedFormats: Ne(e.resolvedFormats)
664
578
  };
665
579
  } catch (t) {
666
- throw t instanceof N ? t : new N(
580
+ throw t instanceof _ ? t : new _(
667
581
  t instanceof Error ? t.message : "Snapshot is invalid."
668
582
  );
669
583
  }
670
584
  }
671
- function Dt(e) {
672
- return We({
585
+ function yt(e) {
586
+ return Oe({
673
587
  version: 1,
674
588
  reportContext: e.reportContext,
675
589
  resolvedFormats: [...e.resolvedFormats]
676
590
  });
677
591
  }
678
- function Ot(e) {
679
- const t = Qe(e);
680
- return H(t) ? t : void 0;
592
+ function ht(e) {
593
+ const t = Ue(e);
594
+ return Z(t) ? t : void 0;
681
595
  }
682
- function Qe(e) {
596
+ function Ue(e) {
683
597
  const t = e.snapshot.resolvedFormats.find(
684
- (o) => o.format.type !== "temporal_bucket" && o.format.type !== "raw_temporal" && o.format.type !== "date" && k(o.scope, e.scope) && A(o.target, e.target)
598
+ (o) => o.format.type !== "temporal_bucket" && o.format.type !== "raw_temporal" && o.format.type !== "date" && T(o.scope, e.scope) && $(o.target, e.target)
685
599
  );
686
600
  return t == null ? void 0 : t.format;
687
601
  }
688
- function Ut(e) {
602
+ function wt(e) {
689
603
  const t = e.snapshot.resolvedFormats.find(
690
- (o) => o.format.type === "date" && k(o.scope, e.scope) && A(o.target, e.target)
604
+ (o) => o.format.type === "date" && T(o.scope, e.scope) && $(o.target, e.target)
691
605
  );
692
606
  return t == null ? void 0 : t.format;
693
607
  }
694
- function Pt(e) {
608
+ function vt(e) {
695
609
  const t = e.snapshot.resolvedFormats.find(
696
- (o) => o.format.type === "raw_temporal" && k(o.scope, e.scope) && A(o.target, e.target)
610
+ (o) => o.format.type === "raw_temporal" && T(o.scope, e.scope) && $(o.target, e.target)
697
611
  );
698
612
  return t == null ? void 0 : t.format;
699
613
  }
700
- function zt(e) {
614
+ function gt(e) {
701
615
  const t = e.snapshot.resolvedFormats.find(
702
- (o) => o.format.type === "temporal_bucket" && k(o.scope, e.scope) && A(o.target, e.target)
616
+ (o) => o.format.type === "temporal_bucket" && T(o.scope, e.scope) && $(o.target, e.target)
703
617
  );
704
618
  return t == null ? void 0 : t.format;
705
619
  }
706
- function qt(e) {
620
+ function bt(e) {
707
621
  var n;
708
622
  const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
709
- if (e.snapshot.resolvedFormats.forEach((s, i) => {
710
- if (s.scope.attachmentIndex !== void 0)
623
+ if (e.snapshot.resolvedFormats.forEach((i, s) => {
624
+ if (i.scope.attachmentIndex !== void 0)
711
625
  throw new Error(
712
- `resolvedFormats.${i}.scope.attachmentIndex is not valid for a card export`
626
+ `resolvedFormats.${s}.scope.attachmentIndex is not valid for a card export`
713
627
  );
714
- if (s.scope.dashboardId !== e.expectedScope.dashboardId || s.scope.cardId !== e.expectedScope.cardId)
628
+ if (i.scope.dashboardId !== e.expectedScope.dashboardId || i.scope.cardId !== e.expectedScope.cardId)
715
629
  throw new Error(
716
- `resolvedFormats.${i}.scope must match the executing dashboard/card`
630
+ `resolvedFormats.${s}.scope must match the executing dashboard/card`
717
631
  );
718
- if (s.target.kind === "field" && s.format.type === "temporal_bucket") {
719
- const a = JSON.stringify(S(s.target));
632
+ if (i.target.kind === "field" && i.format.type === "temporal_bucket") {
633
+ const a = JSON.stringify(R(i.target));
720
634
  if (o.has(a))
721
635
  throw new Error(
722
- `resolvedFormats.${i} duplicates export field "${s.target.fieldId}"`
636
+ `resolvedFormats.${s} duplicates export field "${i.target.fieldId}"`
723
637
  );
724
638
  o.add(a);
725
639
  return;
726
640
  }
727
- if (s.target.kind !== "column")
641
+ if (i.target.kind !== "column")
728
642
  throw new Error(
729
- `resolvedFormats.${i}.target must identify an export column or temporal pivot field`
643
+ `resolvedFormats.${s}.target must identify an export column or temporal pivot field`
730
644
  );
731
- if (t.has(s.target.columnKey))
645
+ if (t.has(i.target.columnKey))
732
646
  throw new Error(
733
- `resolvedFormats.${i} duplicates export column "${s.target.columnKey}"`
647
+ `resolvedFormats.${s} duplicates export column "${i.target.columnKey}"`
734
648
  );
735
- t.add(s.target.columnKey);
649
+ t.add(i.target.columnKey);
736
650
  }), !e.useFormattedValues) return;
737
651
  if (!((n = e.visibleColumns) != null && n.length))
738
652
  throw new Error("visibleColumns must identify every formatted export column");
739
653
  const r = e.visibleColumns.find(
740
- (s) => !t.has(s)
654
+ (i) => !t.has(i)
741
655
  );
742
656
  if (r)
743
657
  throw new Error(
744
658
  `resolvedFormats is missing visible export column "${r}"`
745
659
  );
746
660
  }
747
- function E(e) {
661
+ function I(e) {
748
662
  return Array.from(
749
663
  new Set(
750
664
  (e ?? []).flatMap(
@@ -753,24 +667,24 @@ function E(e) {
753
667
  )
754
668
  );
755
669
  }
756
- function et(e) {
670
+ function Pe(e) {
757
671
  const t = /* @__PURE__ */ new Map();
758
672
  return e.forEach((o) => {
759
673
  o.id && t.set(o.id, (t.get(o.id) ?? 0) + 1);
760
674
  }), e.flatMap(
761
- (o) => o.id && (t.get(o.id) ?? 0) > 1 ? [ne(o)] : []
675
+ (o) => o.id && (t.get(o.id) ?? 0) > 1 ? [ee(o)] : []
762
676
  );
763
677
  }
764
- function Bt(e) {
765
- const t = e.metricFields ?? [], o = E(t);
678
+ function xt(e) {
679
+ const t = e.metricFields ?? [], o = I(t);
766
680
  return {
767
681
  expectedRoleFieldIds: {
768
- groupby: E(e.groupByFields),
769
- metric: o.length > 0 ? o : [re],
770
- pivotby: E(e.pivotByFields),
771
- detail: E(e.detailFields)
682
+ groupby: I(e.groupByFields),
683
+ metric: o.length > 0 ? o : [Q],
684
+ pivotby: I(e.pivotByFields),
685
+ detail: I(e.detailFields)
772
686
  },
773
- expectedMetricAliases: et(t)
687
+ expectedMetricAliases: Pe(t)
774
688
  };
775
689
  }
776
690
  class c extends Error {
@@ -781,7 +695,7 @@ class c extends Error {
781
695
  this.cause = r, this.name = "PivotResultLifecycleError";
782
696
  }
783
697
  }
784
- function tt(e) {
698
+ function ze(e) {
785
699
  if (!Array.isArray(e) || e.some(
786
700
  (o) => !o || typeof o != "object" || Array.isArray(o) || typeof o.key != "string" || !o.key || typeof o.name != "string" || typeof o.label != "string"
787
701
  ))
@@ -794,7 +708,7 @@ function tt(e) {
794
708
  "Canonical pivot column keys must be unique."
795
709
  );
796
710
  for (const o of t) {
797
- const r = se(o, {
711
+ const r = te(o, {
798
712
  metadataRequired: !1
799
713
  });
800
714
  if (!r.ok)
@@ -804,7 +718,7 @@ function tt(e) {
804
718
  }
805
719
  return t;
806
720
  }
807
- function D(e) {
721
+ function K(e) {
808
722
  if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1 || e.source !== "explorer" || !e.byRole || typeof e.byRole != "object" || Array.isArray(e.byRole))
809
723
  throw new c(
810
724
  "A loaded canonical pivot result requires its role-scoped column key map."
@@ -815,10 +729,10 @@ function D(e) {
815
729
  throw new c(
816
730
  `Canonical pivot role map contains invalid "${r}" bindings.`
817
731
  );
818
- for (const [s, i] of Object.entries(n))
819
- if (!s || !i || typeof i != "object" || Array.isArray(i) || i.role !== r || typeof i.rawKey != "string" || !i.rawKey || i.outputKey !== void 0 && (typeof i.outputKey != "string" || !i.outputKey))
732
+ for (const [i, s] of Object.entries(n))
733
+ if (!i || !s || typeof s != "object" || Array.isArray(s) || s.role !== r || typeof s.rawKey != "string" || !s.rawKey || s.outputKey !== void 0 && (typeof s.outputKey != "string" || !s.outputKey))
820
734
  throw new c(
821
- `Canonical pivot role map contains an invalid "${r}:${s}" binding.`
735
+ `Canonical pivot role map contains an invalid "${r}:${i}" binding.`
822
736
  );
823
737
  }
824
738
  if (t.byMetricAlias !== void 0) {
@@ -836,7 +750,7 @@ function D(e) {
836
750
  }
837
751
  return t;
838
752
  }
839
- function ot(e) {
753
+ function qe(e) {
840
754
  if (e === void 0) return {};
841
755
  if (!e || typeof e != "object" || Array.isArray(e))
842
756
  throw new c(
@@ -855,14 +769,14 @@ function ot(e) {
855
769
  }
856
770
  return e;
857
771
  }
858
- function O(e, t) {
772
+ function F(e, t) {
859
773
  if (!Array.isArray(e) || e.some((o) => typeof o != "string" || !o) || new Set(e).size !== e.length)
860
774
  throw new c(
861
775
  `Canonical pivot contract ${t} must be an array of unique field identities.`
862
776
  );
863
777
  return e;
864
778
  }
865
- function rt(e, t) {
779
+ function Be(e, t) {
866
780
  if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1)
867
781
  throw new c(
868
782
  "A canonical pivot result requires its versioned result contract."
@@ -872,7 +786,7 @@ function rt(e, t) {
872
786
  throw new c(
873
787
  "Canonical pivot contract role identities must be an object."
874
788
  );
875
- const s = Object.fromEntries(
789
+ const i = Object.fromEntries(
876
790
  [
877
791
  "groupby",
878
792
  "metric",
@@ -880,12 +794,12 @@ function rt(e, t) {
880
794
  "detail"
881
795
  ].map((u) => [
882
796
  u,
883
- O(
797
+ F(
884
798
  r[u],
885
799
  `expectedRoleFieldIds.${u}`
886
800
  )
887
801
  ])
888
- ), i = O(
802
+ ), s = F(
889
803
  o.expectedMetricAliases,
890
804
  "expectedMetricAliases"
891
805
  ), a = o.columnKinds;
@@ -906,7 +820,7 @@ function rt(e, t) {
906
820
  throw new c(
907
821
  "Canonical pivot contract must classify every authoritative result column exactly once."
908
822
  );
909
- const M = ot(
823
+ const M = qe(
910
824
  o.columnClassifications
911
825
  );
912
826
  if (Object.keys(M).some(
@@ -917,33 +831,33 @@ function rt(e, t) {
917
831
  );
918
832
  return {
919
833
  version: 1,
920
- expectedRoleFieldIds: s,
921
- expectedMetricAliases: i,
834
+ expectedRoleFieldIds: i,
835
+ expectedMetricAliases: s,
922
836
  columnKinds: a,
923
837
  columnClassifications: M
924
838
  };
925
839
  }
926
- function U(e, t) {
840
+ function j(e, t) {
927
841
  const o = [
928
842
  "groupby",
929
843
  "metric",
930
844
  "pivotby",
931
845
  "detail"
932
846
  ];
933
- for (const s of o) {
934
- const i = new Set(t.expectedRoleFieldIds[s] ?? []), a = Object.keys(e.byRole[s] ?? {});
935
- if (a.length !== i.size || a.some((l) => !i.has(l)))
847
+ for (const i of o) {
848
+ const s = new Set(t.expectedRoleFieldIds[i] ?? []), a = Object.keys(e.byRole[i] ?? {});
849
+ if (a.length !== s.size || a.some((l) => !s.has(l)))
936
850
  throw new c(
937
- `The role-scoped ${s} bindings do not match the authored result fields.`
851
+ `The role-scoped ${i} bindings do not match the authored result fields.`
938
852
  );
939
853
  }
940
854
  const r = new Set(t.expectedMetricAliases), n = Object.keys(e.byMetricAlias ?? {});
941
- if (n.length !== r.size || n.some((s) => !r.has(s)))
855
+ if (n.length !== r.size || n.some((i) => !r.has(i)))
942
856
  throw new c(
943
857
  "The metric-alias bindings do not match the authored metric instances."
944
858
  );
945
859
  }
946
- function nt(e) {
860
+ function Ye(e) {
947
861
  if (!Array.isArray(e) || e.some(
948
862
  (t) => !t || typeof t != "object" || Array.isArray(t)
949
863
  ))
@@ -952,7 +866,7 @@ function nt(e) {
952
866
  );
953
867
  return e;
954
868
  }
955
- function st(e, t) {
869
+ function Le(e, t) {
956
870
  e.forEach((o, r) => {
957
871
  t.forEach((n) => {
958
872
  if (!Object.prototype.hasOwnProperty.call(o, n.key) || o[n.key] === void 0)
@@ -962,21 +876,21 @@ function st(e, t) {
962
876
  });
963
877
  });
964
878
  }
965
- function it(e, t, o) {
879
+ function Xe(e, t, o) {
966
880
  const r = new Set(t.map((n) => n.key));
967
881
  ["groupby", "detail"].forEach((n) => {
968
882
  Object.entries(e.byRole[n] ?? {}).forEach(
969
- ([s, i]) => {
970
- const a = i.outputKey || i.rawKey;
883
+ ([i, s]) => {
884
+ const a = s.outputKey || s.rawKey;
971
885
  if (!r.has(a) || o.columnKinds[a] !== "row")
972
886
  throw new c(
973
- `The role-scoped ${n} binding for "${s}" does not name an authoritative result column.`
887
+ `The role-scoped ${n} binding for "${i}" does not name an authoritative result column.`
974
888
  );
975
889
  }
976
890
  );
977
891
  });
978
892
  }
979
- function P(e, t) {
893
+ function D(e, t) {
980
894
  t.forEach((o) => {
981
895
  const r = e.columnKinds[o.key];
982
896
  if (r === "pivot_metric" && o.pivotIdentity === void 0)
@@ -989,8 +903,8 @@ function P(e, t) {
989
903
  );
990
904
  });
991
905
  }
992
- function at(e) {
993
- const t = nt(e.records), o = tt(e.columns), r = rt(
906
+ function Ze(e) {
907
+ const t = Ye(e.records), o = ze(e.columns), r = Be(
994
908
  e.pivotResultContract,
995
909
  o
996
910
  ), n = r.expectedRoleFieldIds.pivotby ?? [];
@@ -1005,9 +919,9 @@ function at(e) {
1005
919
  throw new c(
1006
920
  "A loaded_empty pivot result cannot carry physical pivot columns."
1007
921
  );
1008
- P(r, o);
1009
- const a = D(e.columnKeyMap);
1010
- return U(a, r), {
922
+ D(r, o);
923
+ const a = K(e.columnKeyMap);
924
+ return j(a, r), {
1011
925
  pivotResultState: "loaded_empty",
1012
926
  records: [],
1013
927
  columns: o,
@@ -1023,40 +937,40 @@ function at(e) {
1023
937
  throw new c(
1024
938
  "A loaded_valid pivot result must carry at least one record."
1025
939
  );
1026
- const s = D(e.columnKeyMap);
1027
- U(s, r), it(s, o, r), P(r, o);
1028
- const i = o.filter(
940
+ const i = K(e.columnKeyMap);
941
+ j(i, r), Xe(i, o, r), D(r, o);
942
+ const s = o.filter(
1029
943
  (a) => r.columnKinds[a.key] === "pivot_metric"
1030
944
  );
1031
- if (n.length > 0 && i.length === 0)
945
+ if (n.length > 0 && s.length === 0)
1032
946
  throw new c(
1033
947
  "A loaded_valid pivot result is missing its physical pivot columns."
1034
948
  );
1035
949
  try {
1036
- ie(i, {
950
+ oe(s, {
1037
951
  expectedPivotFieldIds: n,
1038
952
  columnClassifications: r.columnClassifications
1039
953
  });
1040
954
  } catch (a) {
1041
- throw a instanceof ae ? new c(a.message, a) : a;
955
+ throw a instanceof re ? new c(a.message, a) : a;
1042
956
  }
1043
- return st(t, o), {
957
+ return Le(t, o), {
1044
958
  pivotResultState: "loaded_valid",
1045
959
  records: t,
1046
960
  columns: o,
1047
- columnKeyMap: s,
961
+ columnKeyMap: i,
1048
962
  pivotResultContract: r
1049
963
  };
1050
964
  }
1051
- function Lt(e) {
965
+ function It(e) {
1052
966
  const t = /* @__PURE__ */ new Set();
1053
- ["groupby", "detail"].forEach((s) => {
1054
- Object.values(e.columnKeyMap.byRole[s] ?? {}).forEach((i) => {
1055
- t.add(i.outputKey || i.rawKey);
967
+ ["groupby", "detail"].forEach((i) => {
968
+ Object.values(e.columnKeyMap.byRole[i] ?? {}).forEach((s) => {
969
+ t.add(s.outputKey || s.rawKey);
1056
970
  });
1057
971
  });
1058
972
  const o = new Set(e.physicalPivotColumnKeys), r = new Set(
1059
- e.columns.map((s) => s.key)
973
+ e.columns.map((i) => i.key)
1060
974
  ), n = {
1061
975
  version: 1,
1062
976
  expectedRoleFieldIds: {
@@ -1075,18 +989,18 @@ function Lt(e) {
1075
989
  },
1076
990
  expectedMetricAliases: [...e.expectedMetricAliases ?? []],
1077
991
  columnKinds: Object.fromEntries(
1078
- e.columns.map((s) => [
1079
- s.key,
1080
- t.has(s.key) ? "row" : o.has(s.key) ? "pivot_metric" : "value"
992
+ e.columns.map((i) => [
993
+ i.key,
994
+ t.has(i.key) ? "row" : o.has(i.key) ? "pivot_metric" : "value"
1081
995
  ])
1082
996
  ),
1083
997
  columnClassifications: Object.fromEntries(
1084
998
  Object.entries(e.columnMetadata ?? {}).filter(
1085
- ([s]) => r.has(s)
999
+ ([i]) => r.has(i)
1086
1000
  )
1087
1001
  )
1088
1002
  };
1089
- return at({
1003
+ return Ze({
1090
1004
  pivotResultState: e.records.length === 0 ? "loaded_empty" : "loaded_valid",
1091
1005
  pivotResultContract: n,
1092
1006
  records: e.records,
@@ -1095,61 +1009,39 @@ function Lt(e) {
1095
1009
  });
1096
1010
  }
1097
1011
  export {
1098
- Pe as $,
1099
- De as A,
1100
- Oe as B,
1101
- Ie as C,
1102
- Ce as D,
1103
- T as E,
1104
- _t as F,
1105
- Ue as G,
1106
- $t as H,
1107
- qe as I,
1108
- He as J,
1109
- We as K,
1110
- Dt as L,
1111
- Nt as M,
1112
- Ot as N,
1113
- Ut as O,
1114
- N as P,
1115
- zt as Q,
1116
- qt as R,
1117
- et as S,
1118
- Bt as T,
1119
- c as U,
1120
- at as V,
1121
- Lt as W,
1122
- Fe as X,
1123
- Ft as Y,
1124
- Mt as Z,
1125
- Kt as _,
1126
- Qe as a,
1127
- ze as a0,
1128
- jt as a1,
1129
- wt as a2,
1130
- Re as b,
1131
- L as c,
1132
- Se as d,
1133
- Te as e,
1134
- Pt as f,
1135
- vt as g,
1136
- Ae as h,
1137
- _e as i,
1138
- xt as j,
1139
- $e as k,
1140
- Et as l,
1141
- It as m,
1142
- Y as n,
1143
- Ct as o,
1144
- K as p,
1145
- Rt as q,
1146
- bt as r,
1147
- St as s,
1012
+ dt as A,
1013
+ mt as B,
1014
+ ft as C,
1015
+ Re as D,
1016
+ Te as E,
1017
+ ut as F,
1018
+ nt as G,
1019
+ pt as M,
1020
+ _ as P,
1021
+ Ue as a,
1022
+ ge as b,
1023
+ it as c,
1024
+ st as d,
1025
+ at as e,
1026
+ vt as f,
1027
+ ke as g,
1028
+ Ee as h,
1029
+ ct as i,
1030
+ Ae as j,
1031
+ lt as k,
1032
+ $e as l,
1033
+ E as m,
1034
+ Ne as n,
1035
+ Oe as o,
1036
+ w as p,
1037
+ yt as q,
1038
+ ht as r,
1039
+ wt as s,
1148
1040
  gt as t,
1149
- Me as u,
1150
- Tt as v,
1151
- C as w,
1152
- w as x,
1153
- kt as y,
1154
- At as z
1041
+ Pe as u,
1042
+ bt as v,
1043
+ xt as w,
1044
+ c as x,
1045
+ Ze as y,
1046
+ It as z
1155
1047
  };