react-semaphor 0.1.459 → 0.1.461
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.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +32 -32
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{analyze-result-contract-BbRJ-C06.js → analyze-result-contract-DROq4vgY.js} +1 -1
- package/dist/chunks/{analyze-result-contract-LPDNldic.cjs → analyze-result-contract-DSGoFuXQ.cjs} +1 -1
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +33 -0
- package/dist/chunks/canonical-result-keys-Cb96edol.cjs +1 -0
- package/dist/chunks/{common-types-H51FLKB7.js → common-types-BHVKgxRR.js} +1 -1
- package/dist/chunks/{common-types-C57kJ59w.cjs → common-types-BcV9PD9D.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-ClCj98sq.js → dashboard-briefing-launcher-3owMxX5K.js} +60 -61
- package/dist/chunks/{dashboard-briefing-launcher-DHtEouuH.cjs → dashboard-briefing-launcher-xuGrw8H3.cjs} +2 -2
- package/dist/chunks/{dashboard-controls-B8gsKlxc.js → dashboard-controls-B4GvjGr1.js} +44 -45
- package/dist/chunks/{dashboard-controls-VRShl9J0.cjs → dashboard-controls-Bpm_xOXQ.cjs} +1 -1
- package/dist/chunks/dashboard-filter-value-compatibility-KXIyvbhc.js +677 -0
- package/dist/chunks/dashboard-filter-value-compatibility-UapptYnn.cjs +1 -0
- package/dist/chunks/dashboard-input-contract-BkRFQ7Tq.cjs +1 -0
- package/dist/chunks/{dashboard-date-comparison-definition-DC3ekV2S.js → dashboard-input-contract-D5dxTWJ5.js} +41 -25
- package/dist/chunks/{dashboard-json-i_Auue_K.js → dashboard-json-DzyxoBp-.js} +13 -14
- package/dist/chunks/dashboard-json-yLM01xK4.cjs +1 -0
- package/dist/chunks/{edit-dashboard-visual-DWWyT55u.cjs → edit-dashboard-visual-1T278Nr_.cjs} +28 -28
- package/dist/chunks/{edit-dashboard-visual-B3JF0fe4.js → edit-dashboard-visual-nwSasO_j.js} +880 -894
- package/dist/chunks/{editor-action-buttons-BTlCsP63.cjs → editor-action-buttons-CX1Pken3.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-C9x3nGnb.js → editor-action-buttons-Dqw0asfA.js} +28 -28
- package/dist/chunks/index-B1qplNxl.cjs +1392 -0
- package/dist/chunks/{index-BS2-ZZGf.js → index-DazD5k0F.js} +45362 -42931
- package/dist/chunks/{index-BIFLI8ul.js → index-De_7nrwb.js} +10 -10
- package/dist/chunks/index-DjjKJPDy.cjs +4 -0
- package/dist/chunks/{matrix-result-contract-CofATICL.js → matrix-result-contract-BTpPuHOc.js} +88 -104
- package/dist/chunks/matrix-result-contract-ZRNfeIbI.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-B9nXXKlW.cjs → pivot-header-presentation-BijPbP33.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-D-0jvUwn.js → pivot-header-presentation-DW0gKG8g.js} +2 -2
- package/dist/chunks/{pivot-result-identity-Bb4EixVN.cjs → pivot-result-identity-DxHtiKVj.cjs} +1 -1
- package/dist/chunks/{pivot-result-identity-DU1v-5Xk.js → pivot-result-identity-Z9tN2tEV.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DTLRuDEW.cjs → pivot-result-lifecycle-BXzIlQVu.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-CHWEGU2o.js → pivot-result-lifecycle-g2U-vzQb.js} +7 -7
- package/dist/chunks/{raw-temporal-contract-BtjH_G-d.cjs → raw-temporal-contract-DfAvqNMo.cjs} +1 -1
- package/dist/chunks/{raw-temporal-contract-CxncLze5.js → raw-temporal-contract-UtAqoOZO.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-BK0yAJnQ.cjs → report-preferences-dialog-DKPyjiCt.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-BDpkcUtz.js → report-preferences-dialog-Dv3vCCFt.js} +6 -6
- package/dist/chunks/{report-runtime-context-DqxS4wbi.cjs → report-runtime-context-C0NfLPfc.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-SM6YO61_.js → report-runtime-context-CNncA3VD.js} +11 -11
- package/dist/chunks/{saved-temporal-bucket-format-CFfWXRl9.cjs → saved-temporal-bucket-format-3QKveR3v.cjs} +1 -1
- package/dist/chunks/{saved-temporal-bucket-format-SGAV0ivR.js → saved-temporal-bucket-format-Dd2eixTH.js} +11 -11
- package/dist/chunks/switch-DBZsEV0U.cjs +138 -0
- package/dist/chunks/{switch-DQR-Va05.js → switch-kPUJEC1A.js} +6615 -5219
- package/dist/chunks/{temporal-bucket-5UYEotyQ.js → temporal-bucket-C85rmFmC.js} +4 -4
- package/dist/chunks/temporal-bucket-authoring-1fZuPAVb.js +653 -0
- package/dist/chunks/temporal-bucket-authoring-BK1UhYpD.cjs +1 -0
- package/dist/chunks/{temporal-bucket-contract-D5d-xEl3.js → temporal-bucket-contract-DXXNZssK.js} +1 -1
- package/dist/chunks/{temporal-bucket-contract-D2-93DGr.cjs → temporal-bucket-contract-xFkvboaw.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-DHY1y9lq.cjs → temporal-bucket-pMfghsLX.cjs} +1 -1
- package/dist/chunks/{token-types-GbxRUozo.js → token-types-BLxc7UwR.js} +1 -1
- package/dist/chunks/{token-types-D7CaaI80.cjs → token-types-BYYO109W.cjs} +1 -1
- package/dist/chunks/{update-policy-hednMF-0.js → update-policy-CB8XJIoY.js} +1 -1
- package/dist/chunks/{update-policy-BmiOd0PB.cjs → update-policy-DMjjGjQY.cjs} +1 -1
- package/dist/chunks/{validators-DEmd8Sin.js → validators-DVd8s3qY.js} +416 -350
- package/dist/chunks/validators-dJlwubP4.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +328 -311
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +55 -55
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +61 -56
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +15 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +154 -155
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/analytics-protocol.d.ts +16 -8
- package/dist/types/briefings.d.ts +95 -13
- package/dist/types/dashboard-assistant.d.ts +11 -6
- package/dist/types/dashboard-authoring.d.ts +257 -19
- package/dist/types/dashboard.d.ts +109 -14
- package/dist/types/data-app-builder.d.ts +11 -6
- package/dist/types/data-app-codegen-node.d.ts +16 -8
- package/dist/types/data-app-codegen.d.ts +16 -8
- package/dist/types/data-app-sdk-adapters.d.ts +17 -11
- package/dist/types/data-app-sdk-validation.d.ts +17 -11
- package/dist/types/data-app-sdk.d.ts +17 -11
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/main.d.ts +225 -20
- package/dist/types/shared.d.ts +95 -13
- package/dist/types/surfboard.d.ts +109 -14
- package/dist/types/types.d.ts +109 -14
- package/package.json +1 -1
- package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +0 -1
- package/dist/chunks/canonical-result-keys-D6avdjpA.js +0 -467
- package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +0 -1
- package/dist/chunks/dashboard-json-BhvPMpZA.cjs +0 -1
- package/dist/chunks/index-DHF-2AqS.cjs +0 -1392
- package/dist/chunks/index-k8tEp0ys.cjs +0 -4
- package/dist/chunks/matrix-result-contract-zamd9euI.cjs +0 -1
- package/dist/chunks/switch-f3TuZNLr.cjs +0 -138
- package/dist/chunks/temporal-bucket-authoring-K1kE6R_z.js +0 -222
- package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +0 -1
- package/dist/chunks/validators-BDYprKI9.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
2
|
var Y = (e, r, t) => r in e ? x(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var T = (e, r, t) => Y(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import {
|
|
4
|
+
import { h as L, al as O, ak as R, aj as U } from "./validators-DVd8s3qY.js";
|
|
5
5
|
import { canonicalizeSupportedLocale as I } from "../value-format-preferences/index.js";
|
|
6
6
|
const q = "higher_is_better", fe = {
|
|
7
7
|
displayMode: "difference",
|
|
@@ -797,9 +797,9 @@ export {
|
|
|
797
797
|
V as c,
|
|
798
798
|
ye as d,
|
|
799
799
|
_e as e,
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
he as f,
|
|
801
|
+
we as g,
|
|
802
|
+
$e as h,
|
|
803
803
|
J as i,
|
|
804
804
|
te as j,
|
|
805
805
|
Ce as k,
|
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import { aj as O, ak as N } from "./validators-DVd8s3qY.js";
|
|
2
|
+
import "./analyze-result-contract-DROq4vgY.js";
|
|
3
|
+
import { f as R, C as j, h as x } from "./temporal-bucket-C85rmFmC.js";
|
|
4
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as B } from "../value-format-preferences/index.js";
|
|
5
|
+
const M = /* @__PURE__ */ new Set([
|
|
6
|
+
"previous_period",
|
|
7
|
+
"same_period_last_year",
|
|
8
|
+
"start_vs_end",
|
|
9
|
+
"target"
|
|
10
|
+
]), J = /* @__PURE__ */ new Set([...M, "none", ""]);
|
|
11
|
+
function m(e) {
|
|
12
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
13
|
+
}
|
|
14
|
+
function H(e) {
|
|
15
|
+
const o = m(e.preferences) ? e.preferences : void 0, t = o && m(o.kpiVisualOptions) ? o.kpiVisualOptions : void 0, r = o && m(o.tableVisualOptions) ? o.tableVisualOptions : void 0;
|
|
16
|
+
return {
|
|
17
|
+
preferences: o,
|
|
18
|
+
kpiOptions: t,
|
|
19
|
+
kpiComparison: t && m(t.metricComparison) ? t.metricComparison : void 0,
|
|
20
|
+
kpiComparisonPresent: !!t && "metricComparison" in t,
|
|
21
|
+
tableOptions: r,
|
|
22
|
+
tableComparison: r && m(r.metricComparison) ? r.metricComparison : void 0,
|
|
23
|
+
tableComparisonPresent: !!r && "metricComparison" in r
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function w(e) {
|
|
27
|
+
const o = [], t = (r, s) => {
|
|
28
|
+
if (Array.isArray(r)) {
|
|
29
|
+
r.forEach((n, a) => t(n, `${s}[${a}]`));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!m(r)) return;
|
|
33
|
+
const c = r.config;
|
|
34
|
+
if (m(c)) {
|
|
35
|
+
const n = H(r), a = !!(n.kpiComparisonPresent || n.tableComparisonPresent), u = c.metricColumns, l = Array.isArray(u) ? u.flatMap(
|
|
36
|
+
(p, i) => m(p) ? [{ index: i, metric: p }] : []
|
|
37
|
+
) : [];
|
|
38
|
+
if ((l.some(({ metric: p }) => "comparisonType" in p) || a) && o.push({
|
|
39
|
+
path: s,
|
|
40
|
+
card: r,
|
|
41
|
+
metrics: l,
|
|
42
|
+
malformedMetricIndexes: Array.isArray(u) ? u.flatMap(
|
|
43
|
+
(p, i) => m(p) ? [] : [i]
|
|
44
|
+
) : [],
|
|
45
|
+
malformedMetricColumns: "metricColumns" in c && !Array.isArray(u),
|
|
46
|
+
hasLegacyPresentation: a
|
|
47
|
+
}), "metricColumns" in c || a) return;
|
|
48
|
+
}
|
|
49
|
+
Object.entries(r).forEach(
|
|
50
|
+
([n, a]) => t(a, s ? `${s}.${n}` : n)
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
return t(e, "$"), o;
|
|
54
|
+
}
|
|
55
|
+
const I = {
|
|
56
|
+
difference: "difference",
|
|
57
|
+
change: "percent_change",
|
|
58
|
+
change_difference: "both",
|
|
59
|
+
ratio: "ratio"
|
|
60
|
+
};
|
|
61
|
+
function D(e, o) {
|
|
62
|
+
if (!e) return;
|
|
63
|
+
const t = Object.fromEntries(
|
|
64
|
+
o.flatMap(
|
|
65
|
+
(r) => typeof e[r] == "string" ? [[r, e[r]]] : []
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
return Object.keys(t).length ? t : void 0;
|
|
69
|
+
}
|
|
70
|
+
function U(e, o, t) {
|
|
71
|
+
if (e !== void 0) {
|
|
72
|
+
if (!m(e)) {
|
|
73
|
+
t.push({
|
|
74
|
+
severity: "error",
|
|
75
|
+
code: "invalid_legacy_comparison_presentation",
|
|
76
|
+
path: o,
|
|
77
|
+
message: "Legacy comparison formatOptions must be an object."
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
Object.entries(e).forEach(([r, s]) => {
|
|
82
|
+
if (r === "decimalPlaces") {
|
|
83
|
+
(typeof s != "number" || !Number.isInteger(s) || s < 0 || s > 6) && t.push({
|
|
84
|
+
severity: "error",
|
|
85
|
+
code: "invalid_legacy_comparison_presentation",
|
|
86
|
+
path: `${o}.decimalPlaces`,
|
|
87
|
+
message: "Legacy comparison decimalPlaces must be an integer from 0 through 6."
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
r === "type" && (s === void 0 || s === "auto") || s !== void 0 && t.push({
|
|
92
|
+
severity: "error",
|
|
93
|
+
code: "unsupported_comparison_format",
|
|
94
|
+
path: `${o}.${r}`,
|
|
95
|
+
message: `Legacy comparison format option "${r}" has no canonical presentation mapping.`
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function P(e, o) {
|
|
101
|
+
const t = o === "kpi" ? e.calculationType : e.calculatedAs, r = o === "table" && t === void 0 ? "both" : I[String(t)], s = m(e.formatOptions) ? e.formatOptions : void 0, c = m(e.conditionalLabels) ? e.conditionalLabels : void 0, n = m(
|
|
102
|
+
o === "kpi" ? e.colorConfig : e.colors
|
|
103
|
+
) ? o === "kpi" ? e.colorConfig : e.colors : void 0, a = {};
|
|
104
|
+
if (r && (a.displayMode = r), typeof (s == null ? void 0 : s.decimalPlaces) == "number" && (a.precision = s.decimalPlaces), o === "kpi") {
|
|
105
|
+
const p = e.showArrow !== !1, i = e.showColor !== !1;
|
|
106
|
+
a.indicatorStyle = p ? i ? "arrow_badge" : "arrow" : i ? "badge" : "none", a.showColor = i, (e.position === "left" || e.position === "right" || e.position === "top") && (a.position = e.position), typeof e.conditionalLabel == "boolean" && (a.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (a.labelName = e.labelName);
|
|
107
|
+
} else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (a.indicatorStyle = e.indicatorStyle);
|
|
108
|
+
const u = c ? {
|
|
109
|
+
...D(c, ["increase", "decrease"]),
|
|
110
|
+
...typeof c.noChange == "string" ? { neutral: c.noChange } : typeof c.neutral == "string" ? { neutral: c.neutral } : {}
|
|
111
|
+
} : void 0;
|
|
112
|
+
u && Object.keys(u).length && (a.conditionalLabels = u);
|
|
113
|
+
const l = n ? {
|
|
114
|
+
...D(n, ["increase", "decrease"]),
|
|
115
|
+
...typeof n.noChange == "string" ? { neutral: n.noChange } : typeof n.neutral == "string" ? { neutral: n.neutral } : {}
|
|
116
|
+
} : void 0;
|
|
117
|
+
return l && Object.keys(l).length && (a.colors = l), a;
|
|
118
|
+
}
|
|
119
|
+
function A(e) {
|
|
120
|
+
return { ...j, ...e };
|
|
121
|
+
}
|
|
122
|
+
function S(e) {
|
|
123
|
+
return e.some(({ metric: o }) => o.comparisonType === "previous_period" || o.comparisonType === "same_period_last_year" || o.comparisonType === "target" ? !0 : m(o.comparison) && o.comparison.mode === "explicit");
|
|
124
|
+
}
|
|
125
|
+
function T(e) {
|
|
126
|
+
const o = e.card.config;
|
|
127
|
+
return e.metrics.length === 2 && (o.groupByColumns === void 0 || Array.isArray(o.groupByColumns) && o.groupByColumns.length === 0);
|
|
128
|
+
}
|
|
129
|
+
function E(e, o, t, r) {
|
|
130
|
+
const s = o === "kpi" ? [
|
|
131
|
+
"enabled",
|
|
132
|
+
"calculationType",
|
|
133
|
+
"formatOptions",
|
|
134
|
+
"showArrow",
|
|
135
|
+
"showColor",
|
|
136
|
+
"conditionalLabel",
|
|
137
|
+
"labelName",
|
|
138
|
+
"position",
|
|
139
|
+
"conditionalLabels",
|
|
140
|
+
"colorConfig",
|
|
141
|
+
"lowerIsBetter"
|
|
142
|
+
] : [
|
|
143
|
+
"calculatedAs",
|
|
144
|
+
"indicatorStyle",
|
|
145
|
+
"formatOptions",
|
|
146
|
+
"colors",
|
|
147
|
+
"lowerIsBetter"
|
|
148
|
+
];
|
|
149
|
+
Object.keys(e).forEach((p) => {
|
|
150
|
+
s.includes(p) || r.push({
|
|
151
|
+
severity: "error",
|
|
152
|
+
code: "invalid_legacy_comparison_presentation",
|
|
153
|
+
path: `${t}.${p}`,
|
|
154
|
+
message: `Unknown legacy comparison presentation field "${p}" cannot be dropped automatically.`
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
const c = o === "kpi" ? "calculationType" : "calculatedAs";
|
|
158
|
+
e[c] !== void 0 && !I[String(e[c])] && r.push({
|
|
159
|
+
severity: "error",
|
|
160
|
+
code: "invalid_legacy_comparison_presentation",
|
|
161
|
+
path: `${t}.${c}`,
|
|
162
|
+
message: `Legacy comparison ${c} is unsupported.`
|
|
163
|
+
}), o === "kpi" && e.position !== void 0 && !["left", "right", "top"].includes(String(e.position)) && r.push({
|
|
164
|
+
severity: "error",
|
|
165
|
+
code: "invalid_legacy_comparison_presentation",
|
|
166
|
+
path: `${t}.position`,
|
|
167
|
+
message: "Legacy comparison position is unsupported."
|
|
168
|
+
}), o === "kpi" && e.labelName !== void 0 && typeof e.labelName != "string" && r.push({
|
|
169
|
+
severity: "error",
|
|
170
|
+
code: "invalid_legacy_comparison_presentation",
|
|
171
|
+
path: `${t}.labelName`,
|
|
172
|
+
message: "Legacy comparison labelName must be a string."
|
|
173
|
+
}), (o === "kpi" ? [
|
|
174
|
+
["conditionalLabels", ["increase", "decrease", "noChange"]],
|
|
175
|
+
["colorConfig", ["increase", "decrease", "noChange"]]
|
|
176
|
+
] : [["colors", ["increase", "decrease", "neutral"]]]).forEach(([p, i]) => {
|
|
177
|
+
if (e[p] !== void 0) {
|
|
178
|
+
if (!m(e[p])) {
|
|
179
|
+
r.push({
|
|
180
|
+
severity: "error",
|
|
181
|
+
code: "invalid_legacy_comparison_presentation",
|
|
182
|
+
path: `${t}.${p}`,
|
|
183
|
+
message: `Legacy comparison ${p} must be an object.`
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
Object.entries(e[p]).forEach(([h, d]) => {
|
|
188
|
+
i.includes(h) ? typeof d != "string" && r.push({
|
|
189
|
+
severity: "error",
|
|
190
|
+
code: "invalid_legacy_comparison_presentation",
|
|
191
|
+
path: `${t}.${p}.${h}`,
|
|
192
|
+
message: `Legacy comparison ${p}.${h} must be a string.`
|
|
193
|
+
}) : r.push({
|
|
194
|
+
severity: "error",
|
|
195
|
+
code: "invalid_legacy_comparison_presentation",
|
|
196
|
+
path: `${t}.${p}.${h}`,
|
|
197
|
+
message: `Unknown legacy comparison ${p} field "${h}" cannot be dropped automatically.`
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}), (o === "kpi" ? ["enabled", "showArrow", "showColor", "conditionalLabel", "lowerIsBetter"] : ["lowerIsBetter"]).forEach((p) => {
|
|
202
|
+
e[p] !== void 0 && typeof e[p] != "boolean" && r.push({
|
|
203
|
+
severity: "error",
|
|
204
|
+
code: "invalid_legacy_comparison_presentation",
|
|
205
|
+
path: `${t}.${p}`,
|
|
206
|
+
message: `Legacy comparison ${p} must be a boolean.`
|
|
207
|
+
});
|
|
208
|
+
}), o === "table" && e.indicatorStyle !== void 0 && !["arrow_badge", "arrow", "badge", "none"].includes(
|
|
209
|
+
String(e.indicatorStyle)
|
|
210
|
+
) && r.push({
|
|
211
|
+
severity: "error",
|
|
212
|
+
code: "invalid_legacy_comparison_presentation",
|
|
213
|
+
path: `${t}.indicatorStyle`,
|
|
214
|
+
message: "Legacy comparison indicatorStyle is unsupported."
|
|
215
|
+
}), U(e.formatOptions, `${t}.formatOptions`, r);
|
|
216
|
+
const u = P(e, o);
|
|
217
|
+
R(u, t).errors.forEach((p) => {
|
|
218
|
+
r.push({
|
|
219
|
+
severity: "error",
|
|
220
|
+
code: "invalid_legacy_comparison_presentation",
|
|
221
|
+
path: p.path || t,
|
|
222
|
+
message: p.message
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function L(e) {
|
|
227
|
+
const o = H(e.card), t = o.kpiComparison ? P(o.kpiComparison, "kpi") : void 0, r = o.tableComparison ? P(o.tableComparison, "table") : void 0;
|
|
228
|
+
return { namespaces: o, kpi: t, table: r, presentation: t || r };
|
|
229
|
+
}
|
|
230
|
+
function F(e) {
|
|
231
|
+
const o = m(e.preferences) ? e.preferences : {}, t = m(o.kpiVisualOptions) ? o.kpiVisualOptions : {}, r = m(t.metricComparison) ? t.metricComparison : {}, s = m(o.tableVisualOptions) ? o.tableVisualOptions : {}, c = m(s.metricComparison) ? s.metricComparison : {};
|
|
232
|
+
return t.lowerIsBetter === !0 || r.lowerIsBetter === !0 || c.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
|
|
233
|
+
}
|
|
234
|
+
function q(e) {
|
|
235
|
+
switch (e.comparisonType) {
|
|
236
|
+
case "previous_period":
|
|
237
|
+
return { mode: "explicit", spec: { kind: "previous_period" } };
|
|
238
|
+
case "same_period_last_year":
|
|
239
|
+
return { mode: "explicit", spec: { kind: "previous_year" } };
|
|
240
|
+
case "target":
|
|
241
|
+
return {
|
|
242
|
+
mode: "explicit",
|
|
243
|
+
spec: { kind: "target", targetValue: e.targetValue }
|
|
244
|
+
};
|
|
245
|
+
default:
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function z(e) {
|
|
250
|
+
const o = m(e.preferences) ? e.preferences : void 0;
|
|
251
|
+
if (!o) return;
|
|
252
|
+
const t = m(o.kpiVisualOptions) ? o.kpiVisualOptions : void 0;
|
|
253
|
+
t && delete t.lowerIsBetter;
|
|
254
|
+
const r = m(o.tableVisualOptions) ? o.tableVisualOptions : void 0, s = r && m(r.metricComparison) ? r.metricComparison : void 0;
|
|
255
|
+
s && delete s.lowerIsBetter;
|
|
256
|
+
}
|
|
257
|
+
function re(e) {
|
|
258
|
+
const o = w(e);
|
|
259
|
+
if (!o.length)
|
|
260
|
+
return { document: e, changed: !1, changes: [], diagnostics: [] };
|
|
261
|
+
const t = [];
|
|
262
|
+
if (o.forEach((n) => {
|
|
263
|
+
var a, u, l, p;
|
|
264
|
+
if (n.malformedMetricColumns && t.push({
|
|
265
|
+
severity: "error",
|
|
266
|
+
code: "malformed_metric_columns",
|
|
267
|
+
path: `${n.path}.config.metricColumns`,
|
|
268
|
+
message: "Metric columns must be an array before comparison migration."
|
|
269
|
+
}), n.malformedMetricIndexes.forEach((i) => {
|
|
270
|
+
t.push({
|
|
271
|
+
severity: "error",
|
|
272
|
+
code: "malformed_metric_columns",
|
|
273
|
+
path: `${n.path}.config.metricColumns[${i}]`,
|
|
274
|
+
message: "Metric columns must contain objects before comparison migration."
|
|
275
|
+
});
|
|
276
|
+
}), n.metrics.forEach(({ metric: i, index: h }) => {
|
|
277
|
+
if (!("comparisonType" in i)) return;
|
|
278
|
+
const d = `${n.path}.config.metricColumns[${h}]`, g = String(i.comparisonType || "");
|
|
279
|
+
"comparison" in i && t.push({
|
|
280
|
+
severity: "error",
|
|
281
|
+
code: "conflicting_comparison_contracts",
|
|
282
|
+
path: d,
|
|
283
|
+
message: "Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."
|
|
284
|
+
});
|
|
285
|
+
const b = m(i.parameters) ? i.parameters : void 0, _ = b && m(b.windowTransform) ? b.windowTransform : void 0;
|
|
286
|
+
M.has(g) && (_ == null ? void 0 : _.function) === "previous_period_delta" && t.push({
|
|
287
|
+
severity: "error",
|
|
288
|
+
code: "conflicting_comparison_window_transform",
|
|
289
|
+
path: d,
|
|
290
|
+
message: "A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."
|
|
291
|
+
}), J.has(g) || t.push({
|
|
292
|
+
severity: "error",
|
|
293
|
+
code: "unsupported_comparison_type",
|
|
294
|
+
path: `${d}.comparisonType`,
|
|
295
|
+
message: `Unsupported legacy metric comparison type "${g}".`
|
|
296
|
+
}), i.comparisonType === "target" && (typeof i.targetValue != "number" || !Number.isFinite(i.targetValue)) && t.push({
|
|
297
|
+
severity: "error",
|
|
298
|
+
code: "invalid_target_value",
|
|
299
|
+
path: `${d}.targetValue`,
|
|
300
|
+
message: "Legacy target comparison requires a finite metric targetValue."
|
|
301
|
+
}), i.comparisonType === "start_vs_end" && t.push({
|
|
302
|
+
severity: "error",
|
|
303
|
+
code: "unsupported_start_vs_end",
|
|
304
|
+
path: `${d}.comparisonType`,
|
|
305
|
+
message: "start_vs_end is retired and cannot be migrated automatically."
|
|
306
|
+
}), i.targetValue !== void 0 && i.comparisonType !== "target" && t.push({
|
|
307
|
+
severity: "warning",
|
|
308
|
+
code: "stray_target_value",
|
|
309
|
+
path: `${d}.targetValue`,
|
|
310
|
+
message: "Dead non-target targetValue will be removed without changing the baseline."
|
|
311
|
+
});
|
|
312
|
+
}), n.hasLegacyPresentation) {
|
|
313
|
+
const { namespaces: i, kpi: h, table: d } = L(n), g = [
|
|
314
|
+
(a = i.kpiOptions) == null ? void 0 : a.lowerIsBetter,
|
|
315
|
+
(u = i.kpiComparison) == null ? void 0 : u.lowerIsBetter,
|
|
316
|
+
(l = i.tableComparison) == null ? void 0 : l.lowerIsBetter
|
|
317
|
+
].filter((b) => typeof b == "boolean");
|
|
318
|
+
new Set(g).size > 1 && t.push({
|
|
319
|
+
severity: "error",
|
|
320
|
+
code: "conflicting_legacy_polarity",
|
|
321
|
+
path: `${n.path}.preferences`,
|
|
322
|
+
message: "Legacy comparison polarity values disagree; resolve the conflict before migration."
|
|
323
|
+
}), ((p = i.kpiOptions) == null ? void 0 : p.lowerIsBetter) !== void 0 && typeof i.kpiOptions.lowerIsBetter != "boolean" && t.push({
|
|
324
|
+
severity: "error",
|
|
325
|
+
code: "invalid_legacy_comparison_presentation",
|
|
326
|
+
path: `${n.path}.preferences.kpiVisualOptions.lowerIsBetter`,
|
|
327
|
+
message: "Legacy comparison lowerIsBetter must be a boolean."
|
|
328
|
+
}), i.kpiComparisonPresent && !i.kpiComparison && t.push({
|
|
329
|
+
severity: "error",
|
|
330
|
+
code: "invalid_legacy_comparison_presentation",
|
|
331
|
+
path: `${n.path}.preferences.kpiVisualOptions.metricComparison`,
|
|
332
|
+
message: "Legacy KPI comparison presentation must be an object."
|
|
333
|
+
}), i.tableComparisonPresent && !i.tableComparison && t.push({
|
|
334
|
+
severity: "error",
|
|
335
|
+
code: "invalid_legacy_comparison_presentation",
|
|
336
|
+
path: `${n.path}.preferences.tableVisualOptions.metricComparison`,
|
|
337
|
+
message: "Legacy table comparison presentation must be an object."
|
|
338
|
+
}), "comparisonPresentation" in (i.preferences || {}) && t.push({
|
|
339
|
+
severity: "error",
|
|
340
|
+
code: "conflicting_comparison_presentation_contracts",
|
|
341
|
+
path: `${n.path}.preferences.comparisonPresentation`,
|
|
342
|
+
message: "Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."
|
|
343
|
+
}), i.kpiComparison && typeof i.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (i.preferences || {}) && T(n) && t.push({
|
|
344
|
+
severity: "error",
|
|
345
|
+
code: "conflicting_comparison_presentation_contracts",
|
|
346
|
+
path: `${n.path}.preferences.metricPairComparisonEnabled`,
|
|
347
|
+
message: "Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."
|
|
348
|
+
}), i.kpiComparison && E(
|
|
349
|
+
i.kpiComparison,
|
|
350
|
+
"kpi",
|
|
351
|
+
`${n.path}.preferences.kpiVisualOptions.metricComparison`,
|
|
352
|
+
t
|
|
353
|
+
), i.tableComparison && E(
|
|
354
|
+
i.tableComparison,
|
|
355
|
+
"table",
|
|
356
|
+
`${n.path}.preferences.tableVisualOptions.metricComparison`,
|
|
357
|
+
t
|
|
358
|
+
), h && d && JSON.stringify(A(h)) !== JSON.stringify(A(d)) && t.push({
|
|
359
|
+
severity: "error",
|
|
360
|
+
code: "conflicting_legacy_presentation_namespaces",
|
|
361
|
+
path: `${n.path}.preferences`,
|
|
362
|
+
message: "KPI and table comparison presentation values disagree; resolve the conflict before migration."
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}), t.some((n) => n.severity === "error"))
|
|
366
|
+
return { document: e, changed: !1, changes: [], diagnostics: t };
|
|
367
|
+
const r = JSON.parse(JSON.stringify(e)), s = w(r), c = [];
|
|
368
|
+
return s.forEach((n) => {
|
|
369
|
+
var u;
|
|
370
|
+
const a = F(n.card);
|
|
371
|
+
if (n.metrics.forEach(({ metric: l, index: p }) => {
|
|
372
|
+
if (!("comparisonType" in l)) return;
|
|
373
|
+
const i = String(l.comparisonType || ""), h = `${n.path}.config.metricColumns[${p}]`, d = q(l), g = ["comparisonType"];
|
|
374
|
+
delete l.comparisonType, "targetValue" in l && (delete l.targetValue, g.push("targetValue")), "comparisonDisplay" in l && (delete l.comparisonDisplay, g.push("comparisonDisplay")), d ? l.comparison = d : delete l.comparison, M.has(i) && (l.comparisonPolarity = a), c.push({
|
|
375
|
+
kind: "metric",
|
|
376
|
+
path: h,
|
|
377
|
+
metricId: typeof l.id == "string" ? l.id : void 0,
|
|
378
|
+
legacyType: i,
|
|
379
|
+
comparison: d,
|
|
380
|
+
comparisonPolarity: M.has(i) ? a : void 0,
|
|
381
|
+
removedFields: g
|
|
382
|
+
});
|
|
383
|
+
}), z(n.card), n.hasLegacyPresentation) {
|
|
384
|
+
const { namespaces: l, presentation: p } = L(n), i = (u = l.kpiComparison) == null ? void 0 : u.enabled, h = {
|
|
385
|
+
...p
|
|
386
|
+
};
|
|
387
|
+
typeof i == "boolean" && S(n.metrics) && (h.showComparison = i);
|
|
388
|
+
const d = typeof i == "boolean" && T(n) ? i : void 0, g = typeof i == "boolean" && !S(n.metrics) && !T(n) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, b = l.preferences, _ = [];
|
|
389
|
+
n.metrics.forEach(({ metric: C }) => {
|
|
390
|
+
"comparisonPolarity" in C || (C.comparisonPolarity = a, typeof C.id == "string" && _.push(C.id));
|
|
391
|
+
}), Object.keys(h).length && (b.comparisonPresentation = h), d !== void 0 && (b.metricPairComparisonEnabled = d), l.kpiOptions && delete l.kpiOptions.metricComparison, l.tableOptions && delete l.tableOptions.metricComparison, c.push({
|
|
392
|
+
kind: "presentation",
|
|
393
|
+
path: `${n.path}.preferences`,
|
|
394
|
+
comparisonPresentation: Object.keys(h).length ? h : void 0,
|
|
395
|
+
metricPairComparisonEnabled: d,
|
|
396
|
+
comparisonPolarityMetricIds: _,
|
|
397
|
+
intentionallyDiscardedFields: g,
|
|
398
|
+
removedFields: [
|
|
399
|
+
...l.kpiComparison ? ["kpiVisualOptions.metricComparison"] : [],
|
|
400
|
+
...l.tableComparison ? ["tableVisualOptions.metricComparison"] : []
|
|
401
|
+
]
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}), { document: r, changed: !0, changes: c, diagnostics: t };
|
|
405
|
+
}
|
|
406
|
+
const G = [
|
|
407
|
+
"bar",
|
|
408
|
+
"horizontalBar",
|
|
409
|
+
"line",
|
|
410
|
+
"area",
|
|
411
|
+
"stackedArea",
|
|
412
|
+
"combo",
|
|
413
|
+
"stackedBar",
|
|
414
|
+
"stackedLine"
|
|
415
|
+
], W = new Set(
|
|
416
|
+
G
|
|
417
|
+
);
|
|
418
|
+
function K(e) {
|
|
419
|
+
return typeof e == "string" && W.has(e);
|
|
420
|
+
}
|
|
421
|
+
function ne(e) {
|
|
422
|
+
return e === "detailTable" || e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || K(e);
|
|
423
|
+
}
|
|
424
|
+
function V(e) {
|
|
425
|
+
return !!(e != null && e.trim());
|
|
426
|
+
}
|
|
427
|
+
function ie(e) {
|
|
428
|
+
return V(e.sql) || V(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
|
|
429
|
+
}
|
|
430
|
+
const k = {
|
|
431
|
+
type: "temporal_bucket",
|
|
432
|
+
presentation: { mode: "auto" }
|
|
433
|
+
}, Y = {
|
|
434
|
+
value: "auto",
|
|
435
|
+
label: "Automatic",
|
|
436
|
+
format: k
|
|
437
|
+
};
|
|
438
|
+
function f(e, o) {
|
|
439
|
+
return {
|
|
440
|
+
value: `pattern:${e}`,
|
|
441
|
+
label: o,
|
|
442
|
+
format: {
|
|
443
|
+
type: "temporal_bucket",
|
|
444
|
+
presentation: { mode: "pattern", pattern: e }
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function v(e, o) {
|
|
449
|
+
return {
|
|
450
|
+
value: `preset:${e}`,
|
|
451
|
+
label: o,
|
|
452
|
+
format: {
|
|
453
|
+
type: "temporal_bucket",
|
|
454
|
+
presentation: { mode: "preset", preset: e }
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function y(e) {
|
|
459
|
+
return {
|
|
460
|
+
...f(e, "Custom format…"),
|
|
461
|
+
value: "custom",
|
|
462
|
+
custom: !0
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const $ = {
|
|
466
|
+
second: [
|
|
467
|
+
Y,
|
|
468
|
+
f("HH:mm:ss", "14:30:45 (HH:mm:ss)"),
|
|
469
|
+
f(
|
|
470
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
471
|
+
"2024-01-15 14:30:45 (YYYY-MM-DD HH:mm:ss)"
|
|
472
|
+
),
|
|
473
|
+
y("DD/MM/YYYY HH:mm:ss")
|
|
474
|
+
],
|
|
475
|
+
minute: [
|
|
476
|
+
Y,
|
|
477
|
+
f("HH:mm", "14:30 (HH:mm)"),
|
|
478
|
+
f("YYYY-MM-DD HH:mm", "2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),
|
|
479
|
+
y("DD/MM/YYYY HH:mm")
|
|
480
|
+
],
|
|
481
|
+
hour: [
|
|
482
|
+
Y,
|
|
483
|
+
f("HH", "14 (HH)"),
|
|
484
|
+
f("YYYY-MM-DD HH", "2024-01-15 14 (YYYY-MM-DD HH)"),
|
|
485
|
+
y("DD/MM/YYYY HH")
|
|
486
|
+
],
|
|
487
|
+
day: [
|
|
488
|
+
Y,
|
|
489
|
+
f("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
|
|
490
|
+
f("MM/DD/YYYY", "01/15/2024 (MM/DD/YYYY)"),
|
|
491
|
+
f("DD/MM/YYYY", "15/01/2024 (DD/MM/YYYY)"),
|
|
492
|
+
f("MMM DD, YYYY", "Jan 15, 2024 (MMM DD, YYYY)"),
|
|
493
|
+
f("MMMM DD, YYYY", "January 15, 2024 (MMMM DD, YYYY)"),
|
|
494
|
+
y("YYYY/MM/DD")
|
|
495
|
+
],
|
|
496
|
+
week: [
|
|
497
|
+
Y,
|
|
498
|
+
v("week_of_short", "Week of Jan 15, 2024"),
|
|
499
|
+
v("week_of_long", "Week of January 15, 2024"),
|
|
500
|
+
f("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
|
|
501
|
+
y("YYYY/MM/DD")
|
|
502
|
+
],
|
|
503
|
+
month: [
|
|
504
|
+
Y,
|
|
505
|
+
f("MMM YYYY", "Jan 2024 (MMM YYYY)"),
|
|
506
|
+
f("MMMM YYYY", "January 2024 (MMMM YYYY)"),
|
|
507
|
+
f("YYYY-MM", "2024-01 (YYYY-MM)"),
|
|
508
|
+
f("MM/YYYY", "01/2024 (MM/YYYY)"),
|
|
509
|
+
f("YYYY MMM", "2024 Jan (YYYY MMM)"),
|
|
510
|
+
y("YYYY/MM")
|
|
511
|
+
],
|
|
512
|
+
quarter: [
|
|
513
|
+
Y,
|
|
514
|
+
v("quarter_short", "Q1 2024"),
|
|
515
|
+
v("quarter_long", "1st Quarter 2024")
|
|
516
|
+
],
|
|
517
|
+
year: [
|
|
518
|
+
Y,
|
|
519
|
+
f("YYYY", "2024 (YYYY)"),
|
|
520
|
+
f("YY", "24 (YY)")
|
|
521
|
+
]
|
|
522
|
+
}, Q = {
|
|
523
|
+
second: "2026-07-31T14:05:09",
|
|
524
|
+
minute: "2026-07-31T14:05:00",
|
|
525
|
+
hour: "2026-07-31T14:00:00",
|
|
526
|
+
day: "2026-07-31",
|
|
527
|
+
week: "2026-07-27",
|
|
528
|
+
month: "2026-07-01",
|
|
529
|
+
quarter: "2026-07-01",
|
|
530
|
+
year: "2026-01-01"
|
|
531
|
+
};
|
|
532
|
+
function X(e, o, t = B) {
|
|
533
|
+
return x({
|
|
534
|
+
value: Q[o],
|
|
535
|
+
metadata: {
|
|
536
|
+
kind: "temporal_bucket",
|
|
537
|
+
granularity: o,
|
|
538
|
+
calendar: {
|
|
539
|
+
tz: "UTC",
|
|
540
|
+
weekStart: 1,
|
|
541
|
+
...e.presentation.mode === "preset" && (e.presentation.preset === "fiscal_quarter_short" || e.presentation.preset === "fiscal_year") ? {
|
|
542
|
+
fiscalCalendar: {
|
|
543
|
+
kind: "month_aligned",
|
|
544
|
+
yearStartMonth: 7
|
|
545
|
+
}
|
|
546
|
+
} : {}
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
format: e.presentation.mode === "auto" ? {
|
|
550
|
+
type: "temporal_bucket",
|
|
551
|
+
locale: t.locale,
|
|
552
|
+
presentation: {
|
|
553
|
+
mode: "auto",
|
|
554
|
+
styles: {
|
|
555
|
+
dateStyle: t.dateStyle,
|
|
556
|
+
dateTime: { ...t.dateTime }
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
} : {
|
|
560
|
+
type: "temporal_bucket",
|
|
561
|
+
locale: t.locale,
|
|
562
|
+
presentation: e.presentation
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function se(e, o, t = B) {
|
|
567
|
+
const r = $[e], s = (o == null ? void 0 : o.presentation.mode) === "preset" ? o.presentation.preset : void 0, c = s && o && O(o, e).ok && !r.some(
|
|
568
|
+
(a) => {
|
|
569
|
+
var u;
|
|
570
|
+
return ((u = a.format) == null ? void 0 : u.presentation.mode) === "preset" && a.format.presentation.preset === s;
|
|
571
|
+
}
|
|
572
|
+
) ? v(s, s) : void 0;
|
|
573
|
+
return (c ? [...r, c] : r).map((a) => {
|
|
574
|
+
if (!a.format || a.custom) return a;
|
|
575
|
+
const u = X(
|
|
576
|
+
a.format,
|
|
577
|
+
e,
|
|
578
|
+
t
|
|
579
|
+
);
|
|
580
|
+
return a.format.presentation.mode === "pattern" ? {
|
|
581
|
+
...a,
|
|
582
|
+
label: `${u} (${a.format.presentation.pattern})`
|
|
583
|
+
} : a.format.presentation.mode === "auto" ? { ...a, label: `Automatic (${u})` } : { ...a, label: u };
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function ae(e, o) {
|
|
587
|
+
const t = $[o];
|
|
588
|
+
if (e.presentation.mode === "pattern") {
|
|
589
|
+
const r = e.presentation.pattern, s = t.find(
|
|
590
|
+
(c) => {
|
|
591
|
+
var n;
|
|
592
|
+
return ((n = c.format) == null ? void 0 : n.presentation.mode) === "pattern" && c.format.presentation.pattern === r;
|
|
593
|
+
}
|
|
594
|
+
);
|
|
595
|
+
return {
|
|
596
|
+
value: (s == null ? void 0 : s.value) ?? "custom",
|
|
597
|
+
customPattern: s != null && s.custom || !s ? r : "",
|
|
598
|
+
format: e
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
if (e.presentation.mode === "preset") {
|
|
602
|
+
const r = e.presentation.preset, s = t.find(
|
|
603
|
+
(n) => {
|
|
604
|
+
var a;
|
|
605
|
+
return ((a = n.format) == null ? void 0 : a.presentation.mode) === "preset" && n.format.presentation.preset === r;
|
|
606
|
+
}
|
|
607
|
+
), c = O(
|
|
608
|
+
e,
|
|
609
|
+
o
|
|
610
|
+
).ok;
|
|
611
|
+
return s ? { value: s.value, customPattern: "", format: e } : c ? {
|
|
612
|
+
value: `preset:${r}`,
|
|
613
|
+
customPattern: "",
|
|
614
|
+
format: e
|
|
615
|
+
} : { value: "auto", customPattern: "", format: k };
|
|
616
|
+
}
|
|
617
|
+
return { value: "auto", customPattern: "", format: e };
|
|
618
|
+
}
|
|
619
|
+
function pe(e, o, t = "") {
|
|
620
|
+
var n;
|
|
621
|
+
const r = $[e].find(
|
|
622
|
+
(a) => a.value === o
|
|
623
|
+
), s = o.startsWith("preset:") ? o.slice(7) : void 0, c = o === "custom" ? {
|
|
624
|
+
type: "temporal_bucket",
|
|
625
|
+
presentation: {
|
|
626
|
+
mode: "pattern",
|
|
627
|
+
pattern: t.trim() || (((n = r == null ? void 0 : r.format) == null ? void 0 : n.presentation.mode) === "pattern" ? r.format.presentation.pattern : "")
|
|
628
|
+
}
|
|
629
|
+
} : (r == null ? void 0 : r.format) ?? (s && N(s) ? {
|
|
630
|
+
type: "temporal_bucket",
|
|
631
|
+
presentation: {
|
|
632
|
+
mode: "preset",
|
|
633
|
+
preset: s
|
|
634
|
+
}
|
|
635
|
+
} : void 0);
|
|
636
|
+
return !c || !O(c, e).ok ? k : c;
|
|
637
|
+
}
|
|
638
|
+
function ce(e, o) {
|
|
639
|
+
return O(e, o).ok ? e : k;
|
|
640
|
+
}
|
|
641
|
+
export {
|
|
642
|
+
k as A,
|
|
643
|
+
G as S,
|
|
644
|
+
ae as a,
|
|
645
|
+
pe as b,
|
|
646
|
+
ce as c,
|
|
647
|
+
se as g,
|
|
648
|
+
K as i,
|
|
649
|
+
X as p,
|
|
650
|
+
ie as r,
|
|
651
|
+
ne as s,
|
|
652
|
+
re as t
|
|
653
|
+
};
|