react-semaphor 0.1.603 → 0.1.604

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 (167) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4614
  72. package/dist/format-utils/index.js +1 -425
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/index.js +1 -88
  83. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  84. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  85. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  86. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  87. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  88. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  89. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  90. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  91. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  92. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  93. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  94. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  95. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  96. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  97. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  98. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  99. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  100. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  101. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  102. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  103. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  104. package/dist/usage-events/index.js +1 -285
  105. package/dist/value-format-preferences/index.js +1 -635
  106. package/package.json +4 -1
  107. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  108. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  109. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  110. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  111. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  112. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  113. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  114. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  115. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  116. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  117. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  118. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  119. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  120. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  121. package/dist/chunks/context-UCQ7sere.js +0 -369
  122. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  123. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  124. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  125. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  126. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  127. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  128. package/dist/chunks/edit-9df1zOWe.js +0 -226
  129. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  130. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  131. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  132. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  133. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  134. package/dist/chunks/index-BVKzKl5d.js +0 -90
  135. package/dist/chunks/index-CV_Kzou0.js +0 -595
  136. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  137. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  138. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  139. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  140. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  141. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  142. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  143. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  144. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  145. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  146. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  147. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  148. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  149. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  150. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  151. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  152. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  153. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  154. package/dist/chunks/save-C5A0JnEV.js +0 -21
  155. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  156. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  157. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  158. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  159. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  160. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  161. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  162. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  163. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  164. package/dist/chunks/upload-H15d7uHK.js +0 -15
  165. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  166. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  167. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,741 +0,0 @@
