react-semaphor 0.1.587 → 0.1.588

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 (93) hide show
  1. package/dist/analytics-protocol/index.js +341 -338
  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-DhP8wVtM.js → add-to-dashboard-C86FsM8D.js} +1 -1
  7. package/dist/chunks/{aggregate-measure-field-DsFXETpI.js → aggregate-measure-field-BrkXsSJp.js} +2 -2
  8. package/dist/chunks/{analytics-base-schemas-BaIQrEzX.js → analytics-base-schemas-8wz9vqn_.js} +173 -165
  9. package/dist/chunks/{assistant-chat-pfJK-T0b.js → assistant-chat-BeM6joPc.js} +19 -18
  10. package/dist/chunks/{bookmark-impact-BSpGQL1M.js → bookmark-impact-B7pbMx2e.js} +2 -2
  11. package/dist/chunks/{bookmark-state-CL4WEpgB.js → bookmark-state-Bn7k3ttp.js} +5 -5
  12. package/dist/chunks/{card-filter-builder-C8PbhHjq.js → card-filter-builder-DmodrhyI.js} +81 -81
  13. package/dist/chunks/{comparison-window-caption-CoART8BC.js → comparison-window-caption-fqijZdVd.js} +451 -395
  14. package/dist/chunks/{context-BTLBjQNh.js → context-CVXTFljo.js} +1 -1
  15. package/dist/chunks/{dashboard-CVj1oMoW.js → dashboard-Tu5wT0Cw.js} +1 -1
  16. package/dist/chunks/{dashboard-briefing-launcher-TqA58rKz.js → dashboard-briefing-launcher-D8jMxIJo.js} +249 -265
  17. package/dist/chunks/{dashboard-controls-DQ8FsxAz.js → dashboard-controls-uzeAIEkM.js} +65 -65
  18. package/dist/chunks/{dashboard-json-DM88pmk2.js → dashboard-json-i5rpFNCg.js} +5 -5
  19. package/dist/chunks/dates-BunbHJH0.js +115 -0
  20. package/dist/chunks/{edit-dashboard-visual-BpRnU_6G.js → edit-dashboard-visual-BpEK_Sls.js} +2357 -2344
  21. package/dist/chunks/{filter-line-Cu2u1K36.js → filter-line-Dza3ee4w.js} +5 -5
  22. package/dist/chunks/{filter-reach-copy-0Xp97cLk.js → filter-reach-copy-D5AmDHda.js} +944 -942
  23. package/dist/chunks/{filter-value-text-xefXzZlf.js → filter-value-text-DQw4v3nC.js} +6 -6
  24. package/dist/chunks/{index-D_QSeVKy.js → index-dGxJTaP1.js} +39 -39
  25. package/dist/chunks/{layout-grid-9nSS2SL-.js → layout-grid-XCYphks2.js} +1 -1
  26. package/dist/chunks/{list-filter-CfMPI6v4.js → list-filter-DGV3fqqv.js} +1 -1
  27. package/dist/chunks/{matrix-analytical-definition-DOVSFFuf.js → matrix-analytical-definition-SN0JUJVk.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-BKDyxJho.js → matrix-member-presentation-DVBJR0MA.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-BM5TveR3.js → matrix-operation-contract-JSmproo9.js} +15 -15
  30. package/dist/chunks/{metric-comparison-ZmurmEIs.js → metric-comparison-xE_J6hkg.js} +2 -2
  31. package/dist/chunks/{paintbrush-LzAje2ff.js → paintbrush-DEEZXhDj.js} +1 -1
  32. package/dist/chunks/{palette-DicJG0TC.js → palette-Bgy0H-Nt.js} +1 -1
  33. package/dist/chunks/{pivot-header-presentation-CdeTU96P.js → pivot-header-presentation-D-DfPAjb.js} +1 -1
  34. package/dist/chunks/{pivot-result-contract-expectations-Bx_BCu-7.js → pivot-result-contract-expectations-DbBahmgc.js} +545 -536
  35. package/dist/chunks/{pivot-result-identity-Bvs6Uq3v.js → pivot-result-identity-CUsMt_4r.js} +1 -1
  36. package/dist/chunks/{raw-temporal-value-DH-feMc2.js → raw-temporal-value-BnGCWJAL.js} +1 -1
  37. package/dist/chunks/{report-preferences-dialog-CXKmWyLm.js → report-preferences-dialog-CTM0xfd0.js} +14 -14
  38. package/dist/chunks/{report-runtime-context-NlOXwyRB.js → report-runtime-context-CrOgmuxO.js} +2 -2
  39. package/dist/chunks/{resolve-dashboard-input-context-zEXuitoF.js → resolve-dashboard-input-context-DFBIngUZ.js} +5617 -5485
  40. package/dist/chunks/{save-0wu1Z1U7.js → save-xnRCvMeA.js} +1 -1
  41. package/dist/chunks/{saved-dashboard-context-Cll5LipJ.js → saved-dashboard-context-DKMTP9ib.js} +17 -17
  42. package/dist/chunks/selection-filter-compiler-DkIjp1yH.js +131 -0
  43. package/dist/chunks/{semaphor-ready-indicator-Bnj3H0Dm.js → semaphor-ready-indicator-zU9reNmX.js} +45952 -45617
  44. package/dist/chunks/{shelf-drop-preview-context-B8rmn6BD.js → shelf-drop-preview-context-R9sf4oDX.js} +6 -6
  45. package/dist/chunks/{stored-dashboard-CURqJgoa.js → stored-dashboard-CksluF2S.js} +1539 -1404
  46. package/dist/chunks/{style-sheet-parts-_dGSFzDi.js → style-sheet-parts-D7NbsFL0.js} +3 -3
  47. package/dist/chunks/{table-export-sheet-Dmtqi5NV.js → table-export-sheet-ClSgERQC.js} +1 -1
  48. package/dist/chunks/{token-types-DEe_FP4l.js → token-types-DTocOcwt.js} +1 -1
  49. package/dist/chunks/{upload-CtyOkU_B.js → upload-BXGgYS4g.js} +1 -1
  50. package/dist/chunks/{validators-CJ8Jh0E8.js → validators-CrYXNnNE.js} +51 -49
  51. package/dist/chunks/{variable-draft-DIv-9y6Q.js → variable-draft-rbtGPvmX.js} +16 -14
  52. package/dist/chunks/visual-choice-DDfHfHvY.js +172 -0
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +821 -791
  55. package/dist/format-utils/index.js +162 -158
  56. package/dist/index.js +21 -21
  57. package/dist/report-runtime-context/index.js +2 -2
  58. package/dist/style.css +1 -1
  59. package/dist/surfboard/index.js +2 -2
  60. package/dist/types/index.js +5 -5
  61. package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +39 -2
  62. package/dist/types/lib/dashboard-view-state/date-zoom.d.ts +65 -0
  63. package/dist/types/lib/dashboard-view-state/grain-pick.d.ts +38 -0
  64. package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
  65. package/dist/types/lib/formatters/grouped-temporal-presentation.d.ts +6 -2
  66. package/dist/types/lib/hooks/interactions/use-drill-actions.d.ts +1 -1
  67. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +2 -2
  68. package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -1
  69. package/dist/types/lib/query-context/build-card-query-context.d.ts +15 -1
  70. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +3 -0
  71. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +14 -1
  72. package/dist/types/lib/stores/dashboard-store.d.ts +7 -1
  73. package/dist/types/lib/types/explorer-types.d.ts +13 -0
  74. package/dist/types/lib/utils/card-config-utils.d.ts +1 -1
  75. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +32 -0
  76. package/dist/types/shared/analytics-protocol/contracts.d.ts +30 -0
  77. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +13 -0
  78. package/dist/types/shared/dashboard-authoring/automatic-grain.d.ts +77 -0
  79. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  80. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +13 -8
  81. package/dist/types/shared/dashboard-authoring/control-value-resolution.d.ts +24 -0
  82. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  83. package/dist/types/shared/dashboard-authoring/kpi-trend-rule.d.ts +6 -29
  84. package/dist/types/shared/dashboard-authoring/variable-draft.d.ts +1 -0
  85. package/dist/types/shared/format-utils/index.d.ts +1 -0
  86. package/dist/types/shared/format-utils/partial-period.d.ts +40 -0
  87. package/dist/types/shared/format-utils/temporal-bucket.d.ts +11 -0
  88. package/dist/types/shared/usage-events/details.d.ts +2 -2
  89. package/dist/usage-events/index.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/chunks/dates-5z3b9Loo.js +0 -136
  92. package/dist/chunks/selection-filter-compiler-BReJy-uv.js +0 -92
  93. package/dist/chunks/visual-choice-BBPizkRo.js +0 -206
