react-semaphor 0.1.449 → 0.1.454

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 (147) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +119 -112
  3. package/dist/appearance/index.cjs +1 -1
  4. package/dist/appearance/index.js +1 -1
  5. package/dist/brand-studio/index.cjs +4 -4
  6. package/dist/brand-studio/index.js +15 -13
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +39 -2131
  9. package/dist/chunks/{analyze-result-contract-T-0Ntzys.js → analyze-result-contract-BbRJ-C06.js} +1 -1
  10. package/dist/chunks/{analyze-result-contract-BHb7sUUW.cjs → analyze-result-contract-LPDNldic.cjs} +1 -1
  11. package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +1 -0
  12. package/dist/chunks/canonical-result-keys-D6avdjpA.js +467 -0
  13. package/dist/chunks/color-CJvdlFM_.js +2162 -0
  14. package/dist/chunks/color-CyB5o13F.cjs +4 -0
  15. package/dist/chunks/{common-types-CQ6SHfLk.cjs → common-types-C57kJ59w.cjs} +1 -1
  16. package/dist/chunks/{common-types-B7Jk3Rtj.js → common-types-H51FLKB7.js} +1 -1
  17. package/dist/chunks/contracts-CoCOpd_i.js +11 -0
  18. package/dist/chunks/contracts-CtB2VONT.cjs +1 -0
  19. package/dist/chunks/dashboard-briefing-launcher-Dwj1i7lr.cjs +26 -0
  20. package/dist/chunks/{dashboard-briefing-launcher-DCHiEkLE.js → dashboard-briefing-launcher-SYroFdae.js} +86 -84
  21. package/dist/chunks/{dashboard-controls-DwRFCcHV.js → dashboard-controls-1LpeU2sz.js} +15 -13
  22. package/dist/chunks/{dashboard-controls-CaFioayc.cjs → dashboard-controls-CpFoh7-A.cjs} +1 -1
  23. package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +1 -0
  24. package/dist/chunks/{dashboard-date-comparison-definition-Ba-clViK.js → dashboard-date-comparison-definition-DC3ekV2S.js} +1 -1
  25. package/dist/chunks/{dashboard-json-WoILbfTe.js → dashboard-json-D-T-sQxU.js} +25 -23
  26. package/dist/chunks/dashboard-json-DwSQopc_.cjs +1 -0
  27. package/dist/chunks/edit-dashboard-visual-BEmoQAET.cjs +172 -0
  28. package/dist/chunks/{edit-dashboard-visual-ciFhxqaI.js → edit-dashboard-visual-DqxUq4Bs.js} +6925 -6947
  29. package/dist/chunks/editor-action-buttons-18r2xwei.cjs +16 -0
  30. package/dist/chunks/{editor-action-buttons-BPo_45pM.js → editor-action-buttons-B2l3WIRC.js} +41 -39
  31. package/dist/chunks/format-types-CFHQoIuk.js +1350 -0
  32. package/dist/chunks/format-types-PSZZ7hG8.cjs +1 -0
  33. package/dist/chunks/index-Bn5wlkHt.cjs +4 -0
  34. package/dist/chunks/index-ByFbacH7.cjs +1 -0
  35. package/dist/chunks/index-CACdoqu3.js +318 -0
  36. package/dist/chunks/index-CLB_NGZ8.cjs +1392 -0
  37. package/dist/chunks/index-Ca784dpx.js +3714 -0
  38. package/dist/chunks/{index-CPuawpXJ.js → index-DAoS4BNU.js} +48514 -48484
  39. package/dist/chunks/index-DSKR3nKn.js +421 -0
  40. package/dist/chunks/index-F25jnH0p.cjs +1 -0
  41. package/dist/chunks/matrix-result-contract-CofATICL.js +437 -0
  42. package/dist/chunks/matrix-result-contract-zamd9euI.cjs +1 -0
  43. package/dist/chunks/pivot-header-presentation-DhyQXxKq.cjs +4 -0
  44. package/dist/chunks/pivot-header-presentation-ckYOQ4aZ.js +557 -0
  45. package/dist/chunks/{pivot-result-identity-CDLRT-YG.cjs → pivot-result-identity-Bb4EixVN.cjs} +1 -1
  46. package/dist/chunks/{pivot-result-identity-CwJWpKI7.js → pivot-result-identity-DU1v-5Xk.js} +1 -1
  47. package/dist/chunks/pivot-result-lifecycle-DmcF1ris.cjs +1 -0
  48. package/dist/chunks/pivot-result-lifecycle-sjzIOpvp.js +1641 -0
  49. package/dist/chunks/raw-temporal-contract-BtjH_G-d.cjs +1 -0
  50. package/dist/chunks/raw-temporal-contract-CxncLze5.js +64 -0
  51. package/dist/chunks/report-preferences-dialog-BgSvlDXa.cjs +1 -0
  52. package/dist/chunks/report-preferences-dialog-DDc2WUa0.js +723 -0
  53. package/dist/chunks/{report-runtime-context-C8LZFsqV.cjs → report-runtime-context-DqxS4wbi.cjs} +1 -1
  54. package/dist/chunks/{report-runtime-context-bCy3CVzK.js → report-runtime-context-SM6YO61_.js} +5 -5
  55. package/dist/chunks/saved-temporal-bucket-format-CFfWXRl9.cjs +1 -0
  56. package/dist/chunks/saved-temporal-bucket-format-SGAV0ivR.js +922 -0
  57. package/dist/chunks/{switch-BXet-Sno.js → switch-BeZW-HnS.js} +4350 -5249
  58. package/dist/chunks/switch-D-CCcfhc.cjs +138 -0
  59. package/dist/chunks/temporal-bucket-5UYEotyQ.js +810 -0
  60. package/dist/chunks/temporal-bucket-DHY1y9lq.cjs +1 -0
  61. package/dist/chunks/temporal-bucket-authoring-K1kE6R_z.js +222 -0
  62. package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +1 -0
  63. package/dist/chunks/{temporal-bucket-contract-ChDBWX8I.cjs → temporal-bucket-contract-D2-93DGr.cjs} +1 -1
  64. package/dist/chunks/{temporal-bucket-contract-_F6vNhhH.js → temporal-bucket-contract-D5d-xEl3.js} +1 -1
  65. package/dist/chunks/{token-types-BdQ8kHBm.cjs → token-types-D7CaaI80.cjs} +1 -1
  66. package/dist/chunks/{token-types-BHR58aTy.js → token-types-GbxRUozo.js} +1 -1
  67. package/dist/chunks/{update-policy-BxvYMYz0.cjs → update-policy-BmiOd0PB.cjs} +1 -1
  68. package/dist/chunks/{update-policy-g0rCQ9BM.js → update-policy-hednMF-0.js} +1 -1
  69. package/dist/chunks/validators-BDYprKI9.cjs +1 -0
  70. package/dist/chunks/{validators-Cs74WVie.js → validators-DEmd8Sin.js} +1561 -1197
  71. package/dist/dashboard/index.cjs +1 -1
  72. package/dist/dashboard/index.js +2 -2
  73. package/dist/dashboard-authoring/index.cjs +3 -3
  74. package/dist/dashboard-authoring/index.js +35 -32
  75. package/dist/data-app-builder/index.cjs +1 -1
  76. package/dist/data-app-builder/index.js +2 -2
  77. package/dist/data-app-codegen/index.cjs +1 -1
  78. package/dist/data-app-codegen/index.js +2 -2
  79. package/dist/data-app-codegen-node/index.cjs +1 -1
  80. package/dist/data-app-codegen-node/index.js +3 -3
  81. package/dist/data-app-sdk/index.cjs +1 -1
  82. package/dist/data-app-sdk/index.js +78 -77
  83. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  84. package/dist/data-app-sdk-adapters/index.js +29 -30
  85. package/dist/data-app-sdk-validation/index.cjs +1 -1
  86. package/dist/data-app-sdk-validation/index.js +21 -21
  87. package/dist/format-utils/index.cjs +3 -3
  88. package/dist/format-utils/index.js +156 -140
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.js +157 -155
  91. package/dist/report-runtime-context/index.cjs +1 -1
  92. package/dist/report-runtime-context/index.js +2 -2
  93. package/dist/style.css +1 -1
  94. package/dist/surfboard/index.cjs +1 -1
  95. package/dist/surfboard/index.js +3 -3
  96. package/dist/types/analytics-protocol.d.ts +81 -11
  97. package/dist/types/briefings.d.ts +727 -19
  98. package/dist/types/dashboard-assistant.d.ts +37 -17
  99. package/dist/types/dashboard-authoring.d.ts +61 -14
  100. package/dist/types/dashboard.d.ts +137 -12
  101. package/dist/types/data-app-builder.d.ts +28 -2
  102. package/dist/types/data-app-codegen-node.d.ts +29 -3
  103. package/dist/types/data-app-codegen.d.ts +29 -3
  104. package/dist/types/data-app-sdk-adapters.d.ts +28 -2
  105. package/dist/types/data-app-sdk-validation.d.ts +51 -7
  106. package/dist/types/data-app-sdk.d.ts +55 -10
  107. package/dist/types/format-utils.d.ts +190 -3
  108. package/dist/types/index.cjs +1 -1
  109. package/dist/types/index.js +4 -4
  110. package/dist/types/main.d.ts +128 -33
  111. package/dist/types/shared.d.ts +14 -12
  112. package/dist/types/surfboard.d.ts +138 -13
  113. package/dist/types/types.d.ts +117 -23
  114. package/dist/types/value-format-preferences.d.ts +3 -0
  115. package/package.json +2 -1
  116. package/dist/chunks/card-config-utils-15sRtebL.cjs +0 -1
  117. package/dist/chunks/card-config-utils-BYZ5MJOh.js +0 -16
  118. package/dist/chunks/catalog-field-grounding-Bnx-3tE0.cjs +0 -1
  119. package/dist/chunks/catalog-field-grounding-S2jKwKGD.js +0 -100
  120. package/dist/chunks/dashboard-briefing-launcher-DDgDr2s3.cjs +0 -26
  121. package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +0 -1
  122. package/dist/chunks/dashboard-input-contract-DSt8dGzP.js +0 -18
  123. package/dist/chunks/dashboard-input-contract-DV3cshjz.cjs +0 -1
  124. package/dist/chunks/dashboard-json-CYtvwtvj.cjs +0 -1
  125. package/dist/chunks/edit-dashboard-visual-DwKcvlsF.cjs +0 -177
  126. package/dist/chunks/editor-action-buttons-BVmsk0Aj.cjs +0 -16
  127. package/dist/chunks/format-types-CSv0V7mm.cjs +0 -1
  128. package/dist/chunks/format-types-DZGgYj39.js +0 -1663
  129. package/dist/chunks/index-CJdxSyQq.js +0 -2578
  130. package/dist/chunks/index-DPv8_Ild.cjs +0 -1395
  131. package/dist/chunks/index-DRlMUglg.cjs +0 -4
  132. package/dist/chunks/metric-comparison-97zHGEx5.js +0 -387
  133. package/dist/chunks/metric-comparison-CUAJ8n4y.cjs +0 -1
  134. package/dist/chunks/pivot-result-lifecycle-BBabQ_da.js +0 -914
  135. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +0 -4
  136. package/dist/chunks/presentation-execution-BLfPTGX_.js +0 -637
  137. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +0 -1
  138. package/dist/chunks/report-preferences-dialog-D9ZCGh9l.js +0 -691
  139. package/dist/chunks/report-preferences-dialog-DaqTEcac.cjs +0 -1
  140. package/dist/chunks/switch-Cjk6G06r.cjs +0 -138
  141. package/dist/chunks/temporal-bucket-BnPxGrAi.js +0 -446
  142. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +0 -1
  143. package/dist/chunks/temporal-bucket-authoring-CgOuakGW.js +0 -205
  144. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +0 -1
  145. package/dist/chunks/temporal-result-owner-6peubmhU.js +0 -443
  146. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +0 -1
  147. package/dist/chunks/validators-9D4KBqKD.cjs +0 -1