1
- import { aJ as Q, i as ee, k as T, n as te, T as V, aK as R, aL as X, aM as re, aN as G, aO as q, an as ne, ap as oe, aP as w, aQ as $ } from "./pivot-result-contract-expectations-BYqAmG9n.js";
2
- import { h as S } from "./export-file-format-C-tJsxsf.js";
3
- import { a6 as ae, aX as H, m as E, k as se } from "./validators-Baf3VIf5.js";
4
- import "./matrix-operation-contract-DPBj69D8.js";
5
- import "./analytics-base-schemas-DsUh5Q3C.js";
6
- import { readPdfCapacityFacts as ie, PDF_SAFETY_LIMIT_EXCEEDED as O, PDF_CAPACITY as P, PDF_NUMBER_COLUMN_TOO_WIDE as K, getUtf8ByteLength as ue, FAST_PDF_POLICY as ce, isPdfCapacityRefusalCode as le } from "../pdf-export-policy/index.js";
7
- import { w as me } from "./raw-temporal-value-Dg_MTFF7.js";
8
- function de(e, t, r) {
9
- const n = {
10
- ...t,
11
- locale: t.locale ?? r
12
- };
13
- if (n.type === "number")
14
- return T(e, n);
15
- const { prefix: o, suffix: a, ...s } = n;
16
- return `${o ?? ""}${T(e, {
17
- ...s,
18
- negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
19
- })}${a ?? ""}`;
20
- }
21
- function F(e, t, r) {
22
- return e === null ? { value: e, text: null } : !t || !ee(t) && t.type !== "duration" ? {
23
- value: e,
24
- text: T(e, { type: "number", locale: r })
25
- } : t.type === "duration" ? {
26
- value: e,
27
- text: te(e, {
28
- inputUnit: t.inputUnit,
29
- outputStyle: t.outputStyle,
30
- largestUnit: t.largestUnit,
31
- smallestUnit: t.smallestUnit,
32
- maxUnits: t.maxUnits,
33
- prefix: t.prefix,
34
- suffix: t.suffix,
35
- negativeInParentheses: t.negativeStyle === "parentheses"
36
- })
37
- } : { value: e, text: de(e, t, r) };
38
- }
39
- function U(e, t, r, n) {
40
- return e === null ? { value: e, text: null } : n === "percent" ? {
41
- value: e,
42
- text: T(e, {
43
- type: "percent",
44
- locale: r,
45
- minimumFractionDigits: t,
46
- maximumFractionDigits: t,
47
- percentValueMode: "fraction"
48
- })
49
- } : {
50
- value: e,
51
- text: T(e, {
52
- type: "number",
53
- locale: r,
54
- minimumFractionDigits: t,
55
- maximumFractionDigits: t,
56
- suffix: "×"
57
- })
58
- };
59
- }
60
- function j(e, t) {
61
- if (e === void 0) return t;
62
- if (!Number.isInteger(e) || e < 0 || e > 6)
63
- throw new RangeError("Comparison precision must be an integer from 0 to 6.");
64
- return e;
65
- }
66
- function He(e, t) {
67
- const r = {
68
- mode: t.displayMode,
69
- current: F(
70
- e.currentValue,
71
- t.metricFormat,
72
- t.locale
73
- ),
74
- comparison: F(
75
- e.comparisonValue,
76
- t.metricFormat,
77
- t.locale
78
- )
79
- };
80
- return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = F(
81
- e.delta,
82
- Q(t.metricFormat),
83
- t.locale
84
- )), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = U(
85
- e.percentChange,
86
- j(t.precision, 1),
87
- t.locale,
88
- "percent"
89
- )), t.displayMode === "ratio" && (r.ratio = U(
90
- e.ratio,
91
- j(t.precision, 2),
92
- t.locale,
93
- "ratio"
94
- )), r;
95
- }
96
- const Ke = {
97
- rowLabels: "tabular",
98
- subtotals: "after"
99
- };
100
- function We(e, t) {
101
- const r = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
102
- return {
103
- ...e,
104
- layout: r,
105
- totals: {
106
- ...e.totals,
107
- rows: {
108
- ...n,
109
- levels: Object.fromEntries(
110
- Object.entries(n.levels).map(([o, a]) => [
111
- o,
112
- { ...a, position: t.subtotals }
113
- ])
114
- )
115
- }
116
- }
117
- };
118
- }
119
- const fe = 2;
120
- function he(e) {
121
- return typeof e == "number" ? Number.isInteger(e) : H(e) ? !e.value.includes(".") : !0;
122
- }
123
- function pe(e, t, r) {
124
- const n = e.descriptors.measures.filter(
125
- (s) => r.measureFormats[s.id] === void 0 && s.semanticFormat === void 0 && ae(s.column.dataType) === "number"
126
- );
127
- if (n.length === 0) return r;
128
- const o = /* @__PURE__ */ new Set();
129
- e.columns.forEach((s, u) => {
130
- if (!(s.kind !== "measure" || o.has(s.measureId)))
131
- for (const m of t) {
132
- const c = m.values[u];
133
- if ((c == null ? void 0 : c.kind) === "value" && !he(c.value)) {
134
- o.add(s.measureId);
135
- return;
136
- }
137
- }
138
- });
139
- const a = { ...r.measureFormats };
140
- for (const { id: s } of n) {
141
- const u = o.has(s) ? fe : 0;
142
- a[s] = {
143
- type: "number",
144
- minimumFractionDigits: u,
145
- maximumFractionDigits: u,
146
- useGrouping: !0
147
- };
148
- }
149
- return { ...r, measureFormats: a };
150
- }
151
- function L(e) {
152
- return E(e.slice(0, -1));
153
- }
154
- function ge(e, t) {
155
- return t.length > e.length && E(t.slice(0, e.length)) === E(e);
156
- }
157
- function ye(e) {
158
- return e.map((t, r) => {
159
- if (r === 0 || t.kind !== "layout") return !1;
160
- const n = e[r - 1];
161
- if (n.kind !== "layout") return !1;
162
- if (t.role !== "member" || ge(n.rowPath, t.rowPath)) return !0;
163
- const o = e[r - 2];
164
- return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || L(o.rowPath) !== L(n.rowPath)) && t.rowPath.length === n.rowPath.length && L(t.rowPath) === L(n.rowPath);
165
- });
166
- }
167
- const we = "pdf-group-continuation";
168
- function W(e, t, r) {
169
- return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || H(t.value)) ? e : S(e);
170
- }
171
- function be(e, t, r) {
172
- const n = V(e.descriptors, t.presentation, r), o = e.columns.map((i) => {
173
- var l;
174
- return i.kind === "measure" && ((l = n.measureSemantics.get(i.measureId)) == null ? void 0 : l.isNumeric) === !0;
175
- }), a = (i) => R([i], n.levels), s = (i, l, d) => X(i, l, t.presentation.totals[d], n.levels), u = e.columns.map((i) => {
176
- if (i.kind !== "measure") return i.label;
177
- const l = i.columnPath.map(a);
178
- return i.role !== "member" && l.push(s(i.columnPath, i.role, "columns")), [...l, i.label].join(" / ");
179
- }), m = Math.min(t.spec.columns.length, Math.max(
180
- 0,
181
- ...e.columns.map((i) => i.kind === "measure" ? i.columnPath.length + (i.role !== "member" ? 1 : 0) : 0)
182
- )), c = Array.from({ length: m + 1 }, (i, l) => e.columns.map((d) => l === m ? d.label : d.kind !== "measure" ? "" : l < d.columnPath.length ? a(d.columnPath[l]) : l === d.columnPath.length && d.role !== "member" ? s(d.columnPath, d.role, "columns") : "")), f = (i, l) => re({
183
- path: i.rowPath,
184
- role: i.kind === "layout" ? i.role : "member",
185
- levelCount: Math.max(1, t.spec.rows.length),
186
- repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
187
- previousPath: l == null ? void 0 : l.rowPath
188
- }), v = (i, l) => {
189
- if (i.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
190
- if (i.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
191
- const d = f(i, l);
192
- return e.columns.map((h, p) => {
193
- if (h.kind === "hierarchy")
194
- return `${" ".repeat(Math.max(0, i.rowPath.length - 1))}${s(i.rowPath, i.role, "rows")}`;
195
- if (h.kind === "level") {
196
- const D = t.spec.rows.findIndex((J) => J.id === h.levelId), b = d[D];
197
- return b != null && b.visible ? b.total ? s(i.rowPath, i.role, "rows") : R(b.path, n.levels) : "";
198
- }
199
- const C = i.values[p], x = n.measures.get(h.measureId);
200
- if (C.kind === "value" && !x)
201
- throw new Error("Matrix value is missing its measure descriptor.");
202
- return G(C, x, t.presentation.absence);
203
- });
204
- }, _ = (i, l) => v(i, l).map((d, h) => {
205
- const p = e.columns[h];
206
- return p.kind === "measure" ? W(d, i.values[h], n.measureSemantics.get(p.measureId)) : S(d);
207
- });
208
- return {
209
- headers: u,
210
- headerBands: c,
211
- numericColumns: o,
212
- /** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
213
- formatting: n,
214
- /** A row's cells; after `previous`, a tabular layout prints each label once. */
215
- row: (i, l) => v(i, l),
216
- /**
217
- * Level columns whose group label the row above shows, so this row
218
- * continues the group (Plan 2, 2d, C8). Only a member row after a member
219
- * row continues one: a total prints as a band, and its rules stay whole
220
- * above and below it.
221
- */
222
- continuedColumns: (i, l) => {
223
- const d = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
224
- if (!d(i) || !d(l)) return [];
225
- const h = f(i, l);
226
- return e.columns.flatMap((p, C) => {
227
- var D;
228
- if (p.kind !== "level") return [];
229
- const x = t.spec.rows.findIndex((b) => b.id === p.levelId);
230
- return x < i.rowPath.length && ((D = h[x]) == null ? void 0 : D.visible) === !1 ? [C] : [];
231
- });
232
- },
233
- csvRow: (i) => _(i),
234
- /**
235
- * `previousRow` is the row before `data[0]`, carried by the export's
236
- * continuation, so a tabular layout prints each label once across the
237
- * whole file. Retries are pure: suppression never relies on mutable
238
- * formatter state or an earlier worker. Without it, the first row prints
239
- * its labels.
240
- */
241
- csvRows: (i, l) => i.map((d, h) => _(d, h ? i[h - 1] : l ?? void 0))
242
- };
243
- }
244
- function Ye(e) {
245
- return e.columns.map((t) => S(t.label));
246
- }
247
- function Ze(e, t, r) {
248
- return _e(e, t, r).map((n, o) => {
249
- const a = t.columns[o];
250
- return a.kind === "measure" ? W(n, e.values[o], r.measureSemantics.get(a.measureId)) : S(n);
251
- });
252
- }
253
- function _e(e, t, r) {
254
- if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
255
- if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
256
- const n = [...e.rowPath, ...e.columnPath];
257
- return t.columns.map((o, a) => {
258
- if (o.kind === "measure") {
259
- const u = e.values[a], m = r.measures.get(o.measureId);
260
- if (u.kind === "value" && !m) throw new Error("Matrix value is missing its measure descriptor.");
261
- return G(u, m, r.absence);
262
- }
263
- const s = o.kind === "level" ? n.find((u) => u.levelId === o.levelId) : void 0;
264
- if (!s) throw new Error("Flat Matrix row does not match its frozen layout.");
265
- return R([s], r.levels);
266
- });
267
- }
268
- function Pe(e) {
269
- const t = be(e.layout, e.request, e.report), r = e.layout.columns.map((s, u) => ({
270
- index: u,
271
- columnId: `matrix:${u}`,
272
- label: t.headers[u],
273
- isNumeric: t.numericColumns[u]
274
- })), n = (s, u, m) => ({
275
- text: s,
276
- colspan: 1,
277
- rowspan: 1,
278
- columnId: r[u].columnId,
279
- isHeader: m,
280
- isNumeric: r[u].isNumeric,
281
- className: r[u].isNumeric ? "numeric" : e.layout.columns[u].kind === "hierarchy" ? "matrix-hierarchy" : ""
282
- }), o = [], a = e.layout.columns.findIndex((s) => s.kind === "measure");
283
- e.request.spec.columns.length && a >= 0 && o.push({
284
- repeatHeader: !0,
285
- headerType: "pivot-axis",
286
- headerRowIndex: 0,
287
- cells: [
288
- ...a ? [{ ...n("", 0, !0), colspan: a }] : [],
289
- {
290
- ...n(e.request.spec.columns.map((s) => q(s, e.request.presentation)).join(" / "), a, !0),
291
- colspan: e.layout.columns.length - a,
292
- isNumeric: !1,
293
- className: ""
294
- }
295
- ]
296
- });
297
- for (const [s, u] of t.headerBands.entries())
298
- o.push({
299
- repeatHeader: !0,
300
- headerType: s === t.headerBands.length - 1 ? "metrics" : "pivot-level",
301
- headerRowIndex: o.length,
302
- cells: u.map((m, c) => n(m, c, !0))
303
- });
304
- return {
305
- headers: o,
306
- rows: e.rows.map((s, u) => {
307
- const m = new Set(t.continuedColumns(s, e.rows[u - 1]));
308
- return {
309
- index: u,
310
- type: s.kind === "layout" && s.role !== "member" ? "subtotal" : "data",
311
- subtotalLevel: String(s.rowPath.length),
312
- // A tabular layout prints each label once unless it repeats them; the
313
- // blank cell continues its group, so a grid draws no rule above it.
314
- cells: t.row(s, e.rows[u - 1]).map((c, f) => m.has(f) ? { ...n(c, f, !1), className: we } : n(c, f, !1))
315
- };
316
- }),
317
- grandTotal: null,
318
- // Totals are already in the ordered body at their authored position.
319
- metadata: {
320
- tableType: "pivot",
321
- totalRows: e.rows.length,
322
- totalColumns: r.length,
323
- rowLevels: e.layout.columns.filter((s) => s.kind !== "measure").length,
324
- pivotLevels: e.request.spec.columns.length,
325
- hasGrandTotal: !1,
326
- columnOrder: r.map((s) => s.columnId),
327
- columns: r
328
- }
329
- };
330
- }
331
- function ve(e, t, r) {
332
- const { levels: n } = V(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, a = [], s = [], u = e.columns.map((c, f) => {
333
- if (c.kind !== "measure") return null;
334
- const v = o ? `${c.role}:${E(c.columnPath)}` : `measure:${f}`;
335
- let _ = a.indexOf(v);
336
- return _ < 0 && (_ = a.push(v) - 1, s.push(o ? X(c.columnPath, c.role, t.presentation.totals.columns, n) : c.label)), _;
337
- }), m = t.spec.columns[t.spec.columns.length - 1];
338
- return {
339
- columnGroups: u,
340
- groupLabels: s,
341
- /** What bands name their groups by: the innermost column level, or "Measures". */
342
- groupLevelLabel: m ? q(m, t.presentation) : "Measures"
343
- };
344
- }
345
- function ze(e) {
346
- const { layout: t, rows: r, report: n } = e, o = {
347
- ...e.request,
348
- presentation: pe(t, r, e.request.presentation)
349
- }, a = Pe({ layout: t, rows: r, request: o, report: n }), s = ye(r), u = ve(t, o, n), m = {
350
- ...a,
351
- rows: a.rows.map((c, f) => ({ ...c, keepWithPrevious: s[f] })),
352
- metadata: { ...a.metadata, ...u }
353
- };
354
- return { request: o, table: m, ...u };
355
- }
356
- const y = (e) => e.toLocaleString("en-US"), M = (e) => `${y(Math.ceil(e / 1048576))} MB`, I = "export the data as CSV or Excel";
357
- function Je(e) {
358
- const t = ie(e.facts), r = e.dataExport ? `Add a filter to narrow it, or ${I}.` : "Add a filter to narrow it, then export again.";
359
- switch (e.code) {
360
- case "PDF_ROW_LIMIT_EXCEEDED": {
361
- const n = e.subject ?? "This table", o = t.rowLimit ?? P.maxTableRows;
362
- return t.rowCount !== void 0 ? `${n} has ${y(t.rowCount)} rows. A PDF holds up to ${y(o)} rows per table. ${r}` : `${n} has more than ${y(o)} rows, the most a PDF holds per table. ${r}`;
363
- }
364
- case "PDF_PAGE_LIMIT_EXCEEDED": {
365
- const n = e.subject ?? "This PDF", o = t.pageLimit ?? P.maxPages;
366
- return t.pageCount !== void 0 ? `${n} is ${y(t.pageCount)} pages. A PDF holds up to ${y(o)}. ${r}` : `${n} is longer than ${y(o)} pages, the most a PDF holds. ${r}`;
367
- }
368
- case "PDF_SIZE_LIMIT_EXCEEDED": {
369
- const n = e.subject ?? "This PDF", o = t.byteLimit ?? P.maxFileBytes;
370
- return t.bytes !== void 0 ? `${n} is ${M(t.bytes)}. A PDF file holds up to ${M(o)}. ${r}` : `${n} is larger than ${M(o)}, the most a PDF file holds. ${r}`;
371
- }
372
- case "PDF_CAPTURE_TOO_TALL":
373
- return `${e.subject ?? "This dashboard"} is too long to print as one PDF. Print one sheet or fewer cards${e.dataExport ? `, or ${I}` : ""}.`;
374
- case K:
375
- return `A number in this table is too wide for its column in a PDF. Use landscape or fewer columns${e.dataExport ? `, or ${I}` : ""}.`;
376
- case O:
377
- return `This PDF is over what a PDF holds: ${y(P.maxTableRows)} rows per table, ${y(
378
- P.maxPages
379
- )} pages and ${M(P.maxFileBytes)}. ${r}`;
380
- }
381
- }
382
- class xe extends Error {
383
- constructor(t, r = O) {
384
- super(t), this.code = r;
385
- }
386
- }
387
- function Te(e) {
388
- return le(e) || e === O || e === K;
389
- }
390
- function B(e) {
391
- if (!e || typeof e != "object")
392
- return;
393
- const { error: t, message: r, detail: n } = e;
394
- for (const o of [t, r, n])
395
- if (typeof o == "string" && o.trim())
396
- return o.trim();
397
- }
398
- async function $e(e) {
399
- const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
400
- try {
401
- if (r.includes("application/json")) {
402
- const o = await e.json(), a = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
403
- return { message: B(o) || t, code: a };
404
- }
405
- const n = await e.text();
406
- if (!n.trim())
407
- return { message: t };
408
- try {
409
- const o = JSON.parse(n), a = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
410
- return {
411
- message: B(o) || n.trim(),
412
- code: a
413
- };
414
- } catch {
415
- return { message: n.trim() };
416
- }
417
- } catch {
418
- return { message: t };
419
- }
420
- }
421
- async function Qe(e) {
422
- if (!e.token) throw new Error("Missing auth token for PDF export");
423
- if (ue(e.serializedPayload) > ce.maxRequestBytes)
424
- throw new Error("Fast-path PDF request exceeds the structured body limit");
425
- const t = await (e.fetchImpl ?? fetch)(e.url, {
426
- method: "POST",
427
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
428
- body: e.serializedPayload,
429
- signal: e.signal
430
- });
431
- if (!t.ok) {
432
- const n = await $e(t);
433
- throw Te(n.code) ? new xe(n.message, n.code) : new Error(n.message);
434
- }
435
- const r = await t.json();
436
- if (r != null && r.error) throw new Error(r.error);
437
- if (typeof (r == null ? void 0 : r.url) != "string" || !r.url.trim())
438
- throw new Error("Fast-path PDF response missing download URL");
439
- return r;
440
- }
441
- const et = 1, Y = ["loading", "measuring", "checking", "laidOut"], Ce = [
442
- // Already emitted before these contracts; names kept.
443
- "document_matrix_too_large",
444
- "document_matrix_unavailable",
445
- "document_matrix_too_wide",
446
- "document_kpi_value_overflow",
447
- "print_inputs_not_captured",
448
- // New.
449
- "document_section_setup",
450
- "document_input_missing",
451
- "document_section_query_failed",
452
- "document_table_completeness_unverified",
453
- "document_row_limit_exceeded",
454
- "document_section_render_failed",
455
- "document_page_overflow",
456
- "document_sheet_not_found",
457
- "document_print_timed_out",
458
- // PDF capacity contract PC-D3: more pages than one PDF holds.
459
- "document_page_limit_exceeded"
460
- ];
461
- function tt(e) {
462
- return Ce.includes(e);
463
- }
464
- const De = 64, Le = 120, Me = 3, Ee = 80, Se = [...Y, "noPageStack", "unknown"];
465
- function A(e, t) {
466
- return typeof e != "string" ? void 0 : e.trim().slice(0, t).trim() || void 0;
467
- }
468
- function g(e, t) {
469
- return typeof e == "number" && Number.isInteger(e) && e >= t ? e : void 0;
470
- }
471
- function k(e, t) {
472
- return t.includes(e) ? e : void 0;
473
- }
474
- function Fe(e) {
475
- let t = e;
476
- if (typeof e == "string")
477
- try {
478
- t = JSON.parse(e);
479
- } catch {
480
- return {};
481
- }
482
- if (!t || typeof t != "object" || Array.isArray(t)) return {};
483
- const r = t, n = Array.isArray(r.inputLabels) ? r.inputLabels.map((a) => A(a, Ee)).filter((a) => a !== void 0).slice(0, Me) : [], o = {
484
- sectionId: A(r.sectionId, De),
485
- sectionTitle: A(r.sectionTitle, Le),
486
- pageNumber: g(r.pageNumber, 1),
487
- rowCount: g(r.rowCount, 0),
488
- rowLimit: g(r.rowLimit, 1),
489
- inputLabels: n.length ? n : void 0,
490
- overflowAxis: k(r.overflowAxis, ["height", "width"]),
491
- overflowPx: g(r.overflowPx, 0),
492
- matrixLimit: k(r.matrixLimit, ["rows", "bytes"]),
493
- layoutStage: k(r.layoutStage, Se),
494
- loadingSectionCount: g(r.loadingSectionCount, 0),
495
- measuredRowCount: g(r.measuredRowCount, 0),
496
- totalRowCount: g(r.totalRowCount, 0),
497
- pageCount: g(r.pageCount, 0),
498
- pageLimit: g(r.pageLimit, 1)
499
- };
500
- return Object.fromEntries(
501
- Object.entries(o).filter(([, a]) => a !== void 0)
502
- );
503
- }
504
- function rt(e) {
505
- const t = Fe(e.facts), r = t.sectionTitle ? `Section "${t.sectionTitle}"` : t.sectionId ? `Section ${t.sectionId}` : "A section", n = t.pageNumber !== void 0 ? ` on page ${t.pageNumber}` : "";
506
- switch (e.code) {
507
- case "document_section_setup":
508
- return `${r} is not set up to print.`;
509
- case "document_input_missing":
510
- return t.inputLabels ? `${r} needs a value for ${t.inputLabels.join(", ")}.` : `${r} needs a value for a required input.`;
511
- case "document_section_query_failed":
512
- return `${r}: its data could not be loaded.`;
513
- case "document_table_completeness_unverified":
514
- return `${r}: the query returned no total row count, so the table could not be confirmed complete.`;
515
- case "document_row_limit_exceeded":
516
- return t.rowCount !== void 0 && t.rowLimit !== void 0 ? `${r} has ${t.rowCount} rows; a document table prints up to ${t.rowLimit}.` : `${r} has more rows than a document table prints.`;
517
- case "document_section_render_failed":
518
- return `${r} could not be drawn.`;
519
- case "document_page_overflow":
520
- return `${r}${n} does not fit the page${t.overflowAxis ? ` (${t.overflowAxis}` : ""}${t.overflowAxis && t.overflowPx !== void 0 ? `, ${t.overflowPx} px over` : ""}${t.overflowAxis ? ")" : ""}.`;
521
- case "document_matrix_too_large":
522
- return t.matrixLimit === "rows" && t.rowLimit !== void 0 ? `${r}: the Matrix has more than ${t.rowLimit} rows, the most a report prints.` : `${r}: the Matrix is too large to print.`;
523
- case "document_matrix_unavailable":
524
- return `${r}: the Matrix result could not be loaded.`;
525
- case "document_matrix_too_wide":
526
- return `${r}: the Matrix is wider than the page.`;
527
- case "document_kpi_value_overflow":
528
- return `${r}: a KPI value does not fit its tile.`;
529
- case "print_inputs_not_captured":
530
- return t.inputLabels ? `The report's input values were not saved: ${t.inputLabels.join(", ")}.` : "The report's input values were not saved.";
531
- case "document_sheet_not_found":
532
- return "The requested Document sheet is not in the dashboard.";
533
- case "document_page_limit_exceeded":
534
- return t.pageCount !== void 0 && t.pageLimit !== void 0 ? `The Document is ${t.pageCount} pages; a PDF holds up to ${t.pageLimit}.` : "The Document has more pages than a PDF holds.";
535
- case "document_print_timed_out":
536
- return [
537
- `The Document did not finish preparing in time (stage ${t.layoutStage ?? "unknown"}`,
538
- t.measuredRowCount !== void 0 ? `; ${t.measuredRowCount} of ${t.totalRowCount ?? "unknown"} rows measured` : "",
539
- t.pageCount !== void 0 ? `; ${t.pageCount} pages` : "",
540
- t.loadingSectionCount ? `; ${t.loadingSectionCount} sections loading` : "",
541
- ")."
542
- ].join("");
543
- }
544
- }
545
- function Ie(e) {
546
- return Y.includes(e);
547
- }
548
- function N(e) {
549
- return typeof e == "number" && Number.isInteger(e) && e >= 0;
550
- }
551
- function nt(e) {
552
- let t = e;
553
- if (typeof e == "string")
554
- try {
555
- t = JSON.parse(e);
556
- } catch {
557
- return;
558
- }
559
- if (!t || typeof t != "object" || Array.isArray(t)) return;
560
- const { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: a } = t;
561
- if (!(!Ie(r) || !N(n) || o !== null && !N(o) || a !== null && !N(a)))
562
- return { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: a };
563
- }
564
- function ot(e, t, r) {
565
- const n = t.from > e.start ? t.from : e.start, o = t.to && t.to < e.end ? t.to : e.end, s = n <= r && o > r ? "running" : n > e.start ? "start" : o < e.end ? "end" : void 0;
566
- return { start: n, end: o, ...s ? { partial: s } : {} };
567
- }
568
- function at(e, t, r) {
569
- switch (t) {
570
- case "running":
571
- return `${e} (so far)`;
572
- case "start":
573
- return r ? `${e} (from ${r.start})` : `${e} (partial)`;
574
- case "end":
575
- return r ? `${e} (to ${r.end})` : `${e} (partial)`;
576
- default:
577
- return e;
578
- }
579
- }
580
- function st(e, t, r) {
581
- const n = Date.parse(e.startInclusive), o = Date.parse(e.endExclusive);
582
- if (!Number.isFinite(n) || !Number.isFinite(o)) return;
583
- if (t.granularity === "hour" || t.granularity === "minute" || t.granularity === "second") {
584
- const m = (c) => {
585
- try {
586
- return new Intl.DateTimeFormat((r == null ? void 0 : r.locale) ?? "en-US", {
587
- timeStyle: (r == null ? void 0 : r.dateTime.timeStyle) ?? "short",
588
- timeZone: t.calendar.tz
589
- }).format(new Date(c));
590
- } catch {
591
- return new Date(c).toISOString();
592
- }
593
- };
594
- return { start: m(n), end: m(o) };
595
- }
596
- const a = { kind: "temporal_bucket", granularity: "day", calendar: t.calendar };
597
- let s;
598
- try {
599
- s = ne({
600
- metadata: a,
601
- locale: (r == null ? void 0 : r.locale) ?? "en-US",
602
- ...r ? { styles: { dateStyle: r.dateStyle, dateTime: r.dateTime } } : {}
603
- });
604
- } catch {
605
- s = void 0;
606
- }
607
- const u = (m) => {
608
- const c = me(new Date(m), t.calendar.tz), f = `${String(c.year).padStart(4, "0")}-${String(c.month).padStart(2, "0")}-${String(c.day).padStart(2, "0")}`;
609
- try {
610
- return s ? oe({ value: f, metadata: a, format: s.format }) : f;
611
- } catch {
612
- return f;
613
- }
614
- };
615
- return { start: u(n), end: u(o - 1) };
616
- }
617
- function it(e) {
618
- return ((e == null ? void 0 : e.filterValues) ?? []).filter(Ae).map(ke);
619
- }
620
- function Ae(e) {
621
- return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
622
- }
623
- function ke(e) {
624
- if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
625
- const { relativeMeta: t, ...r } = e, n = se(t);
626
- return n ? { ...r, relativeMeta: n } : r;
627
- }
628
- const Ne = /* @__PURE__ */ new Set([
629
- "day",
630
- "week",
631
- "month",
632
- "quarter",
633
- "year"
634
- ]);
635
- function Re(e, t) {
636
- try {
637
- const r = $(e), n = w(r, t, "yyyy-MM-dd");
638
- if (w(r, t, "HH:mm:ss.SSS") !== "00:00:00.000")
639
- return {
640
- date: n,
641
- time: w(r, t, "h:mm a")
642
- };
643
- const [o, a, s] = n.split("-").map(Number), u = new Date(Date.UTC(o, a - 1, s));
644
- return u.setUTCDate(u.getUTCDate() - 1), { date: w(u, "UTC", "yyyy-MM-dd") };
645
- } catch {
646
- return;
647
- }
648
- }
649
- function Z(e, t, r) {
650
- const n = Re(e.end, t);
651
- if (n)
652
- return {
653
- start: w(
654
- $(e.start),
655
- t,
656
- r ? "MMM d" : "MMM d, yyyy"
657
- ),
658
- endDate: w(
659
- $(`${n.date}T00:00:00Z`),
660
- "UTC",
661
- "MMM d, yyyy"
662
- ),
663
- ...n.time ? { endTime: n.time } : {}
664
- };
665
- }
666
- function z(e) {
667
- return !!(e && Ne.has(e));
668
- }
669
- function ut(e, t, r, n = !1) {
670
- if (z(r))
671
- try {
672
- const a = Z(e, t, !1);
673
- if (a && a.start === a.endDate)
674
- return a.endTime ? `${a.endDate} until ${a.endTime}` : a.endDate;
675
- } catch {
676
- }
677
- const o = Oe(
678
- e,
679
- t,
680
- r,
681
- n
682
- );
683
- return `${o.start} – ${o.end}`;
684
- }
685
- function Oe(e, t, r, n = !1) {
686
- try {
687
- if (z(r)) {
688
- const o = Z(e, t, n);
689
- if (o)
690
- return {
691
- start: o.start,
692
- end: o.endTime ? `${o.endDate}, ${o.endTime}` : o.endDate
693
- };
694
- }
695
- if (r === "second" || r === "minute" || r === "hour") {
696
- const o = n ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
697
- return {
698
- start: w($(e.start), t, o),
699
- end: `before ${w(
700
- $(e.end),
701
- t,
702
- o
703
- )}`
704
- };
705
- }
706
- } catch {
707
- }
708
- return { start: e.start, end: `before ${e.end}` };
709
- }
710
- export {
711
- Oe as A,
712
- et as D,
713
- Ke as M,
714
- we as P,
715
- He as a,
716
- Ye as b,
717
- Ze as c,
718
- Pe as d,
719
- ze as e,
720
- ut as f,
721
- We as g,
722
- fe as h,
723
- pe as i,
724
- ye as j,
725
- Je as k,
726
- xe as l,
727
- _e as m,
728
- Te as n,
729
- Qe as o,
730
- be as p,
731
- Ce as q,
732
- $e as r,
733
- tt as s,
734
- Fe as t,
735
- rt as u,
736
- nt as v,
737
- ot as w,
738
- at as x,
739
- st as y,
740
- it as z
741
- };