@@ -1,32 +1,32 @@
1
- import { aE as He, i as ze, k as U, n as Ge, T as Pe, aF as ae, aG as $e, aH as qe, aI as Ie, aJ as Le, ar as Xe, aw as Ye, as as We, a as Je, b as B, a7 as de, al as Ze, a5 as Qe, am as et, f as tt, q as fe, t as rt, Z as pe, $ as nt, a1 as ot, a8 as at, aK as I, aL as K } from "./pivot-result-contract-expectations-Bx_BCu-7.js";
2
- import { h as Y, e as st, p as it, k as ct } from "./export-file-format-C-tJsxsf.js";
3
- import { aU as j, a5 as lt, m as q, aT as ut, r as mt } from "./validators-CJ8Jh0E8.js";
4
- import "./matrix-operation-contract-BM5TveR3.js";
5
- import "./analytics-base-schemas-BaIQrEzX.js";
6
- import { readPdfCapacityFacts as dt, PDF_SAFETY_LIMIT_EXCEEDED as se, PDF_CAPACITY as k, PDF_NUMBER_COLUMN_TOO_WIDE as Me, getUtf8ByteLength as ft, FAST_PDF_POLICY as pt, isPdfCapacityRefusalCode as ht } from "../pdf-export-policy/index.js";
7
- import { p as bt } from "./pivot-header-presentation-CdeTU96P.js";
8
- import { c as yt, b as he } from "./pivot-result-identity-Bvs6Uq3v.js";
9
- import { v as gt } from "./raw-temporal-value-DH-feMc2.js";
10
- function wt(e, t, r) {
1
+ import { aF as Ge, i as qe, k as U, n as Xe, T as $e, aG as ae, aH as Pe, aI as Ye, aJ as Ie, aK as De, am as Le, f as Me, as as We, ax as Ze, at as Je, a as Qe, b as B, a7 as de, a5 as et, an as tt, q as fe, t as rt, Z as pe, $ as nt, a1 as ot, a8 as at, aL as I, aM as K } from "./pivot-result-contract-expectations-DbBahmgc.js";
2
+ import { h as Y, e as st, p as it, k as lt } from "./export-file-format-C-tJsxsf.js";
3
+ import { aU as j, a5 as ct, m as q, aT as ut, r as mt } from "./validators-CrYXNnNE.js";
4
+ import "./matrix-operation-contract-JSmproo9.js";
5
+ import "./analytics-base-schemas-8wz9vqn_.js";
6
+ import { readPdfCapacityFacts as dt, PDF_SAFETY_LIMIT_EXCEEDED as se, PDF_CAPACITY as k, PDF_NUMBER_COLUMN_TOO_WIDE as ke, getUtf8ByteLength as ft, FAST_PDF_POLICY as pt, isPdfCapacityRefusalCode as ht } from "../pdf-export-policy/index.js";
7
+ import { w as bt, v as yt } from "./raw-temporal-value-BnGCWJAL.js";
8
+ import { p as gt } from "./pivot-header-presentation-D-DfPAjb.js";
9
+ import { c as wt, b as he } from "./pivot-result-identity-CUsMt_4r.js";
10
+ function xt(e, t, r) {
11
11
  const n = {
12
12
  ...t,
13
13
  locale: t.locale ?? r
14
14
  };
15
15
  if (n.type === "number")
16
16
  return U(e, n);
17
- const { prefix: o, suffix: i, ...l } = n;
17
+ const { prefix: o, suffix: s, ...c } = n;
18
18
  return `${o ?? ""}${U(e, {
19
- ...l,
19
+ ...c,
20
20
  negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
21
- })}${i ?? ""}`;
21
+ })}${s ?? ""}`;
22
22
  }
23
23
  function Q(e, t, r) {
24
- return e === null ? { value: e, text: null } : !t || !ze(t) && t.type !== "duration" ? {
24
+ return e === null ? { value: e, text: null } : !t || !qe(t) && t.type !== "duration" ? {
25
25
  value: e,
26
26
  text: U(e, { type: "number", locale: r })
27
27
  } : t.type === "duration" ? {
28
28
  value: e,
29
- text: Ge(e, {
29
+ text: Xe(e, {
30
30
  inputUnit: t.inputUnit,
31
31
  outputStyle: t.outputStyle,
32
32
  largestUnit: t.largestUnit,
@@ -36,7 +36,7 @@ function Q(e, t, r) {
36
36
  suffix: t.suffix,
37
37
  negativeInParentheses: t.negativeStyle === "parentheses"
38
38
  })
39
- } : { value: e, text: wt(e, t, r) };
39
+ } : { value: e, text: xt(e, t, r) };
40
40
  }
41
41
  function be(e, t, r, n) {
42
42
  return e === null ? { value: e, text: null } : n === "percent" ? {
@@ -81,7 +81,7 @@ function Fr(e, t) {
81
81
  };
82
82
  return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = Q(
83
83
  e.delta,
84
- He(t.metricFormat),
84
+ Ge(t.metricFormat),
85
85
  t.locale
86
86
  )), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = be(
87
87
  e.percentChange,
@@ -95,19 +95,19 @@ function Fr(e, t) {
95
95
  "ratio"
96
96
  )), r;
97
97
  }
98
- const xt = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
99
- function vt(e) {
98
+ const vt = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
99
+ function Ct(e) {
100
100
  const { presentation: t } = e;
101
- return e.formattedValues ? (t == null ? void 0 : t.kind) === "text" || (t == null ? void 0 : t.kind) === "measure" && t.format.type === "duration" ? "text" : (t == null ? void 0 : t.kind) === "temporal_bucket" ? xt.has(t.grain) ? "date" : "text" : (t == null ? void 0 : t.kind) === "datetime" ? "date" : e.dataType === "number" ? "number" : e.dataType === "boolean" ? "boolean" : e.dataType === "unknown" ? "by_value" : "text" : "by_value";
101
+ return e.formattedValues ? (t == null ? void 0 : t.kind) === "text" || (t == null ? void 0 : t.kind) === "measure" && t.format.type === "duration" ? "text" : (t == null ? void 0 : t.kind) === "temporal_bucket" ? vt.has(t.grain) ? "date" : "text" : (t == null ? void 0 : t.kind) === "datetime" ? "date" : e.dataType === "number" ? "number" : e.dataType === "boolean" ? "boolean" : e.dataType === "unknown" ? "by_value" : "text" : "by_value";
102
102
  }
103
- function Ct(e) {
104
- const t = (o, i) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : i, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
103
+ function _t(e) {
104
+ const t = (o, s) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : s, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
105
105
  return n === 0 ? "" : `.${"0".repeat(n)}`;
106
106
  }
107
107
  function ee(e) {
108
108
  return `"${e.replace(/"/g, "")}"`;
109
109
  }
