react-semaphor 0.1.526 → 0.1.528

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 (180) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1190 -296
  3. package/dist/brand-studio/index.js +15 -15
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DUu-tCQw.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BdPceiw8.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-BkskKMck.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-Bb0RhGRC.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-loWTHPMi.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DUci_SOR.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-z9WN26w7.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-CGSFK9S-.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-CdXSo1pb.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-CbjuruKe.js → index-CTYnXU85.js} +781 -780
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DhykwdZs.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BV9ywFtJ.js} +11 -11
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-1Mm8x8w7.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-Dp7kFpVk.js +1383 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-CZa3556D.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-Bqdtknud.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-VV0-Ro6F.js} +131 -132
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-IZjBSU6Z.js} +47 -26
  35. package/dist/chunks/semantic-format-BBLvfwua.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-DbA4mVQL.js} +49909 -46207
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-DpiJG8lv.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-C4YH-W1X.js +24003 -0
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +12 -12
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +165 -168
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +1 -1
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  58. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  59. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  60. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  61. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  62. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  63. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  64. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  65. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  66. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  67. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  68. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  69. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  70. package/dist/types/index.js +5 -5
  71. package/dist/types/lib/api/exports-api.d.ts +3 -0
  72. package/dist/types/lib/csv-download.d.ts +9 -0
  73. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  75. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  76. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  77. package/dist/types/lib/export-utils.d.ts +17 -15
  78. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  79. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  80. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  81. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  83. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  84. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  85. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  86. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  87. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  88. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  89. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  90. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  91. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  92. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  93. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  94. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  95. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  96. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  97. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  98. package/dist/types/lib/types/common-types.d.ts +5 -0
  99. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  100. package/dist/types/lib/types/semantic-types.d.ts +4 -2
  101. package/dist/types/lib/types/token-types.d.ts +0 -1
  102. package/dist/types/lib/utils/aggregate-expression-utils.d.ts +0 -4
  103. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  104. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  105. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  106. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  107. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  108. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +89 -0
  109. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +32 -0
  110. package/dist/types/shared/analytics-protocol/contracts.d.ts +48 -7
  111. package/dist/types/shared/analytics-protocol/index.d.ts +15 -1
  112. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  113. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  114. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  115. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +61 -6
  116. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +63 -0
  117. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  118. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  119. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  120. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  121. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  122. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  123. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  124. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  125. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  126. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  127. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  128. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  129. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  130. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  131. package/dist/types/shared/temporal/index.d.ts +5 -0
  132. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  133. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  134. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  135. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  136. package/package.json +1 -17
  137. package/src/data-app-sdk/README.md +6 -3
  138. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  139. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  140. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  141. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  142. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  143. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  144. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  145. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  146. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  147. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  148. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  149. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  150. package/dist/data-app-builder/index.js +0 -3666
  151. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  152. package/dist/data-app-codegen/index.js +0 -22
  153. package/dist/data-app-codegen-node/index.js +0 -1807
  154. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  155. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  156. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  157. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  158. package/dist/types/data-app-builder/constants.d.ts +0 -14
  159. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  160. package/dist/types/data-app-builder/index.d.ts +0 -1
  161. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  162. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  163. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  164. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  165. package/dist/types/data-app-builder/types.d.ts +0 -558
  166. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  167. package/dist/types/data-app-builder.d.ts +0 -2
  168. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  169. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  170. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  171. package/dist/types/data-app-codegen/index.d.ts +0 -6
  172. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  173. package/dist/types/data-app-codegen/node.d.ts +0 -2
  174. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  175. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  176. package/dist/types/data-app-codegen-node.d.ts +0 -2
  177. package/dist/types/data-app-codegen.d.ts +0 -2
  178. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  179. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  180. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -0,0 +1,618 @@