@@ -1,443 +0,0 @@
1
- import "./validators-Cs74WVie.js";
2
- import "./analyze-result-contract-T-0Ntzys.js";
3
- import { f as k, C as V } from "./metric-comparison-97zHGEx5.js";
4
- const G = [
5
- "lg",
6
- "md",
7
- "sm",
8
- "xs",
9
- "xxs"
10
- ], U = 15, _ = /* @__PURE__ */ new Set([
11
- "previous_period",
12
- "same_period_last_year",
13
- "start_vs_end",
14
- "target"
15
- ]), I = /* @__PURE__ */ new Set([..._, "none", ""]);
16
- function l(e) {
17
- return !!e && typeof e == "object" && !Array.isArray(e);
18
- }
19
- function E(e) {
20
- const r = l(e.preferences) ? e.preferences : void 0, o = r && l(r.kpiVisualOptions) ? r.kpiVisualOptions : void 0, t = r && l(r.tableVisualOptions) ? r.tableVisualOptions : void 0;
21
- return {
22
- preferences: r,
23
- kpiOptions: o,
24
- kpiComparison: o && l(o.metricComparison) ? o.metricComparison : void 0,
25
- kpiComparisonPresent: !!o && "metricComparison" in o,
26
- tableOptions: t,
27
- tableComparison: t && l(t.metricComparison) ? t.metricComparison : void 0,
28
- tableComparisonPresent: !!t && "metricComparison" in t
29
- };
30
- }
31
- function O(e) {
32
- const r = [], o = (t, p) => {
33
- if (Array.isArray(t)) {
34
- t.forEach((n, c) => o(n, `${p}[${c}]`));
35
- return;
36
- }
37
- if (!l(t)) return;
38
- const m = t.config;
39
- if (l(m)) {
40
- const n = E(t), c = !!(n.kpiComparisonPresent || n.tableComparisonPresent), d = m.metricColumns, a = Array.isArray(d) ? d.flatMap(
41
- (s, i) => l(s) ? [{ index: i, metric: s }] : []
42
- ) : [];
43
- if ((a.some(({ metric: s }) => "comparisonType" in s) || c) && r.push({
44
- path: p,
45
- card: t,
46
- metrics: a,
47
- malformedMetricIndexes: Array.isArray(d) ? d.flatMap(
48
- (s, i) => l(s) ? [] : [i]
49
- ) : [],
50
- malformedMetricColumns: "metricColumns" in m && !Array.isArray(d),
51
- hasLegacyPresentation: c
52
- }), "metricColumns" in m || c) return;
53
- }
54
- Object.entries(t).forEach(
55
- ([n, c]) => o(c, p ? `${p}.${n}` : n)
56
- );
57
- };
58
- return o(e, "$"), r;
59
- }
60
- const L = {
61
- difference: "difference",
62
- change: "percent_change",
63
- change_difference: "both",
64
- ratio: "ratio"
65
- };
66
- function $(e, r) {
67
- if (!e) return;
68
- const o = Object.fromEntries(
69
- r.flatMap(
70
- (t) => typeof e[t] == "string" ? [[t, e[t]]] : []
71
- )
72
- );
73
- return Object.keys(o).length ? o : void 0;
74
- }
75
- function N(e, r, o) {
76
- if (e !== void 0) {
77
- if (!l(e)) {
78
- o.push({
79
- severity: "error",
80
- code: "invalid_legacy_comparison_presentation",
81
- path: r,
82
- message: "Legacy comparison formatOptions must be an object."
83
- });
84
- return;
85
- }
86
- Object.entries(e).forEach(([t, p]) => {
87
- if (t === "decimalPlaces") {
88
- (typeof p != "number" || !Number.isInteger(p) || p < 0 || p > 6) && o.push({
89
- severity: "error",
90
- code: "invalid_legacy_comparison_presentation",
91
- path: `${r}.decimalPlaces`,
92
- message: "Legacy comparison decimalPlaces must be an integer from 0 through 6."
93
- });
94
- return;
95
- }
96
- t === "type" && (p === void 0 || p === "auto") || p !== void 0 && o.push({
97
- severity: "error",
98
- code: "unsupported_comparison_format",
99
- path: `${r}.${t}`,
100
- message: `Legacy comparison format option "${t}" has no canonical presentation mapping.`
101
- });
102
- });
103
- }
104
- }
105
- function v(e, r) {
106
- const o = r === "kpi" ? e.calculationType : e.calculatedAs, t = r === "table" && o === void 0 ? "both" : L[String(o)], p = l(e.formatOptions) ? e.formatOptions : void 0, m = l(e.conditionalLabels) ? e.conditionalLabels : void 0, n = l(
107
- r === "kpi" ? e.colorConfig : e.colors
108
- ) ? r === "kpi" ? e.colorConfig : e.colors : void 0, c = {};
109
- if (t && (c.displayMode = t), typeof (p == null ? void 0 : p.decimalPlaces) == "number" && (c.precision = p.decimalPlaces), r === "kpi") {
110
- const s = e.showArrow !== !1, i = e.showColor !== !1;
111
- c.indicatorStyle = s ? i ? "arrow_badge" : "arrow" : i ? "badge" : "none", c.showColor = i, (e.position === "left" || e.position === "right" || e.position === "top") && (c.position = e.position), typeof e.conditionalLabel == "boolean" && (c.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (c.labelName = e.labelName);
112
- } else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (c.indicatorStyle = e.indicatorStyle);
113
- const d = m ? {
114
- ...$(m, ["increase", "decrease"]),
115
- ...typeof m.noChange == "string" ? { neutral: m.noChange } : typeof m.neutral == "string" ? { neutral: m.neutral } : {}
116
- } : void 0;
117
- d && Object.keys(d).length && (c.conditionalLabels = d);
118
- const a = n ? {
119
- ...$(n, ["increase", "decrease"]),
120
- ...typeof n.noChange == "string" ? { neutral: n.noChange } : typeof n.neutral == "string" ? { neutral: n.neutral } : {}
121
- } : void 0;
122
- return a && Object.keys(a).length && (c.colors = a), c;
123
- }
124
- function w(e) {
125
- return { ...V, ...e };
126
- }
127
- function P(e) {
128
- return e.some(({ metric: r }) => r.comparisonType === "previous_period" || r.comparisonType === "same_period_last_year" || r.comparisonType === "target" ? !0 : l(r.comparison) && r.comparison.mode === "explicit");
129
- }
130
- function C(e) {
131
- const r = e.card.config;
132
- return e.metrics.length === 2 && (r.groupByColumns === void 0 || Array.isArray(r.groupByColumns) && r.groupByColumns.length === 0);
133
- }
134
- function S(e, r, o, t) {
135
- const p = r === "kpi" ? [
136
- "enabled",
137
- "calculationType",
138
- "formatOptions",
139
- "showArrow",
140
- "showColor",
141
- "conditionalLabel",
142
- "labelName",
143
- "position",
144
- "conditionalLabels",
145
- "colorConfig",
146
- "lowerIsBetter"
147
- ] : [
148
- "calculatedAs",
149
- "indicatorStyle",
150
- "formatOptions",
151
- "colors",
152
- "lowerIsBetter"
153
- ];
154
- Object.keys(e).forEach((s) => {
155
- p.includes(s) || t.push({
156
- severity: "error",
157
- code: "invalid_legacy_comparison_presentation",
158
- path: `${o}.${s}`,
159
- message: `Unknown legacy comparison presentation field "${s}" cannot be dropped automatically.`
160
- });
161
- });
162
- const m = r === "kpi" ? "calculationType" : "calculatedAs";
163
- e[m] !== void 0 && !L[String(e[m])] && t.push({
164
- severity: "error",
165
- code: "invalid_legacy_comparison_presentation",
166
- path: `${o}.${m}`,
167
- message: `Legacy comparison ${m} is unsupported.`
168
- }), r === "kpi" && e.position !== void 0 && !["left", "right", "top"].includes(String(e.position)) && t.push({
169
- severity: "error",
170
- code: "invalid_legacy_comparison_presentation",
171
- path: `${o}.position`,
172
- message: "Legacy comparison position is unsupported."
173
- }), r === "kpi" && e.labelName !== void 0 && typeof e.labelName != "string" && t.push({
174
- severity: "error",
175
- code: "invalid_legacy_comparison_presentation",
176
- path: `${o}.labelName`,
177
- message: "Legacy comparison labelName must be a string."
178
- }), (r === "kpi" ? [
179
- ["conditionalLabels", ["increase", "decrease", "noChange"]],
180
- ["colorConfig", ["increase", "decrease", "noChange"]]
181
- ] : [["colors", ["increase", "decrease", "neutral"]]]).forEach(([s, i]) => {
182
- if (e[s] !== void 0) {
183
- if (!l(e[s])) {
184
- t.push({
185
- severity: "error",
186
- code: "invalid_legacy_comparison_presentation",
187
- path: `${o}.${s}`,
188
- message: `Legacy comparison ${s} must be an object.`
189
- });
190
- return;
191
- }
192
- Object.entries(e[s]).forEach(([u, f]) => {
193
- i.includes(u) ? typeof f != "string" && t.push({
194
- severity: "error",
195
- code: "invalid_legacy_comparison_presentation",
196
- path: `${o}.${s}.${u}`,
197
- message: `Legacy comparison ${s}.${u} must be a string.`
198
- }) : t.push({
199
- severity: "error",
200
- code: "invalid_legacy_comparison_presentation",
201
- path: `${o}.${s}.${u}`,
202
- message: `Unknown legacy comparison ${s} field "${u}" cannot be dropped automatically.`
203
- });
204
- });
205
- }
206
- }), (r === "kpi" ? ["enabled", "showArrow", "showColor", "conditionalLabel", "lowerIsBetter"] : ["lowerIsBetter"]).forEach((s) => {
207
- e[s] !== void 0 && typeof e[s] != "boolean" && t.push({
208
- severity: "error",
209
- code: "invalid_legacy_comparison_presentation",
210
- path: `${o}.${s}`,
211
- message: `Legacy comparison ${s} must be a boolean.`
212
- });
213
- }), r === "table" && e.indicatorStyle !== void 0 && !["arrow_badge", "arrow", "badge", "none"].includes(
214
- String(e.indicatorStyle)
215
- ) && t.push({
216
- severity: "error",
217
- code: "invalid_legacy_comparison_presentation",
218
- path: `${o}.indicatorStyle`,
219
- message: "Legacy comparison indicatorStyle is unsupported."
220
- }), N(e.formatOptions, `${o}.formatOptions`, t);
221
- const d = v(e, r);
222
- k(d, o).errors.forEach((s) => {
223
- t.push({
224
- severity: "error",
225
- code: "invalid_legacy_comparison_presentation",
226
- path: s.path || o,
227
- message: s.message
228
- });
229
- });
230
- }
231
- function A(e) {
232
- const r = E(e.card), o = r.kpiComparison ? v(r.kpiComparison, "kpi") : void 0, t = r.tableComparison ? v(r.tableComparison, "table") : void 0;
233
- return { namespaces: r, kpi: o, table: t, presentation: o || t };
234
- }
235
- function B(e) {
236
- const r = l(e.preferences) ? e.preferences : {}, o = l(r.kpiVisualOptions) ? r.kpiVisualOptions : {}, t = l(o.metricComparison) ? o.metricComparison : {}, p = l(r.tableVisualOptions) ? r.tableVisualOptions : {}, m = l(p.metricComparison) ? p.metricComparison : {};
237
- return o.lowerIsBetter === !0 || t.lowerIsBetter === !0 || m.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
238
- }
239
- function M(e) {
240
- switch (e.comparisonType) {
241
- case "previous_period":
242
- return { mode: "explicit", spec: { kind: "previous_period" } };
243
- case "same_period_last_year":
244
- return { mode: "explicit", spec: { kind: "previous_year" } };
245
- case "target":
246
- return {
247
- mode: "explicit",
248
- spec: { kind: "target", targetValue: e.targetValue }
249
- };
250
- default:
251
- return;
252
- }
253
- }
254
- function R(e) {
255
- const r = l(e.preferences) ? e.preferences : void 0;
256
- if (!r) return;
257
- const o = l(r.kpiVisualOptions) ? r.kpiVisualOptions : void 0;
258
- o && delete o.lowerIsBetter;
259
- const t = l(r.tableVisualOptions) ? r.tableVisualOptions : void 0, p = t && l(t.metricComparison) ? t.metricComparison : void 0;
260
- p && delete p.lowerIsBetter;
261
- }
262
- function z(e) {
263
- const r = O(e);
264
- if (!r.length)
265
- return { document: e, changed: !1, changes: [], diagnostics: [] };
266
- const o = [];
267
- if (r.forEach((n) => {
268
- var c, d, a, s;
269
- if (n.malformedMetricColumns && o.push({
270
- severity: "error",
271
- code: "malformed_metric_columns",
272
- path: `${n.path}.config.metricColumns`,
273
- message: "Metric columns must be an array before comparison migration."
274
- }), n.malformedMetricIndexes.forEach((i) => {
275
- o.push({
276
- severity: "error",
277
- code: "malformed_metric_columns",
278
- path: `${n.path}.config.metricColumns[${i}]`,
279
- message: "Metric columns must contain objects before comparison migration."
280
- });
281
- }), n.metrics.forEach(({ metric: i, index: u }) => {
282
- if (!("comparisonType" in i)) return;
283
- const f = `${n.path}.config.metricColumns[${u}]`, g = String(i.comparisonType || "");
284
- "comparison" in i && o.push({
285
- severity: "error",
286
- code: "conflicting_comparison_contracts",
287
- path: f,
288
- message: "Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."
289
- });
290
- const h = l(i.parameters) ? i.parameters : void 0, b = h && l(h.windowTransform) ? h.windowTransform : void 0;
291
- _.has(g) && (b == null ? void 0 : b.function) === "previous_period_delta" && o.push({
292
- severity: "error",
293
- code: "conflicting_comparison_window_transform",
294
- path: f,
295
- message: "A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."
296
- }), I.has(g) || o.push({
297
- severity: "error",
298
- code: "unsupported_comparison_type",
299
- path: `${f}.comparisonType`,
300
- message: `Unsupported legacy metric comparison type "${g}".`
301
- }), i.comparisonType === "target" && (typeof i.targetValue != "number" || !Number.isFinite(i.targetValue)) && o.push({
302
- severity: "error",
303
- code: "invalid_target_value",
304
- path: `${f}.targetValue`,
305
- message: "Legacy target comparison requires a finite metric targetValue."
306
- }), i.comparisonType === "start_vs_end" && o.push({
307
- severity: "error",
308
- code: "unsupported_start_vs_end",
309
- path: `${f}.comparisonType`,
310
- message: "start_vs_end is retired and cannot be migrated automatically."
311
- }), i.targetValue !== void 0 && i.comparisonType !== "target" && o.push({
312
- severity: "warning",
313
- code: "stray_target_value",
314
- path: `${f}.targetValue`,
315
- message: "Dead non-target targetValue will be removed without changing the baseline."
316
- });
317
- }), n.hasLegacyPresentation) {
318
- const { namespaces: i, kpi: u, table: f } = A(n), g = [
319
- (c = i.kpiOptions) == null ? void 0 : c.lowerIsBetter,
320
- (d = i.kpiComparison) == null ? void 0 : d.lowerIsBetter,
321
- (a = i.tableComparison) == null ? void 0 : a.lowerIsBetter
322
- ].filter((h) => typeof h == "boolean");
323
- new Set(g).size > 1 && o.push({
324
- severity: "error",
325
- code: "conflicting_legacy_polarity",
326
- path: `${n.path}.preferences`,
327
- message: "Legacy comparison polarity values disagree; resolve the conflict before migration."
328
- }), ((s = i.kpiOptions) == null ? void 0 : s.lowerIsBetter) !== void 0 && typeof i.kpiOptions.lowerIsBetter != "boolean" && o.push({
329
- severity: "error",
330
- code: "invalid_legacy_comparison_presentation",
331
- path: `${n.path}.preferences.kpiVisualOptions.lowerIsBetter`,
332
- message: "Legacy comparison lowerIsBetter must be a boolean."
333
- }), i.kpiComparisonPresent && !i.kpiComparison && o.push({
334
- severity: "error",
335
- code: "invalid_legacy_comparison_presentation",
336
- path: `${n.path}.preferences.kpiVisualOptions.metricComparison`,
337
- message: "Legacy KPI comparison presentation must be an object."
338
- }), i.tableComparisonPresent && !i.tableComparison && o.push({
339
- severity: "error",
340
- code: "invalid_legacy_comparison_presentation",
341
- path: `${n.path}.preferences.tableVisualOptions.metricComparison`,
342
- message: "Legacy table comparison presentation must be an object."
343
- }), "comparisonPresentation" in (i.preferences || {}) && o.push({
344
- severity: "error",
345
- code: "conflicting_comparison_presentation_contracts",
346
- path: `${n.path}.preferences.comparisonPresentation`,
347
- message: "Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."
348
- }), i.kpiComparison && typeof i.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (i.preferences || {}) && C(n) && o.push({
349
- severity: "error",
350
- code: "conflicting_comparison_presentation_contracts",
351
- path: `${n.path}.preferences.metricPairComparisonEnabled`,
352
- message: "Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."
353
- }), i.kpiComparison && S(
354
- i.kpiComparison,
355
- "kpi",
356
- `${n.path}.preferences.kpiVisualOptions.metricComparison`,
357
- o
358
- ), i.tableComparison && S(
359
- i.tableComparison,
360
- "table",
361
- `${n.path}.preferences.tableVisualOptions.metricComparison`,
362
- o
363
- ), u && f && JSON.stringify(w(u)) !== JSON.stringify(w(f)) && o.push({
364
- severity: "error",
365
- code: "conflicting_legacy_presentation_namespaces",
366
- path: `${n.path}.preferences`,
367
- message: "KPI and table comparison presentation values disagree; resolve the conflict before migration."
368
- });
369
- }
370
- }), o.some((n) => n.severity === "error"))
371
- return { document: e, changed: !1, changes: [], diagnostics: o };
372
- const t = JSON.parse(JSON.stringify(e)), p = O(t), m = [];
373
- return p.forEach((n) => {
374
- var d;
375
- const c = B(n.card);
376
- if (n.metrics.forEach(({ metric: a, index: s }) => {
377
- if (!("comparisonType" in a)) return;
378
- const i = String(a.comparisonType || ""), u = `${n.path}.config.metricColumns[${s}]`, f = M(a), g = ["comparisonType"];
379
- delete a.comparisonType, "targetValue" in a && (delete a.targetValue, g.push("targetValue")), "comparisonDisplay" in a && (delete a.comparisonDisplay, g.push("comparisonDisplay")), f ? a.comparison = f : delete a.comparison, _.has(i) && (a.comparisonPolarity = c), m.push({
380
- kind: "metric",
381
- path: u,
382
- metricId: typeof a.id == "string" ? a.id : void 0,
383
- legacyType: i,
384
- comparison: f,
385
- comparisonPolarity: _.has(i) ? c : void 0,
386
- removedFields: g
387
- });
388
- }), R(n.card), n.hasLegacyPresentation) {
389
- const { namespaces: a, presentation: s } = A(n), i = (d = a.kpiComparison) == null ? void 0 : d.enabled, u = {
390
- ...s
391
- };
392
- typeof i == "boolean" && P(n.metrics) && (u.showComparison = i);
393
- const f = typeof i == "boolean" && C(n) ? i : void 0, g = typeof i == "boolean" && !P(n.metrics) && !C(n) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, h = a.preferences, b = [];
394
- n.metrics.forEach(({ metric: y }) => {
395
- "comparisonPolarity" in y || (y.comparisonPolarity = c, typeof y.id == "string" && b.push(y.id));
396
- }), Object.keys(u).length && (h.comparisonPresentation = u), f !== void 0 && (h.metricPairComparisonEnabled = f), a.kpiOptions && delete a.kpiOptions.metricComparison, a.tableOptions && delete a.tableOptions.metricComparison, m.push({
397
- kind: "presentation",
398
- path: `${n.path}.preferences`,
399
- comparisonPresentation: Object.keys(u).length ? u : void 0,
400
- metricPairComparisonEnabled: f,
401
- comparisonPolarityMetricIds: b,
402
- intentionallyDiscardedFields: g,
403
- removedFields: [
404
- ...a.kpiComparison ? ["kpiVisualOptions.metricComparison"] : [],
405
- ...a.tableComparison ? ["tableVisualOptions.metricComparison"] : []
406
- ]
407
- });
408
- }
409
- }), { document: t, changed: !0, changes: m, diagnostics: o };
410
- }
411
- const D = [
412
- "bar",
413
- "horizontalBar",
414
- "line",
415
- "area",
416
- "stackedArea",
417
- "combo",
418
- "stackedBar",
419
- "stackedLine"
420
- ], j = new Set(
421
- D
422
- );
423
- function x(e) {
424
- return typeof e == "string" && j.has(e);
425
- }
426
- function J(e) {
427
- return e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || x(e);
428
- }
429
- function T(e) {
430
- return !!(e != null && e.trim());
431
- }
432
- function K(e) {
433
- return T(e.sql) || T(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
434
- }
435
- export {
436
- U as D,
437
- D as S,
438
- G as a,
439
- x as i,
440
- K as r,
441
- J as s,
442
- z as t
443
- };
@@ -1 +0,0 @@
1
- "use strict";require("./validators-9D4KBqKD.cjs");require("./analyze-result-contract-BHb7sUUW.cjs");const E=require("./metric-comparison-CUAJ8n4y.cjs"),N=["lg","md","sm","xs","xxs"],R=15,y=new Set(["previous_period","same_period_last_year","start_vs_end","target"]),B=new Set([...y,"none",""]);function l(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function L(e){const r=l(e.preferences)?e.preferences:void 0,o=r&&l(r.kpiVisualOptions)?r.kpiVisualOptions:void 0,n=r&&l(r.tableVisualOptions)?r.tableVisualOptions:void 0;return{preferences:r,kpiOptions:o,kpiComparison:o&&l(o.metricComparison)?o.metricComparison:void 0,kpiComparisonPresent:!!o&&"metricComparison"in o,tableOptions:n,tableComparison:n&&l(n.metricComparison)?n.metricComparison:void 0,tableComparisonPresent:!!n&&"metricComparison"in n}}function O(e){const r=[],o=(n,p)=>{if(Array.isArray(n)){n.forEach((t,c)=>o(t,`${p}[${c}]`));return}if(!l(n))return;const m=n.config;if(l(m)){const t=L(n),c=!!(t.kpiComparisonPresent||t.tableComparisonPresent),d=m.metricColumns,a=Array.isArray(d)?d.flatMap((s,i)=>l(s)?[{index:i,metric:s}]:[]):[];if((a.some(({metric:s})=>"comparisonType"in s)||c)&&r.push({path:p,card:n,metrics:a,malformedMetricIndexes:Array.isArray(d)?d.flatMap((s,i)=>l(s)?[]:[i]):[],malformedMetricColumns:"metricColumns"in m&&!Array.isArray(d),hasLegacyPresentation:c}),"metricColumns"in m||c)return}Object.entries(n).forEach(([t,c])=>o(c,p?`${p}.${t}`:t))};return o(e,"$"),r}const I={difference:"difference",change:"percent_change",change_difference:"both",ratio:"ratio"};function A(e,r){if(!e)return;const o=Object.fromEntries(r.flatMap(n=>typeof e[n]=="string"?[[n,e[n]]]:[]));return Object.keys(o).length?o:void 0}function D(e,r,o){if(e!==void 0){if(!l(e)){o.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:r,message:"Legacy comparison formatOptions must be an object."});return}Object.entries(e).forEach(([n,p])=>{if(n==="decimalPlaces"){(typeof p!="number"||!Number.isInteger(p)||p<0||p>6)&&o.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${r}.decimalPlaces`,message:"Legacy comparison decimalPlaces must be an integer from 0 through 6."});return}n==="type"&&(p===void 0||p==="auto")||p!==void 0&&o.push({severity:"error",code:"unsupported_comparison_format",path:`${r}.${n}`,message:`Legacy comparison format option "${n}" has no canonical presentation mapping.`})})}}function v(e,r){const o=r==="kpi"?e.calculationType:e.calculatedAs,n=r==="table"&&o===void 0?"both":I[String(o)],p=l(e.formatOptions)?e.formatOptions:void 0,m=l(e.conditionalLabels)?e.conditionalLabels:void 0,t=l(r==="kpi"?e.colorConfig:e.colors)?r==="kpi"?e.colorConfig:e.colors:void 0,c={};if(n&&(c.displayMode=n),typeof(p==null?void 0:p.decimalPlaces)=="number"&&(c.precision=p.decimalPlaces),r==="kpi"){const s=e.showArrow!==!1,i=e.showColor!==!1;c.indicatorStyle=s?i?"arrow_badge":"arrow":i?"badge":"none",c.showColor=i,(e.position==="left"||e.position==="right"||e.position==="top")&&(c.position=e.position),typeof e.conditionalLabel=="boolean"&&(c.conditionalLabel=e.conditionalLabel),typeof e.labelName=="string"&&(c.labelName=e.labelName)}else(e.indicatorStyle==="arrow_badge"||e.indicatorStyle==="arrow"||e.indicatorStyle==="badge"||e.indicatorStyle==="none")&&(c.indicatorStyle=e.indicatorStyle);const d=m?{...A(m,["increase","decrease"]),...typeof m.noChange=="string"?{neutral:m.noChange}:typeof m.neutral=="string"?{neutral:m.neutral}:{}}:void 0;d&&Object.keys(d).length&&(c.conditionalLabels=d);const a=t?{...A(t,["increase","decrease"]),...typeof t.noChange=="string"?{neutral:t.noChange}:typeof t.neutral=="string"?{neutral:t.neutral}:{}}:void 0;return a&&Object.keys(a).length&&(c.colors=a),c}function $(e){return{...E.COMPARISON_PRESENTATION_DEFAULTS,...e}}function w(e){return e.some(({metric:r})=>r.comparisonType==="previous_period"||r.comparisonType==="same_period_last_year"||r.comparisonType==="target"?!0:l(r.comparison)&&r.comparison.mode==="explicit")}function C(e){const r=e.card.config;return e.metrics.length===2&&(r.groupByColumns===void 0||Array.isArray(r.groupByColumns)&&r.groupByColumns.length===0)}function S(e,r,o,n){const p=r==="kpi"?["enabled","calculationType","formatOptions","showArrow","showColor","conditionalLabel","labelName","position","conditionalLabels","colorConfig","lowerIsBetter"]:["calculatedAs","indicatorStyle","formatOptions","colors","lowerIsBetter"];Object.keys(e).forEach(s=>{p.includes(s)||n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${s}`,message:`Unknown legacy comparison presentation field "${s}" cannot be dropped automatically.`})});const m=r==="kpi"?"calculationType":"calculatedAs";e[m]!==void 0&&!I[String(e[m])]&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${m}`,message:`Legacy comparison ${m} is unsupported.`}),r==="kpi"&&e.position!==void 0&&!["left","right","top"].includes(String(e.position))&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.position`,message:"Legacy comparison position is unsupported."}),r==="kpi"&&e.labelName!==void 0&&typeof e.labelName!="string"&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.labelName`,message:"Legacy comparison labelName must be a string."}),(r==="kpi"?[["conditionalLabels",["increase","decrease","noChange"]],["colorConfig",["increase","decrease","noChange"]]]:[["colors",["increase","decrease","neutral"]]]).forEach(([s,i])=>{if(e[s]!==void 0){if(!l(e[s])){n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${s}`,message:`Legacy comparison ${s} must be an object.`});return}Object.entries(e[s]).forEach(([u,f])=>{i.includes(u)?typeof f!="string"&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${s}.${u}`,message:`Legacy comparison ${s}.${u} must be a string.`}):n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${s}.${u}`,message:`Unknown legacy comparison ${s} field "${u}" cannot be dropped automatically.`})})}}),(r==="kpi"?["enabled","showArrow","showColor","conditionalLabel","lowerIsBetter"]:["lowerIsBetter"]).forEach(s=>{e[s]!==void 0&&typeof e[s]!="boolean"&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.${s}`,message:`Legacy comparison ${s} must be a boolean.`})}),r==="table"&&e.indicatorStyle!==void 0&&!["arrow_badge","arrow","badge","none"].includes(String(e.indicatorStyle))&&n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${o}.indicatorStyle`,message:"Legacy comparison indicatorStyle is unsupported."}),D(e.formatOptions,`${o}.formatOptions`,n);const d=v(e,r);E.validateComparisonPresentationSpec(d,o).errors.forEach(s=>{n.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:s.path||o,message:s.message})})}function T(e){const r=L(e.card),o=r.kpiComparison?v(r.kpiComparison,"kpi"):void 0,n=r.tableComparison?v(r.tableComparison,"table"):void 0;return{namespaces:r,kpi:o,table:n,presentation:o||n}}function M(e){const r=l(e.preferences)?e.preferences:{},o=l(r.kpiVisualOptions)?r.kpiVisualOptions:{},n=l(o.metricComparison)?o.metricComparison:{},p=l(r.tableVisualOptions)?r.tableVisualOptions:{},m=l(p.metricComparison)?p.metricComparison:{};return o.lowerIsBetter===!0||n.lowerIsBetter===!0||m.lowerIsBetter===!0?"lower_is_better":"higher_is_better"}function j(e){switch(e.comparisonType){case"previous_period":return{mode:"explicit",spec:{kind:"previous_period"}};case"same_period_last_year":return{mode:"explicit",spec:{kind:"previous_year"}};case"target":return{mode:"explicit",spec:{kind:"target",targetValue:e.targetValue}};default:return}}function x(e){const r=l(e.preferences)?e.preferences:void 0;if(!r)return;const o=l(r.kpiVisualOptions)?r.kpiVisualOptions:void 0;o&&delete o.lowerIsBetter;const n=l(r.tableVisualOptions)?r.tableVisualOptions:void 0,p=n&&l(n.metricComparison)?n.metricComparison:void 0;p&&delete p.lowerIsBetter}function H(e){const r=O(e);if(!r.length)return{document:e,changed:!1,changes:[],diagnostics:[]};const o=[];if(r.forEach(t=>{var c,d,a,s;if(t.malformedMetricColumns&&o.push({severity:"error",code:"malformed_metric_columns",path:`${t.path}.config.metricColumns`,message:"Metric columns must be an array before comparison migration."}),t.malformedMetricIndexes.forEach(i=>{o.push({severity:"error",code:"malformed_metric_columns",path:`${t.path}.config.metricColumns[${i}]`,message:"Metric columns must contain objects before comparison migration."})}),t.metrics.forEach(({metric:i,index:u})=>{if(!("comparisonType"in i))return;const f=`${t.path}.config.metricColumns[${u}]`,g=String(i.comparisonType||"");"comparison"in i&&o.push({severity:"error",code:"conflicting_comparison_contracts",path:f,message:"Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."});const h=l(i.parameters)?i.parameters:void 0,b=h&&l(h.windowTransform)?h.windowTransform:void 0;y.has(g)&&(b==null?void 0:b.function)==="previous_period_delta"&&o.push({severity:"error",code:"conflicting_comparison_window_transform",path:f,message:"A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."}),B.has(g)||o.push({severity:"error",code:"unsupported_comparison_type",path:`${f}.comparisonType`,message:`Unsupported legacy metric comparison type "${g}".`}),i.comparisonType==="target"&&(typeof i.targetValue!="number"||!Number.isFinite(i.targetValue))&&o.push({severity:"error",code:"invalid_target_value",path:`${f}.targetValue`,message:"Legacy target comparison requires a finite metric targetValue."}),i.comparisonType==="start_vs_end"&&o.push({severity:"error",code:"unsupported_start_vs_end",path:`${f}.comparisonType`,message:"start_vs_end is retired and cannot be migrated automatically."}),i.targetValue!==void 0&&i.comparisonType!=="target"&&o.push({severity:"warning",code:"stray_target_value",path:`${f}.targetValue`,message:"Dead non-target targetValue will be removed without changing the baseline."})}),t.hasLegacyPresentation){const{namespaces:i,kpi:u,table:f}=T(t),g=[(c=i.kpiOptions)==null?void 0:c.lowerIsBetter,(d=i.kpiComparison)==null?void 0:d.lowerIsBetter,(a=i.tableComparison)==null?void 0:a.lowerIsBetter].filter(h=>typeof h=="boolean");new Set(g).size>1&&o.push({severity:"error",code:"conflicting_legacy_polarity",path:`${t.path}.preferences`,message:"Legacy comparison polarity values disagree; resolve the conflict before migration."}),((s=i.kpiOptions)==null?void 0:s.lowerIsBetter)!==void 0&&typeof i.kpiOptions.lowerIsBetter!="boolean"&&o.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${t.path}.preferences.kpiVisualOptions.lowerIsBetter`,message:"Legacy comparison lowerIsBetter must be a boolean."}),i.kpiComparisonPresent&&!i.kpiComparison&&o.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${t.path}.preferences.kpiVisualOptions.metricComparison`,message:"Legacy KPI comparison presentation must be an object."}),i.tableComparisonPresent&&!i.tableComparison&&o.push({severity:"error",code:"invalid_legacy_comparison_presentation",path:`${t.path}.preferences.tableVisualOptions.metricComparison`,message:"Legacy table comparison presentation must be an object."}),"comparisonPresentation"in(i.preferences||{})&&o.push({severity:"error",code:"conflicting_comparison_presentation_contracts",path:`${t.path}.preferences.comparisonPresentation`,message:"Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."}),i.kpiComparison&&typeof i.kpiComparison.enabled=="boolean"&&"metricPairComparisonEnabled"in(i.preferences||{})&&C(t)&&o.push({severity:"error",code:"conflicting_comparison_presentation_contracts",path:`${t.path}.preferences.metricPairComparisonEnabled`,message:"Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."}),i.kpiComparison&&S(i.kpiComparison,"kpi",`${t.path}.preferences.kpiVisualOptions.metricComparison`,o),i.tableComparison&&S(i.tableComparison,"table",`${t.path}.preferences.tableVisualOptions.metricComparison`,o),u&&f&&JSON.stringify($(u))!==JSON.stringify($(f))&&o.push({severity:"error",code:"conflicting_legacy_presentation_namespaces",path:`${t.path}.preferences`,message:"KPI and table comparison presentation values disagree; resolve the conflict before migration."})}}),o.some(t=>t.severity==="error"))return{document:e,changed:!1,changes:[],diagnostics:o};const n=JSON.parse(JSON.stringify(e)),p=O(n),m=[];return p.forEach(t=>{var d;const c=M(t.card);if(t.metrics.forEach(({metric:a,index:s})=>{if(!("comparisonType"in a))return;const i=String(a.comparisonType||""),u=`${t.path}.config.metricColumns[${s}]`,f=j(a),g=["comparisonType"];delete a.comparisonType,"targetValue"in a&&(delete a.targetValue,g.push("targetValue")),"comparisonDisplay"in a&&(delete a.comparisonDisplay,g.push("comparisonDisplay")),f?a.comparison=f:delete a.comparison,y.has(i)&&(a.comparisonPolarity=c),m.push({kind:"metric",path:u,metricId:typeof a.id=="string"?a.id:void 0,legacyType:i,comparison:f,comparisonPolarity:y.has(i)?c:void 0,removedFields:g})}),x(t.card),t.hasLegacyPresentation){const{namespaces:a,presentation:s}=T(t),i=(d=a.kpiComparison)==null?void 0:d.enabled,u={...s};typeof i=="boolean"&&w(t.metrics)&&(u.showComparison=i);const f=typeof i=="boolean"&&C(t)?i:void 0,g=typeof i=="boolean"&&!w(t.metrics)&&!C(t)?["kpiVisualOptions.metricComparison.enabled"]:void 0,h=a.preferences,b=[];t.metrics.forEach(({metric:_})=>{"comparisonPolarity"in _||(_.comparisonPolarity=c,typeof _.id=="string"&&b.push(_.id))}),Object.keys(u).length&&(h.comparisonPresentation=u),f!==void 0&&(h.metricPairComparisonEnabled=f),a.kpiOptions&&delete a.kpiOptions.metricComparison,a.tableOptions&&delete a.tableOptions.metricComparison,m.push({kind:"presentation",path:`${t.path}.preferences`,comparisonPresentation:Object.keys(u).length?u:void 0,metricPairComparisonEnabled:f,comparisonPolarityMetricIds:b,intentionallyDiscardedFields:g,removedFields:[...a.kpiComparison?["kpiVisualOptions.metricComparison"]:[],...a.tableComparison?["tableVisualOptions.metricComparison"]:[]]})}}),{document:n,changed:!0,changes:m,diagnostics:o}}const k=["bar","horizontalBar","line","area","stackedArea","combo","stackedBar","stackedLine"],Y=new Set(k);function V(e){return typeof e=="string"&&Y.has(e)}function G(e){return e==="table"||e==="aggregateTable"||e==="pivotTable"||e==="custom"||V(e)}function P(e){return!!(e!=null&&e.trim())}function F(e){return P(e.sql)||P(e.normalizedPython)?"freeform":e.hasExecutableConfig?"config":"none"}exports.DASHBOARD_AUTHORING_BREAKPOINTS=N;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=R;exports.SEMAPHOR_CARTESIAN_CHART_TYPES=k;exports.isSemaphorCartesianChartType=V;exports.resolveTemporalResultOwner=F;exports.supportsCanonicalDashboardTemporalResult=G;exports.transformComparisonDocument=H;