react-semaphor 0.1.537 → 0.1.539

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 (174) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
  24. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
  25. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  26. package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
  27. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
  28. package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
  101. package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
  102. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  103. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  104. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  105. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  106. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  107. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  108. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  109. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  110. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  111. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  112. package/dist/types/lib/types/token-types.d.ts +11 -0
  113. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  114. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  115. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  116. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  117. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  118. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  119. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  120. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  121. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  122. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  123. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  124. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  125. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  126. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  127. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  128. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  129. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  130. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  131. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  132. package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
  133. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  134. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  135. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  136. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  137. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  138. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  140. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  141. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  142. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  144. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  145. package/dist/types/shared/format-utils/index.d.ts +3 -0
  146. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  147. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  148. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  149. package/dist/types/shared/layouts/index.d.ts +1 -0
  150. package/package.json +12 -2
  151. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  152. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  153. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  154. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  155. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  156. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  157. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  158. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  159. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  160. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  161. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  162. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  163. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  164. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  165. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  166. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  167. package/dist/chunks/save-kO6cIaob.js +0 -34
  168. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  169. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  170. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  171. package/dist/chunks/x-CXDkqdur.js +0 -149
  172. package/dist/types/lib/class-utils.d.ts +0 -2
  173. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  174. package/dist/types/lib/utils.d.ts +0 -51