1
+ var U = Object.defineProperty;
2
+ var X = (e, r, t) => r in e ? U(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var k = (e, r, t) => X(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { i as j } from "./raw-temporal-CdnA_OXJ.js";
5
+ import { e as L, i as K } from "./numeric-presentation-LvnNY5Ma.js";
6
+ import { e as V, m as _, h as D, i as z, j as H } from "./matrix-formatter-1Mm8x8w7.js";
7
+ import { i as S } from "./pivot-result-lifecycle-Bqdtknud.js";
8
+ import { F as W, bh as C, B as A } from "./validators-CQcG0EPN.js";
9
+ import "./matrix-operation-contract-Dp7kFpVk.js";
10
+ import "zod";
11
+ import { g as O } from "./matrix-definition-Cdn3LoxW.js";
12
+ import { PDF_SAFETY_LIMIT_EXCEEDED as N, getUtf8ByteLength as Y, FAST_PDF_POLICY as q } from "../pdf-export-policy/index.js";
13
+ import { f as J } from "./temporal-bucket-DlFuhCnT.js";
14
+ function Z(e, r, t) {
15
+ const a = {
16
+ ...r,
17
+ locale: r.locale ?? t
18
+ };
19
+ if (a.type === "number")
20
+ return L(e, a);
21
+ const { prefix: o, suffix: n, ...s } = a;
22
+ return `${o ?? ""}${L(e, {
23
+ ...s,
24
+ negativeStyle: a.type === "currency" ? a.negativeStyle : "minus"
25
+ })}${n ?? ""}`;
26
+ }
27
+ function E(e, r, t) {
28
+ return e === null ? { value: e, text: null } : !r || !j(r) && r.type !== "duration" ? {
29
+ value: e,
30
+ text: L(e, { type: "number", locale: t })
31
+ } : r.type === "duration" ? {
32
+ value: e,
33
+ text: K(e, {
34
+ inputUnit: r.inputUnit,
35
+ outputStyle: r.outputStyle,
36
+ largestUnit: r.largestUnit,
37
+ smallestUnit: r.smallestUnit,
38
+ maxUnits: r.maxUnits,
39
+ prefix: r.prefix,
40
+ suffix: r.suffix,
41
+ negativeInParentheses: r.negativeStyle === "parentheses"
42
+ })
43
+ } : { value: e, text: Z(e, r, t) };
44
+ }
45
+ function I(e, r, t, a) {
46
+ return e === null ? { value: e, text: null } : a === "percent" ? {
47
+ value: e,
48
+ text: L(e, {
49
+ type: "percent",
50
+ locale: t,
51
+ minimumFractionDigits: r,
52
+ maximumFractionDigits: r,
53
+ percentValueMode: "fraction"
54
+ })
55
+ } : {
56
+ value: e,
57
+ text: L(e, {
58
+ type: "number",
59
+ locale: t,
60
+ minimumFractionDigits: r,
61
+ maximumFractionDigits: r,
62
+ suffix: "×"
63
+ })
64
+ };
65
+ }
66
+ function R(e, r) {
67
+ if (e === void 0) return r;
68
+ if (!Number.isInteger(e) || e < 0 || e > 6)
69
+ throw new RangeError("Comparison precision must be an integer from 0 to 6.");
70
+ return e;
71
+ }
72
+ function Ee(e, r) {
73
+ const t = {
74
+ mode: r.displayMode,
75
+ current: E(
76
+ e.currentValue,
77
+ r.metricFormat,
78
+ r.locale
79
+ ),
80
+ comparison: E(
81
+ e.comparisonValue,
82
+ r.metricFormat,
83
+ r.locale
84
+ )
85
+ };
86
+ return (r.displayMode === "difference" || r.displayMode === "both") && (t.difference = E(
87
+ e.delta,
88
+ r.metricFormat,
89
+ r.locale
90
+ )), (r.displayMode === "percent_change" || r.displayMode === "both") && (t.percentChange = I(
91
+ e.percentChange,
92
+ R(r.precision, 1),
93
+ r.locale,
94
+ "percent"
95
+ )), r.displayMode === "ratio" && (t.ratio = I(
96
+ e.ratio,
97
+ R(r.precision, 2),
98
+ r.locale,
99
+ "ratio"
100
+ )), t;
101
+ }
102
+ const Q = 1e4, Me = 1e6, Se = 5e6, Ce = 1024 ** 3, _e = 1024 ** 3;
103
+ function Ie(e) {
104
+ return e > Q;
105
+ }
106
+ const Re = {
107
+ rowLabels: "tabular",
108
+ subtotals: "after"
109
+ };
110
+ function Fe(e, r) {
111
+ const t = r.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, a = e.totals.rows;
112
+ return {
113
+ ...e,
114
+ layout: t,
115
+ totals: {
116
+ ...e.totals,
117
+ rows: {
118
+ ...a,
119
+ levels: Object.fromEntries(
120
+ Object.entries(a.levels).map(([o, n]) => [
121
+ o,
122
+ { ...n, position: r.subtotals }
123
+ ])
124
+ )
125
+ }
126
+ }
127
+ };
128
+ }
129
+ const ee = 2;
130
+ function re(e) {
131
+ return typeof e == "number" ? Number.isInteger(e) : C(e) ? !e.value.includes(".") : !0;
132
+ }
133
+ function te(e, r, t) {
134
+ const a = e.descriptors.measures.filter(
135
+ (s) => t.measureFormats[s.id] === void 0 && s.semanticFormat === void 0 && W(s.column.dataType) === "number"
136
+ );
137
+ if (a.length === 0) return t;
138
+ const o = /* @__PURE__ */ new Set();
139
+ e.columns.forEach((s, i) => {
140
+ if (!(s.kind !== "measure" || o.has(s.measureId)))
141
+ for (const m of r) {
142
+ const u = m.values[i];
143
+ if ((u == null ? void 0 : u.kind) === "value" && !re(u.value)) {
144
+ o.add(s.measureId);
145
+ return;
146
+ }
147
+ }
148
+ });
149
+ const n = { ...t.measureFormats };
150
+ for (const { id: s } of a) {
151
+ const i = o.has(s) ? ee : 0;
152
+ n[s] = {
153
+ type: "number",
154
+ minimumFractionDigits: i,
155
+ maximumFractionDigits: i,
156
+ useGrouping: !0
157
+ };
158
+ }
159
+ return { ...t, measureFormats: n };
160
+ }
161
+ function P(e) {
162
+ return A(e.slice(0, -1));
163
+ }
164
+ function oe(e, r) {
165
+ return r.length > e.length && A(r.slice(0, e.length)) === A(e);
166
+ }
167
+ function ae(e) {
168
+ return e.map((r, t) => {
169
+ if (t === 0 || r.kind !== "layout") return !1;
170
+ const a = e[t - 1];
171
+ if (a.kind !== "layout") return !1;
172
+ if (r.role !== "member" || oe(a.rowPath, r.rowPath)) return !0;
173
+ const o = e[t - 2];
174
+ return a.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || P(o.rowPath) !== P(a.rowPath)) && r.rowPath.length === a.rowPath.length && P(r.rowPath) === P(a.rowPath);
175
+ });
176
+ }
177
+ const se = "pdf-group-continuation";
178
+ function ne(e) {
179
+ if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
180
+ return !0;
181
+ for (let r = 0; r <= e.levelIndex; r++)
182
+ if (e.getValue(e.row, r) !== e.getValue(e.previousRow, r))
183
+ return !0;
184
+ return !1;
185
+ }
186
+ function le(e, r, t) {
187
+ const a = V(e.descriptors, r.presentation, t), o = e.columns.map((l) => {
188
+ var c;
189
+ return l.kind === "measure" && ((c = a.measureSemantics.get(l.measureId)) == null ? void 0 : c.isNumeric) === !0;
190
+ }), n = (l) => _([l], a.levels), s = (l, c, f) => D(l, c, r.presentation.totals[f], a.levels), i = e.columns.map((l) => {
191
+ if (l.kind !== "measure") return l.label;
192
+ const c = l.columnPath.map(n);
193
+ return l.role !== "member" && c.push(s(l.columnPath, l.role, "columns")), [...c, l.label].join(" / ");
194
+ }), m = Math.min(r.spec.columns.length, Math.max(
195
+ 0,
196
+ ...e.columns.map((l) => l.kind === "measure" ? l.columnPath.length + (l.role !== "member" ? 1 : 0) : 0)
197
+ )), u = Array.from({ length: m + 1 }, (l, c) => e.columns.map((f) => c === m ? f.label : f.kind !== "measure" ? "" : c < f.columnPath.length ? n(f.columnPath[c]) : c === f.columnPath.length && f.role !== "member" ? s(f.columnPath, f.role, "columns") : "")), g = (l, c) => z({
198
+ path: l.rowPath,
199
+ role: l.kind === "layout" ? l.role : "member",
200
+ levelCount: Math.max(1, r.spec.rows.length),
201
+ repeatLabels: r.presentation.layout.kind !== "tabular" || r.presentation.layout.repeatLabels,
202
+ previousPath: c == null ? void 0 : c.rowPath
203
+ }), d = (l, c) => {
204
+ if (l.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
205
+ if (l.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
206
+ const f = g(l, c);
207
+ return e.columns.map((w, h) => {
208
+ if (w.kind === "hierarchy")
209
+ return `${" ".repeat(Math.max(0, l.rowPath.length - 1))}${s(l.rowPath, l.role, "rows")}`;
210
+ if (w.kind === "level") {
211
+ const y = r.spec.rows.findIndex((G) => G.id === w.levelId), v = f[y];
212
+ return v != null && v.visible ? v.total ? s(l.rowPath, l.role, "rows") : _(v.path, a.levels) : "";
213
+ }
214
+ const b = l.values[h], x = a.measures.get(w.measureId);
215
+ if (b.kind === "value" && !x)
216
+ throw new Error("Matrix value is missing its measure descriptor.");
217
+ return H(b, x, r.presentation.absence);
218
+ });
219
+ }, p = (l, c) => d(l, c).map((f, w) => {
220
+ var y;
221
+ const h = l.values[w], b = e.columns[w];
222
+ return b.kind === "measure" && !((y = a.measureSemantics.get(b.measureId)) != null && y.hasTextAffixes) && h.kind === "value" && (typeof h.value == "number" || C(h.value)) ? f : S(f);
223
+ });
224
+ return {
225
+ headers: i,
226
+ headerBands: u,
227
+ numericColumns: o,
228
+ /** A row's cells; after `previous`, a tabular layout prints each label once. */
229
+ row: (l, c) => d(l, c),
230
+ /**
231
+ * Level columns whose group label the row above shows, so this row
232
+ * continues the group (Plan 2, 2d, C8). Only a member row after a member
233
+ * row continues one: a total prints as a band, and its rules stay whole
234
+ * above and below it.
235
+ */
236
+ continuedColumns: (l, c) => {
237
+ const f = (h) => (h == null ? void 0 : h.kind) === "layout" && h.role === "member";
238
+ if (!f(l) || !f(c)) return [];
239
+ const w = g(l, c);
240
+ return e.columns.flatMap((h, b) => {
241
+ var y;
242
+ if (h.kind !== "level") return [];
243
+ const x = r.spec.rows.findIndex((v) => v.id === h.levelId);
244
+ return x < l.rowPath.length && ((y = w[x]) == null ? void 0 : y.visible) === !1 ? [b] : [];
245
+ });
246
+ },
247
+ csvRow: (l) => p(l),
248
+ // Each committed batch starts with identifying labels. Retries are pure;
249
+ // suppression never relies on mutable formatter state or an earlier worker.
250
+ csvRows: (l) => l.map((c, f) => p(c, l[f - 1]))
251
+ };
252
+ }
253
+ function Ve(e) {
254
+ return e.columns.map((r) => S(r.label));
255
+ }
256
+ function De(e) {
257
+ if (e.kind !== "flat") throw new Error("Raw Matrix CSV requires flat rows.");
258
+ return e.values.map((r) => r.kind !== "value" ? null : C(r.value) ? r.value.value : typeof r.value == "string" ? S(r.value) : typeof r.value == "boolean" ? String(r.value) : r.value);
259
+ }
260
+ function ie(e) {
261
+ const r = le(e.layout, e.request, e.report), t = e.layout.columns.map((s, i) => ({
262
+ index: i,
263
+ columnId: `matrix:${i}`,
264
+ label: r.headers[i],
265
+ isNumeric: r.numericColumns[i]
266
+ })), a = (s, i, m) => ({
267
+ text: s,
268
+ colspan: 1,
269
+ rowspan: 1,
270
+ columnId: t[i].columnId,
271
+ isHeader: m,
272
+ isNumeric: t[i].isNumeric,
273
+ className: t[i].isNumeric ? "numeric" : e.layout.columns[i].kind === "hierarchy" ? "matrix-hierarchy" : ""
274
+ }), o = [], n = e.layout.columns.findIndex((s) => s.kind === "measure");
275
+ e.request.spec.columns.length && n >= 0 && o.push({
276
+ repeatHeader: !0,
277
+ headerType: "pivot-axis",
278
+ headerRowIndex: 0,
279
+ cells: [
280
+ ...n ? [{ ...a("", 0, !0), colspan: n }] : [],
281
+ {
282
+ ...a(e.request.spec.columns.map((s) => O(s, e.request.presentation)).join(" / "), n, !0),
283
+ colspan: e.layout.columns.length - n,
284
+ isNumeric: !1,
285
+ className: ""
286
+ }
287
+ ]
288
+ });
289
+ for (const [s, i] of r.headerBands.entries())
290
+ o.push({
291
+ repeatHeader: !0,
292
+ headerType: s === r.headerBands.length - 1 ? "metrics" : "pivot-level",
293
+ headerRowIndex: o.length,
294
+ cells: i.map((m, u) => a(m, u, !0))
295
+ });
296
+ return {
297
+ headers: o,
298
+ rows: e.rows.map((s, i) => {
299
+ const m = new Set(r.continuedColumns(s, e.rows[i - 1]));
300
+ return {
301
+ index: i,
302
+ type: s.kind === "layout" && s.role !== "member" ? "subtotal" : "data",
303
+ subtotalLevel: String(s.rowPath.length),
304
+ // A tabular layout prints each label once unless it repeats them; the
305
+ // blank cell continues its group, so a grid draws no rule above it.
306
+ cells: r.row(s, e.rows[i - 1]).map((u, g) => m.has(g) ? { ...a(u, g, !1), className: se } : a(u, g, !1))
307
+ };
308
+ }),
309
+ grandTotal: null,
310
+ // Totals are already in the ordered body at their authored position.
311
+ metadata: {
312
+ tableType: "pivot",
313
+ totalRows: e.rows.length,
314
+ totalColumns: t.length,
315
+ rowLevels: e.layout.columns.filter((s) => s.kind !== "measure").length,
316
+ pivotLevels: e.request.spec.columns.length,
317
+ hasGrandTotal: !1,
318
+ columnOrder: t.map((s) => s.columnId),
319
+ columns: t
320
+ }
321
+ };
322
+ }
323
+ function ue(e, r, t) {
324
+ const { levels: a } = V(e.descriptors, r.presentation, t), o = r.spec.columns.length > 0, n = [], s = [], i = e.columns.map((u, g) => {
325
+ if (u.kind !== "measure") return null;
326
+ const d = o ? `${u.role}:${A(u.columnPath)}` : `measure:${g}`;
327
+ let p = n.indexOf(d);
328
+ return p < 0 && (p = n.push(d) - 1, s.push(o ? D(u.columnPath, u.role, r.presentation.totals.columns, a) : u.label)), p;
329
+ }), m = r.spec.columns[r.spec.columns.length - 1];
330
+ return {
331
+ columnGroups: i,
332
+ groupLabels: s,
333
+ /** What bands name their groups by: the innermost column level, or "Measures". */
334
+ groupLevelLabel: m ? O(m, r.presentation) : "Measures"
335
+ };
336
+ }
337
+ function Oe(e) {
338
+ const { layout: r, rows: t, report: a } = e, o = {
339
+ ...e.request,
340
+ presentation: te(r, t, e.request.presentation)
341
+ }, n = ie({ layout: r, rows: t, request: o, report: a }), s = ae(t), i = ue(r, o, a), m = {
342
+ ...n,
343
+ rows: n.rows.map((u, g) => ({ ...u, keepWithPrevious: s[g] })),
344
+ metadata: { ...n.metadata, ...i }
345
+ };
346
+ return { request: o, table: m, ...i };
347
+ }
348
+ class ce extends Error {
349
+ constructor() {
350
+ super(...arguments);
351
+ k(this, "code", N);
352
+ }
353
+ }
354
+ function F(e) {
355
+ if (!e || typeof e != "object")
356
+ return;
357
+ const { error: r, message: t, detail: a } = e;
358
+ for (const o of [r, t, a])
359
+ if (typeof o == "string" && o.trim())
360
+ return o.trim();
361
+ }
362
+ async function me(e) {
363
+ const r = `PDF request failed: ${e.status} ${e.statusText}`.trim(), t = e.headers.get("content-type") || "";
364
+ try {
365
+ if (t.includes("application/json")) {
366
+ const o = await e.json(), n = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
367
+ return { message: F(o) || r, code: n };
368
+ }
369
+ const a = await e.text();
370
+ if (!a.trim())
371
+ return { message: r };
372
+ try {
373
+ const o = JSON.parse(a), n = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
374
+ return {
375
+ message: F(o) || a.trim(),
376
+ code: n
377
+ };
378
+ } catch {
379
+ return { message: a.trim() };
380
+ }
381
+ } catch {
382
+ return { message: r };
383
+ }
384
+ }
385
+ async function Ne(e) {
386
+ if (!e.token) throw new Error("Missing auth token for PDF export");
387
+ if (Y(e.serializedPayload) > q.maxRequestBytes)
388
+ throw new Error("Fast-path PDF request exceeds the structured body limit");
389
+ const r = await (e.fetchImpl ?? fetch)(e.url, {
390
+ method: "POST",
391
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
392
+ body: e.serializedPayload,
393
+ signal: e.signal
394
+ });
395
+ if (!r.ok) {
396
+ const a = await me(r);
397
+ throw a.code === N ? new ce(a.message) : new Error(a.message);
398
+ }
399
+ const t = await r.json();
400
+ if (t != null && t.error) throw new Error(t.error);
401
+ if (typeof (t == null ? void 0 : t.url) != "string" || !t.url.trim())
402
+ throw new Error("Fast-path PDF response missing download URL");
403
+ return t;
404
+ }
405
+ const fe = "__TOTAL__";
406
+ function T(e) {
407
+ return typeof e == "object" && e !== null && !Array.isArray(e);
408
+ }
409
+ function M(e) {
410
+ return e === fe;
411
+ }
412
+ function $e(e) {
413
+ const r = /* @__PURE__ */ new Map(), t = (e.groupByColumns ?? []).map((o, n) => {
414
+ var u, g, d;
415
+ if (!T(o))
416
+ throw new Error(`Aggregate groupByColumns[${n}] is invalid`);
417
+ const s = typeof o.id == "string" && o.id.length > 0 ? o.id : void 0, i = s ? (d = (g = (u = e.columnKeyMap) == null ? void 0 : u.byRole) == null ? void 0 : g.groupby) == null ? void 0 : d[s] : void 0, m = (i == null ? void 0 : i.outputKey) || (i == null ? void 0 : i.rawKey) || (typeof o.alias == "string" && o.alias.length > 0 ? o.alias : typeof o.name == "string" && o.name.length > 0 ? o.name : void 0);
418
+ if (!m)
419
+ throw new Error(`Aggregate groupByColumns[${n}] has no output key`);
420
+ return [s, o.alias, o.name, m].forEach((p) => {
421
+ typeof p == "string" && p.length > 0 && r.set(p, m);
422
+ }), m;
423
+ }), a = (e.rowAggregates ?? []).flatMap((o) => !T(o) || typeof o.function != "string" || typeof o.groupLevel != "string" ? [] : [
424
+ {
425
+ function: o.function,
426
+ groupLevel: o.groupLevel === "ALL" ? "ALL" : r.get(o.groupLevel) || o.groupLevel,
427
+ ...typeof o.label == "string" ? { label: o.label } : {}
428
+ }
429
+ ]);
430
+ return { groupColumnKeys: t, rowAggregates: a };
431
+ }
432
+ function $(e) {
433
+ return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
434
+ }
435
+ function ge(e) {
436
+ var t;
437
+ if (e.customLabel) return e.customLabel;
438
+ const r = $(e.aggregateFunction);
439
+ if (e.levelValue !== void 0 && !M(e.levelValue)) {
440
+ if (e.levelValue === null) {
441
+ const o = (t = e.formatValue) == null ? void 0 : t.call(e, null);
442
+ return o ? `Subtotal ${o}` : `Subtotal ${r}`;
443
+ }
444
+ const a = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
445
+ if (a) return `Subtotal (${a})`;
446
+ }
447
+ return `Subtotal ${r}`;
448
+ }
449
+ function de(e, r) {
450
+ return r || `Grand ${$(e)}`;
451
+ }
452
+ function Be(e) {
453
+ const r = e.context.groupColumnKeys.indexOf(e.columnKey);
454
+ if (r < 0)
455
+ throw new Error(
456
+ `Aggregate group column "${e.columnKey}" is unknown`
457
+ );
458
+ return ne({
459
+ row: e.row,
460
+ previousRow: e.previousRow,
461
+ levelIndex: r,
462
+ getValue: (t, a) => t[e.context.groupColumnKeys[a]]
463
+ });
464
+ }
465
+ function B(e) {
466
+ var a, o;
467
+ const r = e.context.groupColumnKeys, t = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
468
+ if (e.row.isGrandTotal === !0) {
469
+ const n = (a = e.context.rowAggregates.find(
470
+ (s) => s.groupLevel === "ALL"
471
+ )) == null ? void 0 : a.label;
472
+ return {
473
+ kind: "grand-total",
474
+ cells: r.map((s, i) => ({
475
+ columnKey: s,
476
+ text: i === 0 ? de(t, n) : "",
477
+ placement: i === 0 ? "label" : "empty",
478
+ colSpan: i === 0 ? r.length : 1
479
+ }))
480
+ };
481
+ }
482
+ if (e.row.isSubtotal === !0) {
483
+ if (typeof e.row.subtotalLevel != "string")
484
+ throw new Error("Aggregate subtotal row is missing subtotalLevel");
485
+ const n = r.indexOf(e.row.subtotalLevel);
486
+ if (n < 0)
487
+ throw new Error(
488
+ `Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
489
+ );
490
+ const s = T(e.row.subtotalContext) ? e.row.subtotalContext : void 0, i = T(s == null ? void 0 : s.groupByValues) ? s.groupByValues : {}, m = (o = e.context.rowAggregates.find(
491
+ (u) => u.groupLevel === e.row.subtotalLevel && u.function === t
492
+ )) == null ? void 0 : o.label;
493
+ return {
494
+ kind: "subtotal",
495
+ cells: r.map((u, g) => {
496
+ if (g > n)
497
+ return {
498
+ columnKey: u,
499
+ text: "",
500
+ placement: "empty",
501
+ colSpan: 1
502
+ };
503
+ if (g < n) {
504
+ const d = e.row[u];
505
+ return {
506
+ columnKey: u,
507
+ text: d === void 0 || M(d) ? "" : e.formatValue(d, u),
508
+ placement: "value",
509
+ colSpan: 1
510
+ };
511
+ }
512
+ return {
513
+ columnKey: u,
514
+ text: ge({
515
+ aggregateFunction: t,
516
+ customLabel: m,
517
+ levelValue: i[u],
518
+ formatValue: (d) => e.formatLabelValue ? e.formatLabelValue(d, u) : String(e.formatValue(d, u) ?? "")
519
+ }),
520
+ placement: "label",
521
+ colSpan: r.length - n
522
+ };
523
+ })
524
+ };
525
+ }
526
+ return {
527
+ kind: "data",
528
+ cells: r.map((n) => {
529
+ const s = e.row[n];
530
+ return {
531
+ columnKey: n,
532
+ text: s === void 0 || M(s) ? "" : e.formatValue(s, n),
533
+ placement: "value",
534
+ colSpan: 1
535
+ };
536
+ })
537
+ };
538
+ }
539
+ function Ge(e) {
540
+ const r = B(e).cells.find(
541
+ (t) => t.columnKey === e.columnKey
542
+ );
543
+ if (!r)
544
+ throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
545
+ return r.text;
546
+ }
547
+ function Ue(e) {
548
+ return B(e).cells.map((r) => r.text);
549
+ }
550
+ class he extends Error {
551
+ constructor(t, a) {
552
+ super(`${t}: ${a}`);
553
+ k(this, "deliveryBlocking", !0);
554
+ this.code = t, this.name = "PivotHeaderPresentationError";
555
+ }
556
+ }
557
+ function Xe(e) {
558
+ var o;
559
+ const r = e.mode ?? "formatted", t = e.members.map((n) => {
560
+ var i;
561
+ if (r === "canonical" || !n.temporalBucket)
562
+ return n.value === null ? "" : String(n.value);
563
+ const s = (i = e.resolveTemporalFormat) == null ? void 0 : i.call(e, n.fieldId);
564
+ if (!s)
565
+ throw new he(
566
+ "missing_resolved_temporal_format",
567
+ `Missing resolved temporal presentation for pivot field "${n.fieldId}"`
568
+ );
569
+ return J({
570
+ value: n.value,
571
+ metadata: n.temporalBucket,
572
+ format: s
573
+ });
574
+ }), a = ((o = e.metricLabel) == null ? void 0 : o.trim()) || void 0;
575
+ return {
576
+ memberLabels: t,
577
+ ...a ? { metricLabel: a } : {},
578
+ flattenedLabel: [
579
+ ...t,
580
+ ...a ? [a] : []
581
+ ].join(" / ")
582
+ };
583
+ }
584
+ export {
585
+ fe as A,
586
+ Xe as B,
587
+ ne as C,
588
+ Q as D,
589
+ Me as F,
590
+ Se as M,
591
+ se as P,
592
+ Ce as a,
593
+ _e as b,
594
+ De as c,
595
+ ie as d,
596
+ Oe as e,
597
+ Ee as f,
598
+ Re as g,
599
+ Fe as h,
600
+ ee as i,
601
+ te as j,
602
+ ae as k,
603
+ ce as l,
604
+ Ve as m,
605
+ me as n,
606
+ Ne as o,
607
+ le as p,
608
+ M as q,
609
+ Ie as r,
610
+ $e as s,
611
+ ge as t,
612
+ de as u,
613
+ Be as v,
614
+ B as w,
615
+ Ge as x,
616
+ Ue as y,
617
+ he as z
618
+ };
@@ -1,7 +1,7 @@
1
1
  var y = Object.defineProperty;
2
2
  var c = (t, e, r) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var u = (t, e, r) => c(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { v as d } from "./temporal-bucket-contract-DTLDRzgV.js";
4
+ import { v as d } from "./temporal-bucket-contract-C6lUGPS3.js";
5
5
  function f(t) {
6
6
  return !!(t != null && t.isSubtotal && t.subtotalScope === "pivot-value");
7
7
  }