110
- function _t(e) {
110
+ function Tt(e) {
111
111
  let t;
112
112
  try {
113
113
  t = new Intl.NumberFormat(e.locale ?? "en-US", {
@@ -117,33 +117,33 @@ function _t(e) {
117
117
  } catch {
118
118
  return;
119
119
  }
120
- const r = t.findIndex((i) => i.type === "currency"), n = t.findIndex((i) => i.type === "integer");
120
+ const r = t.findIndex((s) => s.type === "currency"), n = t.findIndex((s) => s.type === "integer");
121
121
  if (r < 0 || n < 0) return;
122
- const o = (i, l) => t.slice(i, l).filter((c) => c.type === "literal").map((c) => c.value.replace(/\s/g, " ")).join("");
122
+ const o = (s, c) => t.slice(s, c).filter((l) => l.type === "literal").map((l) => l.value.replace(/\s/g, " ")).join("");
123
123
  return r < n ? { side: "before", text: t[r].value + o(r + 1, n) } : {
124
124
  side: "after",
125
125
  text: o(n + 1, r) + t[r].value
126
126
  };
127
127
  }
128
- function Tt(e) {
129
- const t = Ct(e);
128
+ function Et(e) {
129
+ const t = _t(e);
130
130
  let r;
131
131
  if (e.type === "scientific")
132
132
  r = `0${t}E+00`;
133
133
  else {
134
134
  const n = `${e.useGrouping === !1 ? "0" : "#,##0"}${t}`;
135
135
  if (e.type === "currency") {
136
- const o = _t(e);
136
+ const o = Tt(e);
137
137
  r = o ? o.side === "before" ? `${ee(o.text)}${n}` : `${n}${ee(o.text)}` : n;
138
138
  } else e.type === "percent" ? r = e.percentValueMode === "whole" ? `${n}${ee("%")}` : `${n}%` : r = n;
139
139
  }
140
140
  return e.negativeStyle === "parentheses" ? `${r};(${r})` : r;
141
141
  }
142
- function Et(e, t) {
142
+ function St(e, t) {
143
143
  if (!e.formattedValues) return;
144
144
  const { presentation: r } = e;
145
145
  if (t === "number" || t === "by_value")
146
- return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : Tt(r.format);
146
+ return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : Et(r.format);
147
147
  if (t === "date") {
148
148
  if ((r == null ? void 0 : r.kind) === "temporal_bucket")
149
149
  return r.grain === "day" ? "yyyy-mm-dd" : r.grain === "month" ? "mmm yyyy" : "yyyy-mm-dd hh:mm";
@@ -152,7 +152,7 @@ function Et(e, t) {
152
152
  }
153
153
  }
154
154
  function ge(e) {
155
- const t = vt(e), r = Et(e, t);
155
+ const t = Ct(e), r = St(e, t);
156
156
  return Object.freeze({
157
157
  key: e.key,
158
158
  label: e.label,
@@ -160,9 +160,9 @@ function ge(e) {
160
160
  ...r === void 0 ? {} : { numberFormat: r }
161
161
  });
162
162
  }
163
- const Ft = 15, St = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
164
- function De(e) {
165
- return St.test(e) ? e : void 0;
163
+ const Ft = 15, $t = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
164
+ function Ae(e) {
165
+ return $t.test(e) ? e : void 0;
166
166
  }
167
167
  function we(e) {
168
168
  const r = e.replace(/^-/, "").replace(/[eE].*$/, "").replace(".", "").replace(/^0+/, "").replace(/0+$/, "");
@@ -170,7 +170,7 @@ function we(e) {
170
170
  const n = Number(e);
171
171
  return Number.isFinite(n) && (n !== 0 || r.length === 0);
172
172
  }
173
- const Pt = Date.UTC(1900, 2, 1), $t = Date.UTC(1e4, 0, 1), It = Date.UTC(1899, 11, 30), Lt = 864e5;
173
+ const Pt = Date.UTC(1900, 2, 1), It = Date.UTC(1e4, 0, 1), Dt = Date.UTC(1899, 11, 30), Lt = 864e5;
174
174
  function Mt(e) {
175
175
  const t = Date.UTC(
176
176
  e.year,
@@ -180,8 +180,8 @@ function Mt(e) {
180
180
  e.minute,
181
181
  e.second
182
182
  );
183
- if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Pt || t >= $t))
184
- return (t - It) / Lt;
183
+ if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Pt || t >= It))
184
+ return (t - Dt) / Lt;
185
185
  }
186
186
  function xe(e, t, r) {
187
187
  if (typeof e == "number")
@@ -189,7 +189,7 @@ function xe(e, t, r) {
189
189
  if (j(e))
190
190
  return we(e.value) ? { kind: "number", text: t, value: e } : void 0;
191
191
  if (r && typeof e == "string") {
192
- const n = De(e);
192
+ const n = Ae(e);
193
193
  return n !== void 0 && we(n) ? { kind: "number", text: t, value: n } : void 0;
194
194
  }
195
195
  }
@@ -201,8 +201,8 @@ function H(e) {
201
201
  case "text":
202
202
  return o;
203
203
  case "date": {
204
- const i = e.wallClock ? Mt(e.wallClock) : void 0;
205
- return i === void 0 ? o : { kind: "date", text: r, serial: i };
204
+ const s = e.wallClock ? Mt(e.wallClock) : void 0;
205
+ return s === void 0 ? o : { kind: "date", text: r, serial: s };
206
206
  }
207
207
  case "number":
208
208
  return xe(t, r, !0) ?? o;
@@ -212,14 +212,14 @@ function H(e) {
212
212
  return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : xe(t, r, !1) ?? o;
213
213
  }
214
214
  }
215
- function Sr(e) {
215
+ function $r(e) {
216
216
  return e.kind === "empty" ? "" : e.text;
217
217
  }
218
218
  const Pr = {
219
219
  rowLabels: "tabular",
220
220
  subtotals: "after"
221
221
  };
222
- function $r(e, t) {
222
+ function Ir(e, t) {
223
223
  const r = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
224
224
  return {
225
225
  ...e,
@@ -229,79 +229,79 @@ function $r(e, t) {
229
229
  rows: {
230
230
  ...n,
231
231
  levels: Object.fromEntries(
232
- Object.entries(n.levels).map(([o, i]) => [
232
+ Object.entries(n.levels).map(([o, s]) => [
233
233
  o,
234
- { ...i, position: t.subtotals }
234
+ { ...s, position: t.subtotals }
235
235
  ])
236
236
  )
237
237
  }
238
238
  }
239
239
  };
240
240
  }
241
- const Dt = 2;
242
- function kt(e) {
241
+ const kt = 2;
242
+ function At(e) {
243
243
  return typeof e == "number" ? Number.isInteger(e) : j(e) ? !e.value.includes(".") : !0;
244
244
  }
245
- function At(e, t, r) {
245
+ function Nt(e, t, r) {
246
246
  const n = e.descriptors.measures.filter(
247
- (l) => r.measureFormats[l.id] === void 0 && l.semanticFormat === void 0 && lt(l.column.dataType) === "number"
247
+ (c) => r.measureFormats[c.id] === void 0 && c.semanticFormat === void 0 && ct(c.column.dataType) === "number"
248
248
  );
249
249
  if (n.length === 0) return r;
250
250
  const o = /* @__PURE__ */ new Set();
251
- e.columns.forEach((l, c) => {
252
- if (!(l.kind !== "measure" || o.has(l.measureId)))
251
+ e.columns.forEach((c, l) => {
252
+ if (!(c.kind !== "measure" || o.has(c.measureId)))
253
253
  for (const f of t) {
254
- const h = f.values[c];
255
- if ((h == null ? void 0 : h.kind) === "value" && !kt(h.value)) {
256
- o.add(l.measureId);
254
+ const d = f.values[l];
255
+ if ((d == null ? void 0 : d.kind) === "value" && !At(d.value)) {
256
+ o.add(c.measureId);
257
257
  return;
258
258
  }
259
259
  }
260
260
  });
261
- const i = { ...r.measureFormats };
262
- for (const { id: l } of n) {
263
- const c = o.has(l) ? Dt : 0;
264
- i[l] = {
261
+ const s = { ...r.measureFormats };
262
+ for (const { id: c } of n) {
263
+ const l = o.has(c) ? kt : 0;
264
+ s[c] = {
265
265
  type: "number",
266
- minimumFractionDigits: c,
267
- maximumFractionDigits: c,
266
+ minimumFractionDigits: l,
267
+ maximumFractionDigits: l,
268
268
  useGrouping: !0
269
269
  };
270
270
  }
271
- return { ...r, measureFormats: i };
271
+ return { ...r, measureFormats: s };
272
272
  }
273
273
  function z(e) {
274
274
  return q(e.slice(0, -1));
275
275
  }
276
- function Nt(e, t) {
276
+ function Ot(e, t) {
277
277
  return t.length > e.length && q(t.slice(0, e.length)) === q(e);
278
278
  }
279
- function Ot(e) {
279
+ function Rt(e) {
280
280
  return e.map((t, r) => {
281
281
  if (r === 0 || t.kind !== "layout") return !1;
282
282
  const n = e[r - 1];
283
283
  if (n.kind !== "layout") return !1;
284
- if (t.role !== "member" || Nt(n.rowPath, t.rowPath)) return !0;
284
+ if (t.role !== "member" || Ot(n.rowPath, t.rowPath)) return !0;
285
285
  const o = e[r - 2];
286
286
  return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || z(o.rowPath) !== z(n.rowPath)) && t.rowPath.length === n.rowPath.length && z(t.rowPath) === z(n.rowPath);
287
287
  });
288
288
  }
289
- const Rt = "pdf-group-continuation";
290
- function ke(e, t, r) {
289
+ const Ut = "pdf-group-continuation";
290
+ function Ne(e, t, r) {
291
291
  return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || j(t.value)) ? e : Y(e);
292
292
  }
293
- function Ut(e, t, r) {
294
- const n = Pe(e.descriptors, t.presentation, r), o = e.columns.map((u) => {
293
+ function Kt(e, t, r) {
294
+ const n = $e(e.descriptors, t.presentation, r), o = e.columns.map((u) => {
295
295
  var a;
296
296
  return u.kind === "measure" && ((a = n.measureSemantics.get(u.measureId)) == null ? void 0 : a.isNumeric) === !0;
297
- }), i = (u) => ae([u], n.levels), l = (u, a, m) => $e(u, a, t.presentation.totals[m], n.levels), c = e.columns.map((u) => {
297
+ }), s = (u) => ae([u], n.levels), c = (u, a, m) => Pe(u, a, t.presentation.totals[m], n.levels), l = e.columns.map((u) => {
298
298
  if (u.kind !== "measure") return u.label;
299
- const a = u.columnPath.map(i);
300
- return u.role !== "member" && a.push(l(u.columnPath, u.role, "columns")), [...a, u.label].join(" / ");
299
+ const a = u.columnPath.map(s);
300
+ return u.role !== "member" && a.push(c(u.columnPath, u.role, "columns")), [...a, u.label].join(" / ");
301
301
  }), f = Math.min(t.spec.columns.length, Math.max(
302
302
  0,
303
303
  ...e.columns.map((u) => u.kind === "measure" ? u.columnPath.length + (u.role !== "member" ? 1 : 0) : 0)
304
- )), h = Array.from({ length: f + 1 }, (u, a) => e.columns.map((m) => a === f ? m.label : m.kind !== "measure" ? "" : a < m.columnPath.length ? i(m.columnPath[a]) : a === m.columnPath.length && m.role !== "member" ? l(m.columnPath, m.role, "columns") : "")), y = (u, a) => qe({
304
+ )), d = Array.from({ length: f + 1 }, (u, a) => e.columns.map((m) => a === f ? m.label : m.kind !== "measure" ? "" : a < m.columnPath.length ? s(m.columnPath[a]) : a === m.columnPath.length && m.role !== "member" ? c(m.columnPath, m.role, "columns") : "")), b = (u, a) => Ye({
305
305
  path: u.rowPath,
306
306
  role: u.kind === "layout" ? u.role : "member",
307
307
  levelCount: Math.max(1, t.spec.rows.length),
@@ -310,26 +310,26 @@ function Ut(e, t, r) {
310
310
  }), w = (u, a) => {
311
311
  if (u.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
312
312
  if (u.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
313
- const m = y(u, a);
314
- return e.columns.map((b, d) => {
315
- if (b.kind === "hierarchy")
316
- return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${l(u.rowPath, u.role, "rows")}`;
317
- if (b.kind === "level") {
318
- const x = t.spec.rows.findIndex((P) => P.id === b.levelId), v = m[x];
319
- return v != null && v.visible ? v.total ? l(u.rowPath, u.role, "rows") : ae(v.path, n.levels) : "";
313
+ const m = b(u, a);
314
+ return e.columns.map((y, p) => {
315
+ if (y.kind === "hierarchy")
316
+ return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${c(u.rowPath, u.role, "rows")}`;
317
+ if (y.kind === "level") {
318
+ const x = t.spec.rows.findIndex(($) => $.id === y.levelId), v = m[x];
319
+ return v != null && v.visible ? v.total ? c(u.rowPath, u.role, "rows") : ae(v.path, n.levels) : "";
320
320
  }
321
- const C = u.values[d], g = n.measures.get(b.measureId);
321
+ const C = u.values[p], g = n.measures.get(y.measureId);
322
322
  if (C.kind === "value" && !g)
323
323
  throw new Error("Matrix value is missing its measure descriptor.");
324
324
  return Ie(C, g, t.presentation.absence);
325
325
  });
326
- }, T = (u, a) => w(u, a).map((m, b) => {
327
- const d = e.columns[b];
328
- return d.kind === "measure" ? ke(m, u.values[b], n.measureSemantics.get(d.measureId)) : Y(m);
326
+ }, T = (u, a) => w(u, a).map((m, y) => {
327
+ const p = e.columns[y];
328
+ return p.kind === "measure" ? Ne(m, u.values[y], n.measureSemantics.get(p.measureId)) : Y(m);
329
329
  });
330
330
  return {
331
- headers: c,
332
- headerBands: h,
331
+ headers: l,
332
+ headerBands: d,
333
333
  numericColumns: o,
334
334
  /** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
335
335
  formatting: n,
@@ -342,14 +342,14 @@ function Ut(e, t, r) {
342
342
  * above and below it.
343
343
  */
344
344
  continuedColumns: (u, a) => {
345
- const m = (d) => (d == null ? void 0 : d.kind) === "layout" && d.role === "member";
345
+ const m = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
346
346
  if (!m(u) || !m(a)) return [];
347
- const b = y(u, a);
348
- return e.columns.flatMap((d, C) => {
347
+ const y = b(u, a);
348
+ return e.columns.flatMap((p, C) => {
349
349
  var x;
350
- if (d.kind !== "level") return [];
351
- const g = t.spec.rows.findIndex((v) => v.id === d.levelId);
352
- return g < u.rowPath.length && ((x = b[g]) == null ? void 0 : x.visible) === !1 ? [C] : [];
350
+ if (p.kind !== "level") return [];
351
+ const g = t.spec.rows.findIndex((v) => v.id === p.levelId);
352
+ return g < u.rowPath.length && ((x = y[g]) == null ? void 0 : x.visible) === !1 ? [C] : [];
353
353
  });
354
354
  },
355
355
  csvRow: (u) => T(u),
@@ -360,80 +360,80 @@ function Ut(e, t, r) {
360
360
  * formatter state or an earlier worker. Without it, the first row prints
361
361
  * its labels.
362
362
  */
363
- csvRows: (u, a) => u.map((m, b) => T(m, b ? u[b - 1] : a ?? void 0))
363
+ csvRows: (u, a) => u.map((m, y) => T(m, y ? u[y - 1] : a ?? void 0))
364
364
  };
365
365
  }
366
- function Ir(e) {
366
+ function Dr(e) {
367
367
  return e.columns.map((t) => Y(t.label));
368
368
  }
369
369
  function Lr(e, t, r) {
370
- return Kt(e, t, r).map((n, o) => {
371
- const i = t.columns[o];
372
- return i.kind === "measure" ? ke(n, e.values[o], r.measureSemantics.get(i.measureId)) : Y(n);
370
+ return jt(e, t, r).map((n, o) => {
371
+ const s = t.columns[o];
372
+ return s.kind === "measure" ? Ne(n, e.values[o], r.measureSemantics.get(s.measureId)) : Y(n);
373
373
  });
374
374
  }
375
- function Kt(e, t, r) {
375
+ function jt(e, t, r) {
376
376
  if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
377
377
  if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
378
378
  const n = [...e.rowPath, ...e.columnPath];
379
- return t.columns.map((o, i) => {
379
+ return t.columns.map((o, s) => {
380
380
  if (o.kind === "measure") {
381
- const c = e.values[i], f = r.measures.get(o.measureId);
382
- if (c.kind === "value" && !f) throw new Error("Matrix value is missing its measure descriptor.");
383
- return Ie(c, f, r.absence);
381
+ const l = e.values[s], f = r.measures.get(o.measureId);
382
+ if (l.kind === "value" && !f) throw new Error("Matrix value is missing its measure descriptor.");
383
+ return Ie(l, f, r.absence);
384
384
  }
385
- const l = o.kind === "level" ? n.find((c) => c.levelId === o.levelId) : void 0;
386
- if (!l) throw new Error("Flat Matrix row does not match its frozen layout.");
387
- return ae([l], r.levels);
385
+ const c = o.kind === "level" ? n.find((l) => l.levelId === o.levelId) : void 0;
386
+ if (!c) throw new Error("Flat Matrix row does not match its frozen layout.");
387
+ return ae([c], r.levels);
388
388
  });
389
389
  }
390
- function jt(e) {
391
- const t = Ut(e.layout, e.request, e.report), r = e.layout.columns.map((l, c) => ({
392
- index: c,
393
- columnId: `matrix:${c}`,
394
- label: t.headers[c],
395
- isNumeric: t.numericColumns[c]
396
- })), n = (l, c, f) => ({
397
- text: l,
390
+ function Vt(e) {
391
+ const t = Kt(e.layout, e.request, e.report), r = e.layout.columns.map((c, l) => ({
392
+ index: l,
393
+ columnId: `matrix:${l}`,
394
+ label: t.headers[l],
395
+ isNumeric: t.numericColumns[l]
396
+ })), n = (c, l, f) => ({
397
+ text: c,
398
398
  colspan: 1,
399
399
  rowspan: 1,
400
- columnId: r[c].columnId,
400
+ columnId: r[l].columnId,
401
401
  isHeader: f,
402
- isNumeric: r[c].isNumeric,
403
- className: r[c].isNumeric ? "numeric" : e.layout.columns[c].kind === "hierarchy" ? "matrix-hierarchy" : ""
404
- }), o = [], i = e.layout.columns.findIndex((l) => l.kind === "measure");
405
- e.request.spec.columns.length && i >= 0 && o.push({
402
+ isNumeric: r[l].isNumeric,
403
+ className: r[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
404
+ }), o = [], s = e.layout.columns.findIndex((c) => c.kind === "measure");
405
+ e.request.spec.columns.length && s >= 0 && o.push({
406
406
  repeatHeader: !0,
407
407
  headerType: "pivot-axis",
408
408
  headerRowIndex: 0,
409
409
  cells: [
410
- ...i ? [{ ...n("", 0, !0), colspan: i }] : [],
410
+ ...s ? [{ ...n("", 0, !0), colspan: s }] : [],
411
411
  {
412
- ...n(e.request.spec.columns.map((l) => Le(l, e.request.presentation)).join(" / "), i, !0),
413
- colspan: e.layout.columns.length - i,
412
+ ...n(e.request.spec.columns.map((c) => De(c, e.request.presentation)).join(" / "), s, !0),
413
+ colspan: e.layout.columns.length - s,
414
414
  isNumeric: !1,
415
415
  className: ""
416
416
  }
417
417
  ]
418
418
  });
419
- for (const [l, c] of t.headerBands.entries())
419
+ for (const [c, l] of t.headerBands.entries())
420
420
  o.push({
421
421
  repeatHeader: !0,
422
- headerType: l === t.headerBands.length - 1 ? "metrics" : "pivot-level",
422
+ headerType: c === t.headerBands.length - 1 ? "metrics" : "pivot-level",
423
423
  headerRowIndex: o.length,
424
- cells: c.map((f, h) => n(f, h, !0))
424
+ cells: l.map((f, d) => n(f, d, !0))
425
425
  });
426
426
  return {
427
427
  headers: o,
428
- rows: e.rows.map((l, c) => {
429
- const f = new Set(t.continuedColumns(l, e.rows[c - 1]));
428
+ rows: e.rows.map((c, l) => {
429
+ const f = new Set(t.continuedColumns(c, e.rows[l - 1]));
430
430
  return {
431
- index: c,
432
- type: l.kind === "layout" && l.role !== "member" ? "subtotal" : "data",
433
- subtotalLevel: String(l.rowPath.length),
431
+ index: l,
432
+ type: c.kind === "layout" && c.role !== "member" ? "subtotal" : "data",
433
+ subtotalLevel: String(c.rowPath.length),
434
434
  // A tabular layout prints each label once unless it repeats them; the
435
435
  // blank cell continues its group, so a grid draws no rule above it.
436
- cells: t.row(l, e.rows[c - 1]).map((h, y) => f.has(y) ? { ...n(h, y, !1), className: Rt } : n(h, y, !1))
436
+ cells: t.row(c, e.rows[l - 1]).map((d, b) => f.has(b) ? { ...n(d, b, !1), className: Ut } : n(d, b, !1))
437
437
  };
438
438
  }),
439
439
  grandTotal: null,
@@ -442,50 +442,50 @@ function jt(e) {
442
442
  tableType: "pivot",
443
443
  totalRows: e.rows.length,
444
444
  totalColumns: r.length,
445
- rowLevels: e.layout.columns.filter((l) => l.kind !== "measure").length,
445
+ rowLevels: e.layout.columns.filter((c) => c.kind !== "measure").length,
446
446
  pivotLevels: e.request.spec.columns.length,
447
447
  hasGrandTotal: !1,
448
- columnOrder: r.map((l) => l.columnId),
448
+ columnOrder: r.map((c) => c.columnId),
449
449
  columns: r
450
450
  }
451
451
  };
452
452
  }
453
- function Vt(e, t, r) {
454
- const { levels: n } = Pe(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, i = [], l = [], c = e.columns.map((h, y) => {
455
- if (h.kind !== "measure") return null;
456
- const w = o ? `${h.role}:${q(h.columnPath)}` : `measure:${y}`;
457
- let T = i.indexOf(w);
458
- return T < 0 && (T = i.push(w) - 1, l.push(o ? $e(h.columnPath, h.role, t.presentation.totals.columns, n) : h.label)), T;
453
+ function Bt(e, t, r) {
454
+ const { levels: n } = $e(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, s = [], c = [], l = e.columns.map((d, b) => {
455
+ if (d.kind !== "measure") return null;
456
+ const w = o ? `${d.role}:${q(d.columnPath)}` : `measure:${b}`;
457
+ let T = s.indexOf(w);
458
+ return T < 0 && (T = s.push(w) - 1, c.push(o ? Pe(d.columnPath, d.role, t.presentation.totals.columns, n) : d.label)), T;
459
459
  }), f = t.spec.columns[t.spec.columns.length - 1];
460
460
  return {
461
- columnGroups: c,
462
- groupLabels: l,
461
+ columnGroups: l,
462
+ groupLabels: c,
463
463
  /** What bands name their groups by: the innermost column level, or "Measures". */
464
- groupLevelLabel: f ? Le(f, t.presentation) : "Measures"
464
+ groupLevelLabel: f ? De(f, t.presentation) : "Measures"
465
465
  };
466
466
  }
467
467
  function Mr(e) {
468
468
  const { layout: t, rows: r, report: n } = e, o = {
469
469
  ...e.request,
470
- presentation: At(t, r, e.request.presentation)
471
- }, i = jt({ layout: t, rows: r, request: o, report: n }), l = Ot(r), c = Vt(t, o, n), f = {
472
- ...i,
473
- rows: i.rows.map((h, y) => ({ ...h, keepWithPrevious: l[y] })),
474
- metadata: { ...i.metadata, ...c }
470
+ presentation: Nt(t, r, e.request.presentation)
471
+ }, s = Vt({ layout: t, rows: r, request: o, report: n }), c = Rt(r), l = Bt(t, o, n), f = {
472
+ ...s,
473
+ rows: s.rows.map((d, b) => ({ ...d, keepWithPrevious: c[b] })),
474
+ metadata: { ...s.metadata, ...l }
475
475
  };
476
- return { request: o, table: f, ...c };
476
+ return { request: o, table: f, ...l };
477
477
  }
478
- const S = (e) => e.toLocaleString("en-US"), G = (e) => `${S(Math.ceil(e / 1048576))} MB`, te = "export the data as CSV or Excel";
479
- function Dr(e) {
478
+ const F = (e) => e.toLocaleString("en-US"), G = (e) => `${F(Math.ceil(e / 1048576))} MB`, te = "export the data as CSV or Excel";
479
+ function kr(e) {
480
480
  const t = dt(e.facts), r = e.dataExport ? `Add a filter to narrow it, or ${te}.` : "Add a filter to narrow it, then export again.";
481
481
  switch (e.code) {
482
482
  case "PDF_ROW_LIMIT_EXCEEDED": {
483
483
  const n = e.subject ?? "This table", o = t.rowLimit ?? k.maxTableRows;
484
- return t.rowCount !== void 0 ? `${n} has ${S(t.rowCount)} rows. A PDF holds up to ${S(o)} rows per table. ${r}` : `${n} has more than ${S(o)} rows, the most a PDF holds per table. ${r}`;
484
+ return t.rowCount !== void 0 ? `${n} has ${F(t.rowCount)} rows. A PDF holds up to ${F(o)} rows per table. ${r}` : `${n} has more than ${F(o)} rows, the most a PDF holds per table. ${r}`;
485
485
  }
486
486
  case "PDF_PAGE_LIMIT_EXCEEDED": {
487
487
  const n = e.subject ?? "This PDF", o = t.pageLimit ?? k.maxPages;
488
- return t.pageCount !== void 0 ? `${n} is ${S(t.pageCount)} pages. A PDF holds up to ${S(o)}. ${r}` : `${n} is longer than ${S(o)} pages, the most a PDF holds. ${r}`;
488
+ return t.pageCount !== void 0 ? `${n} is ${F(t.pageCount)} pages. A PDF holds up to ${F(o)}. ${r}` : `${n} is longer than ${F(o)} pages, the most a PDF holds. ${r}`;
489
489
  }
490
490
  case "PDF_SIZE_LIMIT_EXCEEDED": {
491
491
  const n = e.subject ?? "This PDF", o = t.byteLimit ?? k.maxFileBytes;
@@ -493,21 +493,21 @@ function Dr(e) {
493
493
  }
494
494
  case "PDF_CAPTURE_TOO_TALL":
495
495
  return `${e.subject ?? "This dashboard"} is too long to print as one PDF. Print one sheet or fewer cards${e.dataExport ? `, or ${te}` : ""}.`;
496
- case Me:
496
+ case ke:
497
497
  return `A number in this table is too wide for its column in a PDF. Use landscape or fewer columns${e.dataExport ? `, or ${te}` : ""}.`;
498
498
  case se:
499
- return `This PDF is over what a PDF holds: ${S(k.maxTableRows)} rows per table, ${S(
499
+ return `This PDF is over what a PDF holds: ${F(k.maxTableRows)} rows per table, ${F(
500
500
  k.maxPages
501
501
  )} pages and ${G(k.maxFileBytes)}. ${r}`;
502
502
  }
503
503
  }
504
- class Bt extends Error {
504
+ class Ht extends Error {
505
505
  constructor(t, r = se) {
506
506
  super(t), this.code = r;
507
507
  }
508
508
  }
509
- function Ht(e) {
510
- return ht(e) || e === se || e === Me;
509
+ function zt(e) {
510
+ return ht(e) || e === se || e === ke;
511
511
  }
512
512
  function ve(e) {
513
513
  if (!e || typeof e != "object")
@@ -517,21 +517,21 @@ function ve(e) {
517
517
  if (typeof o == "string" && o.trim())
518
518
  return o.trim();
519
519
  }
520
- async function zt(e) {
520
+ async function Gt(e) {
521
521
  const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
522
522
  try {
523
523
  if (r.includes("application/json")) {
524
- const o = await e.json(), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
525
- return { message: ve(o) || t, code: i };
524
+ const o = await e.json(), s = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
525
+ return { message: ve(o) || t, code: s };
526
526
  }
527
527
  const n = await e.text();
528
528
  if (!n.trim())
529
529
  return { message: t };
530
530
  try {
531
- const o = JSON.parse(n), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
531
+ const o = JSON.parse(n), s = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
532
532
  return {
533
533
  message: ve(o) || n.trim(),
534
- code: i
534
+ code: s
535
535
  };
536
536
  } catch {
537
537
  return { message: n.trim() };
@@ -540,7 +540,7 @@ async function zt(e) {
540
540
  return { message: t };
541
541
  }
542
542
  }
543
- async function kr(e) {
543
+ async function Ar(e) {
544
544
  if (!e.token) throw new Error("Missing auth token for PDF export");
545
545
  if (ft(e.serializedPayload) > pt.maxRequestBytes)
546
546
  throw new Error("Fast-path PDF request exceeds the structured body limit");
@@ -551,8 +551,8 @@ async function kr(e) {
551
551
  signal: e.signal
552
552
  });
553
553
  if (!t.ok) {
554
- const n = await zt(t);
555
- throw Ht(n.code) ? new Bt(n.message, n.code) : new Error(n.message);
554
+ const n = await Gt(t);
555
+ throw zt(n.code) ? new Ht(n.message, n.code) : new Error(n.message);
556
556
  }
557
557
  const r = await t.json();
558
558
  if (r != null && r.error) throw new Error(r.error);
@@ -560,7 +560,7 @@ async function kr(e) {
560
560
  throw new Error("Fast-path PDF response missing download URL");
561
561
  return r;
562
562
  }
563
- const Ar = 1, Ae = ["loading", "measuring", "checking", "laidOut"], Gt = [
563
+ const Nr = 1, Oe = ["loading", "measuring", "checking", "laidOut"], qt = [
564
564
  // Already emitted before these contracts; names kept.
565
565
  "document_matrix_too_large",
566
566
  "document_matrix_unavailable",
@@ -580,20 +580,20 @@ const Ar = 1, Ae = ["loading", "measuring", "checking", "laidOut"], Gt = [
580
580
  // PDF capacity contract PC-D3: more pages than one PDF holds.
581
581
  "document_page_limit_exceeded"
582
582
  ];
583
- function Nr(e) {
584
- return Gt.includes(e);
583
+ function Or(e) {
584
+ return qt.includes(e);
585
585
  }
586
- const qt = 64, Xt = 120, Yt = 3, Wt = 80, Jt = [...Ae, "noPageStack", "unknown"];
586
+ const Xt = 64, Yt = 120, Wt = 3, Zt = 80, Jt = [...Oe, "noPageStack", "unknown"];
587
587
  function re(e, t) {
588
588
  return typeof e != "string" ? void 0 : e.trim().slice(0, t).trim() || void 0;
589
589
  }
590
- function F(e, t) {
590
+ function S(e, t) {
591
591
  return typeof e == "number" && Number.isInteger(e) && e >= t ? e : void 0;
592
592
  }
593
593
  function ne(e, t) {
594
594
  return t.includes(e) ? e : void 0;
595
595
  }
596
- function Zt(e) {
596
+ function Qt(e) {
597
597
  let t = e;
598
598
  if (typeof e == "string")
599
599
  try {
@@ -602,29 +602,29 @@ function Zt(e) {
602
602
  return {};
603
603
  }
604
604
  if (!t || typeof t != "object" || Array.isArray(t)) return {};
605
- const r = t, n = Array.isArray(r.inputLabels) ? r.inputLabels.map((i) => re(i, Wt)).filter((i) => i !== void 0).slice(0, Yt) : [], o = {
606
- sectionId: re(r.sectionId, qt),
607
- sectionTitle: re(r.sectionTitle, Xt),
608
- pageNumber: F(r.pageNumber, 1),
609
- rowCount: F(r.rowCount, 0),
610
- rowLimit: F(r.rowLimit, 1),
605
+ const r = t, n = Array.isArray(r.inputLabels) ? r.inputLabels.map((s) => re(s, Zt)).filter((s) => s !== void 0).slice(0, Wt) : [], o = {
606
+ sectionId: re(r.sectionId, Xt),
607
+ sectionTitle: re(r.sectionTitle, Yt),
608
+ pageNumber: S(r.pageNumber, 1),
609
+ rowCount: S(r.rowCount, 0),
610
+ rowLimit: S(r.rowLimit, 1),
611
611
  inputLabels: n.length ? n : void 0,
612
612
  overflowAxis: ne(r.overflowAxis, ["height", "width"]),
613
- overflowPx: F(r.overflowPx, 0),
613
+ overflowPx: S(r.overflowPx, 0),
614
614
  matrixLimit: ne(r.matrixLimit, ["rows", "bytes"]),
615
615
  layoutStage: ne(r.layoutStage, Jt),
616
- loadingSectionCount: F(r.loadingSectionCount, 0),
617
- measuredRowCount: F(r.measuredRowCount, 0),
618
- totalRowCount: F(r.totalRowCount, 0),
619
- pageCount: F(r.pageCount, 0),
620
- pageLimit: F(r.pageLimit, 1)
616
+ loadingSectionCount: S(r.loadingSectionCount, 0),
617
+ measuredRowCount: S(r.measuredRowCount, 0),
618
+ totalRowCount: S(r.totalRowCount, 0),
619
+ pageCount: S(r.pageCount, 0),
620
+ pageLimit: S(r.pageLimit, 1)
621
621
  };
622
622
  return Object.fromEntries(
623
- Object.entries(o).filter(([, i]) => i !== void 0)
623
+ Object.entries(o).filter(([, s]) => s !== void 0)
624
624
  );
625
625
  }
626
- function Or(e) {
627
- const t = Zt(e.facts), r = t.sectionTitle ? `Section "${t.sectionTitle}"` : t.sectionId ? `Section ${t.sectionId}` : "A section", n = t.pageNumber !== void 0 ? ` on page ${t.pageNumber}` : "";
626
+ function Rr(e) {
627
+ const t = Qt(e.facts), r = t.sectionTitle ? `Section "${t.sectionTitle}"` : t.sectionId ? `Section ${t.sectionId}` : "A section", n = t.pageNumber !== void 0 ? ` on page ${t.pageNumber}` : "";
628
628
  switch (e.code) {
629
629
  case "document_section_setup":
630
630
  return `${r} is not set up to print.`;
@@ -664,13 +664,13 @@ function Or(e) {
664
664
  ].join("");
665
665
  }
666
666
  }
667
- function Qt(e) {
668
- return Ae.includes(e);
667
+ function er(e) {
668
+ return Oe.includes(e);
669
669
  }
670
670
  function oe(e) {
671
671
  return typeof e == "number" && Number.isInteger(e) && e >= 0;
672
672
  }
673
- function Rr(e) {
673
+ function Ur(e) {
674
674
  let t = e;
675
675
  if (typeof e == "string")
676
676
  try {
@@ -679,28 +679,81 @@ function Rr(e) {
679
679
  return;
680
680
  }
681
681
  if (!t || typeof t != "object" || Array.isArray(t)) return;
682
- const { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: i } = t;
683
- if (!(!Qt(r) || !oe(n) || o !== null && !oe(o) || i !== null && !oe(i)))
684
- return { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: i };
682
+ const { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: s } = t;
683
+ if (!(!er(r) || !oe(n) || o !== null && !oe(o) || s !== null && !oe(s)))
684
+ return { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: s };
685
+ }
686
+ function Kr(e, t, r) {
687
+ const n = t.from > e.start ? t.from : e.start, o = t.to && t.to < e.end ? t.to : e.end, s = o > r ? "running" : n > e.start ? "start" : o < e.end ? "end" : void 0;
688
+ return { start: n, end: o, ...s ? { partial: s } : {} };
689
+ }
690
+ function jr(e, t, r) {
691
+ switch (t) {
692
+ case "running":
693
+ return `${e} (so far)`;
694
+ case "start":
695
+ return r ? `${e} (from ${r.start})` : `${e} (partial)`;
696
+ case "end":
697
+ return r ? `${e} (to ${r.end})` : `${e} (partial)`;
698
+ default:
699
+ return e;
700
+ }
685
701
  }
686
- function er(e, t) {
702
+ function Vr(e, t, r) {
703
+ const n = Date.parse(e.startInclusive), o = Date.parse(e.endExclusive);
704
+ if (!Number.isFinite(n) || !Number.isFinite(o)) return;
705
+ if (t.granularity === "hour" || t.granularity === "minute" || t.granularity === "second") {
706
+ const f = (d) => {
707
+ try {
708
+ return new Intl.DateTimeFormat((r == null ? void 0 : r.locale) ?? "en-US", {
709
+ timeStyle: (r == null ? void 0 : r.dateTime.timeStyle) ?? "short",
710
+ timeZone: t.calendar.tz
711
+ }).format(new Date(d));
712
+ } catch {
713
+ return new Date(d).toISOString();
714
+ }
715
+ };
716
+ return { start: f(n), end: f(o) };
717
+ }
718
+ const s = { kind: "temporal_bucket", granularity: "day", calendar: t.calendar };
719
+ let c;
720
+ try {
721
+ c = Le({
722
+ metadata: s,
723
+ locale: (r == null ? void 0 : r.locale) ?? "en-US",
724
+ ...r ? { styles: { dateStyle: r.dateStyle, dateTime: r.dateTime } } : {}
725
+ });
726
+ } catch {
727
+ c = void 0;
728
+ }
729
+ const l = (f) => {
730
+ const d = bt(new Date(f), t.calendar.tz), b = `${String(d.year).padStart(4, "0")}-${String(d.month).padStart(2, "0")}-${String(d.day).padStart(2, "0")}`;
731
+ try {
732
+ return c ? Me({ value: b, metadata: s, format: c.format }) : b;
733
+ } catch {
734
+ return b;
735
+ }
736
+ };
737
+ return { start: l(n), end: l(o - 1) };
738
+ }
739
+ function tr(e, t) {
687
740
  return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === void 0;
688
741
  }
689
- function Ne(e) {
742
+ function Re(e) {
690
743
  return new Map(
691
744
  e.presentationExecutionSnapshot.resolvedFormats.flatMap(
692
- (t) => t.format.type === "raw_temporal" && t.target.kind === "column" && er(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
745
+ (t) => t.format.type === "raw_temporal" && t.target.kind === "column" && tr(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
693
746
  )
694
747
  );
695
748
  }
696
- function Oe(e) {
749
+ function Ue(e) {
697
750
  const t = e == null ? void 0 : e.sql, r = e == null ? void 0 : e.python;
698
751
  return (e == null ? void 0 : e.resultOwner) === "freeform" && typeof t == "string" && !!t.trim() && (typeof r != "string" || !r.trim());
699
752
  }
700
- function Ur(e) {
701
- return e.formatting.useFormattedValues !== !1 && Oe(e.queryPayload) && Ne(e.formatting).size > 0;
753
+ function Br(e) {
754
+ return e.formatting.useFormattedValues !== !1 && Ue(e.queryPayload) && Re(e.formatting).size > 0;
702
755
  }
703
- function tr(e, t) {
756
+ function rr(e, t) {
704
757
  return e.map((r, n) => {
705
758
  if (!Object.prototype.hasOwnProperty.call(r, t) || r[t] === void 0)
706
759
  throw new Error(
@@ -710,52 +763,52 @@ function tr(e, t) {
710
763
  return o === null || typeof o == "string" ? o : String(o);
711
764
  });
712
765
  }
713
- function rr(e) {
766
+ function nr(e) {
714
767
  if (e.formatting.useFormattedValues === !1)
715
768
  return {
716
769
  activatedColumnKeys: /* @__PURE__ */ new Set(),
717
770
  byColumnKey: /* @__PURE__ */ new Map()
718
771
  };
719
- const t = Ne(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
772
+ const t = Re(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
720
773
  if (t.size === 0)
721
774
  return { activatedColumnKeys: r, byColumnKey: n };
722
775
  const o = new Map(
723
- e.columns.flatMap((c) => {
724
- const f = c.key || c.field;
725
- return f ? [[f, c]] : [];
776
+ e.columns.flatMap((l) => {
777
+ const f = l.key || l.field;
778
+ return f ? [[f, l]] : [];
726
779
  })
727
- ), i = Oe(e.queryPayload), l = /* @__PURE__ */ new Map();
728
- for (const [c, f] of t) {
729
- const h = o.get(c);
730
- let y;
731
- if (h != null && h.rawTemporal)
732
- y = gt(h, {
780
+ ), s = Ue(e.queryPayload), c = /* @__PURE__ */ new Map();
781
+ for (const [l, f] of t) {
782
+ const d = o.get(l);
783
+ let b;
784
+ if (d != null && d.rawTemporal)
785
+ b = yt(d, {
733
786
  metadataRequired: !0
734
- }), r.add(c);
735
- else if (i) {
736
- r.add(c);
737
- const w = Xe({
738
- columnKey: c,
739
- values: tr(e.records, c)
787
+ }), r.add(l);
788
+ else if (s) {
789
+ r.add(l);
790
+ const w = We({
791
+ columnKey: l,
792
+ values: rr(e.records, l)
740
793
  });
741
- l.set(c, w), w.status === "classified" && (y = w.metadata);
794
+ c.set(l, w), w.status === "classified" && (b = w.metadata);
742
795
  } else
743
796
  continue;
744
- y && n.set(c, {
745
- metadata: y,
797
+ b && n.set(l, {
798
+ metadata: b,
746
799
  format: f,
747
- formatValue: Ye({ metadata: y, format: f })
800
+ formatValue: Ze({ metadata: b, format: f })
748
801
  });
749
802
  }
750
803
  return {
751
804
  activatedColumnKeys: r,
752
805
  byColumnKey: n,
753
- ...i ? {
754
- sqlChunkEvidence: We(l)
806
+ ...s ? {
807
+ sqlChunkEvidence: Je(c)
755
808
  } : {}
756
809
  };
757
810
  }
758
- function nr(e) {
811
+ function or(e) {
759
812
  if (!e.resolution.activatedColumnKeys.has(e.columnKey))
760
813
  return;
761
814
  if (e.value === void 0)
@@ -774,7 +827,7 @@ function Ce(e, t) {
774
827
  const r = e.byColumnKey.get(t);
775
828
  return r ? r.metadata.valueKind === "date" : void 0;
776
829
  }
777
- const or = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), ar = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, sr = /^\d{4}-\d{2}-\d{2}$/, Re = "MM/dd/yyyy";
830
+ const ar = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), sr = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, ir = /^\d{4}-\d{2}-\d{2}$/, Ke = "MM/dd/yyyy";
778
831
  function X(e) {
779
832
  return typeof e == "object" && e !== null && !Array.isArray(e);
780
833
  }
@@ -791,12 +844,12 @@ function Te(e, t) {
791
844
  return X(r.dateFormat) ? r.dateFormat : {};
792
845
  }
793
846
  function Ee(e) {
794
- return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || Re;
847
+ return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || Ke;
795
848
  }
796
- function Fe(e, t) {
849
+ function Se(e, t) {
797
850
  return e && e !== "auto" ? e : t;
798
851
  }
799
- function ir(e) {
852
+ function lr(e) {
800
853
  return !/[HhKkmsSa]/.test(e.replace(/'[^']*'/g, ""));
801
854
  }
802
855
  function cr(e) {
@@ -805,8 +858,8 @@ function cr(e) {
805
858
  const t = Number(e);
806
859
  return Number.isFinite(t) ? t : null;
807
860
  }
808
- function lr(e) {
809
- const t = De(e);
861
+ function ur(e) {
862
+ const t = Ae(e);
810
863
  if (t !== void 0)
811
864
  try {
812
865
  return ut(t, /[.eE]/.test(t) ? "decimal" : "integer");
@@ -814,42 +867,42 @@ function lr(e) {
814
867
  return;
815
868
  }
816
869
  }
817
- function ur(e) {
870
+ function mr(e) {
818
871
  return e.calendar.fiscalCalendar && (e.granularity === "quarter" || e.granularity === "year") ? "fiscal" : e.granularity;
819
872
  }
820
- function Kr(e) {
821
- const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, i = (a) => Je({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } }), l = (a) => Qe({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } });
822
- function c(a) {
823
- var b;
824
- if ((b = t.visibleColumns) != null && b.length) return t.visibleColumns;
825
- const m = a.columns.map(R).filter((d) => !!d);
873
+ function Hr(e) {
874
+ const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, s = (a) => Qe({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } }), c = (a) => et({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } });
875
+ function l(a) {
876
+ var y;
877
+ if ((y = t.visibleColumns) != null && y.length) return t.visibleColumns;
878
+ const m = a.columns.map(R).filter((p) => !!p);
826
879
  return m.length > 0 ? m : a.records[0] ? Object.keys(a.records[0]) : [];
827
880
  }
828
881
  function f(a, m) {
829
- return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, a) && t.columnLabels[a] || void 0 || h(m) || (m == null ? void 0 : m.label) || (m == null ? void 0 : m.headerName) || a;
882
+ return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, a) && t.columnLabels[a] || void 0 || d(m) || (m == null ? void 0 : m.label) || (m == null ? void 0 : m.headerName) || a;
830
883
  }
831
- function h(a, m) {
832
- const b = a == null ? void 0 : a.pivotIdentity;
833
- if (!b || !b.members || b.members.length === 0) return;
834
- const d = he({ identity: b, columnKey: (a == null ? void 0 : a.key) || (a == null ? void 0 : a.field) || "" });
835
- return bt({
836
- members: d,
884
+ function d(a, m) {
885
+ const y = a == null ? void 0 : a.pivotIdentity;
886
+ if (!y || !y.members || y.members.length === 0) return;
887
+ const p = he({ identity: y, columnKey: (a == null ? void 0 : a.key) || (a == null ? void 0 : a.field) || "" });
888
+ return gt({
889
+ members: p,
837
890
  metricLabel: (a == null ? void 0 : a.label) || (a == null ? void 0 : a.headerName),
838
891
  mode: n ? "formatted" : "canonical",
839
892
  resolveTemporalFormat: (C) => {
840
- const g = d.find((v) => v.fieldId === C);
893
+ const g = p.find((v) => v.fieldId === C);
841
894
  if (!(g != null && g.temporalBucket)) return;
842
895
  const x = de({
843
896
  snapshot: t.presentationExecutionSnapshot,
844
897
  scope: o,
845
898
  target: { kind: "field", fieldId: C, role: "pivotby" }
846
899
  });
847
- return x ? y(g.temporalBucket, x) : void 0;
900
+ return x ? b(g.temporalBucket, x) : void 0;
848
901
  }
849
902
  }).flattenedLabel;
850
903
  }
851
- function y(a, m) {
852
- return Ze({
904
+ function b(a, m) {
905
+ return Le({
853
906
  metadata: a,
854
907
  cardFormat: m,
855
908
  locale: m.locale,
@@ -857,152 +910,152 @@ function Kr(e) {
857
910
  }).format;
858
911
  }
859
912
  function w(a, m) {
860
- const { records: b, columns: d } = a, C = X(r.cardConfig) ? r.cardConfig : void 0, g = C == null ? void 0 : C.pivotByColumns, x = Array.isArray(g) ? g.flatMap(
861
- (s) => X(s) && typeof s.id == "string" && s.id ? [s.id] : []
913
+ const { records: y, columns: p } = a, C = X(r.cardConfig) ? r.cardConfig : void 0, g = C == null ? void 0 : C.pivotByColumns, x = Array.isArray(g) ? g.flatMap(
914
+ (i) => X(i) && typeof i.id == "string" && i.id ? [i.id] : []
862
915
  ) : [];
863
- yt(
864
- d.map((s) => ({ key: R(s) || "<unknown>", pivotIdentity: s.pivotIdentity })),
916
+ wt(
917
+ p.map((i) => ({ key: R(i) || "<unknown>", pivotIdentity: i.pivotIdentity })),
865
918
  { expectedPivotFieldIds: x }
866
919
  );
867
- const v = c(a), P = new Map(
868
- d.flatMap((s) => {
869
- const p = R(s);
870
- return p ? [[p, s]] : [];
920
+ const v = l(a), $ = new Map(
921
+ p.flatMap((i) => {
922
+ const h = R(i);
923
+ return h ? [[h, i]] : [];
871
924
  })
872
- ), je = new Map(a.resultColumns.map((s) => [s.key, s.dataType])), M = rr({
873
- records: b,
874
- columns: d,
925
+ ), Be = new Map(a.resultColumns.map((i) => [i.key, i.dataType])), L = nr({
926
+ records: y,
927
+ columns: p,
875
928
  formatting: t,
876
929
  queryPayload: r
877
930
  }), W = new Map(
878
- d.flatMap((s) => {
879
- const p = R(s);
880
- return p && s.temporalBucket ? [[p, s.temporalBucket]] : [];
931
+ p.flatMap((i) => {
932
+ const h = R(i);
933
+ return h && i.temporalBucket ? [[h, i.temporalBucket]] : [];
881
934
  })
882
- ), ce = /* @__PURE__ */ new Map();
883
- for (const s of v) {
884
- const p = de({
935
+ ), le = /* @__PURE__ */ new Map();
936
+ for (const i of v) {
937
+ const h = de({
885
938
  snapshot: t.presentationExecutionSnapshot,
886
939
  scope: o,
887
- target: { kind: "column", columnKey: s }
888
- }), _ = W.get(s);
940
+ target: { kind: "column", columnKey: i }
941
+ }), _ = W.get(i);
889
942
  if (n) {
890
- if (p && !_) throw new Error(`Missing temporal bucket metadata for column "${s}"`);
891
- if (_ && !p) throw new Error(`Missing resolved temporal presentation for column "${s}"`);
943
+ if (h && !_) throw new Error(`Missing temporal bucket metadata for column "${i}"`);
944
+ if (_ && !h) throw new Error(`Missing resolved temporal presentation for column "${i}"`);
892
945
  }
893
- p && _ && ce.set(s, y(_, p));
946
+ h && _ && le.set(i, b(_, h));
894
947
  }
895
- const J = v.map((s) => {
896
- const p = je.get(s), _ = p && or.has(p) ? p : "unknown", E = n ? T(s, M, W) : void 0, L = f(s, P.get(s)), A = n && M.activatedColumnKeys.has(s) && Ce(M, s) === void 0;
948
+ const Z = v.map((i) => {
949
+ const h = Be.get(i), _ = h && ar.has(h) ? h : "unknown", E = n ? T(i, L, W) : void 0, D = f(i, $.get(i)), A = n && L.activatedColumnKeys.has(i) && Ce(L, i) === void 0;
897
950
  return {
898
- key: s,
899
- label: L,
951
+ key: i,
952
+ label: D,
900
953
  dataType: _,
901
954
  ...E ? { presentation: E } : {},
902
- xlsx: ge({ key: s, label: L, formattedValues: n, dataType: _, presentation: E }),
955
+ xlsx: ge({ key: i, label: D, formattedValues: n, dataType: _, presentation: E }),
903
956
  ...A ? { xlsxPending: !0 } : {}
904
957
  };
905
958
  });
906
- function Ve(s, p, _, E) {
907
- if (!n) return { text: _e(s), value: s };
908
- const L = nr({ value: s, columnKey: p, rowIndex: _, resolution: M });
909
- if (L !== void 0) return { text: L.text, value: s, ...L.wallClock ? { wallClock: L.wallClock } : {} };
910
- const A = W.get(p);
959
+ function He(i, h, _, E) {
960
+ if (!n) return { text: _e(i), value: i };
961
+ const D = or({ value: i, columnKey: h, rowIndex: _, resolution: L });
962
+ if (D !== void 0) return { text: D.text, value: i, ...D.wallClock ? { wallClock: D.wallClock } : {} };
963
+ const A = W.get(h);
911
964
  if (A) {
912
- const $ = ce.get(p);
913
- if (!$) throw new Error(`Missing resolved temporal presentation for column "${p}"`);
914
- if (s != null && typeof s != "string")
915
- throw new Error(`Canonical temporal column "${p}" must contain a string or null`);
916
- const N = s ?? null, O = et(N, A);
965
+ const P = le.get(h);
966
+ if (!P) throw new Error(`Missing resolved temporal presentation for column "${h}"`);
967
+ if (i != null && typeof i != "string")
968
+ throw new Error(`Canonical temporal column "${h}" must contain a string or null`);
969
+ const N = i ?? null, O = tt(N, A);
917
970
  return {
918
- text: tt({ value: N, metadata: A, format: $ }),
919
- value: s,
971
+ text: Me({ value: N, metadata: A, format: P }),
972
+ value: i,
920
973
  ...O ? { wallClock: O } : {}
921
974
  };
922
975
  }
923
- if (s == null) return { text: "", value: s };
924
- const Z = l(p);
925
- if (Z && typeof s == "number" && Number.isFinite(s))
976
+ if (i == null) return { text: "", value: i };
977
+ const J = c(h);
978
+ if (J && typeof i == "number" && Number.isFinite(i))
926
979
  return {
927
980
  text: fe(
928
- new Date(s).toISOString(),
929
- Z.pattern || Re,
930
- Fe(Z.timezone, t.timezone),
981
+ new Date(i).toISOString(),
982
+ J.pattern || Ke,
983
+ Se(J.timezone, t.timezone),
931
984
  "UTC"
932
985
  ),
933
- value: s
986
+ value: i
934
987
  };
935
- const D = i(p);
936
- if (typeof s == "number")
937
- return { text: D ? B(s, D) : String(s), value: s };
938
- if (j(s))
939
- return { text: D ? B(s, D) : s.value, value: s };
940
- const V = Te(t, p);
941
- if (V && (s instanceof Date || typeof s == "string" && ar.test(s))) {
942
- const $ = s instanceof Date ? s.toISOString() : s, N = typeof s == "string" && sr.test(s), O = N ? "UTC" : Fe(V.timezone, t.timezone), ue = N ? "UTC" : V.sourceTimezone || "auto", me = rt($, O, ue);
988
+ const M = s(h);
989
+ if (typeof i == "number")
990
+ return { text: M ? B(i, M) : String(i), value: i };
991
+ if (j(i))
992
+ return { text: M ? B(i, M) : i.value, value: i };
993
+ const V = Te(t, h);
994
+ if (V && (i instanceof Date || typeof i == "string" && sr.test(i))) {
995
+ const P = i instanceof Date ? i.toISOString() : i, N = typeof i == "string" && ir.test(i), O = N ? "UTC" : Se(V.timezone, t.timezone), ue = N ? "UTC" : V.sourceTimezone || "auto", me = rt(P, O, ue);
943
996
  return {
944
- text: fe($, Ee(V), O, ue),
945
- value: s,
997
+ text: fe(P, Ee(V), O, ue),
998
+ value: i,
946
999
  ...me ? { wallClock: me } : {}
947
1000
  };
948
1001
  }
949
- if (typeof s == "string" && D && E.dataType === "number") {
950
- const $ = lr(s);
951
- if ($) return { text: B($, D), value: s };
1002
+ if (typeof i == "string" && M && E.dataType === "number") {
1003
+ const P = ur(i);
1004
+ if (P) return { text: B(P, M), value: i };
952
1005
  }
953
- return { text: _e(s), value: s };
1006
+ return { text: _e(i), value: i };
954
1007
  }
955
- const Be = b.map(
956
- (s, p) => J.map((_) => {
957
- const E = Ve(s[_.key], _.key, p, _);
1008
+ const ze = y.map(
1009
+ (i, h) => Z.map((_) => {
1010
+ const E = He(i[_.key], _.key, h, _);
958
1011
  return H({ value: E.value, text: E.text, column: _.xlsx, wallClock: E.wallClock });
959
1012
  })
960
- ), le = (m == null ? void 0 : m.withHeader) !== !1 && t.includeHeaders;
961
- if (le)
962
- for (const s of v) {
963
- const p = P.get(s);
964
- p != null && p.pivotIdentity && he({ identity: p.pivotIdentity, columnKey: R(p) || s });
1013
+ ), ce = (m == null ? void 0 : m.withHeader) !== !1 && t.includeHeaders;
1014
+ if (ce)
1015
+ for (const i of v) {
1016
+ const h = $.get(i);
1017
+ h != null && h.pivotIdentity && he({ identity: h.pivotIdentity, columnKey: R(h) || i });
965
1018
  }
966
1019
  return {
967
- ...le ? { header: J.map((s) => s.label) } : {},
968
- columns: J,
969
- rows: Be,
970
- ...M.sqlChunkEvidence ? { rawTemporalClassification: M.sqlChunkEvidence } : {}
1020
+ ...ce ? { header: Z.map((i) => i.label) } : {},
1021
+ columns: Z,
1022
+ rows: ze,
1023
+ ...L.sqlChunkEvidence ? { rawTemporalClassification: L.sqlChunkEvidence } : {}
971
1024
  };
972
1025
  }
973
- function T(a, m, b) {
1026
+ function T(a, m, y) {
974
1027
  if (m.activatedColumnKeys.has(a)) {
975
1028
  const x = Ce(m, a);
976
1029
  return x === void 0 ? { kind: "text" } : { kind: "datetime", dateOnly: x };
977
1030
  }
978
- const d = b.get(a);
979
- if (d) return { kind: "temporal_bucket", grain: ur(d) };
980
- if (l(a)) return { kind: "text" };
1031
+ const p = y.get(a);
1032
+ if (p) return { kind: "temporal_bucket", grain: mr(p) };
1033
+ if (c(a)) return { kind: "text" };
981
1034
  const C = Te(t, a);
982
- if (C) return { kind: "datetime", dateOnly: ir(Ee(C)) };
983
- const g = i(a);
1035
+ if (C) return { kind: "datetime", dateOnly: lr(Ee(C)) };
1036
+ const g = s(a);
984
1037
  return g ? { kind: "measure", format: g } : void 0;
985
1038
  }
986
1039
  function u(a, m) {
987
1040
  if (!Number.isInteger(m) || m < 0)
988
1041
  throw new Error("totalRows must be a non-negative integer");
989
- return m === 0 ? void 0 : (t.visibleColumns ?? Object.keys(a)).map((d) => {
990
- const g = Object.prototype.hasOwnProperty.call(a, d) ? a[d] : d === t.tableTotalsLabelColumnKey ? "Total" : null, x = n ? i(d) : void 0, v = ge({
991
- key: d,
992
- label: d,
1042
+ return m === 0 ? void 0 : (t.visibleColumns ?? Object.keys(a)).map((p) => {
1043
+ const g = Object.prototype.hasOwnProperty.call(a, p) ? a[p] : p === t.tableTotalsLabelColumnKey ? "Total" : null, x = n ? s(p) : void 0, v = ge({
1044
+ key: p,
1045
+ label: p,
993
1046
  formattedValues: n,
994
1047
  dataType: "unknown",
995
1048
  ...x ? { presentation: { kind: "measure", format: x } } : {}
996
1049
  });
997
1050
  if (g == null) return { kind: "empty" };
998
1051
  if (!n) return H({ value: g, text: String(g), column: v });
999
- const P = x ? cr(g) : null;
1000
- return H(x && P !== null ? { value: P, text: B(P, x), column: v } : { value: g, text: String(g), column: v });
1052
+ const $ = x ? cr(g) : null;
1053
+ return H(x && $ !== null ? { value: $, text: B($, x), column: v } : { value: g, text: String(g), column: v });
1001
1054
  });
1002
1055
  }
1003
1056
  return { format: w, totals: u };
1004
1057
  }
1005
- const mr = /* @__PURE__ */ new Set([
1058
+ const dr = /* @__PURE__ */ new Set([
1006
1059
  "scope",
1007
1060
  "useFormattedValues",
1008
1061
  "timezone",
@@ -1020,14 +1073,14 @@ const mr = /* @__PURE__ */ new Set([
1020
1073
  function ie(e) {
1021
1074
  return e !== null && typeof e == "object" && !Array.isArray(e);
1022
1075
  }
1023
- function Se(e, t) {
1076
+ function Fe(e, t) {
1024
1077
  if (e !== void 0) {
1025
1078
  if (!ie(e))
1026
1079
  throw new Error(`formatting.${t} must be an object`);
1027
1080
  return e;
1028
1081
  }
1029
1082
  }
1030
- function jr(e) {
1083
+ function zr(e) {
1031
1084
  if (!ie(e))
1032
1085
  throw new Error("formatting must be an object");
1033
1086
  const t = ["reportContext", "resolvedFormats"].find(
@@ -1037,7 +1090,7 @@ function jr(e) {
1037
1090
  throw new pe(
1038
1091
  `formatting.${t} is retired; formatting.presentationExecutionSnapshot is authoritative.`
1039
1092
  );
1040
- const r = Object.keys(e).find((a) => !mr.has(a));
1093
+ const r = Object.keys(e).find((a) => !dr.has(a));
1041
1094
  if (r)
1042
1095
  throw new Error(`formatting contains unknown property "${r}"`);
1043
1096
  const n = typeof e.timezone == "string" ? e.timezone.trim() : "";
@@ -1046,28 +1099,28 @@ function jr(e) {
1046
1099
  const o = st(e.delimiter);
1047
1100
  if (!o)
1048
1101
  throw new Error("formatting.delimiter must be a comma, semicolon or tab");
1049
- const i = it(e.csvEncoding);
1050
- if (!i)
1102
+ const s = it(e.csvEncoding);
1103
+ if (!s)
1051
1104
  throw new Error("formatting.csvEncoding must be 'utf-8-bom' or 'utf-8'");
1052
1105
  if (typeof e.includeHeaders != "boolean")
1053
1106
  throw new Error("formatting.includeHeaders must be a boolean");
1054
1107
  if (e.useFormattedValues !== void 0 && typeof e.useFormattedValues != "boolean")
1055
1108
  throw new Error("formatting.useFormattedValues must be a boolean");
1056
- const l = e.fileFormat === void 0 ? void 0 : ct(e.fileFormat);
1057
- if (e.fileFormat !== void 0 && !l)
1109
+ const c = e.fileFormat === void 0 ? void 0 : lt(e.fileFormat);
1110
+ if (e.fileFormat !== void 0 && !c)
1058
1111
  throw new Error("formatting.fileFormat must be 'csv' or 'xlsx'");
1059
1112
  if (e.title !== void 0 && typeof e.title != "string")
1060
1113
  throw new Error("formatting.title must be a string");
1061
- const c = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((a) => typeof a == "string") ? e.visibleColumns : void 0;
1062
- if (e.visibleColumns !== void 0 && !c)
1114
+ const l = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((a) => typeof a == "string") ? e.visibleColumns : void 0;
1115
+ if (e.visibleColumns !== void 0 && !l)
1063
1116
  throw new Error("formatting.visibleColumns must be an array of strings");
1064
- const f = Se(e.columnLabels, "columnLabels");
1117
+ const f = Fe(e.columnLabels, "columnLabels");
1065
1118
  if (f && Object.values(f).some((a) => typeof a != "string"))
1066
1119
  throw new Error("formatting.columnLabels values must be strings");
1067
- const h = Se(e.columnSettings, "columnSettings"), y = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey : null;
1068
- if (y === null)
1120
+ const d = Fe(e.columnSettings, "columnSettings"), b = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey : null;
1121
+ if (b === null)
1069
1122
  throw new Error("formatting.tableTotalsLabelColumnKey must be a non-empty string");
1070
- if (y && !(c != null && c.includes(y)))
1123
+ if (b && !(l != null && l.includes(b)))
1071
1124
  throw new Error("formatting.tableTotalsLabelColumnKey must identify a visible column");
1072
1125
  const w = nt(e.scope, "formatting.scope");
1073
1126
  if (!w.cardId || w.attachmentIndex !== void 0)
@@ -1081,7 +1134,7 @@ function jr(e) {
1081
1134
  at({
1082
1135
  snapshot: u,
1083
1136
  expectedScope: { dashboardId: w.dashboardId, cardId: w.cardId },
1084
- visibleColumns: c,
1137
+ visibleColumns: l,
1085
1138
  useFormattedValues: T
1086
1139
  });
1087
1140
  } catch (a) {
@@ -1095,17 +1148,17 @@ function jr(e) {
1095
1148
  timezone: n,
1096
1149
  presentationExecutionSnapshot: u,
1097
1150
  delimiter: o,
1098
- csvEncoding: i,
1151
+ csvEncoding: s,
1099
1152
  includeHeaders: e.includeHeaders,
1100
- ...h ? { columnSettings: h } : {},
1101
- ...c ? { visibleColumns: c } : {},
1153
+ ...d ? { columnSettings: d } : {},
1154
+ ...l ? { visibleColumns: l } : {},
1102
1155
  ...f ? { columnLabels: f } : {},
1103
- ...y ? { tableTotalsLabelColumnKey: y } : {},
1104
- ...l ? { fileFormat: l } : {},
1156
+ ...b ? { tableTotalsLabelColumnKey: b } : {},
1157
+ ...c ? { fileFormat: c } : {},
1105
1158
  ...typeof e.title == "string" ? { title: e.title } : {}
1106
1159
  };
1107
1160
  }
1108
- function Vr(e) {
1161
+ function Gr(e) {
1109
1162
  const t = e.formatOptions, r = (n) => ie(n) ? n : void 0;
1110
1163
  return {
1111
1164
  scope: { dashboardId: e.dashboardId, cardId: e.cardId },
@@ -1123,25 +1176,25 @@ function Vr(e) {
1123
1176
  ...typeof e.title == "string" ? { title: e.title } : {}
1124
1177
  };
1125
1178
  }
1126
- function Br(e) {
1127
- return ((e == null ? void 0 : e.filterValues) ?? []).filter(dr).map(fr);
1179
+ function qr(e) {
1180
+ return ((e == null ? void 0 : e.filterValues) ?? []).filter(fr).map(pr);
1128
1181
  }
1129
- function dr(e) {
1182
+ function fr(e) {
1130
1183
  return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
1131
1184
  }
1132
- function fr(e) {
1185
+ function pr(e) {
1133
1186
  if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
1134
1187
  const { relativeMeta: t, ...r } = e, n = mt(t);
1135
1188
  return n ? { ...r, relativeMeta: n } : r;
1136
1189
  }
1137
- const pr = /* @__PURE__ */ new Set([
1190
+ const hr = /* @__PURE__ */ new Set([
1138
1191
  "day",
1139
1192
  "week",
1140
1193
  "month",
1141
1194
  "quarter",
1142
1195
  "year"
1143
1196
  ]);
1144
- function hr(e, t) {
1197
+ function br(e, t) {
1145
1198
  try {
1146
1199
  const r = K(e), n = I(r, t, "yyyy-MM-dd");
1147
1200
  if (I(r, t, "HH:mm:ss.SSS") !== "00:00:00.000")
@@ -1149,14 +1202,14 @@ function hr(e, t) {
1149
1202
  date: n,
1150
1203
  time: I(r, t, "h:mm a")
1151
1204
  };
1152
- const [o, i, l] = n.split("-").map(Number), c = new Date(Date.UTC(o, i - 1, l));
1153
- return c.setUTCDate(c.getUTCDate() - 1), { date: I(c, "UTC", "yyyy-MM-dd") };
1205
+ const [o, s, c] = n.split("-").map(Number), l = new Date(Date.UTC(o, s - 1, c));
1206
+ return l.setUTCDate(l.getUTCDate() - 1), { date: I(l, "UTC", "yyyy-MM-dd") };
1154
1207
  } catch {
1155
1208
  return;
1156
1209
  }
1157
1210
  }
1158
- function Ue(e, t, r) {
1159
- const n = hr(e.end, t);
1211
+ function je(e, t, r) {
1212
+ const n = br(e.end, t);
1160
1213
  if (n)
1161
1214
  return {
1162
1215
  start: I(
@@ -1172,18 +1225,18 @@ function Ue(e, t, r) {
1172
1225
  ...n.time ? { endTime: n.time } : {}
1173
1226
  };
1174
1227
  }
1175
- function Ke(e) {
1176
- return !!(e && pr.has(e));
1228
+ function Ve(e) {
1229
+ return !!(e && hr.has(e));
1177
1230
  }
1178
- function Hr(e, t, r, n = !1) {
1179
- if (Ke(r))
1231
+ function Xr(e, t, r, n = !1) {
1232
+ if (Ve(r))
1180
1233
  try {
1181
- const i = Ue(e, t, !1);
1182
- if (i && i.start === i.endDate)
1183
- return i.endTime ? `${i.endDate} until ${i.endTime}` : i.endDate;
1234
+ const s = je(e, t, !1);
1235
+ if (s && s.start === s.endDate)
1236
+ return s.endTime ? `${s.endDate} until ${s.endTime}` : s.endDate;
1184
1237
  } catch {
1185
1238
  }
1186
- const o = br(
1239
+ const o = yr(
1187
1240
  e,
1188
1241
  t,
1189
1242
  r,
@@ -1191,10 +1244,10 @@ function Hr(e, t, r, n = !1) {
1191
1244
  );
1192
1245
  return `${o.start} – ${o.end}`;
1193
1246
  }
1194
- function br(e, t, r, n = !1) {
1247
+ function yr(e, t, r, n = !1) {
1195
1248
  try {
1196
- if (Ke(r)) {
1197
- const o = Ue(e, t, n);
1249
+ if (Ve(r)) {
1250
+ const o = je(e, t, n);
1198
1251
  if (o)
1199
1252
  return {
1200
1253
  start: o.start,
@@ -1219,36 +1272,39 @@ function br(e, t, r, n = !1) {
1219
1272
  export {
1220
1273
  jr as A,
1221
1274
  Vr as B,
1222
- Ur as C,
1223
- Ar as D,
1224
- Br as E,
1225
- br as F,
1275
+ Hr as C,
1276
+ Nr as D,
1277
+ zr as E,
1278
+ Gr as F,
1279
+ Br as G,
1280
+ qr as H,
1281
+ yr as I,
1226
1282
  Pr as M,
1227
- Rt as P,
1283
+ Ut as P,
1228
1284
  Fr as a,
1229
- Ir as b,
1285
+ Dr as b,
1230
1286
  Lr as c,
1231
- jt as d,
1232
- Sr as e,
1233
- Hr as f,
1287
+ Vt as d,
1288
+ $r as e,
1289
+ Xr as f,
1234
1290
  Mr as g,
1235
- $r as h,
1236
- Dt as i,
1237
- At as j,
1238
- Ot as k,
1239
- Dr as l,
1240
- Kt as m,
1241
- Bt as n,
1242
- Ht as o,
1243
- Ut as p,
1244
- zt as q,
1291
+ Ir as h,
1292
+ kt as i,
1293
+ Nt as j,
1294
+ Rt as k,
1295
+ kr as l,
1296
+ jt as m,
1297
+ Ht as n,
1298
+ zt as o,
1299
+ Kt as p,
1300
+ Gt as q,
1245
1301
  ge as r,
1246
- kr as s,
1302
+ Ar as s,
1247
1303
  H as t,
1248
- Gt as u,
1249
- Nr as v,
1250
- Zt as w,
1251
- Or as x,
1252
- Rr as y,
1304
+ qt as u,
1305
+ Or as v,
1306
+ Qt as w,
1307
+ Rr as x,
1308
+ Ur as y,
1253
1309
  Kr as z
1254
1310
  };