@@ -1,789 +0,0 @@
1
- var _ = Object.defineProperty;
2
- var K = (e, o, t) => o in e ? _(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
- var f = (e, o, t) => K(e, typeof o != "symbol" ? o + "" : o, t);
4
- import { p as F, i as j } from "./raw-temporal-iMXRK-Qz.js";
5
- import { b as M } from "./report-runtime-context-CG_I0PPW.js";
6
- import { k as T } from "./numeric-presentation-CWu3gunq.js";
7
- import { d as u, b as P } from "./temporal-bucket-DlFuhCnT.js";
8
- import { S as O } from "./validators-DMSH81OM.js";
9
- import "./matrix-operation-contract-BKupLHXL.js";
10
- import { r as U } from "./metric-comparison-BKHyvnAy.js";
11
- import "zod";
12
- import { a as q } from "./temporal-bucket-contract-D2OuaVZ7.js";
13
- import { d as N, P as D } from "./pivot-result-identity-Bs4tLtLo.js";
14
- const B = ["utf-8-bom", "utf-8"], V = "utf-8-bom", z = [",", ";", " "], J = `\r
15
- `, Ee = "text/csv; charset=utf-8";
16
- function Ae(e) {
17
- return e == null || typeof e == "string" || typeof e == "number" ? e : typeof e == "object" ? JSON.stringify(e) : String(e);
18
- }
19
- const L = "\uFEFF";
20
- function I(e) {
21
- return B.find((o) => o === e);
22
- }
23
- function ke(e) {
24
- return z.find((o) => o === e);
25
- }
26
- function $e(e) {
27
- return I(e.requested) ?? I(e.dashboardDefault) ?? V;
28
- }
29
- function G(e) {
30
- return e === "utf-8-bom" ? L : "";
31
- }
32
- function Se(e) {
33
- const o = e.trimStart().charAt(0);
34
- return ["=", "+", "-", "@"].includes(o) || [" ", "\r", `
35
- `].includes(e.charAt(0)) ? `'${e}` : e;
36
- }
37
- function Y(e, o = ",") {
38
- if (e == null)
39
- return "";
40
- const t = String(e);
41
- return t.includes(o) || t.includes('"') || t.includes(`
42
- `) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
43
- }
44
- function S(e, o) {
45
- return e.map((t) => Y(t, o)).join(o) + J;
46
- }
47
- function H(e, o) {
48
- return e.map((t) => S(t, o)).join("");
49
- }
50
- function _e(e) {
51
- return G(e.encoding) + (e.header ? S(e.header, e.delimiter) : "") + H(e.rows, e.delimiter);
52
- }
53
- class C extends Error {
54
- constructor(t) {
55
- super(
56
- `invalid_presentation_execution_snapshot: ${t} Resave this report before running it again.`
57
- );
58
- f(this, "code", "invalid_presentation_execution_snapshot");
59
- f(this, "deliveryBlocking", !0);
60
- this.name = "PresentationExecutionSnapshotError";
61
- }
62
- }
63
- class Ke extends Error {
64
- constructor(t) {
65
- super(
66
- `missing_resolved_raw_temporal_format: Column "${t}" has no captured presentation. Resave this report before running it again.`
67
- );
68
- f(this, "code", "missing_resolved_raw_temporal_format");
69
- f(this, "deliveryBlocking", !0);
70
- this.name = "MissingResolvedRawTemporalFormatError";
71
- }
72
- }
73
- function v(e, o, t) {
74
- const n = new Set(o), r = Object.keys(e).find((s) => !n.has(s));
75
- if (r)
76
- throw new Error(`${t} contains unknown property "${r}"`);
77
- }
78
- function Q(e, o = "scope") {
79
- if (!u(e))
80
- throw new Error(`${o} must be an object`);
81
- v(
82
- e,
83
- ["dashboardId", "cardId", "attachmentIndex"],
84
- o
85
- );
86
- const t = typeof e.dashboardId == "string" ? e.dashboardId.trim() : "";
87
- if (!t)
88
- throw new Error(`${o}.dashboardId is required`);
89
- const n = typeof e.cardId == "string" ? e.cardId.trim() : void 0;
90
- if (e.cardId !== void 0 && !n)
91
- throw new Error(`${o}.cardId must be a non-empty string`);
92
- const r = e.attachmentIndex;
93
- if (r !== void 0 && (typeof r != "number" || !Number.isInteger(r) || r < 0))
94
- throw new Error(
95
- `${o}.attachmentIndex must be a non-negative integer`
96
- );
97
- return {
98
- dashboardId: t,
99
- ...n ? { cardId: n } : {},
100
- ...typeof r == "number" ? { attachmentIndex: r } : {}
101
- };
102
- }
103
- function y(e, o, t, n) {
104
- if (e.kind !== o) return;
105
- v(e, ["kind", t], n);
106
- const r = typeof e[t] == "string" ? e[t].trim() : "";
107
- if (!r)
108
- throw new Error(`${n}.${t} is required`);
109
- return r;
110
- }
111
- function R(e, o) {
112
- if (!u(e))
113
- throw new Error(`${o} must be an object`);
114
- const t = y(e, "metric", "metricId", o);
115
- if (t) return { kind: "metric", metricId: t };
116
- const n = y(e, "column", "columnKey", o);
117
- if (n) return { kind: "column", columnKey: n };
118
- const r = y(
119
- e,
120
- "matrix_measure",
121
- "measureId",
122
- o
123
- );
124
- if (r) return { kind: "matrix_measure", measureId: r };
125
- throw new Error(`${o} is not a valid numeric presentation target`);
126
- }
127
- const W = [
128
- "type",
129
- "inputUnit",
130
- "outputStyle",
131
- "largestUnit",
132
- "smallestUnit",
133
- "maxUnits",
134
- "prefix",
135
- "suffix",
136
- "negativeStyle"
137
- ];
138
- function X(e) {
139
- return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
140
- }
141
- function Z(e, o) {
142
- v(e, W, o);
143
- for (const s of ["inputUnit", "largestUnit", "smallestUnit"])
144
- if (e[s] !== void 0 && !X(e[s]))
145
- throw new Error(`${o}.${s} must be a duration unit`);
146
- const t = e.outputStyle;
147
- if (t !== void 0 && t !== "compact" && t !== "digital" && t !== "long")
148
- throw new Error(`${o}.outputStyle must be compact, digital, or long`);
149
- const n = e.maxUnits;
150
- if (n !== void 0 && (typeof n != "number" || !Number.isInteger(n) || n < 0 || n > 10))
151
- throw new Error(`${o}.maxUnits must be an integer from 0 to 10`);
152
- for (const s of ["prefix", "suffix"])
153
- if (e[s] !== void 0 && typeof e[s] != "string")
154
- throw new Error(`${o}.${s} must be a string`);
155
- const r = e.negativeStyle;
156
- if (r !== void 0 && r !== "minus" && r !== "parentheses")
157
- throw new Error(`${o}.negativeStyle must be minus or parentheses`);
158
- return {
159
- type: "duration",
160
- ...e.inputUnit !== void 0 ? { inputUnit: e.inputUnit } : {},
161
- ...t !== void 0 ? { outputStyle: t } : {},
162
- ...e.largestUnit !== void 0 ? { largestUnit: e.largestUnit } : {},
163
- ...e.smallestUnit !== void 0 ? { smallestUnit: e.smallestUnit } : {},
164
- ...n !== void 0 ? { maxUnits: n } : {},
165
- ...e.prefix !== void 0 ? { prefix: e.prefix } : {},
166
- ...e.suffix !== void 0 ? { suffix: e.suffix } : {},
167
- ...r !== void 0 ? { negativeStyle: r } : {}
168
- };
169
- }
170
- function ee(e, o) {
171
- if (!u(e))
172
- throw new Error(`${o} must be an object`);
173
- if (e.kind === "field") {
174
- v(e, ["kind", "fieldId", "role"], o);
175
- const r = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
176
- if (!r)
177
- throw new Error(`${o}.fieldId is required`);
178
- const s = e.role;
179
- if (s !== void 0 && s !== "groupby" && s !== "pivotby")
180
- throw new Error(`${o}.role must be groupby or pivotby`);
181
- return {
182
- kind: "field",
183
- fieldId: r,
184
- ...s ? { role: s } : {}
185
- };
186
- }
187
- const t = y(e, "column", "columnKey", o);
188
- if (t) return { kind: "column", columnKey: t };
189
- const n = y(
190
- e,
191
- "matrix_axis",
192
- "axisInstanceId",
193
- o
194
- );
195
- if (n) return { kind: "matrix_axis", axisInstanceId: n };
196
- throw new Error(`${o} is not a valid temporal bucket presentation target`);
197
- }
198
- function te(e, o) {
199
- if (!u(e))
200
- throw new Error(`${o} must be an object`);
201
- const t = y(e, "column", "columnKey", o);
202
- if (!t)
203
- throw new Error(`${o} must identify a column`);
204
- return { kind: "column", columnKey: t };
205
- }
206
- function oe(e) {
207
- return [
208
- e.dashboardId,
209
- e.cardId ?? null,
210
- e.attachmentIndex ?? null
211
- ];
212
- }
213
- function h(e) {
214
- switch (e.kind) {
215
- case "metric":
216
- return [e.kind, e.metricId];
217
- case "column":
218
- return [e.kind, e.columnKey];
219
- case "matrix_measure":
220
- return [e.kind, e.measureId];
221
- case "field":
222
- return [e.kind, e.fieldId, e.role ?? ""];
223
- case "matrix_axis":
224
- return [e.kind, e.axisInstanceId];
225
- }
226
- }
227
- function b(e, o) {
228
- return e.dashboardId === o.dashboardId && e.cardId === o.cardId && e.attachmentIndex === o.attachmentIndex;
229
- }
230
- function g(e, o) {
231
- const t = h(e), n = h(o);
232
- return t.length === n.length && t.every((r, s) => r === n[s]);
233
- }
234
- function re(e) {
235
- if (!Array.isArray(e))
236
- throw new Error("resolvedFormats must be an array");
237
- const o = /* @__PURE__ */ new Set();
238
- return e.map((t, n) => {
239
- var m, p;
240
- const r = `resolvedFormats.${n}`;
241
- if (!u(t))
242
- throw new Error(`${r} must be an object`);
243
- v(t, ["scope", "target", "format"], r);
244
- const s = Q(t.scope, `${r}.scope`);
245
- if (!u(t.format))
246
- throw new Error(`${r}.format must be an object`);
247
- let i;
248
- switch (t.format.type) {
249
- case "temporal_bucket": {
250
- const l = P(t.format);
251
- if (!l.ok)
252
- throw new Error(
253
- `${r}.format is invalid: ${((m = l.issues[0]) == null ? void 0 : m.message) ?? "invalid value"}`
254
- );
255
- i = {
256
- scope: s,
257
- target: ee(t.target, `${r}.target`),
258
- format: l.value
259
- };
260
- break;
261
- }
262
- case "raw_temporal":
263
- i = {
264
- scope: s,
265
- target: te(t.target, `${r}.target`),
266
- format: F(t.format)
267
- };
268
- break;
269
- case "number":
270
- case "currency":
271
- case "percent":
272
- case "scientific": {
273
- const l = T(t.format);
274
- if (!l.ok)
275
- throw new Error(
276
- `${r}.format is invalid: ${((p = l.issues[0]) == null ? void 0 : p.message) ?? "invalid value"}`
277
- );
278
- i = {
279
- scope: s,
280
- target: R(t.target, `${r}.target`),
281
- format: l.value
282
- };
283
- break;
284
- }
285
- case "duration":
286
- i = {
287
- scope: s,
288
- target: R(t.target, `${r}.target`),
289
- format: Z(
290
- t.format,
291
- `${r}.format`
292
- )
293
- };
294
- break;
295
- default:
296
- throw new Error(`${r}.format.type is unsupported`);
297
- }
298
- const c = JSON.stringify([
299
- ...oe(i.scope),
300
- ...h(i.target)
301
- ]);
302
- if (o.has(c))
303
- throw new Error(
304
- `${r} duplicates a scoped presentation target`
305
- );
306
- return o.add(c), i;
307
- });
308
- }
309
- function ne(e) {
310
- try {
311
- if (!u(e))
312
- throw new Error("presentation execution snapshot must be an object");
313
- if (v(
314
- e,
315
- ["version", "reportContext", "resolvedFormats"],
316
- "presentation execution snapshot"
317
- ), e.version !== 1)
318
- throw new Error("presentation execution snapshot version must be 1");
319
- const o = M(e.reportContext);
320
- if (!o.ok) {
321
- const t = o.issues[0];
322
- throw new Error(
323
- `presentation execution snapshot reportContext is invalid: ${t != null && t.path && t.path !== "$" ? `${t.path}: ` : ""}${(t == null ? void 0 : t.message) ?? "invalid value"}`
324
- );
325
- }
326
- return {
327
- version: 1,
328
- reportContext: o.value,
329
- resolvedFormats: re(e.resolvedFormats)
330
- };
331
- } catch (o) {
332
- throw o instanceof C ? o : new C(
333
- o instanceof Error ? o.message : "Snapshot is invalid."
334
- );
335
- }
336
- }
337
- function Fe(e) {
338
- return ne({
339
- version: 1,
340
- reportContext: e.reportContext,
341
- resolvedFormats: [...e.resolvedFormats]
342
- });
343
- }
344
- function je(e) {
345
- const o = se(e);
346
- return j(o) ? o : void 0;
347
- }
348
- function se(e) {
349
- const o = e.snapshot.resolvedFormats.find(
350
- (t) => t.format.type !== "temporal_bucket" && t.format.type !== "raw_temporal" && b(t.scope, e.scope) && g(t.target, e.target)
351
- );
352
- return o == null ? void 0 : o.format;
353
- }
354
- function Me(e) {
355
- const o = e.snapshot.resolvedFormats.find(
356
- (t) => t.format.type === "raw_temporal" && b(t.scope, e.scope) && g(t.target, e.target)
357
- );
358
- return o == null ? void 0 : o.format;
359
- }
360
- function Te(e) {
361
- const o = e.snapshot.resolvedFormats.find(
362
- (t) => t.format.type === "temporal_bucket" && b(t.scope, e.scope) && g(t.target, e.target)
363
- );
364
- return o == null ? void 0 : o.format;
365
- }
366
- function Pe(e) {
367
- var r;
368
- const o = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
369
- if (e.snapshot.resolvedFormats.forEach((s, i) => {
370
- if (s.scope.attachmentIndex !== void 0)
371
- throw new Error(
372
- `resolvedFormats.${i}.scope.attachmentIndex is not valid for a card export`
373
- );
374
- if (s.scope.dashboardId !== e.expectedScope.dashboardId || s.scope.cardId !== e.expectedScope.cardId)
375
- throw new Error(
376
- `resolvedFormats.${i}.scope must match the executing dashboard/card`
377
- );
378
- if (s.target.kind === "field" && s.format.type === "temporal_bucket") {
379
- const c = JSON.stringify(h(s.target));
380
- if (t.has(c))
381
- throw new Error(
382
- `resolvedFormats.${i} duplicates export field "${s.target.fieldId}"`
383
- );
384
- t.add(c);
385
- return;
386
- }
387
- if (s.target.kind !== "column")
388
- throw new Error(
389
- `resolvedFormats.${i}.target must identify an export column or temporal pivot field`
390
- );
391
- if (o.has(s.target.columnKey))
392
- throw new Error(
393
- `resolvedFormats.${i} duplicates export column "${s.target.columnKey}"`
394
- );
395
- o.add(s.target.columnKey);
396
- }), !e.useFormattedValues) return;
397
- if (!((r = e.visibleColumns) != null && r.length))
398
- throw new Error("visibleColumns must identify every formatted export column");
399
- const n = e.visibleColumns.find(
400
- (s) => !o.has(s)
401
- );
402
- if (n)
403
- throw new Error(
404
- `resolvedFormats is missing visible export column "${n}"`
405
- );
406
- }
407
- function w(e) {
408
- return Array.from(
409
- new Set(
410
- (e ?? []).flatMap(
411
- (o) => typeof o.id == "string" && o.id ? [o.id] : []
412
- )
413
- )
414
- );
415
- }
416
- function ie(e) {
417
- const o = /* @__PURE__ */ new Map();
418
- return e.forEach((t) => {
419
- t.id && o.set(t.id, (o.get(t.id) ?? 0) + 1);
420
- }), e.flatMap(
421
- (t) => t.id && (o.get(t.id) ?? 0) > 1 ? [U(t)] : []
422
- );
423
- }
424
- function Oe(e) {
425
- const o = e.metricFields ?? [], t = w(o);
426
- return {
427
- expectedRoleFieldIds: {
428
- groupby: w(e.groupByFields),
429
- metric: t.length > 0 ? t : [O],
430
- pivotby: w(e.pivotByFields),
431
- detail: w(e.detailFields)
432
- },
433
- expectedMetricAliases: ie(o)
434
- };
435
- }
436
- class a extends Error {
437
- constructor(t, n) {
438
- super(`invalid_pivot_result_lifecycle: ${t}`);
439
- f(this, "code", "invalid_pivot_result_lifecycle");
440
- f(this, "deliveryBlocking", !0);
441
- this.cause = n, this.name = "PivotResultLifecycleError";
442
- }
443
- }
444
- function ae(e) {
445
- if (!Array.isArray(e) || e.some(
446
- (t) => !t || typeof t != "object" || Array.isArray(t) || typeof t.key != "string" || !t.key || typeof t.name != "string" || typeof t.label != "string"
447
- ))
448
- throw new a(
449
- "Canonical pivot columns must be an array of keyed, named result descriptors."
450
- );
451
- const o = e;
452
- if (new Set(o.map((t) => t.key)).size !== o.length)
453
- throw new a(
454
- "Canonical pivot column keys must be unique."
455
- );
456
- for (const t of o) {
457
- const n = q(t, {
458
- metadataRequired: !1
459
- });
460
- if (!n.ok)
461
- throw new a(
462
- `Canonical pivot column "${t.key}" has invalid temporal metadata: ${n.error.message}`
463
- );
464
- }
465
- return o;
466
- }
467
- function E(e) {
468
- if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1 || e.source !== "explorer" || !e.byRole || typeof e.byRole != "object" || Array.isArray(e.byRole))
469
- throw new a(
470
- "A loaded canonical pivot result requires its role-scoped column key map."
471
- );
472
- const o = e, t = /* @__PURE__ */ new Set(["groupby", "metric", "pivotby", "detail"]);
473
- for (const [n, r] of Object.entries(o.byRole)) {
474
- if (!t.has(n) || !r || typeof r != "object" || Array.isArray(r))
475
- throw new a(
476
- `Canonical pivot role map contains invalid "${n}" bindings.`
477
- );
478
- for (const [s, i] of Object.entries(r))
479
- if (!s || !i || typeof i != "object" || Array.isArray(i) || i.role !== n || typeof i.rawKey != "string" || !i.rawKey || i.outputKey !== void 0 && (typeof i.outputKey != "string" || !i.outputKey))
480
- throw new a(
481
- `Canonical pivot role map contains an invalid "${n}:${s}" binding.`
482
- );
483
- }
484
- if (o.byMetricAlias !== void 0) {
485
- if (!o.byMetricAlias || typeof o.byMetricAlias != "object" || Array.isArray(o.byMetricAlias))
486
- throw new a(
487
- "Canonical pivot metric-alias bindings must be an object."
488
- );
489
- for (const [n, r] of Object.entries(
490
- o.byMetricAlias
491
- ))
492
- if (!n || !r || typeof r != "object" || Array.isArray(r) || r.role !== "metric" || typeof r.rawKey != "string" || !r.rawKey || r.outputKey !== void 0 && (typeof r.outputKey != "string" || !r.outputKey))
493
- throw new a(
494
- `Canonical pivot metric-alias map contains an invalid "${n}" binding.`
495
- );
496
- }
497
- return o;
498
- }
499
- function ce(e) {
500
- if (e === void 0) return {};
501
- if (!e || typeof e != "object" || Array.isArray(e))
502
- throw new a(
503
- "Canonical pivot column metadata must be an object."
504
- );
505
- for (const [o, t] of Object.entries(e)) {
506
- if (!o || !t || typeof t != "object" || Array.isArray(t))
507
- throw new a(
508
- `Canonical pivot column metadata contains an invalid "${o}" classification.`
509
- );
510
- const { isSubtotal: n, subtotalScope: r } = t;
511
- if (n !== void 0 && typeof n != "boolean" || r !== void 0 && r !== "base" && r !== "pivot-value" && r !== "grand-total" || n === !0 && r !== "pivot-value" && r !== "grand-total" || (r === "pivot-value" || r === "grand-total") && n !== !0 || r === "base" && n === !0)
512
- throw new a(
513
- `Canonical pivot column metadata contains an incoherent "${o}" subtotal classification.`
514
- );
515
- }
516
- return e;
517
- }
518
- function A(e, o) {
519
- if (!Array.isArray(e) || e.some((t) => typeof t != "string" || !t) || new Set(e).size !== e.length)
520
- throw new a(
521
- `Canonical pivot contract ${o} must be an array of unique field identities.`
522
- );
523
- return e;
524
- }
525
- function le(e, o) {
526
- if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1)
527
- throw new a(
528
- "A canonical pivot result requires its versioned result contract."
529
- );
530
- const t = e, n = t.expectedRoleFieldIds;
531
- if (!n || typeof n != "object" || Array.isArray(n))
532
- throw new a(
533
- "Canonical pivot contract role identities must be an object."
534
- );
535
- const s = Object.fromEntries(
536
- [
537
- "groupby",
538
- "metric",
539
- "pivotby",
540
- "detail"
541
- ].map((d) => [
542
- d,
543
- A(
544
- n[d],
545
- `expectedRoleFieldIds.${d}`
546
- )
547
- ])
548
- ), i = A(
549
- t.expectedMetricAliases,
550
- "expectedMetricAliases"
551
- ), c = t.columnKinds;
552
- if (!c || typeof c != "object" || Array.isArray(c))
553
- throw new a(
554
- "Canonical pivot contract column kinds must be an object."
555
- );
556
- const m = /* @__PURE__ */ new Set([
557
- "row",
558
- "pivot_metric",
559
- "value"
560
- ]), p = o.map((d) => d.key), l = Object.keys(c);
561
- if (l.length !== p.length || l.some(
562
- (d) => !p.includes(d) || !m.has(
563
- c[d]
564
- )
565
- ))
566
- throw new a(
567
- "Canonical pivot contract must classify every authoritative result column exactly once."
568
- );
569
- const x = ce(
570
- t.columnClassifications
571
- );
572
- if (Object.keys(x).some(
573
- (d) => !p.includes(d)
574
- ))
575
- throw new a(
576
- "Canonical pivot contract contains a classification for an unknown result column."
577
- );
578
- return {
579
- version: 1,
580
- expectedRoleFieldIds: s,
581
- expectedMetricAliases: i,
582
- columnKinds: c,
583
- columnClassifications: x
584
- };
585
- }
586
- function k(e, o) {
587
- const t = [
588
- "groupby",
589
- "metric",
590
- "pivotby",
591
- "detail"
592
- ];
593
- for (const s of t) {
594
- const i = new Set(o.expectedRoleFieldIds[s] ?? []), c = Object.keys(e.byRole[s] ?? {});
595
- if (c.length !== i.size || c.some((m) => !i.has(m)))
596
- throw new a(
597
- `The role-scoped ${s} bindings do not match the authored result fields.`
598
- );
599
- }
600
- const n = new Set(o.expectedMetricAliases), r = Object.keys(e.byMetricAlias ?? {});
601
- if (r.length !== n.size || r.some((s) => !n.has(s)))
602
- throw new a(
603
- "The metric-alias bindings do not match the authored metric instances."
604
- );
605
- }
606
- function de(e) {
607
- if (!Array.isArray(e) || e.some(
608
- (o) => !o || typeof o != "object" || Array.isArray(o)
609
- ))
610
- throw new a(
611
- "Canonical pivot records must be an array of row objects."
612
- );
613
- return e;
614
- }
615
- function me(e, o) {
616
- e.forEach((t, n) => {
617
- o.forEach((r) => {
618
- if (!Object.prototype.hasOwnProperty.call(t, r.key) || t[r.key] === void 0)
619
- throw new a(
620
- `Canonical pivot column "${r.key}" is absent from row ${n}.`
621
- );
622
- });
623
- });
624
- }
625
- function fe(e, o, t) {
626
- const n = new Set(o.map((r) => r.key));
627
- ["groupby", "detail"].forEach((r) => {
628
- Object.entries(e.byRole[r] ?? {}).forEach(
629
- ([s, i]) => {
630
- const c = i.outputKey || i.rawKey;
631
- if (!n.has(c) || t.columnKinds[c] !== "row")
632
- throw new a(
633
- `The role-scoped ${r} binding for "${s}" does not name an authoritative result column.`
634
- );
635
- }
636
- );
637
- });
638
- }
639
- function $(e, o) {
640
- o.forEach((t) => {
641
- const n = e.columnKinds[t.key];
642
- if (n === "pivot_metric" && t.pivotIdentity === void 0)
643
- throw new a(
644
- `Physical pivot result column "${t.key}" is missing its identity.`
645
- );
646
- if (n !== "pivot_metric" && t.pivotIdentity !== void 0)
647
- throw new a(
648
- `Canonical pivot result column "${t.key}" carries pivot identity outside the physical pivot projection.`
649
- );
650
- });
651
- }
652
- function ue(e) {
653
- const o = de(e.records), t = ae(e.columns), n = le(
654
- e.pivotResultContract,
655
- t
656
- ), r = n.expectedRoleFieldIds.pivotby ?? [];
657
- if (e.pivotResultState === "loaded_empty") {
658
- if (o.length !== 0)
659
- throw new a(
660
- "A loaded_empty pivot result cannot carry records."
661
- );
662
- if (t.some(
663
- (m) => n.columnKinds[m.key] === "pivot_metric"
664
- ))
665
- throw new a(
666
- "A loaded_empty pivot result cannot carry physical pivot columns."
667
- );
668
- $(n, t);
669
- const c = E(e.columnKeyMap);
670
- return k(c, n), {
671
- pivotResultState: "loaded_empty",
672
- records: [],
673
- columns: t,
674
- columnKeyMap: c,
675
- pivotResultContract: n
676
- };
677
- }
678
- if (e.pivotResultState !== "loaded_valid")
679
- throw new a(
680
- "A canonical pivot result must declare loaded_empty or loaded_valid."
681
- );
682
- if (o.length === 0)
683
- throw new a(
684
- "A loaded_valid pivot result must carry at least one record."
685
- );
686
- const s = E(e.columnKeyMap);
687
- k(s, n), fe(s, t, n), $(n, t);
688
- const i = t.filter(
689
- (c) => n.columnKinds[c.key] === "pivot_metric"
690
- );
691
- if (r.length > 0 && i.length === 0)
692
- throw new a(
693
- "A loaded_valid pivot result is missing its physical pivot columns."
694
- );
695
- try {
696
- N(i, {
697
- expectedPivotFieldIds: r,
698
- columnClassifications: n.columnClassifications
699
- });
700
- } catch (c) {
701
- throw c instanceof D ? new a(c.message, c) : c;
702
- }
703
- return me(o, t), {
704
- pivotResultState: "loaded_valid",
705
- records: o,
706
- columns: t,
707
- columnKeyMap: s,
708
- pivotResultContract: n
709
- };
710
- }
711
- function Ue(e) {
712
- const o = /* @__PURE__ */ new Set();
713
- ["groupby", "detail"].forEach((s) => {
714
- Object.values(e.columnKeyMap.byRole[s] ?? {}).forEach((i) => {
715
- o.add(i.outputKey || i.rawKey);
716
- });
717
- });
718
- const t = new Set(e.physicalPivotColumnKeys), n = new Set(
719
- e.columns.map((s) => s.key)
720
- ), r = {
721
- version: 1,
722
- expectedRoleFieldIds: {
723
- groupby: Array.from(
724
- new Set(e.expectedRoleFieldIds.groupby ?? [])
725
- ),
726
- metric: Array.from(
727
- new Set(e.expectedRoleFieldIds.metric ?? [])
728
- ),
729
- pivotby: Array.from(
730
- new Set(e.expectedRoleFieldIds.pivotby ?? [])
731
- ),
732
- detail: Array.from(
733
- new Set(e.expectedRoleFieldIds.detail ?? [])
734
- )
735
- },
736
- expectedMetricAliases: [...e.expectedMetricAliases ?? []],
737
- columnKinds: Object.fromEntries(
738
- e.columns.map((s) => [
739
- s.key,
740
- o.has(s.key) ? "row" : t.has(s.key) ? "pivot_metric" : "value"
741
- ])
742
- ),
743
- columnClassifications: Object.fromEntries(
744
- Object.entries(e.columnMetadata ?? {}).filter(
745
- ([s]) => n.has(s)
746
- )
747
- )
748
- };
749
- return ue({
750
- pivotResultState: e.records.length === 0 ? "loaded_empty" : "loaded_valid",
751
- pivotResultContract: r,
752
- records: e.records,
753
- columns: e.columns,
754
- columnKeyMap: e.columnKeyMap
755
- });
756
- }
757
- export {
758
- Ue as A,
759
- B as C,
760
- V as D,
761
- Ke as M,
762
- C as P,
763
- z as a,
764
- J as b,
765
- S as c,
766
- Ee as d,
767
- ke as e,
768
- se as f,
769
- G as g,
770
- Y as h,
771
- Se as i,
772
- H as j,
773
- _e as k,
774
- Q as l,
775
- re as m,
776
- ne as n,
777
- Fe as o,
778
- I as p,
779
- je as q,
780
- $e as r,
781
- Me as s,
782
- Ae as t,
783
- Te as u,
784
- Pe as v,
785
- ie as w,
786
- Oe as x,
787
- a as y,
788
- ue as z
789
- };