react-semaphor 0.1.541 → 0.1.542
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.js +75 -75
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.js +51 -49
- package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
- package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-oHF5lTjA.js} +12 -12
- package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
- package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
- package/dist/chunks/comparison-window-caption-ChIyd_-L.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
- package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-CIn22Qgp.js} +69 -70
- package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
- package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-ZUYsIExq.js} +4 -4
- package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-s5WJBcK8.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-C6MJVyoI.js} +2382 -4975
- package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-DLdereA7.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/{index-DaQlghLY.js → index-CV5rHq5D.js} +824 -1351
- package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
- package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
- package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
- package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
- package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
- package/dist/chunks/numeric-presentation-BSAqPpHt.js +5227 -0
- package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
- package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-BBlAfBA0.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
- package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-MRUWpMcJ.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-DjPqgFly.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-BWSpRsPj.js} +37489 -39476
- package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-CQbFLm3q.js} +6 -6
- package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
- package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
- package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
- package/dist/chunks/table-export-sheet-BHSnuZHd.js +949 -0
- package/dist/chunks/table-settings-CLZocegs.js +501 -0
- package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
- package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BJDNqdOh.js} +151 -151
- package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +462 -457
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.js +346 -241
- package/dist/index.js +174 -175
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +5 -3
- package/dist/types/index.js +48 -48
- package/dist/types/lib/api/exports-api.d.ts +11 -65
- package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
- package/dist/types/lib/types/explorer-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
- package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
- package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
- package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
- package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
- package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
- package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
- package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
- package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
- package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
- package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
- package/package.json +2 -1
- package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
- package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
- package/dist/chunks/common-types-CUf03Htv.js +0 -288
- package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
- package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
- package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
- package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
- package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
- package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
|
@@ -0,0 +1,2260 @@
|
|
|
1
|
+
import { e as Ue, a as Ge, y as $e, z as We, A as Ye, B as xe, C as Xe, E as T, F as Ie, G as Je, H as Qe, I as re, J as Ze, K as Me, L as et, M as tt, N as rt, O as nt, P as ot, Q as it, R as at, S as Pe, b as st, T as ct, U as ut, V as lt, W as Y, X as dt, Y as mt, x as ft } from "./document-sheet-utils-BsZUnHRl.js";
|
|
2
|
+
import { l as yt, f as gt, e as bt } from "./validators-DMHTpf7a.js";
|
|
3
|
+
import "./matrix-operation-contract-8OIO4gob.js";
|
|
4
|
+
import { r as Ft, C as pt } from "./metric-comparison-DEwi9uc2.js";
|
|
5
|
+
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
6
|
+
import "zod";
|
|
7
|
+
import { L as vt } from "./pivot-result-lifecycle-BBlAfBA0.js";
|
|
8
|
+
import { f as E } from "./matrix-formatter-BnsTX90d.js";
|
|
9
|
+
import { b as Te, m as ht, h as Ct, d as Z, e as xt, i as P, u as I, R as It, v as Mt, r as Pt } from "./temporal-bucket-D7NBrrtL.js";
|
|
10
|
+
import "../value-format-preferences/index.js";
|
|
11
|
+
import { B as Tt } from "./table-settings-CLZocegs.js";
|
|
12
|
+
import { af as Oe, ag as Se, ah as Ot, ai as St, ab as ne, aj as At, ac as Fe } from "./numeric-presentation-BSAqPpHt.js";
|
|
13
|
+
import { r as wt } from "./pivot-result-identity-DJhXXcns.js";
|
|
14
|
+
import { g as Dt } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
15
|
+
import { e as Bt, d as Rt } from "./raw-temporal-presentation-CZ2r0Vb_.js";
|
|
16
|
+
import { duplicateLayoutItem as Kt, addToLayout as Et } from "../layouts/index.js";
|
|
17
|
+
const oe = { kind: "allSheets" }, B = (e, t) => (t == null ? void 0 : t[e]) ?? e;
|
|
18
|
+
function Ae(e, t) {
|
|
19
|
+
switch (e.kind) {
|
|
20
|
+
case "cards":
|
|
21
|
+
return {
|
|
22
|
+
kind: "cards",
|
|
23
|
+
cardIds: e.cardIds.map((r) => B(r, t.cardIds))
|
|
24
|
+
};
|
|
25
|
+
case "sheets":
|
|
26
|
+
return {
|
|
27
|
+
kind: "sheets",
|
|
28
|
+
sheetIds: e.sheetIds.map((r) => B(r, t.sheetIds))
|
|
29
|
+
};
|
|
30
|
+
case "documentSections":
|
|
31
|
+
return {
|
|
32
|
+
...e,
|
|
33
|
+
sheetId: B(e.sheetId, t.sheetIds),
|
|
34
|
+
sectionIds: e.sectionIds.map((r) => B(r, t.sectionIds))
|
|
35
|
+
};
|
|
36
|
+
default:
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function _t(e, t) {
|
|
41
|
+
return {
|
|
42
|
+
...e,
|
|
43
|
+
targets: Ae(e.targets, t),
|
|
44
|
+
cardMappings: e.cardMappings.map((r) => ({
|
|
45
|
+
...r,
|
|
46
|
+
cardId: B(r.cardId, t.cardIds)
|
|
47
|
+
}))
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function cn(e, t) {
|
|
51
|
+
return {
|
|
52
|
+
...e.targets !== void 0 ? { targets: e.targets && Ae(e.targets, t) } : {},
|
|
53
|
+
...e.cardMappings !== void 0 ? {
|
|
54
|
+
cardMappings: e.cardMappings && e.cardMappings.map((r) => ({
|
|
55
|
+
...r,
|
|
56
|
+
cardId: B(r.cardId, t.cardIds)
|
|
57
|
+
}))
|
|
58
|
+
} : {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function un(e, t) {
|
|
62
|
+
return t ? {
|
|
63
|
+
...e,
|
|
64
|
+
targets: t.targets === void 0 ? e.targets : t.targets ?? oe,
|
|
65
|
+
cardMappings: t.cardMappings === void 0 ? e.cardMappings : t.cardMappings ?? []
|
|
66
|
+
} : e;
|
|
67
|
+
}
|
|
68
|
+
const X = (e, t) => JSON.stringify(e) === JSON.stringify(t);
|
|
69
|
+
function ln(e, t) {
|
|
70
|
+
const r = {};
|
|
71
|
+
return X(e.targets, t.targets) || (r.targets = X(e.targets, oe) ? null : e.targets), X(e.cardMappings, t.cardMappings) || (r.cardMappings = e.cardMappings.length ? e.cardMappings : null), Object.keys(r).length ? r : void 0;
|
|
72
|
+
}
|
|
73
|
+
function dn(e, t) {
|
|
74
|
+
return {
|
|
75
|
+
...e,
|
|
76
|
+
targets: (t == null ? void 0 : t.targets) ?? oe,
|
|
77
|
+
cardMappings: (t == null ? void 0 : t.cardMappings) ?? []
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function mn(e) {
|
|
81
|
+
const t = Object.values(e.linkedInteractionTargetOverrides ?? {});
|
|
82
|
+
if (!t.length) return;
|
|
83
|
+
const r = {};
|
|
84
|
+
if (t.some(
|
|
85
|
+
(i) => i.applyToCardIds !== void 0
|
|
86
|
+
)) {
|
|
87
|
+
const i = t.flatMap(
|
|
88
|
+
(a) => Array.isArray(a.applyToCardIds) ? [a.applyToCardIds] : []
|
|
89
|
+
);
|
|
90
|
+
r.targets = i.length === t.length ? { kind: "cards", cardIds: [...new Set(i.flat())] } : null;
|
|
91
|
+
}
|
|
92
|
+
const o = t.filter((i) => !Array.isArray(i.applyToCardIds));
|
|
93
|
+
if (o.some((i) => i.excludeCardIds !== void 0)) {
|
|
94
|
+
const i = [
|
|
95
|
+
...new Set(o.flatMap((a) => a.excludeCardIds ?? []))
|
|
96
|
+
].filter(
|
|
97
|
+
(a) => o.every((c) => {
|
|
98
|
+
var s;
|
|
99
|
+
return (s = c.excludeCardIds) == null ? void 0 : s.includes(a);
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
r.cardMappings = i.length ? i.map(
|
|
103
|
+
(a) => ({ kind: "excluded", cardId: a })
|
|
104
|
+
) : null;
|
|
105
|
+
}
|
|
106
|
+
return Object.keys(r).length ? r : void 0;
|
|
107
|
+
}
|
|
108
|
+
function Nt(e, t) {
|
|
109
|
+
var o;
|
|
110
|
+
const r = (o = e.controlBindings) == null ? void 0 : o.map((i) => ({
|
|
111
|
+
...i,
|
|
112
|
+
controlId: t.get(i.controlId) ?? i.controlId
|
|
113
|
+
})), n = Ue(e).flatMap(
|
|
114
|
+
({ paramId: i, controlId: a }) => {
|
|
115
|
+
var s;
|
|
116
|
+
const c = t.get(a);
|
|
117
|
+
return !c || c === a || (s = e.controlBindings) != null && s.some(
|
|
118
|
+
(u) => u.target === "sql_param" && u.paramId === i
|
|
119
|
+
) ? [] : [{ target: "sql_param", paramId: i, controlId: c }];
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
return n.length ? [...r ?? [], ...n] : r;
|
|
123
|
+
}
|
|
124
|
+
function we(e, t) {
|
|
125
|
+
var o, i;
|
|
126
|
+
const r = e.source === "dashboardInputAlias" ? ((o = t.inputAliases) == null ? void 0 : o[e.variableName]) ?? e : e, n = e.source === "dashboardInputAlias" && r !== e ? { ...r, export: e.export ?? "label" } : r;
|
|
127
|
+
return n.source === "dashboardInput" ? {
|
|
128
|
+
...n,
|
|
129
|
+
inputId: ((i = t.inputIds) == null ? void 0 : i[n.inputId]) ?? n.inputId
|
|
130
|
+
} : n;
|
|
131
|
+
}
|
|
132
|
+
function fn(e, t) {
|
|
133
|
+
var o;
|
|
134
|
+
const r = {};
|
|
135
|
+
for (const i of [
|
|
136
|
+
"cardIds",
|
|
137
|
+
"sheetIds",
|
|
138
|
+
"inputIds",
|
|
139
|
+
"controlIds",
|
|
140
|
+
"filterIds"
|
|
141
|
+
]) {
|
|
142
|
+
const a = { ...t[i] };
|
|
143
|
+
for (const [c, s] of Object.entries((e == null ? void 0 : e[i]) ?? {}))
|
|
144
|
+
a[c] = ((o = t[i]) == null ? void 0 : o[s]) ?? s;
|
|
145
|
+
Object.keys(a).length && (r[i] = a);
|
|
146
|
+
}
|
|
147
|
+
const n = { ...t.inputAliases };
|
|
148
|
+
for (const [i, a] of Object.entries((e == null ? void 0 : e.inputAliases) ?? {}))
|
|
149
|
+
n[i] = we(a, t);
|
|
150
|
+
return Object.keys(n).length && (r.inputAliases = n), r;
|
|
151
|
+
}
|
|
152
|
+
function yn(e, t) {
|
|
153
|
+
var o, i, a, c;
|
|
154
|
+
const r = Ge(e);
|
|
155
|
+
r.controlBindings = Nt(
|
|
156
|
+
e,
|
|
157
|
+
new Map(Object.entries(t.controlIds ?? {}))
|
|
158
|
+
);
|
|
159
|
+
for (const s of r.controls ?? [])
|
|
160
|
+
s.id = ((o = t.controlIds) == null ? void 0 : o[s.id]) ?? s.id;
|
|
161
|
+
for (const s of r.inlineFilters ?? [])
|
|
162
|
+
s.id = ((i = t.filterIds) == null ? void 0 : i[s.id]) ?? s.id;
|
|
163
|
+
const n = (s) => {
|
|
164
|
+
var l, m, f;
|
|
165
|
+
if (!s || typeof s != "object") return;
|
|
166
|
+
if (Array.isArray(s)) {
|
|
167
|
+
s.forEach(n);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const u = s;
|
|
171
|
+
if (u.type === "variable" && u.ref && typeof u.ref == "object") {
|
|
172
|
+
const g = u.ref;
|
|
173
|
+
u.ref = g.source === "input" ? { ...g, inputId: ((l = t.inputIds) == null ? void 0 : l[g.inputId]) ?? g.inputId } : we(g, t);
|
|
174
|
+
}
|
|
175
|
+
if (typeof u.entityId == "string") {
|
|
176
|
+
const g = u.entityId;
|
|
177
|
+
u.fieldScope === "card" && (u.entityId = ((m = t.cardIds) == null ? void 0 : m[g]) ?? g), u.fieldScope === "sheet" && (u.entityId = ((f = t.sheetIds) == null ? void 0 : f[g]) ?? g);
|
|
178
|
+
}
|
|
179
|
+
for (const [g, F] of Object.entries(u))
|
|
180
|
+
g !== "linkedReferenceOverrides" && n(F);
|
|
181
|
+
};
|
|
182
|
+
n(r), r.clickToFilter && (r.clickToFilter = _t(r.clickToFilter, t));
|
|
183
|
+
for (const s of Object.values(
|
|
184
|
+
((a = r.customCardPreferences) == null ? void 0 : a.dataInputCardIds) ?? {}
|
|
185
|
+
))
|
|
186
|
+
s.cardId = ((c = t.cardIds) == null ? void 0 : c[s.cardId]) ?? s.cardId;
|
|
187
|
+
return r;
|
|
188
|
+
}
|
|
189
|
+
const gn = [
|
|
190
|
+
"lg",
|
|
191
|
+
"md",
|
|
192
|
+
"sm",
|
|
193
|
+
"xs",
|
|
194
|
+
"xxs"
|
|
195
|
+
], bn = 15, Vt = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, kt = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, Lt = /\bwhere\b/i;
|
|
196
|
+
function jt(e) {
|
|
197
|
+
return e != null && e.trim() ? Vt.test(e) || kt.test(e) : !1;
|
|
198
|
+
}
|
|
199
|
+
function Fn(e) {
|
|
200
|
+
return !(e != null && e.trim()) || jt(e) ? null : Lt.test(e) ? {
|
|
201
|
+
helper: "{{ filters | and }}",
|
|
202
|
+
description: "For queries with an existing WHERE clause."
|
|
203
|
+
} : {
|
|
204
|
+
helper: "{{ filters | where }}",
|
|
205
|
+
description: "For queries without a WHERE clause."
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const pe = [10, 20, 50, 100, 500, 1e3], qt = 50;
|
|
209
|
+
function zt(e) {
|
|
210
|
+
return e && e > 0 ? e : qt;
|
|
211
|
+
}
|
|
212
|
+
function pn(e) {
|
|
213
|
+
const t = zt(e), r = [...pe];
|
|
214
|
+
return pe.includes(
|
|
215
|
+
t
|
|
216
|
+
) || (r.push(t), r.sort((n, o) => n - o)), r;
|
|
217
|
+
}
|
|
218
|
+
function vn(e) {
|
|
219
|
+
var t, r;
|
|
220
|
+
return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Oe(e.config) && !((r = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && r.forceClientPagination));
|
|
221
|
+
}
|
|
222
|
+
function Ht(e, t) {
|
|
223
|
+
var n, o, i, a;
|
|
224
|
+
if (t === "table-print")
|
|
225
|
+
return "disabled";
|
|
226
|
+
if ((o = (n = e.preferences) == null ? void 0 : n.tablePrefs) != null && o.forceClientPagination)
|
|
227
|
+
return "client";
|
|
228
|
+
const r = Oe(e.config);
|
|
229
|
+
return e.sql && !r ? (a = (i = e.preferences) == null ? void 0 : i.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : r && $e(e) ? "server" : "client";
|
|
230
|
+
}
|
|
231
|
+
const De = Object.freeze({}), hn = {
|
|
232
|
+
access: "session-only",
|
|
233
|
+
printMode: !1,
|
|
234
|
+
baseline: null,
|
|
235
|
+
applied: null,
|
|
236
|
+
appliedBookmark: null,
|
|
237
|
+
tableSettings: De,
|
|
238
|
+
notices: []
|
|
239
|
+
};
|
|
240
|
+
function Cn(e) {
|
|
241
|
+
return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
|
|
242
|
+
}
|
|
243
|
+
function Ut(e) {
|
|
244
|
+
return e.isDashboardEditing ? De : e.viewer.tableSettings;
|
|
245
|
+
}
|
|
246
|
+
function Gt(e, t) {
|
|
247
|
+
return Ut(e)[t];
|
|
248
|
+
}
|
|
249
|
+
function xn(e, t, r) {
|
|
250
|
+
if (!(r.isEditorPreview || e.isDashboardEditing) && Tt(e.dashboard, t))
|
|
251
|
+
return { settings: Gt(e, t) };
|
|
252
|
+
}
|
|
253
|
+
function $t(e) {
|
|
254
|
+
var t;
|
|
255
|
+
return We({
|
|
256
|
+
card: e.card,
|
|
257
|
+
paginationMode: Ht(e.card) === "server" ? "server" : "client",
|
|
258
|
+
result: {
|
|
259
|
+
keys: e.keys ?? Ye(e.records),
|
|
260
|
+
rows: e.records,
|
|
261
|
+
columns: e.resultColumns,
|
|
262
|
+
columnKeyMap: e.columnKeyMap,
|
|
263
|
+
comparisonMetadata: e.comparisonMetadata
|
|
264
|
+
},
|
|
265
|
+
settings: (t = e.viewerTable) == null ? void 0 : t.settings,
|
|
266
|
+
projection: "export"
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const In = (e) => {
|
|
270
|
+
e = e.replace("#", "");
|
|
271
|
+
const t = Number.parseInt(e.substr(0, 2), 16), r = Number.parseInt(e.substr(2, 2), 16), n = Number.parseInt(e.substr(4, 2), 16);
|
|
272
|
+
return (0.299 * t + 0.587 * r + 0.114 * n) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
273
|
+
}, Wt = () => ({
|
|
274
|
+
urlTemplate: "{value}",
|
|
275
|
+
// Default: use cell value as-is
|
|
276
|
+
labelType: "value",
|
|
277
|
+
// Default: show cell value as label
|
|
278
|
+
staticLabel: "",
|
|
279
|
+
labelColumn: "",
|
|
280
|
+
openInNewTab: !0
|
|
281
|
+
// Default: open in new tab (current behavior)
|
|
282
|
+
}), ie = () => ({
|
|
283
|
+
type: "none",
|
|
284
|
+
inheritMetricFormat: !0,
|
|
285
|
+
textAlign: "left",
|
|
286
|
+
width: 150,
|
|
287
|
+
// Default width in pixels
|
|
288
|
+
minWidth: 50,
|
|
289
|
+
maxWidth: 500,
|
|
290
|
+
textOverflow: "ellipsis",
|
|
291
|
+
textWrap: "default",
|
|
292
|
+
numberFormat: {
|
|
293
|
+
style: "decimal",
|
|
294
|
+
currency: "USD",
|
|
295
|
+
locale: "en-US",
|
|
296
|
+
minimumFractionDigits: 0,
|
|
297
|
+
maximumFractionDigits: 2,
|
|
298
|
+
useGrouping: !0,
|
|
299
|
+
percentValueMode: "whole",
|
|
300
|
+
showDataBar: !1,
|
|
301
|
+
showHeatmap: !1,
|
|
302
|
+
dataBarColor: "#3b82f6",
|
|
303
|
+
// Default blue color
|
|
304
|
+
dataBarMinValue: void 0,
|
|
305
|
+
dataBarMaxValue: void 0
|
|
306
|
+
},
|
|
307
|
+
dateFormat: {
|
|
308
|
+
format: "MM/dd/yyyy",
|
|
309
|
+
useCustomFormat: !1,
|
|
310
|
+
customFormat: "yyyy-MM-dd'T'HH:mm:ss",
|
|
311
|
+
useRelativeTime: !1,
|
|
312
|
+
timezone: "auto",
|
|
313
|
+
// Default to auto (use context or browser timezone for display)
|
|
314
|
+
sourceTimezone: "auto"
|
|
315
|
+
// Default to auto (use explicit timezone if present, otherwise assume UTC)
|
|
316
|
+
},
|
|
317
|
+
linkFormat: Wt(),
|
|
318
|
+
colorRanges: []
|
|
319
|
+
});
|
|
320
|
+
function Mn(e, t, r, n) {
|
|
321
|
+
return t && t !== "auto" ? t : r;
|
|
322
|
+
}
|
|
323
|
+
const Pn = (e) => !e || e === "auto" ? "local time" : {
|
|
324
|
+
"America/New_York": "Eastern Time",
|
|
325
|
+
"America/Chicago": "Central Time",
|
|
326
|
+
"America/Denver": "Mountain Time",
|
|
327
|
+
"America/Los_Angeles": "Pacific Time",
|
|
328
|
+
"Europe/London": "London Time",
|
|
329
|
+
"Europe/Paris": "Central European Time",
|
|
330
|
+
"Asia/Tokyo": "Japan Time",
|
|
331
|
+
"Asia/Shanghai": "China Time",
|
|
332
|
+
UTC: "UTC"
|
|
333
|
+
}[e] || e;
|
|
334
|
+
function Yt(e) {
|
|
335
|
+
const t = E(e == null ? void 0 : e.format);
|
|
336
|
+
return !!(t && Te(t));
|
|
337
|
+
}
|
|
338
|
+
function ee(e, t) {
|
|
339
|
+
var a, c;
|
|
340
|
+
if (!(e != null && e.config) || e.type === "matrixTable" || (a = e.sql) != null && a.trim() || (c = e.python) != null && c.trim())
|
|
341
|
+
return;
|
|
342
|
+
const r = e.type === "detailTable" ? (e.config.detailColumns || []).map((s) => ({
|
|
343
|
+
field: s,
|
|
344
|
+
role: "detail"
|
|
345
|
+
})) : [
|
|
346
|
+
...(e.type === "table" ? e.config.detailColumns || [] : []).map(
|
|
347
|
+
(s) => ({ field: s, role: "detail" })
|
|
348
|
+
),
|
|
349
|
+
...(e.config.metricColumns || []).map((s) => ({
|
|
350
|
+
field: s,
|
|
351
|
+
role: "metric"
|
|
352
|
+
})),
|
|
353
|
+
...(e.config.groupByColumns || []).map((s) => ({
|
|
354
|
+
field: s,
|
|
355
|
+
role: "groupby"
|
|
356
|
+
}))
|
|
357
|
+
], n = t.fieldRole ? r.filter((s) => s.role === t.fieldRole) : r, o = (s) => s.length === 1 ? s[0].field : void 0;
|
|
358
|
+
if (t.fieldId)
|
|
359
|
+
return o(
|
|
360
|
+
n.filter(
|
|
361
|
+
({ field: s, role: u }) => s.id === t.fieldId && (!t.fieldRole || u === t.fieldRole)
|
|
362
|
+
)
|
|
363
|
+
);
|
|
364
|
+
if (t.metricId)
|
|
365
|
+
return o(
|
|
366
|
+
n.filter(
|
|
367
|
+
({ field: s, role: u }) => u === (e.type === "detailTable" ? "detail" : "metric") && s.id === t.metricId
|
|
368
|
+
)
|
|
369
|
+
);
|
|
370
|
+
if (t.columnKeyMap) {
|
|
371
|
+
const s = [
|
|
372
|
+
t.columnId,
|
|
373
|
+
t.metricAlias,
|
|
374
|
+
...t.columnIds || []
|
|
375
|
+
].filter((m) => m !== void 0), u = n.map((m) => {
|
|
376
|
+
var f, g;
|
|
377
|
+
return {
|
|
378
|
+
...m,
|
|
379
|
+
bindings: [
|
|
380
|
+
wt(
|
|
381
|
+
t.columnKeyMap,
|
|
382
|
+
m.field.id,
|
|
383
|
+
m.role
|
|
384
|
+
),
|
|
385
|
+
m.role === "metric" && m.field.alias ? (g = (f = t.columnKeyMap) == null ? void 0 : f.byMetricAlias) == null ? void 0 : g[m.field.alias] : void 0
|
|
386
|
+
]
|
|
387
|
+
};
|
|
388
|
+
}), l = u.filter(
|
|
389
|
+
(m) => m.bindings.some(
|
|
390
|
+
(f) => (f == null ? void 0 : f.outputKey) !== void 0 && s.includes(f.outputKey)
|
|
391
|
+
)
|
|
392
|
+
);
|
|
393
|
+
return l.length ? o(l) : o(
|
|
394
|
+
u.filter(
|
|
395
|
+
(m) => m.bindings.some(
|
|
396
|
+
(f) => (f == null ? void 0 : f.rawKey) !== void 0 && s.includes(f.rawKey)
|
|
397
|
+
)
|
|
398
|
+
)
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
const i = (s) => s == null ? void 0 : s.trim().toLowerCase();
|
|
402
|
+
return o(
|
|
403
|
+
n.filter(
|
|
404
|
+
({ field: s }) => [t.columnId, t.metricAlias, ...t.columnIds || []].some(
|
|
405
|
+
(u) => u !== void 0 && [
|
|
406
|
+
s.id,
|
|
407
|
+
s.alias,
|
|
408
|
+
s.name,
|
|
409
|
+
s.qualifiedFieldName,
|
|
410
|
+
s.label
|
|
411
|
+
].some(
|
|
412
|
+
(l) => l !== void 0 && i(l) === i(u)
|
|
413
|
+
)
|
|
414
|
+
)
|
|
415
|
+
)
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function Xt(e, t, r) {
|
|
419
|
+
return ee(e, {
|
|
420
|
+
fieldId: t.id,
|
|
421
|
+
fieldRole: "groupby"
|
|
422
|
+
}) ?? ee(
|
|
423
|
+
e,
|
|
424
|
+
r ? {
|
|
425
|
+
columnIds: [t.alias, t.name, t.id].filter(
|
|
426
|
+
(n) => !!n
|
|
427
|
+
),
|
|
428
|
+
columnKeyMap: r,
|
|
429
|
+
fieldRole: "groupby"
|
|
430
|
+
} : { fieldId: t.id, fieldRole: "groupby" }
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
function Tn(e, t, r) {
|
|
434
|
+
return e.map((n) => {
|
|
435
|
+
const o = Xt(
|
|
436
|
+
t,
|
|
437
|
+
n,
|
|
438
|
+
r
|
|
439
|
+
);
|
|
440
|
+
if (!o) return n;
|
|
441
|
+
const { format: i, ...a } = n;
|
|
442
|
+
return {
|
|
443
|
+
...a,
|
|
444
|
+
...o.label ? { label: o.label } : {},
|
|
445
|
+
...o.format !== void 0 ? { format: o.format } : {}
|
|
446
|
+
};
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function Be(e, t) {
|
|
450
|
+
const r = typeof e.decimalPlaces == "number", n = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : r ? e.decimalPlaces : t.min, o = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : r ? e.decimalPlaces : t.max;
|
|
451
|
+
return {
|
|
452
|
+
minimumFractionDigits: n,
|
|
453
|
+
maximumFractionDigits: Math.max(n, o)
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function L(e, t) {
|
|
457
|
+
const r = Be(e, t), n = typeof e.suffix == "string" && e.suffix.length > 0;
|
|
458
|
+
return {
|
|
459
|
+
style: "decimal",
|
|
460
|
+
locale: e.locale,
|
|
461
|
+
currency: e.currency,
|
|
462
|
+
minimumFractionDigits: r.minimumFractionDigits,
|
|
463
|
+
maximumFractionDigits: r.maximumFractionDigits,
|
|
464
|
+
useGrouping: e.useGrouping,
|
|
465
|
+
// Preserve legacy behavior: explicit custom suffix should not trigger compacting.
|
|
466
|
+
useSuffix: !!(e.useSuffix && !n),
|
|
467
|
+
prefix: e.prefix,
|
|
468
|
+
suffix: e.suffix,
|
|
469
|
+
negativeInParentheses: e.negativeInParentheses,
|
|
470
|
+
multiplyBy: e.multiplyBy,
|
|
471
|
+
percentValueMode: e.percentValueMode
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function Re(e, t = "auto", r = {}) {
|
|
475
|
+
switch (t === "auto" && (t = tr(e, r)), t) {
|
|
476
|
+
case "number":
|
|
477
|
+
return Ke(e, r);
|
|
478
|
+
case "currency":
|
|
479
|
+
return Ee(e, r);
|
|
480
|
+
case "percent":
|
|
481
|
+
return Jt(e, r);
|
|
482
|
+
case "date":
|
|
483
|
+
return Qt(e, r);
|
|
484
|
+
case "scientific":
|
|
485
|
+
return Zt(e, r);
|
|
486
|
+
case "duration":
|
|
487
|
+
return er(e, r);
|
|
488
|
+
default:
|
|
489
|
+
return String(e);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function Ke(e, t = {}) {
|
|
493
|
+
return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${Z(
|
|
494
|
+
Math.abs(e),
|
|
495
|
+
L(t, {
|
|
496
|
+
min: 0,
|
|
497
|
+
max: 0
|
|
498
|
+
})
|
|
499
|
+
)}` : Z(
|
|
500
|
+
e,
|
|
501
|
+
L(t, {
|
|
502
|
+
min: 0,
|
|
503
|
+
max: 0
|
|
504
|
+
})
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
function Ee(e, t = {}) {
|
|
508
|
+
return xt(e, {
|
|
509
|
+
...L(t, {
|
|
510
|
+
min: 2,
|
|
511
|
+
max: 2
|
|
512
|
+
}),
|
|
513
|
+
style: "currency",
|
|
514
|
+
currency: t.currency || "USD"
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
function Jt(e, t = {}) {
|
|
518
|
+
const r = Be(t, { min: 1, max: 1 }), o = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, i = e * o;
|
|
519
|
+
return Z(i, {
|
|
520
|
+
locale: t.locale,
|
|
521
|
+
minimumFractionDigits: r.minimumFractionDigits,
|
|
522
|
+
maximumFractionDigits: r.maximumFractionDigits,
|
|
523
|
+
useGrouping: t.useGrouping,
|
|
524
|
+
prefix: t.prefix,
|
|
525
|
+
suffix: t.suffix || "%",
|
|
526
|
+
negativeInParentheses: t.negativeInParentheses,
|
|
527
|
+
useSuffix: !1
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
function Qt(e, t = {}) {
|
|
531
|
+
const { locale: r = "en-US" } = t;
|
|
532
|
+
try {
|
|
533
|
+
const n = new Date(e);
|
|
534
|
+
return isNaN(n.getTime()) ? String(e) : new Intl.DateTimeFormat(r, {
|
|
535
|
+
dateStyle: "short"
|
|
536
|
+
}).format(n);
|
|
537
|
+
} catch {
|
|
538
|
+
return String(e);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function Zt(e, t = {}) {
|
|
542
|
+
return Ct(
|
|
543
|
+
e,
|
|
544
|
+
L(t, { min: 2, max: 2 })
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
function er(e, t = {}) {
|
|
548
|
+
return ht(e, {
|
|
549
|
+
inputUnit: t.durationInputUnit,
|
|
550
|
+
outputStyle: t.durationDisplayStyle,
|
|
551
|
+
largestUnit: t.durationLargestUnit,
|
|
552
|
+
smallestUnit: t.durationSmallestUnit,
|
|
553
|
+
maxUnits: t.durationMaxUnits,
|
|
554
|
+
prefix: t.prefix,
|
|
555
|
+
suffix: t.suffix,
|
|
556
|
+
negativeInParentheses: t.negativeInParentheses
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
function tr(e, t) {
|
|
560
|
+
return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
|
|
561
|
+
}
|
|
562
|
+
function On(e, t = {}) {
|
|
563
|
+
return (r) => Re(r, e, t);
|
|
564
|
+
}
|
|
565
|
+
function rr({
|
|
566
|
+
number: e,
|
|
567
|
+
decimalPlaces: t = 0,
|
|
568
|
+
useSuffix: r = !1,
|
|
569
|
+
customSuffix: n = "",
|
|
570
|
+
currency: o = "",
|
|
571
|
+
locale: i = "en-US"
|
|
572
|
+
}) {
|
|
573
|
+
if (o) {
|
|
574
|
+
const a = Ee(e, {
|
|
575
|
+
currency: o,
|
|
576
|
+
decimalPlaces: t,
|
|
577
|
+
locale: i,
|
|
578
|
+
useSuffix: r && !n
|
|
579
|
+
});
|
|
580
|
+
return r && n ? `${a}${n}` : a;
|
|
581
|
+
}
|
|
582
|
+
return Ke(e, {
|
|
583
|
+
decimalPlaces: t,
|
|
584
|
+
useSuffix: r && !n,
|
|
585
|
+
suffix: n,
|
|
586
|
+
locale: i
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
var nr = function e(t, r) {
|
|
590
|
+
if (t === r) return !0;
|
|
591
|
+
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
592
|
+
if (t.constructor !== r.constructor) return !1;
|
|
593
|
+
var n, o, i;
|
|
594
|
+
if (Array.isArray(t)) {
|
|
595
|
+
if (n = t.length, n != r.length) return !1;
|
|
596
|
+
for (o = n; o-- !== 0; )
|
|
597
|
+
if (!e(t[o], r[o])) return !1;
|
|
598
|
+
return !0;
|
|
599
|
+
}
|
|
600
|
+
if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
|
|
601
|
+
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
|
|
602
|
+
if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
|
|
603
|
+
if (i = Object.keys(t), n = i.length, n !== Object.keys(r).length) return !1;
|
|
604
|
+
for (o = n; o-- !== 0; )
|
|
605
|
+
if (!Object.prototype.hasOwnProperty.call(r, i[o])) return !1;
|
|
606
|
+
for (o = n; o-- !== 0; ) {
|
|
607
|
+
var a = i[o];
|
|
608
|
+
if (!(a === "_owner" && t.$$typeof) && !e(t[a], r[a]))
|
|
609
|
+
return !1;
|
|
610
|
+
}
|
|
611
|
+
return !0;
|
|
612
|
+
}
|
|
613
|
+
return t !== t && r !== r;
|
|
614
|
+
};
|
|
615
|
+
const j = /* @__PURE__ */ Dt(nr);
|
|
616
|
+
function or(e) {
|
|
617
|
+
if (typeof e == "number")
|
|
618
|
+
return Number.isFinite(e);
|
|
619
|
+
if (typeof e != "string")
|
|
620
|
+
return !1;
|
|
621
|
+
const t = e.trim().replace(/,/g, "");
|
|
622
|
+
return t !== "" && Number.isFinite(Number(t));
|
|
623
|
+
}
|
|
624
|
+
function ir(e) {
|
|
625
|
+
if (!(e != null && e.length))
|
|
626
|
+
return [];
|
|
627
|
+
const t = /* @__PURE__ */ new Set();
|
|
628
|
+
return e.forEach((r) => {
|
|
629
|
+
Object.keys(r).forEach((n) => t.add(n));
|
|
630
|
+
}), [...t];
|
|
631
|
+
}
|
|
632
|
+
function ar(e) {
|
|
633
|
+
return ir(e).filter(
|
|
634
|
+
(r) => e == null ? void 0 : e.some((n) => or(n[r]))
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
function ae(e, t) {
|
|
638
|
+
var r;
|
|
639
|
+
if (t.id)
|
|
640
|
+
return (r = e.sql) != null && r.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
|
|
641
|
+
}
|
|
642
|
+
function _e(e) {
|
|
643
|
+
const t = e.context.preferences;
|
|
644
|
+
if (!t)
|
|
645
|
+
return e.authoredFormat;
|
|
646
|
+
const r = ae(e.card, e.metric);
|
|
647
|
+
return I(
|
|
648
|
+
e.authoredFormat,
|
|
649
|
+
t,
|
|
650
|
+
r ? e.context.resolveBoundCurrency(r) : void 0
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
function sr(e) {
|
|
654
|
+
var i, a, c;
|
|
655
|
+
const t = (c = (a = (i = e.card.preferences) == null ? void 0 : i.tablePrefs) == null ? void 0 : a.columnSettingsMap) == null ? void 0 : c[e.columnKey], r = (t == null ? void 0 : t.type) === "number" ? Xe(
|
|
656
|
+
{ dataType: "number", format: void 0 },
|
|
657
|
+
t
|
|
658
|
+
) : void 0, n = r == null ? void 0 : r.authoredFormat, o = P(n) ? _e({
|
|
659
|
+
card: e.card,
|
|
660
|
+
metric: {
|
|
661
|
+
id: e.columnKey
|
|
662
|
+
},
|
|
663
|
+
context: e.context,
|
|
664
|
+
authoredFormat: n
|
|
665
|
+
}) : void 0;
|
|
666
|
+
return {
|
|
667
|
+
id: e.columnKey,
|
|
668
|
+
name: e.columnKey,
|
|
669
|
+
label: e.columnKey,
|
|
670
|
+
alias: e.columnKey,
|
|
671
|
+
dataType: "number",
|
|
672
|
+
role: "metric",
|
|
673
|
+
format: o
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function Sn(e) {
|
|
677
|
+
var o, i;
|
|
678
|
+
const t = new Set(
|
|
679
|
+
ar(e.records)
|
|
680
|
+
), r = new Set(
|
|
681
|
+
e.renderedMetricKeys || e.resultKeys
|
|
682
|
+
), n = ((i = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : i.columnSettingsMap) || {};
|
|
683
|
+
return e.resultKeys.filter(
|
|
684
|
+
(a) => {
|
|
685
|
+
var c;
|
|
686
|
+
return r.has(a) && (t.has(a) || ((c = n[a]) == null ? void 0 : c.type) === "number");
|
|
687
|
+
}
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
function An(e) {
|
|
691
|
+
var i, a;
|
|
692
|
+
const { card: t, context: r } = e;
|
|
693
|
+
if (!(r != null && r.preferences) || !Se(t.type))
|
|
694
|
+
return t;
|
|
695
|
+
const n = r.preferences, o = (i = t.sql) != null && i.trim() ? e.resultMetricKeys.map(
|
|
696
|
+
(c) => sr({
|
|
697
|
+
card: t,
|
|
698
|
+
columnKey: c,
|
|
699
|
+
context: r
|
|
700
|
+
})
|
|
701
|
+
) : (((a = t.config) == null ? void 0 : a.metricColumns) || []).map((c) => {
|
|
702
|
+
const s = xe(t, c), u = s.authoredFormat;
|
|
703
|
+
if (!P(u))
|
|
704
|
+
return c;
|
|
705
|
+
const l = ae(t, c), m = l ? r.resolveBoundCurrency(l) : void 0;
|
|
706
|
+
return s.source === "inferred" && !m ? c : {
|
|
707
|
+
...c,
|
|
708
|
+
format: s.source === "inferred" ? I(
|
|
709
|
+
u,
|
|
710
|
+
n,
|
|
711
|
+
m
|
|
712
|
+
) : _e({
|
|
713
|
+
card: t,
|
|
714
|
+
metric: c,
|
|
715
|
+
context: r,
|
|
716
|
+
authoredFormat: u
|
|
717
|
+
})
|
|
718
|
+
};
|
|
719
|
+
});
|
|
720
|
+
return {
|
|
721
|
+
...t,
|
|
722
|
+
config: {
|
|
723
|
+
...t.config || {},
|
|
724
|
+
metricColumns: o
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function z(e) {
|
|
729
|
+
var s;
|
|
730
|
+
const { card: t, context: r, formatOptions: n } = e, o = r == null ? void 0 : r.preferences;
|
|
731
|
+
if (!t || !o || !Se(t.type))
|
|
732
|
+
return n;
|
|
733
|
+
if (!n) {
|
|
734
|
+
const u = e.metrics.filter(
|
|
735
|
+
(m) => !!m
|
|
736
|
+
), l = u.some(
|
|
737
|
+
(m) => P(m.format)
|
|
738
|
+
);
|
|
739
|
+
return u.length < 2 || !l ? n : T(
|
|
740
|
+
I({ type: "number" }, o),
|
|
741
|
+
{ preserveOmittedProperties: !0 }
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
if ((s = t.sql) != null && s.trim()) {
|
|
745
|
+
const u = e.metrics.filter(
|
|
746
|
+
(m) => !!m
|
|
747
|
+
), l = u.filter(
|
|
748
|
+
(m) => P(m.format)
|
|
749
|
+
);
|
|
750
|
+
if (l.length === 0)
|
|
751
|
+
return n;
|
|
752
|
+
if (l.length !== u.length)
|
|
753
|
+
return T(
|
|
754
|
+
I({ type: "number" }, o),
|
|
755
|
+
{ preserveOmittedProperties: !0 }
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
const i = Ie(n, {
|
|
759
|
+
preserveOmittedProperties: !0
|
|
760
|
+
});
|
|
761
|
+
if (!P(i))
|
|
762
|
+
return n;
|
|
763
|
+
const a = e.metrics.flatMap((u) => {
|
|
764
|
+
if (!u)
|
|
765
|
+
return [];
|
|
766
|
+
const l = ae(t, u);
|
|
767
|
+
return [
|
|
768
|
+
I(
|
|
769
|
+
i,
|
|
770
|
+
o,
|
|
771
|
+
l ? r.resolveBoundCurrency(l) : void 0
|
|
772
|
+
)
|
|
773
|
+
];
|
|
774
|
+
});
|
|
775
|
+
if (a.length === 0)
|
|
776
|
+
return T(
|
|
777
|
+
I(i, o),
|
|
778
|
+
{ preserveOmittedProperties: !0 }
|
|
779
|
+
);
|
|
780
|
+
const [c] = a;
|
|
781
|
+
if (a.some((u) => !j(u, c))) {
|
|
782
|
+
const u = I(
|
|
783
|
+
{
|
|
784
|
+
...i,
|
|
785
|
+
type: "number",
|
|
786
|
+
currency: void 0
|
|
787
|
+
},
|
|
788
|
+
o
|
|
789
|
+
);
|
|
790
|
+
return T(u, {
|
|
791
|
+
preserveOmittedProperties: !0
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
return T(c, {
|
|
795
|
+
preserveOmittedProperties: !0
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
const cr = /* @__PURE__ */ new Set([
|
|
799
|
+
"horizontalBar",
|
|
800
|
+
"tornado",
|
|
801
|
+
"pyramid",
|
|
802
|
+
"range"
|
|
803
|
+
]), ur = /* @__PURE__ */ new Set([
|
|
804
|
+
"tornado",
|
|
805
|
+
"pyramid",
|
|
806
|
+
"range"
|
|
807
|
+
]), lr = /* @__PURE__ */ new Set([
|
|
808
|
+
"tornado",
|
|
809
|
+
"pyramid",
|
|
810
|
+
"range"
|
|
811
|
+
]);
|
|
812
|
+
function dr(e) {
|
|
813
|
+
const { chartType: t, resultKeys: r, config: n } = e, o = 1 + (n != null && n.enableGrouping && (n.groupKey || r[1]) ? 1 : 0), i = r.slice(o), a = (n == null ? void 0 : n.xMetricKey) ?? i[0], c = (n == null ? void 0 : n.yMetricKey) ?? i[1] ?? i[0], s = t === "bubble" ? (n == null ? void 0 : n.radiusMetricKey) ?? i[2] ?? i[1] ?? i[0] : void 0, u = new Set(r);
|
|
814
|
+
return [a, c, s].filter((l) => !!l).filter((l) => u.has(l));
|
|
815
|
+
}
|
|
816
|
+
function wn(e) {
|
|
817
|
+
const { chartType: t, resultKeys: r, preferences: n } = e;
|
|
818
|
+
return t === "scatter" || t === "bubble" ? [
|
|
819
|
+
...new Set(
|
|
820
|
+
dr({
|
|
821
|
+
chartType: t,
|
|
822
|
+
resultKeys: r,
|
|
823
|
+
config: n == null ? void 0 : n.bubbleScatterConfig
|
|
824
|
+
})
|
|
825
|
+
)
|
|
826
|
+
] : lr.has(t || "") ? r.slice(2) : r.length === 1 ? [r[0]] : r.slice(1);
|
|
827
|
+
}
|
|
828
|
+
function _(e, t) {
|
|
829
|
+
var r;
|
|
830
|
+
return ((r = t == null ? void 0 : t.chartOptions) == null ? void 0 : r.indexAxis) === "y" || cr.has(e || "") ? "x" : "y";
|
|
831
|
+
}
|
|
832
|
+
function Dn(e, t) {
|
|
833
|
+
return _(e, t) === "x";
|
|
834
|
+
}
|
|
835
|
+
function mr(e, t) {
|
|
836
|
+
return _(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (ur.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
|
|
837
|
+
}
|
|
838
|
+
function K(e) {
|
|
839
|
+
return e ? Object.entries(e).some(([t, r]) => r == null || r === "" ? !1 : t === "type" ? r !== "auto" : !0) : !1;
|
|
840
|
+
}
|
|
841
|
+
function Ne(e) {
|
|
842
|
+
if (e)
|
|
843
|
+
return e.alias || e.label || e.name;
|
|
844
|
+
}
|
|
845
|
+
function te(e, t) {
|
|
846
|
+
var n;
|
|
847
|
+
return (((n = e == null ? void 0 : e.config) == null ? void 0 : n.metricColumns) || []).find((o) => {
|
|
848
|
+
const i = Ne(o);
|
|
849
|
+
return t.metricId && o.id === t.metricId || t.metricAlias && i === t.metricAlias || t.metricAlias && o.alias === t.metricAlias || t.columnId && i === t.columnId || t.columnId && o.alias === t.columnId || t.columnId && o.label === t.columnId || t.columnId && o.name === t.columnId;
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function N(e, t) {
|
|
853
|
+
var n, o;
|
|
854
|
+
const r = ee(e, t);
|
|
855
|
+
if (!(r && ((o = (n = e == null ? void 0 : e.config) == null ? void 0 : n.groupByColumns) != null && o.includes(r)) && !Yt(r)))
|
|
856
|
+
return r;
|
|
857
|
+
}
|
|
858
|
+
function fr(e) {
|
|
859
|
+
return !!e && !(e != null && e.format) && yt(e == null ? void 0 : e.dataType) === "number";
|
|
860
|
+
}
|
|
861
|
+
const yr = {
|
|
862
|
+
style: "decimal",
|
|
863
|
+
showDataBar: !1,
|
|
864
|
+
dataBarColor: "#3b82f6"
|
|
865
|
+
};
|
|
866
|
+
function Ve(e) {
|
|
867
|
+
if (!e)
|
|
868
|
+
return;
|
|
869
|
+
const t = ie();
|
|
870
|
+
return {
|
|
871
|
+
...t,
|
|
872
|
+
...e,
|
|
873
|
+
inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
|
|
874
|
+
numberFormat: {
|
|
875
|
+
...yr,
|
|
876
|
+
...e.numberFormat
|
|
877
|
+
},
|
|
878
|
+
dateFormat: {
|
|
879
|
+
...t.dateFormat,
|
|
880
|
+
...e.dateFormat
|
|
881
|
+
},
|
|
882
|
+
linkFormat: {
|
|
883
|
+
...t.linkFormat,
|
|
884
|
+
...e.linkFormat
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function Bn(e) {
|
|
889
|
+
return Object.fromEntries(
|
|
890
|
+
Object.entries(e || {}).map(([t, r]) => [
|
|
891
|
+
t,
|
|
892
|
+
Ve(r)
|
|
893
|
+
])
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
function k(e) {
|
|
897
|
+
return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
|
|
898
|
+
}
|
|
899
|
+
function ke(e, t, r) {
|
|
900
|
+
if (!k(r))
|
|
901
|
+
return r;
|
|
902
|
+
const n = k(e) ? e : {}, o = k(t) ? t : {}, i = {};
|
|
903
|
+
for (const a of Object.keys(r)) {
|
|
904
|
+
const c = r[a];
|
|
905
|
+
if (c === void 0)
|
|
906
|
+
continue;
|
|
907
|
+
const s = Object.prototype.hasOwnProperty.call(
|
|
908
|
+
n,
|
|
909
|
+
a
|
|
910
|
+
), u = o[a];
|
|
911
|
+
if (s && j(c, u)) {
|
|
912
|
+
i[a] = n[a];
|
|
913
|
+
continue;
|
|
914
|
+
}
|
|
915
|
+
if (!s && j(c, u))
|
|
916
|
+
continue;
|
|
917
|
+
const l = ke(
|
|
918
|
+
n[a],
|
|
919
|
+
u,
|
|
920
|
+
c
|
|
921
|
+
);
|
|
922
|
+
k(l) && Object.keys(l).length === 0 && !s || (i[a] = l);
|
|
923
|
+
}
|
|
924
|
+
return i;
|
|
925
|
+
}
|
|
926
|
+
function gr(e) {
|
|
927
|
+
let t = ke(
|
|
928
|
+
e.persisted,
|
|
929
|
+
e.baseline,
|
|
930
|
+
e.next
|
|
931
|
+
);
|
|
932
|
+
if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
|
|
933
|
+
const r = e.next.dateFormat.customFormat;
|
|
934
|
+
if (!(r != null && r.trim()))
|
|
935
|
+
throw new It(
|
|
936
|
+
"invalid_raw_temporal_format",
|
|
937
|
+
"Custom table date formatting requires a non-empty pattern."
|
|
938
|
+
);
|
|
939
|
+
Mt({
|
|
940
|
+
dialect: "date_fns",
|
|
941
|
+
pattern: r,
|
|
942
|
+
valueKind: e.rawTemporalValueKind
|
|
943
|
+
}), t = {
|
|
944
|
+
...t,
|
|
945
|
+
dateFormat: {
|
|
946
|
+
...t.dateFormat,
|
|
947
|
+
useCustomFormat: !0,
|
|
948
|
+
customFormat: r
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
return e.next.type === "number" && !j(e.next.numberFormat, e.baseline.numberFormat) && t.numberFormat ? {
|
|
953
|
+
...t,
|
|
954
|
+
type: "number",
|
|
955
|
+
inheritMetricFormat: e.next.inheritMetricFormat ?? !1
|
|
956
|
+
} : e.next.type === "number" && e.baseline.inheritMetricFormat === !0 && e.next.inheritMetricFormat === !1 ? {
|
|
957
|
+
...t,
|
|
958
|
+
type: "number",
|
|
959
|
+
inheritMetricFormat: !1
|
|
960
|
+
} : e.forcePersistDateType && e.next.type === "date" ? {
|
|
961
|
+
...t,
|
|
962
|
+
type: "date"
|
|
963
|
+
} : t;
|
|
964
|
+
}
|
|
965
|
+
function Rn(e) {
|
|
966
|
+
return e.reset ? br(e.persisted, e.columnId) : {
|
|
967
|
+
...e.persisted,
|
|
968
|
+
[e.columnId]: gr({
|
|
969
|
+
persisted: e.persisted[e.columnId],
|
|
970
|
+
baseline: e.baseline,
|
|
971
|
+
next: e.next,
|
|
972
|
+
forcePersistDateType: e.forcePersistDateType,
|
|
973
|
+
enforceDeclaredSqlTemporalFormat: e.enforceDeclaredSqlTemporalFormat,
|
|
974
|
+
rawTemporalValueKind: e.rawTemporalValueKind
|
|
975
|
+
})
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
function br(e, t) {
|
|
979
|
+
if (!(t in e))
|
|
980
|
+
return e;
|
|
981
|
+
const r = { ...e };
|
|
982
|
+
return delete r[t], r;
|
|
983
|
+
}
|
|
984
|
+
function Fr(e, t) {
|
|
985
|
+
const r = e || ie(), n = !t;
|
|
986
|
+
return {
|
|
987
|
+
...r,
|
|
988
|
+
type: "number",
|
|
989
|
+
textAlign: r.type === "none" ? "right" : r.textAlign,
|
|
990
|
+
numberFormat: {
|
|
991
|
+
style: "decimal",
|
|
992
|
+
minimumFractionDigits: n ? r.numberFormat.minimumFractionDigits : void 0,
|
|
993
|
+
maximumFractionDigits: n ? r.numberFormat.maximumFractionDigits : void 0,
|
|
994
|
+
useGrouping: r.numberFormat.useGrouping,
|
|
995
|
+
showDataBar: r.numberFormat.showDataBar,
|
|
996
|
+
showHeatmap: r.numberFormat.showHeatmap,
|
|
997
|
+
dataBarColor: r.numberFormat.dataBarColor,
|
|
998
|
+
dataBarMinValue: r.numberFormat.dataBarMinValue,
|
|
999
|
+
dataBarMaxValue: r.numberFormat.dataBarMaxValue
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
function J(e) {
|
|
1004
|
+
if (e)
|
|
1005
|
+
return e.trim().toLowerCase();
|
|
1006
|
+
}
|
|
1007
|
+
const Le = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
|
|
1008
|
+
function pr(e) {
|
|
1009
|
+
const t = e == null ? void 0 : e.trim();
|
|
1010
|
+
return t ? t.replace(Le, "").trim() || t : void 0;
|
|
1011
|
+
}
|
|
1012
|
+
function vr(e) {
|
|
1013
|
+
const t = e == null ? void 0 : e.trim();
|
|
1014
|
+
return t ? Le.test(t) : !1;
|
|
1015
|
+
}
|
|
1016
|
+
function hr(e, t) {
|
|
1017
|
+
return t.metricAlias ? e.find(
|
|
1018
|
+
(r) => Ft(r) === t.metricAlias
|
|
1019
|
+
) : t.metricId ? e.find((r) => r.id === t.metricId) : void 0;
|
|
1020
|
+
}
|
|
1021
|
+
function Cr(e) {
|
|
1022
|
+
var p;
|
|
1023
|
+
const {
|
|
1024
|
+
card: t,
|
|
1025
|
+
metricId: r,
|
|
1026
|
+
metricAlias: n,
|
|
1027
|
+
datasetIndex: o,
|
|
1028
|
+
datasetLabel: i,
|
|
1029
|
+
metricKey: a
|
|
1030
|
+
} = e, c = ((p = t == null ? void 0 : t.config) == null ? void 0 : p.metricColumns) || [];
|
|
1031
|
+
if (n || r)
|
|
1032
|
+
return hr(c, {
|
|
1033
|
+
metricAlias: n,
|
|
1034
|
+
metricId: r
|
|
1035
|
+
});
|
|
1036
|
+
const s = [a, i], u = s.some(
|
|
1037
|
+
(d) => vr(d)
|
|
1038
|
+
), l = s.filter(
|
|
1039
|
+
(d) => !!d
|
|
1040
|
+
);
|
|
1041
|
+
for (const d of l) {
|
|
1042
|
+
const b = te(t, {
|
|
1043
|
+
columnId: d,
|
|
1044
|
+
metricAlias: d
|
|
1045
|
+
});
|
|
1046
|
+
if (b)
|
|
1047
|
+
return b;
|
|
1048
|
+
}
|
|
1049
|
+
const m = l.map((d) => J(d)).filter((d) => !!d), f = l.map((d) => pr(d)).filter((d) => !!d);
|
|
1050
|
+
for (const d of f) {
|
|
1051
|
+
const b = te(t, {
|
|
1052
|
+
columnId: d,
|
|
1053
|
+
metricAlias: d
|
|
1054
|
+
});
|
|
1055
|
+
if (b)
|
|
1056
|
+
return b;
|
|
1057
|
+
}
|
|
1058
|
+
if (c.length === 1)
|
|
1059
|
+
return c[0];
|
|
1060
|
+
if (!u && typeof o == "number" && o >= 0 && o < c.length)
|
|
1061
|
+
return c[o];
|
|
1062
|
+
const g = f.map((d) => J(d)).filter((d) => !!d), F = [
|
|
1063
|
+
...m,
|
|
1064
|
+
...g
|
|
1065
|
+
];
|
|
1066
|
+
if (F.length !== 0)
|
|
1067
|
+
return c.find((d) => {
|
|
1068
|
+
const b = [
|
|
1069
|
+
d.alias,
|
|
1070
|
+
d.label,
|
|
1071
|
+
d.name,
|
|
1072
|
+
Ne(d)
|
|
1073
|
+
].map((C) => J(C)).filter((C) => !!C);
|
|
1074
|
+
return F.some(
|
|
1075
|
+
(C) => b.includes(C)
|
|
1076
|
+
);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
function xr(e) {
|
|
1080
|
+
const t = E(e == null ? void 0 : e.format);
|
|
1081
|
+
return T(t);
|
|
1082
|
+
}
|
|
1083
|
+
function ve(e, t) {
|
|
1084
|
+
if (t)
|
|
1085
|
+
return te(e, {
|
|
1086
|
+
columnId: t,
|
|
1087
|
+
metricAlias: t
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
function he(e) {
|
|
1091
|
+
const t = Ie(e);
|
|
1092
|
+
if (t)
|
|
1093
|
+
return JSON.stringify(t);
|
|
1094
|
+
}
|
|
1095
|
+
function Ir(e, t) {
|
|
1096
|
+
const r = he(e), n = he(t);
|
|
1097
|
+
return !!(r && n && r === n);
|
|
1098
|
+
}
|
|
1099
|
+
function Mr(e) {
|
|
1100
|
+
if (e.length === 0)
|
|
1101
|
+
return;
|
|
1102
|
+
const t = e.map(
|
|
1103
|
+
(a) => xr(a)
|
|
1104
|
+
);
|
|
1105
|
+
if (!t.every(
|
|
1106
|
+
(a) => K(a)
|
|
1107
|
+
))
|
|
1108
|
+
return;
|
|
1109
|
+
const n = t, [o] = n;
|
|
1110
|
+
return n.every(
|
|
1111
|
+
(a) => Ir(o, a)
|
|
1112
|
+
) ? o : void 0;
|
|
1113
|
+
}
|
|
1114
|
+
function Pr(e) {
|
|
1115
|
+
const t = e.formatMode || e.legacyMode;
|
|
1116
|
+
return t === "override" ? "override" : t === "inherit" ? "inherit" : e.legacyMode && e.legacyMode !== "auto" && e.legacyMode !== "inherit" && e.legacyMode !== "override" || K(e.formatOptions) ? "override" : "inherit";
|
|
1117
|
+
}
|
|
1118
|
+
function H(e) {
|
|
1119
|
+
const t = Pr({
|
|
1120
|
+
formatMode: e.formatMode,
|
|
1121
|
+
legacyMode: e.legacyMode,
|
|
1122
|
+
formatOptions: e.overrideFormatOptions
|
|
1123
|
+
});
|
|
1124
|
+
if (t === "override" && K(e.overrideFormatOptions))
|
|
1125
|
+
return {
|
|
1126
|
+
formatOptions: e.overrideFormatOptions || void 0,
|
|
1127
|
+
source: "override"
|
|
1128
|
+
};
|
|
1129
|
+
if (t === "override" && e.legacyMode === "none")
|
|
1130
|
+
return {
|
|
1131
|
+
formatOptions: void 0,
|
|
1132
|
+
source: "override",
|
|
1133
|
+
rawValue: !0
|
|
1134
|
+
};
|
|
1135
|
+
const r = Mr(
|
|
1136
|
+
e.metrics || []
|
|
1137
|
+
);
|
|
1138
|
+
if (K(r))
|
|
1139
|
+
return {
|
|
1140
|
+
formatOptions: r,
|
|
1141
|
+
source: "metric"
|
|
1142
|
+
};
|
|
1143
|
+
const n = Br(e.preferences);
|
|
1144
|
+
return K(n) ? {
|
|
1145
|
+
formatOptions: n,
|
|
1146
|
+
source: "legacy"
|
|
1147
|
+
} : {
|
|
1148
|
+
formatOptions: void 0,
|
|
1149
|
+
source: "auto"
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function je(e) {
|
|
1153
|
+
var s, u, l;
|
|
1154
|
+
const { card: t, chartType: r, axis: n, preferences: o } = e, i = ((s = t == null ? void 0 : t.config) == null ? void 0 : s.metricColumns) || [], a = (o == null ? void 0 : o.datasetOptions) || [];
|
|
1155
|
+
if (!i.length)
|
|
1156
|
+
return [];
|
|
1157
|
+
if (r === "combo")
|
|
1158
|
+
return n === "x" ? [] : i.filter((m, f) => {
|
|
1159
|
+
const g = a.find((p) => p.idx === f);
|
|
1160
|
+
return ((g == null ? void 0 : g.yAxisId) === "y2" ? "y2" : "y") === n;
|
|
1161
|
+
});
|
|
1162
|
+
if (r === "bubble" || r === "scatter") {
|
|
1163
|
+
if (n === "y2")
|
|
1164
|
+
return [];
|
|
1165
|
+
const m = ve(
|
|
1166
|
+
t,
|
|
1167
|
+
(u = o == null ? void 0 : o.bubbleScatterConfig) == null ? void 0 : u.xMetricKey
|
|
1168
|
+
) || i[0], f = ve(
|
|
1169
|
+
t,
|
|
1170
|
+
(l = o == null ? void 0 : o.bubbleScatterConfig) == null ? void 0 : l.yMetricKey
|
|
1171
|
+
) || i[1] || i[0];
|
|
1172
|
+
return n === "x" ? m ? [m] : [] : f ? [f] : [];
|
|
1173
|
+
}
|
|
1174
|
+
const c = _(r, o);
|
|
1175
|
+
return r === "radar" ? n === "y" ? i : [] : n !== c ? [] : i;
|
|
1176
|
+
}
|
|
1177
|
+
function se(e) {
|
|
1178
|
+
const { card: t, chartType: r, axis: n, preferences: o, axisConfig: i } = e, a = je({
|
|
1179
|
+
card: t,
|
|
1180
|
+
chartType: r,
|
|
1181
|
+
axis: n,
|
|
1182
|
+
preferences: o
|
|
1183
|
+
}), c = H({
|
|
1184
|
+
formatMode: i == null ? void 0 : i.formatMode,
|
|
1185
|
+
overrideFormatOptions: i == null ? void 0 : i.formatOptions,
|
|
1186
|
+
metrics: a,
|
|
1187
|
+
preferences: o
|
|
1188
|
+
});
|
|
1189
|
+
return {
|
|
1190
|
+
...c,
|
|
1191
|
+
formatOptions: z({
|
|
1192
|
+
card: t,
|
|
1193
|
+
metrics: a,
|
|
1194
|
+
formatOptions: c.formatOptions,
|
|
1195
|
+
context: e.numericPresentation
|
|
1196
|
+
})
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
function qe(e, t) {
|
|
1200
|
+
if (!e && (!t || t === "auto" || t === "none"))
|
|
1201
|
+
return;
|
|
1202
|
+
const r = {
|
|
1203
|
+
...e || {}
|
|
1204
|
+
};
|
|
1205
|
+
return t && t !== "auto" && t !== "none" && !r.type && (r.type = t), r;
|
|
1206
|
+
}
|
|
1207
|
+
function Tr(e) {
|
|
1208
|
+
const { preferences: t, metric: r } = e, n = t == null ? void 0 : t.tooltipConfig, o = H({
|
|
1209
|
+
formatMode: n == null ? void 0 : n.formatMode,
|
|
1210
|
+
legacyMode: n == null ? void 0 : n.mode,
|
|
1211
|
+
overrideFormatOptions: n == null ? void 0 : n.formatOptions,
|
|
1212
|
+
metrics: r ? [r] : [],
|
|
1213
|
+
preferences: t
|
|
1214
|
+
});
|
|
1215
|
+
return {
|
|
1216
|
+
...o,
|
|
1217
|
+
formatOptions: z({
|
|
1218
|
+
card: e.card,
|
|
1219
|
+
metrics: e.metric ? [e.metric] : [],
|
|
1220
|
+
formatOptions: o.formatOptions,
|
|
1221
|
+
context: e.numericPresentation
|
|
1222
|
+
})
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
function ce(e, t, r) {
|
|
1226
|
+
return t === _(r, e) ? mr(r, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
|
|
1227
|
+
}
|
|
1228
|
+
function ue(e) {
|
|
1229
|
+
const { chartType: t, preferences: r } = e;
|
|
1230
|
+
return t === "bubble" || t === "scatter" ? "y" : _(t, r);
|
|
1231
|
+
}
|
|
1232
|
+
function ze(e) {
|
|
1233
|
+
switch (e) {
|
|
1234
|
+
case "pie":
|
|
1235
|
+
case "doughnut":
|
|
1236
|
+
case "polarArea":
|
|
1237
|
+
case "funnel":
|
|
1238
|
+
case "treemap":
|
|
1239
|
+
case "heatmap":
|
|
1240
|
+
return !1;
|
|
1241
|
+
default:
|
|
1242
|
+
return !0;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
function Kn(e) {
|
|
1246
|
+
const { card: t, chartType: r, preferences: n, metric: o } = e, i = Tr({
|
|
1247
|
+
card: t,
|
|
1248
|
+
preferences: n,
|
|
1249
|
+
metric: o,
|
|
1250
|
+
numericPresentation: e.numericPresentation
|
|
1251
|
+
});
|
|
1252
|
+
if (i.source === "override")
|
|
1253
|
+
return i;
|
|
1254
|
+
const a = e.axis || ue({ chartType: r, preferences: n }), c = se({
|
|
1255
|
+
card: t,
|
|
1256
|
+
chartType: r,
|
|
1257
|
+
axis: a,
|
|
1258
|
+
preferences: n,
|
|
1259
|
+
axisConfig: ce(n, a, r),
|
|
1260
|
+
numericPresentation: e.numericPresentation
|
|
1261
|
+
});
|
|
1262
|
+
return c.source === "override" ? c : i;
|
|
1263
|
+
}
|
|
1264
|
+
function En(e) {
|
|
1265
|
+
const { card: t, chartType: r, preferences: n, dataLabelsConfig: o } = e, i = r || (t == null ? void 0 : t.type), a = ue({
|
|
1266
|
+
chartType: i,
|
|
1267
|
+
preferences: n
|
|
1268
|
+
}), c = je({
|
|
1269
|
+
card: t,
|
|
1270
|
+
chartType: i,
|
|
1271
|
+
axis: a,
|
|
1272
|
+
preferences: n
|
|
1273
|
+
}), s = H({
|
|
1274
|
+
formatMode: o == null ? void 0 : o.formatMode,
|
|
1275
|
+
legacyMode: o == null ? void 0 : o.format,
|
|
1276
|
+
overrideFormatOptions: qe(
|
|
1277
|
+
o == null ? void 0 : o.formatOptions,
|
|
1278
|
+
o == null ? void 0 : o.format
|
|
1279
|
+
),
|
|
1280
|
+
metrics: c,
|
|
1281
|
+
preferences: n
|
|
1282
|
+
}), u = {
|
|
1283
|
+
...s,
|
|
1284
|
+
formatOptions: z({
|
|
1285
|
+
card: t,
|
|
1286
|
+
metrics: c,
|
|
1287
|
+
formatOptions: s.formatOptions,
|
|
1288
|
+
context: e.numericPresentation
|
|
1289
|
+
})
|
|
1290
|
+
};
|
|
1291
|
+
if (u.source === "override" || !ze(i))
|
|
1292
|
+
return u;
|
|
1293
|
+
const l = se({
|
|
1294
|
+
card: t,
|
|
1295
|
+
chartType: i,
|
|
1296
|
+
axis: a,
|
|
1297
|
+
preferences: n,
|
|
1298
|
+
axisConfig: ce(
|
|
1299
|
+
n,
|
|
1300
|
+
a,
|
|
1301
|
+
i
|
|
1302
|
+
),
|
|
1303
|
+
numericPresentation: e.numericPresentation
|
|
1304
|
+
});
|
|
1305
|
+
return l.source === "override" ? l : u;
|
|
1306
|
+
}
|
|
1307
|
+
function Or(e) {
|
|
1308
|
+
const { preferences: t, dataLabelsConfig: r, metric: n } = e, o = H({
|
|
1309
|
+
formatMode: r == null ? void 0 : r.formatMode,
|
|
1310
|
+
legacyMode: r == null ? void 0 : r.format,
|
|
1311
|
+
overrideFormatOptions: qe(
|
|
1312
|
+
r == null ? void 0 : r.formatOptions,
|
|
1313
|
+
r == null ? void 0 : r.format
|
|
1314
|
+
),
|
|
1315
|
+
metrics: n ? [n] : [],
|
|
1316
|
+
preferences: t
|
|
1317
|
+
});
|
|
1318
|
+
return {
|
|
1319
|
+
...o,
|
|
1320
|
+
formatOptions: z({
|
|
1321
|
+
card: e.card,
|
|
1322
|
+
metrics: e.metric ? [e.metric] : [],
|
|
1323
|
+
formatOptions: o.formatOptions,
|
|
1324
|
+
context: e.numericPresentation
|
|
1325
|
+
})
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
function _n(e) {
|
|
1329
|
+
var a, c;
|
|
1330
|
+
const t = Cr({
|
|
1331
|
+
card: e.card,
|
|
1332
|
+
metricId: e.metricId,
|
|
1333
|
+
metricAlias: e.metricAlias,
|
|
1334
|
+
datasetIndex: e.datasetIndex,
|
|
1335
|
+
datasetLabel: e.datasetLabel,
|
|
1336
|
+
metricKey: e.metricKey
|
|
1337
|
+
}), r = Or({
|
|
1338
|
+
card: e.card,
|
|
1339
|
+
preferences: e.preferences,
|
|
1340
|
+
dataLabelsConfig: e.dataLabelsConfig,
|
|
1341
|
+
metric: t,
|
|
1342
|
+
numericPresentation: e.numericPresentation
|
|
1343
|
+
});
|
|
1344
|
+
if (r.source === "override")
|
|
1345
|
+
return r;
|
|
1346
|
+
const n = (a = e.card) == null ? void 0 : a.type;
|
|
1347
|
+
if (!ze(n))
|
|
1348
|
+
return r;
|
|
1349
|
+
let o = ue({
|
|
1350
|
+
chartType: n,
|
|
1351
|
+
preferences: e.preferences
|
|
1352
|
+
});
|
|
1353
|
+
if (n === "combo" && typeof e.datasetIndex == "number") {
|
|
1354
|
+
const u = (((c = e.preferences) == null ? void 0 : c.datasetOptions) || []).find(
|
|
1355
|
+
(l) => l.idx === e.datasetIndex
|
|
1356
|
+
);
|
|
1357
|
+
o = (u == null ? void 0 : u.yAxisId) === "y2" ? "y2" : "y";
|
|
1358
|
+
}
|
|
1359
|
+
const i = se({
|
|
1360
|
+
card: e.card,
|
|
1361
|
+
chartType: n,
|
|
1362
|
+
axis: o,
|
|
1363
|
+
preferences: e.preferences,
|
|
1364
|
+
axisConfig: ce(
|
|
1365
|
+
e.preferences,
|
|
1366
|
+
o,
|
|
1367
|
+
n
|
|
1368
|
+
),
|
|
1369
|
+
numericPresentation: e.numericPresentation
|
|
1370
|
+
});
|
|
1371
|
+
return i.source === "override" ? i : r;
|
|
1372
|
+
}
|
|
1373
|
+
function Nn(e) {
|
|
1374
|
+
return (e == null ? void 0 : e.rawValue) === !0;
|
|
1375
|
+
}
|
|
1376
|
+
function Sr(e) {
|
|
1377
|
+
const t = e == null ? void 0 : e.numberFormat;
|
|
1378
|
+
if (!t)
|
|
1379
|
+
return;
|
|
1380
|
+
if (t.style === "duration")
|
|
1381
|
+
return T(re(t), {
|
|
1382
|
+
preserveOmittedProperties: !0
|
|
1383
|
+
});
|
|
1384
|
+
const r = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", n = t.minimumFractionDigits, o = t.maximumFractionDigits;
|
|
1385
|
+
return {
|
|
1386
|
+
type: r,
|
|
1387
|
+
currency: r === "currency" ? t.currency : void 0,
|
|
1388
|
+
locale: t.locale,
|
|
1389
|
+
decimalPlaces: n === o ? o : void 0,
|
|
1390
|
+
minimumFractionDigits: n,
|
|
1391
|
+
maximumFractionDigits: o,
|
|
1392
|
+
useGrouping: t.useGrouping,
|
|
1393
|
+
percentValueMode: r === "percent" ? t.percentValueMode : void 0,
|
|
1394
|
+
multiplyBy: t.scale,
|
|
1395
|
+
useSuffix: t.compact,
|
|
1396
|
+
negativeInParentheses: t.negativeStyle === "parentheses",
|
|
1397
|
+
prefix: t.prefix,
|
|
1398
|
+
suffix: t.suffix
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
function Ar(e, t, r = !1) {
|
|
1402
|
+
const n = r ? { preserveOmittedProperties: !0 } : void 0, o = E(e == null ? void 0 : e.format, n), i = Me(
|
|
1403
|
+
o,
|
|
1404
|
+
n
|
|
1405
|
+
);
|
|
1406
|
+
if (!i)
|
|
1407
|
+
return;
|
|
1408
|
+
const a = t || ie(), c = r ? {
|
|
1409
|
+
showDataBar: a.numberFormat.showDataBar,
|
|
1410
|
+
showHeatmap: a.numberFormat.showHeatmap,
|
|
1411
|
+
dataBarColor: a.numberFormat.dataBarColor,
|
|
1412
|
+
dataBarMinValue: a.numberFormat.dataBarMinValue,
|
|
1413
|
+
dataBarMaxValue: a.numberFormat.dataBarMaxValue
|
|
1414
|
+
} : a.numberFormat, s = a.type && a.type !== "none";
|
|
1415
|
+
return {
|
|
1416
|
+
...a,
|
|
1417
|
+
type: s ? a.type : "number",
|
|
1418
|
+
inheritMetricFormat: a.inheritMetricFormat ?? !0,
|
|
1419
|
+
textAlign: s ? a.textAlign : "right",
|
|
1420
|
+
numberFormat: {
|
|
1421
|
+
...c,
|
|
1422
|
+
...i,
|
|
1423
|
+
showDataBar: c.showDataBar,
|
|
1424
|
+
showHeatmap: c.showHeatmap,
|
|
1425
|
+
dataBarColor: c.dataBarColor,
|
|
1426
|
+
dataBarMinValue: c.dataBarMinValue,
|
|
1427
|
+
dataBarMaxValue: c.dataBarMaxValue
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
function He(e) {
|
|
1432
|
+
var v, h, S, w;
|
|
1433
|
+
const {
|
|
1434
|
+
card: t,
|
|
1435
|
+
columnId: r,
|
|
1436
|
+
persistedSettings: n,
|
|
1437
|
+
resolvedSettings: o,
|
|
1438
|
+
fallbackSettings: i,
|
|
1439
|
+
metricId: a,
|
|
1440
|
+
metricAlias: c,
|
|
1441
|
+
fieldId: s,
|
|
1442
|
+
fieldRole: u,
|
|
1443
|
+
columnKeyMap: l,
|
|
1444
|
+
valueFormatPreferences: m,
|
|
1445
|
+
boundCurrency: f,
|
|
1446
|
+
preserveOmittedProperties: g
|
|
1447
|
+
} = e, F = n ?? ((S = (h = (v = t == null ? void 0 : t.preferences) == null ? void 0 : v.tablePrefs) == null ? void 0 : h.columnSettingsMap) == null ? void 0 : S[r]), p = !((w = t == null ? void 0 : t.sql) != null && w.trim()) || Je(F), d = p ? m : null, b = p ? f : void 0, C = Qe(
|
|
1448
|
+
F == null ? void 0 : F.numberFormat
|
|
1449
|
+
), x = o ?? Ve(F);
|
|
1450
|
+
if (x && x.inheritMetricFormat !== !0)
|
|
1451
|
+
return Ce(
|
|
1452
|
+
x,
|
|
1453
|
+
d,
|
|
1454
|
+
b,
|
|
1455
|
+
{
|
|
1456
|
+
preserveHistoricalPersistedPrecision: C
|
|
1457
|
+
}
|
|
1458
|
+
);
|
|
1459
|
+
const O = N(t, {
|
|
1460
|
+
columnId: r,
|
|
1461
|
+
metricId: a,
|
|
1462
|
+
metricAlias: c,
|
|
1463
|
+
columnKeyMap: l,
|
|
1464
|
+
fieldId: s,
|
|
1465
|
+
fieldRole: u
|
|
1466
|
+
}), A = Ar(
|
|
1467
|
+
O,
|
|
1468
|
+
x || i,
|
|
1469
|
+
g ?? !!m
|
|
1470
|
+
), R = !A && d && fr(O) ? Fr(
|
|
1471
|
+
x || i,
|
|
1472
|
+
b
|
|
1473
|
+
) : void 0;
|
|
1474
|
+
return Ce(
|
|
1475
|
+
A || R || x || i,
|
|
1476
|
+
d,
|
|
1477
|
+
b,
|
|
1478
|
+
{
|
|
1479
|
+
preserveHistoricalPersistedPrecision: !!(x && C && !A && !R)
|
|
1480
|
+
}
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
function Ce(e, t, r, n) {
|
|
1484
|
+
if (!e || e.type !== "number" || !t)
|
|
1485
|
+
return e;
|
|
1486
|
+
const o = e.numberFormat, i = o ? n != null && n.preserveHistoricalPersistedPrecision ? Ze(o) : re(o, {
|
|
1487
|
+
preserveOmittedProperties: !0
|
|
1488
|
+
}) : { type: "number" };
|
|
1489
|
+
if (!i || !P(i))
|
|
1490
|
+
return e;
|
|
1491
|
+
const a = I(
|
|
1492
|
+
i,
|
|
1493
|
+
t,
|
|
1494
|
+
r
|
|
1495
|
+
), c = Me(a, {
|
|
1496
|
+
preserveOmittedProperties: !0
|
|
1497
|
+
});
|
|
1498
|
+
return c ? {
|
|
1499
|
+
...e,
|
|
1500
|
+
numberFormat: {
|
|
1501
|
+
...o,
|
|
1502
|
+
...c,
|
|
1503
|
+
showDataBar: (o == null ? void 0 : o.showDataBar) ?? c.showDataBar,
|
|
1504
|
+
showHeatmap: o == null ? void 0 : o.showHeatmap,
|
|
1505
|
+
dataBarColor: (o == null ? void 0 : o.dataBarColor) ?? c.dataBarColor,
|
|
1506
|
+
dataBarMinValue: o == null ? void 0 : o.dataBarMinValue,
|
|
1507
|
+
dataBarMaxValue: o == null ? void 0 : o.dataBarMaxValue
|
|
1508
|
+
}
|
|
1509
|
+
} : e;
|
|
1510
|
+
}
|
|
1511
|
+
function q(e) {
|
|
1512
|
+
if (!e.valueFormatPreferences)
|
|
1513
|
+
return;
|
|
1514
|
+
const t = He(e);
|
|
1515
|
+
if (!t || t.type !== "number")
|
|
1516
|
+
return;
|
|
1517
|
+
const r = re(t.numberFormat, {
|
|
1518
|
+
preserveOmittedProperties: !0
|
|
1519
|
+
});
|
|
1520
|
+
if (!(!r || !Te(r)))
|
|
1521
|
+
return r;
|
|
1522
|
+
}
|
|
1523
|
+
function wr(e) {
|
|
1524
|
+
var n, o;
|
|
1525
|
+
if (!e.presentation.preferences)
|
|
1526
|
+
return;
|
|
1527
|
+
const t = N(e.card, {
|
|
1528
|
+
columnId: e.columnId,
|
|
1529
|
+
metricId: e.metricId,
|
|
1530
|
+
metricAlias: e.metricAlias,
|
|
1531
|
+
columnKeyMap: e.columnKeyMap
|
|
1532
|
+
});
|
|
1533
|
+
if (e.comparisonValueKind === "percent_change" || e.comparisonValueKind === "ratio") {
|
|
1534
|
+
const i = q({
|
|
1535
|
+
card: e.card,
|
|
1536
|
+
columnId: e.columnId,
|
|
1537
|
+
persistedSettings: e.persistedSettings,
|
|
1538
|
+
resolvedSettings: e.resolvedSettings,
|
|
1539
|
+
fallbackSettings: e.fallbackSettings,
|
|
1540
|
+
metricId: e.metricId,
|
|
1541
|
+
columnKeyMap: e.columnKeyMap,
|
|
1542
|
+
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1543
|
+
valueFormatPreferences: e.presentation.preferences
|
|
1544
|
+
}), a = rt(e.comparisonPrecision) ?? (P(i) ? i.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
|
|
1545
|
+
return e.comparisonValueKind === "percent_change" ? {
|
|
1546
|
+
type: "percent",
|
|
1547
|
+
locale: e.presentation.preferences.locale,
|
|
1548
|
+
percentValueMode: "fraction",
|
|
1549
|
+
minimumFractionDigits: a,
|
|
1550
|
+
maximumFractionDigits: a
|
|
1551
|
+
} : {
|
|
1552
|
+
type: "number",
|
|
1553
|
+
locale: e.presentation.preferences.locale,
|
|
1554
|
+
minimumFractionDigits: a,
|
|
1555
|
+
maximumFractionDigits: a,
|
|
1556
|
+
suffix: "×"
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
const r = nt({
|
|
1560
|
+
card: e.card,
|
|
1561
|
+
columnKey: e.columnId,
|
|
1562
|
+
metricId: e.metricId ?? (t && !((o = (n = e.card.config) == null ? void 0 : n.groupByColumns) != null && o.includes(t)) ? t.id : void 0)
|
|
1563
|
+
});
|
|
1564
|
+
return q({
|
|
1565
|
+
card: e.card,
|
|
1566
|
+
columnId: e.columnId,
|
|
1567
|
+
persistedSettings: e.persistedSettings,
|
|
1568
|
+
resolvedSettings: e.resolvedSettings,
|
|
1569
|
+
fallbackSettings: e.fallbackSettings,
|
|
1570
|
+
metricId: e.metricId,
|
|
1571
|
+
columnKeyMap: e.columnKeyMap,
|
|
1572
|
+
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1573
|
+
valueFormatPreferences: e.presentation.preferences,
|
|
1574
|
+
boundCurrency: r ? e.presentation.resolveBoundCurrency(r) : void 0
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
function Dr(e) {
|
|
1578
|
+
var c, s, u, l, m, f, g;
|
|
1579
|
+
if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
|
|
1580
|
+
const F = e.target, p = ot(e.card, e.matrixCatalog).find(
|
|
1581
|
+
(b) => b.measureId === F.measureId
|
|
1582
|
+
), d = p == null ? void 0 : p.canonical;
|
|
1583
|
+
return d && (d.type === "number" || d.type === "currency") ? I(
|
|
1584
|
+
d,
|
|
1585
|
+
e.valueFormatPreferences,
|
|
1586
|
+
e.boundCurrency
|
|
1587
|
+
) : void 0;
|
|
1588
|
+
}
|
|
1589
|
+
if (e.target.kind === "matrix_measure")
|
|
1590
|
+
return;
|
|
1591
|
+
if (e.card.type === "kpi") {
|
|
1592
|
+
const F = e.target.kind === "metric" ? e.target.metricId : void 0, p = F ? ((s = (c = e.card.config) == null ? void 0 : c.metricColumns) == null ? void 0 : s.findIndex(
|
|
1593
|
+
(C) => C.id === F
|
|
1594
|
+
)) ?? -1 : 0;
|
|
1595
|
+
if (p < 0)
|
|
1596
|
+
return;
|
|
1597
|
+
const d = it(e.card, {
|
|
1598
|
+
metricIndex: p,
|
|
1599
|
+
resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
|
|
1600
|
+
}), b = d.authoredFormat;
|
|
1601
|
+
return d.currencyBindable && b && P(b) ? I(
|
|
1602
|
+
b,
|
|
1603
|
+
e.valueFormatPreferences,
|
|
1604
|
+
e.boundCurrency
|
|
1605
|
+
) : void 0;
|
|
1606
|
+
}
|
|
1607
|
+
if (!((u = e.card.sql) != null && u.trim()) && !Ot(e.card.type) && e.target.kind === "metric") {
|
|
1608
|
+
const F = e.target.metricId, p = (m = (l = e.card.config) == null ? void 0 : l.metricColumns) == null ? void 0 : m.find(
|
|
1609
|
+
(C) => C.id === F
|
|
1610
|
+
);
|
|
1611
|
+
if (!p)
|
|
1612
|
+
return;
|
|
1613
|
+
const d = xe(
|
|
1614
|
+
e.card,
|
|
1615
|
+
p
|
|
1616
|
+
), b = d.authoredFormat;
|
|
1617
|
+
return d.currencyBindable && b && P(b) ? I(
|
|
1618
|
+
b,
|
|
1619
|
+
e.valueFormatPreferences,
|
|
1620
|
+
e.boundCurrency
|
|
1621
|
+
) : void 0;
|
|
1622
|
+
}
|
|
1623
|
+
const r = ((g = (f = e.card.preferences) == null ? void 0 : f.tablePrefs) == null ? void 0 : g.columnSettingsMap) || {}, n = e.target.kind === "metric" ? e.target.metricId : void 0, o = e.target.kind === "column" ? [e.target.columnKey] : [
|
|
1624
|
+
...e.resultColumnKeys || [],
|
|
1625
|
+
...Object.keys(r),
|
|
1626
|
+
e.target.metricId
|
|
1627
|
+
], i = e.target.kind === "column" ? e.target.columnKey : o.find(
|
|
1628
|
+
(F) => {
|
|
1629
|
+
var p;
|
|
1630
|
+
return ((p = N(e.card, {
|
|
1631
|
+
columnId: F
|
|
1632
|
+
})) == null ? void 0 : p.id) === n;
|
|
1633
|
+
}
|
|
1634
|
+
) || n, a = q({
|
|
1635
|
+
card: e.card,
|
|
1636
|
+
columnId: i,
|
|
1637
|
+
metricId: n,
|
|
1638
|
+
persistedSettings: r[i],
|
|
1639
|
+
valueFormatPreferences: e.valueFormatPreferences,
|
|
1640
|
+
boundCurrency: e.boundCurrency
|
|
1641
|
+
});
|
|
1642
|
+
return P(a) ? a : void 0;
|
|
1643
|
+
}
|
|
1644
|
+
function Vn(e) {
|
|
1645
|
+
var r, n, o, i, a, c;
|
|
1646
|
+
const t = e.persistedSettings ?? ((i = (o = (n = (r = e.card) == null ? void 0 : r.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : o.columnSettingsMap) == null ? void 0 : i[e.columnId]);
|
|
1647
|
+
if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((a = e.resolvedSettings) == null ? void 0 : a.inheritMetricFormat) === !0) {
|
|
1648
|
+
const s = E(
|
|
1649
|
+
(c = N(e.card, {
|
|
1650
|
+
columnId: e.columnId,
|
|
1651
|
+
metricId: e.metricId,
|
|
1652
|
+
metricAlias: e.metricAlias,
|
|
1653
|
+
columnKeyMap: e.columnKeyMap
|
|
1654
|
+
})) == null ? void 0 : c.format,
|
|
1655
|
+
{ preserveOmittedProperties: !0 }
|
|
1656
|
+
);
|
|
1657
|
+
if ((s == null ? void 0 : s.type) === "date" || (s == null ? void 0 : s.type) === "duration")
|
|
1658
|
+
return T(s, {
|
|
1659
|
+
preserveOmittedProperties: !0
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
return Sr(
|
|
1663
|
+
He({
|
|
1664
|
+
...e,
|
|
1665
|
+
persistedSettings: t
|
|
1666
|
+
})
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
function Br(e) {
|
|
1670
|
+
var F, p, d, b, C, x, O;
|
|
1671
|
+
const t = (F = e == null ? void 0 : e.formatNumber) == null ? void 0 : F.enabled, r = typeof t == "string" ? t.trim().toLowerCase() !== "false" : t !== !1, n = et(e == null ? void 0 : e.numberAxisFormat) || (r ? tt(e == null ? void 0 : e.formatNumber) : void 0), o = T(n);
|
|
1672
|
+
if (!o || !o.type || o.type === "auto")
|
|
1673
|
+
return o;
|
|
1674
|
+
const i = (p = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : p.decimalPlaces, a = r ? (d = e == null ? void 0 : e.formatNumber) == null ? void 0 : d.decimalPlaces : void 0, c = typeof i == "number" ? i : typeof a == "number" ? a : void 0, s = (b = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : b.minimumFractionDigits, u = (C = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : C.maximumFractionDigits, l = r ? (x = e == null ? void 0 : e.formatNumber) == null ? void 0 : x.minimumFractionDigits : void 0, m = r ? (O = e == null ? void 0 : e.formatNumber) == null ? void 0 : O.maximumFractionDigits : void 0, f = typeof c == "number" ? c : typeof s == "number" ? s : typeof l == "number" ? l : 0, g = typeof c == "number" ? c : typeof u == "number" ? u : typeof m == "number" ? m : 0;
|
|
1675
|
+
return {
|
|
1676
|
+
...o,
|
|
1677
|
+
decimalPlaces: f === g ? g : o.decimalPlaces,
|
|
1678
|
+
minimumFractionDigits: f,
|
|
1679
|
+
maximumFractionDigits: Math.max(
|
|
1680
|
+
f,
|
|
1681
|
+
g
|
|
1682
|
+
)
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
function kn(e) {
|
|
1686
|
+
var o, i, a, c, s;
|
|
1687
|
+
const { value: t, formatOptions: r, preferences: n } = e;
|
|
1688
|
+
return r != null && r.type && r.type !== "auto" ? Re(t, r.type, r) : rr({
|
|
1689
|
+
number: t,
|
|
1690
|
+
decimalPlaces: ((o = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : o.decimalPlaces) ?? 0,
|
|
1691
|
+
useSuffix: !!((i = n == null ? void 0 : n.numberAxisFormat) != null && i.suffix),
|
|
1692
|
+
customSuffix: ((a = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : a.suffix) || "",
|
|
1693
|
+
locale: ((c = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : c.locale) || "en-US",
|
|
1694
|
+
currency: ((s = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : s.currency) || ""
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
function Rr(e) {
|
|
1698
|
+
return St({
|
|
1699
|
+
...e,
|
|
1700
|
+
activation: ne({
|
|
1701
|
+
card: e.card,
|
|
1702
|
+
cardConfig: e.cardConfig
|
|
1703
|
+
})
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
function Ln(e) {
|
|
1707
|
+
return At({
|
|
1708
|
+
activation: ne({
|
|
1709
|
+
card: e.card,
|
|
1710
|
+
cardConfig: e.cardConfig
|
|
1711
|
+
}),
|
|
1712
|
+
result: e.result,
|
|
1713
|
+
expectedResultOwner: e.expectedResultOwner
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
function Kr(e) {
|
|
1717
|
+
var n, o;
|
|
1718
|
+
const t = Pe(e.card, e.effectiveCardConfig), r = $t({
|
|
1719
|
+
card: t,
|
|
1720
|
+
records: e.rows,
|
|
1721
|
+
keys: e.rows.length === 0 ? e.resultKeys : void 0,
|
|
1722
|
+
columnKeyMap: e.result.columnKeyMap,
|
|
1723
|
+
resultColumns: e.result.resultColumns,
|
|
1724
|
+
comparisonMetadata: e.result.comparisonMetadata,
|
|
1725
|
+
viewerTable: e.file.viewerTable
|
|
1726
|
+
});
|
|
1727
|
+
return e.rows.length === 0 && !e.resultKeys || r.visibleKeys.length === 0 ? null : {
|
|
1728
|
+
view: r,
|
|
1729
|
+
formatOptions: {
|
|
1730
|
+
useFormattedValues: e.file.useFormattedValues,
|
|
1731
|
+
timezone: e.reportContext.calendar.tz,
|
|
1732
|
+
delimiter: e.file.delimiter,
|
|
1733
|
+
csvEncoding: e.file.csvEncoding,
|
|
1734
|
+
includeHeaders: e.file.includeHeaders,
|
|
1735
|
+
columnSettings: (o = (n = e.card.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : o.columnSettingsMap,
|
|
1736
|
+
visibleColumns: [...r.visibleKeys],
|
|
1737
|
+
columnLabels: Object.fromEntries(r.visibleKeys.map((i) => [i, r.labels[i] ?? i]))
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
function Er(e) {
|
|
1742
|
+
var r;
|
|
1743
|
+
const t = (r = e.preferences) == null ? void 0 : r.comparisonPresentation;
|
|
1744
|
+
return {
|
|
1745
|
+
...pt,
|
|
1746
|
+
...t,
|
|
1747
|
+
...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
|
|
1748
|
+
...t != null && t.colors ? { colors: { ...t.colors } } : {}
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
function _r(e) {
|
|
1752
|
+
var x, O, U, A, R;
|
|
1753
|
+
const t = Pe(e.card, e.effectiveCardConfig), { cardId: r, ...n } = e.requestPayloadBase, o = e.formatOptions.visibleColumns ?? [], i = [
|
|
1754
|
+
...o,
|
|
1755
|
+
...Object.keys(e.formatOptions.columnSettings ?? {})
|
|
1756
|
+
], a = ct(
|
|
1757
|
+
e.card,
|
|
1758
|
+
o,
|
|
1759
|
+
e.effectiveCardConfig
|
|
1760
|
+
), c = ut(
|
|
1761
|
+
e.card,
|
|
1762
|
+
e.effectiveCardConfig,
|
|
1763
|
+
a
|
|
1764
|
+
), s = lt(
|
|
1765
|
+
t,
|
|
1766
|
+
i
|
|
1767
|
+
), u = new Set(
|
|
1768
|
+
s.eligibleTargets.map(Y)
|
|
1769
|
+
), l = (y) => u.has(Y(y)) ? mt({
|
|
1770
|
+
bindings: n.controlBindings,
|
|
1771
|
+
controls: [
|
|
1772
|
+
...n.controlDefinitions ?? [],
|
|
1773
|
+
...n.cardControlDefinitions ?? []
|
|
1774
|
+
],
|
|
1775
|
+
values: n.controlValues,
|
|
1776
|
+
target: y,
|
|
1777
|
+
knownTargets: s.knownTargets,
|
|
1778
|
+
eligibleTargets: s.eligibleTargets
|
|
1779
|
+
}).currency : void 0, m = dt({
|
|
1780
|
+
card: e.card,
|
|
1781
|
+
comparisonMetadata: e.comparisonMetadata,
|
|
1782
|
+
columnKeyMap: ((x = e.canonicalPivotResult) == null ? void 0 : x.columnKeyMap) ?? e.columnKeyMap
|
|
1783
|
+
}), f = ne({
|
|
1784
|
+
card: e.card,
|
|
1785
|
+
cardConfig: e.effectiveCardConfig
|
|
1786
|
+
});
|
|
1787
|
+
if (e.card.type === "pivotTable" && f && !e.canonicalPivotResult)
|
|
1788
|
+
throw new Error(
|
|
1789
|
+
"Canonical pivot export requires a parsed pivot result lifecycle."
|
|
1790
|
+
);
|
|
1791
|
+
const g = Rr({
|
|
1792
|
+
card: e.card,
|
|
1793
|
+
cardConfig: e.effectiveCardConfig,
|
|
1794
|
+
columns: ((O = e.canonicalPivotResult) == null ? void 0 : O.columns) ?? e.resultColumns,
|
|
1795
|
+
columnKeyMap: ((U = e.canonicalPivotResult) == null ? void 0 : U.columnKeyMap) ?? e.columnKeyMap,
|
|
1796
|
+
resultRowCount: e.totalRows,
|
|
1797
|
+
valueFormatPreferences: e.reportContext.valueFormat
|
|
1798
|
+
}), F = (f == null ? void 0 : f.fields) ?? [], p = new Map(
|
|
1799
|
+
F.map((y) => [
|
|
1800
|
+
`${y.role}:${y.id}`,
|
|
1801
|
+
y
|
|
1802
|
+
])
|
|
1803
|
+
), d = /* @__PURE__ */ new Map();
|
|
1804
|
+
if (e.card.type === "detailTable" && n.resultOwner === "config") {
|
|
1805
|
+
const y = e.resultColumns || [];
|
|
1806
|
+
if (y.filter(
|
|
1807
|
+
(h) => h.rawTemporal
|
|
1808
|
+
).length > 0) {
|
|
1809
|
+
if (!e.columnKeyMap)
|
|
1810
|
+
throw new Error(
|
|
1811
|
+
"Canonical raw temporal export requires an authoritative columnKeyMap."
|
|
1812
|
+
);
|
|
1813
|
+
const h = Bt({
|
|
1814
|
+
cardType: e.card.type,
|
|
1815
|
+
resultOwner: n.resultOwner,
|
|
1816
|
+
effectiveCardConfig: e.effectiveCardConfig,
|
|
1817
|
+
result: {
|
|
1818
|
+
records: [],
|
|
1819
|
+
columns: y,
|
|
1820
|
+
columnKeyMap: e.columnKeyMap
|
|
1821
|
+
},
|
|
1822
|
+
preferences: e.reportContext.valueFormat,
|
|
1823
|
+
calendar: e.reportContext.calendar
|
|
1824
|
+
});
|
|
1825
|
+
if (h.kind === "invalid") throw h.error;
|
|
1826
|
+
if (h.kind === "loaded_empty" || h.kind === "loaded_valid")
|
|
1827
|
+
for (const [S, w] of h.presentation.byColumnKey)
|
|
1828
|
+
d.set(S, w.format);
|
|
1829
|
+
}
|
|
1830
|
+
} else if (n.resultOwner === "freeform" && n.sql.trim() && !n.python.trim())
|
|
1831
|
+
for (const [y, v] of Object.entries(
|
|
1832
|
+
((R = (A = e.card.preferences) == null ? void 0 : A.tablePrefs) == null ? void 0 : R.columnSettingsMap) || {}
|
|
1833
|
+
)) {
|
|
1834
|
+
if (v.type !== "date") continue;
|
|
1835
|
+
const h = Rt(v.dateFormat);
|
|
1836
|
+
h && d.set(
|
|
1837
|
+
y,
|
|
1838
|
+
Pt({
|
|
1839
|
+
format: h,
|
|
1840
|
+
preferences: e.reportContext.valueFormat,
|
|
1841
|
+
calendar: e.reportContext.calendar
|
|
1842
|
+
})
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
const b = [
|
|
1846
|
+
...new Set(i)
|
|
1847
|
+
].flatMap((y) => {
|
|
1848
|
+
var de, me, fe, ye, ge, be;
|
|
1849
|
+
if (g.byColumnKey.has(y) || d.has(y))
|
|
1850
|
+
return [];
|
|
1851
|
+
const v = m.columnPresentationOwners.get(y), h = (de = t.sql) != null && de.trim() ? void 0 : N(t, {
|
|
1852
|
+
columnId: y,
|
|
1853
|
+
columnKeyMap: e.columnKeyMap,
|
|
1854
|
+
metricId: v == null ? void 0 : v.metricId,
|
|
1855
|
+
metricAlias: v == null ? void 0 : v.metricAlias
|
|
1856
|
+
}), S = h ? { kind: "metric", metricId: h.id } : { kind: "column", columnKey: y }, w = u.has(
|
|
1857
|
+
Y(S)
|
|
1858
|
+
), le = l(S), V = (ye = (fe = (me = t.preferences) == null ? void 0 : me.tablePrefs) == null ? void 0 : fe.columnSettingsMap) == null ? void 0 : ye[y], G = {
|
|
1859
|
+
dashboardId: e.dashboardId,
|
|
1860
|
+
cardId: t.id
|
|
1861
|
+
}, $ = { kind: "column", columnKey: y }, M = h && (!V || V.inheritMetricFormat === !0) ? E(h.format, {
|
|
1862
|
+
preserveOmittedProperties: !0
|
|
1863
|
+
}) : void 0;
|
|
1864
|
+
if ((M == null ? void 0 : M.type) === "date")
|
|
1865
|
+
return [
|
|
1866
|
+
{
|
|
1867
|
+
scope: G,
|
|
1868
|
+
target: $,
|
|
1869
|
+
format: {
|
|
1870
|
+
type: "date",
|
|
1871
|
+
locale: M.locale ?? e.reportContext.valueFormat.locale,
|
|
1872
|
+
...M.pattern ? { pattern: M.pattern } : {},
|
|
1873
|
+
...M.timezone ? { timezone: M.timezone } : {},
|
|
1874
|
+
...M.sourceTimezone ? { sourceTimezone: M.sourceTimezone } : {}
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
];
|
|
1878
|
+
const D = (v ? wr({
|
|
1879
|
+
card: t,
|
|
1880
|
+
columnId: y,
|
|
1881
|
+
columnKeyMap: e.columnKeyMap,
|
|
1882
|
+
persistedSettings: V,
|
|
1883
|
+
metricId: v.metricId,
|
|
1884
|
+
metricAlias: v.metricAlias,
|
|
1885
|
+
comparisonValueKind: v.kind,
|
|
1886
|
+
comparisonPrecision: (be = (ge = t.preferences) == null ? void 0 : ge.comparisonPresentation) == null ? void 0 : be.precision,
|
|
1887
|
+
presentation: {
|
|
1888
|
+
preferences: e.reportContext.valueFormat,
|
|
1889
|
+
resolveBoundCurrency: l
|
|
1890
|
+
}
|
|
1891
|
+
}) : void 0) ?? (w ? Dr({
|
|
1892
|
+
card: t,
|
|
1893
|
+
target: S,
|
|
1894
|
+
resultColumnKeys: i,
|
|
1895
|
+
valueFormatPreferences: e.reportContext.valueFormat,
|
|
1896
|
+
boundCurrency: le
|
|
1897
|
+
}) : void 0) ?? q({
|
|
1898
|
+
card: t,
|
|
1899
|
+
columnId: y,
|
|
1900
|
+
columnKeyMap: e.columnKeyMap,
|
|
1901
|
+
metricId: v == null ? void 0 : v.metricId,
|
|
1902
|
+
persistedSettings: V,
|
|
1903
|
+
valueFormatPreferences: e.reportContext.valueFormat
|
|
1904
|
+
}), W = (D == null ? void 0 : D.type) === "duration" ? D : D ? I(
|
|
1905
|
+
D,
|
|
1906
|
+
e.reportContext.valueFormat,
|
|
1907
|
+
le
|
|
1908
|
+
) : I(
|
|
1909
|
+
{
|
|
1910
|
+
type: "number",
|
|
1911
|
+
minimumFractionDigits: 0,
|
|
1912
|
+
maximumFractionDigits: 3
|
|
1913
|
+
},
|
|
1914
|
+
e.reportContext.valueFormat
|
|
1915
|
+
);
|
|
1916
|
+
return [
|
|
1917
|
+
W.type === "duration" ? { scope: G, target: $, format: W } : { scope: G, target: $, format: W }
|
|
1918
|
+
];
|
|
1919
|
+
});
|
|
1920
|
+
b.push(
|
|
1921
|
+
...[...g.byColumnKey.values()].map((y) => {
|
|
1922
|
+
const v = p.get(
|
|
1923
|
+
`${y.role ?? "groupby"}:${y.fieldId}`
|
|
1924
|
+
);
|
|
1925
|
+
if (!v)
|
|
1926
|
+
throw new Error(
|
|
1927
|
+
`Unable to resolve temporal export field "${y.fieldId}".`
|
|
1928
|
+
);
|
|
1929
|
+
return {
|
|
1930
|
+
scope: {
|
|
1931
|
+
dashboardId: e.dashboardId,
|
|
1932
|
+
cardId: e.card.id
|
|
1933
|
+
},
|
|
1934
|
+
target: { kind: "column", columnKey: y.columnKey },
|
|
1935
|
+
format: Fe(
|
|
1936
|
+
v,
|
|
1937
|
+
{
|
|
1938
|
+
dateStyle: e.reportContext.valueFormat.dateStyle,
|
|
1939
|
+
dateTime: { ...e.reportContext.valueFormat.dateTime }
|
|
1940
|
+
},
|
|
1941
|
+
e.reportContext.valueFormat.locale
|
|
1942
|
+
)
|
|
1943
|
+
};
|
|
1944
|
+
})
|
|
1945
|
+
), b.push(
|
|
1946
|
+
...((f == null ? void 0 : f.fields) || []).flatMap(
|
|
1947
|
+
(y) => y.role === "pivotby" ? [
|
|
1948
|
+
{
|
|
1949
|
+
scope: {
|
|
1950
|
+
dashboardId: e.dashboardId,
|
|
1951
|
+
cardId: e.card.id
|
|
1952
|
+
},
|
|
1953
|
+
target: {
|
|
1954
|
+
kind: "field",
|
|
1955
|
+
fieldId: y.id,
|
|
1956
|
+
role: y.role
|
|
1957
|
+
},
|
|
1958
|
+
format: Fe(
|
|
1959
|
+
y,
|
|
1960
|
+
{
|
|
1961
|
+
dateStyle: e.reportContext.valueFormat.dateStyle,
|
|
1962
|
+
dateTime: { ...e.reportContext.valueFormat.dateTime }
|
|
1963
|
+
},
|
|
1964
|
+
e.reportContext.valueFormat.locale
|
|
1965
|
+
)
|
|
1966
|
+
}
|
|
1967
|
+
] : []
|
|
1968
|
+
)
|
|
1969
|
+
), b.push(
|
|
1970
|
+
...[...d].map(([y, v]) => ({
|
|
1971
|
+
scope: { dashboardId: e.dashboardId, cardId: e.card.id },
|
|
1972
|
+
target: { kind: "column", columnKey: y },
|
|
1973
|
+
format: v
|
|
1974
|
+
}))
|
|
1975
|
+
);
|
|
1976
|
+
const C = vt({
|
|
1977
|
+
reportContext: e.reportContext,
|
|
1978
|
+
resolvedFormats: b
|
|
1979
|
+
});
|
|
1980
|
+
return {
|
|
1981
|
+
formatOptions: {
|
|
1982
|
+
...e.formatOptions,
|
|
1983
|
+
...a ? { tableTotalsLabelColumnKey: a } : {},
|
|
1984
|
+
comparisonPresentation: Er(e.card),
|
|
1985
|
+
presentationExecutionSnapshot: C
|
|
1986
|
+
},
|
|
1987
|
+
...c ? { tableTotalsRequest: c } : {}
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
function Nr(e) {
|
|
1991
|
+
const t = st(
|
|
1992
|
+
e.card,
|
|
1993
|
+
e.requestPayloadBase
|
|
1994
|
+
), { cardId: r, ...n } = t.requestPayloadBase, o = _r(e);
|
|
1995
|
+
return {
|
|
1996
|
+
type: "card",
|
|
1997
|
+
dashboardId: e.dashboardId,
|
|
1998
|
+
cardId: e.card.id,
|
|
1999
|
+
title: e.title,
|
|
2000
|
+
connection_id: t.connectionId,
|
|
2001
|
+
...n,
|
|
2002
|
+
...o.tableTotalsRequest ? { tableTotalsRequest: o.tableTotalsRequest } : {},
|
|
2003
|
+
totalRows: e.totalRows,
|
|
2004
|
+
format: e.format,
|
|
2005
|
+
formatOptions: o.formatOptions
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function jn(e) {
|
|
2009
|
+
const { card: t, result: r } = e;
|
|
2010
|
+
if (t.type !== "table" && t.type !== "detailTable")
|
|
2011
|
+
return { status: "refused", reason: "not_a_table" };
|
|
2012
|
+
if (at({ card: t, comparisonMetadata: r.comparisonMetadata }))
|
|
2013
|
+
return { status: "refused", reason: "comparison_metadata_missing" };
|
|
2014
|
+
const n = Kr({
|
|
2015
|
+
card: t,
|
|
2016
|
+
effectiveCardConfig: e.effectiveCardConfig,
|
|
2017
|
+
rows: e.rows,
|
|
2018
|
+
resultKeys: r.resultColumns.map((o) => o.key),
|
|
2019
|
+
result: r,
|
|
2020
|
+
reportContext: e.reportContext,
|
|
2021
|
+
file: e.file
|
|
2022
|
+
});
|
|
2023
|
+
return n ? {
|
|
2024
|
+
status: "ready",
|
|
2025
|
+
request: Nr({
|
|
2026
|
+
card: t,
|
|
2027
|
+
dashboardId: e.dashboardId,
|
|
2028
|
+
title: e.title,
|
|
2029
|
+
reportContext: e.reportContext,
|
|
2030
|
+
totalRows: r.totalRows,
|
|
2031
|
+
format: e.file.format,
|
|
2032
|
+
formatOptions: n.formatOptions,
|
|
2033
|
+
comparisonMetadata: r.comparisonMetadata,
|
|
2034
|
+
requestPayloadBase: e.query,
|
|
2035
|
+
resultColumns: [...r.resultColumns],
|
|
2036
|
+
columnKeyMap: r.columnKeyMap,
|
|
2037
|
+
effectiveCardConfig: e.effectiveCardConfig
|
|
2038
|
+
})
|
|
2039
|
+
} : { status: "refused", reason: "columns_unresolved" };
|
|
2040
|
+
}
|
|
2041
|
+
function Vr(e, t, r) {
|
|
2042
|
+
if (gt(
|
|
2043
|
+
bt(t),
|
|
2044
|
+
e.aggregateOrigin
|
|
2045
|
+
))
|
|
2046
|
+
return { aggregate: void 0, aggregateOrigin: void 0 };
|
|
2047
|
+
const n = r === "selection" && e.role === "metric" ? t.aggregate : void 0;
|
|
2048
|
+
return {
|
|
2049
|
+
aggregate: e.aggregate ?? n,
|
|
2050
|
+
aggregateOrigin: e.aggregate ? e.aggregateOrigin : n ? t.aggregateOrigin : void 0
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
function kr(e, t, r) {
|
|
2054
|
+
var n, o, i, a, c, s;
|
|
2055
|
+
if (r === "domain")
|
|
2056
|
+
return {
|
|
2057
|
+
filters: (n = t.parameters) == null ? void 0 : n.filters,
|
|
2058
|
+
windowTransform: (o = e.parameters) == null ? void 0 : o.windowTransform
|
|
2059
|
+
};
|
|
2060
|
+
if (!(!e.parameters && !t.parameters))
|
|
2061
|
+
return {
|
|
2062
|
+
filters: ((i = e.parameters) == null ? void 0 : i.filters) ?? ((a = t.parameters) == null ? void 0 : a.filters),
|
|
2063
|
+
windowTransform: ((c = e.parameters) == null ? void 0 : c.windowTransform) ?? ((s = t.parameters) == null ? void 0 : s.windowTransform)
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
function qn(e, t, r) {
|
|
2067
|
+
const n = e;
|
|
2068
|
+
return {
|
|
2069
|
+
id: e.id,
|
|
2070
|
+
role: e.role,
|
|
2071
|
+
// Result-column names belong to the selection's consumer (for example,
|
|
2072
|
+
// range bounds). They do not identify or redefine the catalog calculation.
|
|
2073
|
+
...r === "selection" && e.alias ? { alias: e.alias } : {},
|
|
2074
|
+
granularity: e.granularity ?? t.granularity,
|
|
2075
|
+
dateFormat: e.dateFormat,
|
|
2076
|
+
customFormat: e.customFormat,
|
|
2077
|
+
semanticTemporalPresentation: t.semanticTemporalPresentation || e.semanticTemporalPresentation,
|
|
2078
|
+
...Vr(e, t, r),
|
|
2079
|
+
...e.role === "metric" ? {
|
|
2080
|
+
aliasTemplate: n.aliasTemplate,
|
|
2081
|
+
valueAliases: n.valueAliases,
|
|
2082
|
+
comparison: n.comparison,
|
|
2083
|
+
comparisonPolarity: n.comparisonPolarity,
|
|
2084
|
+
parameters: kr(
|
|
2085
|
+
n,
|
|
2086
|
+
t,
|
|
2087
|
+
"domain"
|
|
2088
|
+
)
|
|
2089
|
+
} : {},
|
|
2090
|
+
...Lr(e)
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function Lr(e) {
|
|
2094
|
+
const t = {
|
|
2095
|
+
...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
|
|
2096
|
+
...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
|
|
2097
|
+
};
|
|
2098
|
+
switch (e.role) {
|
|
2099
|
+
case "pivotby":
|
|
2100
|
+
return {
|
|
2101
|
+
...t,
|
|
2102
|
+
memberOrder: e.memberOrder
|
|
2103
|
+
};
|
|
2104
|
+
case "sortby":
|
|
2105
|
+
return {
|
|
2106
|
+
...t,
|
|
2107
|
+
direction: e.direction
|
|
2108
|
+
};
|
|
2109
|
+
case "detail":
|
|
2110
|
+
return {
|
|
2111
|
+
...t,
|
|
2112
|
+
...e.dateFormat !== void 0 ? { dateFormat: e.dateFormat } : {},
|
|
2113
|
+
...e.customFormat !== void 0 ? { customFormat: e.customFormat } : {}
|
|
2114
|
+
};
|
|
2115
|
+
default:
|
|
2116
|
+
return t;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
const jr = "table";
|
|
2120
|
+
function zn({ preferences: e, ...t }) {
|
|
2121
|
+
return {
|
|
2122
|
+
...t,
|
|
2123
|
+
type: jr,
|
|
2124
|
+
preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
|
|
2125
|
+
sql: "",
|
|
2126
|
+
data: []
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
function Hn(e, t) {
|
|
2130
|
+
let r = e;
|
|
2131
|
+
for (const [n, o] of t.entries()) {
|
|
2132
|
+
const i = qr(r, o);
|
|
2133
|
+
if (!i.ok)
|
|
2134
|
+
return { ok: !1, failedAt: { index: n, op: o.op, ...i.failure } };
|
|
2135
|
+
r = i.dashboard;
|
|
2136
|
+
}
|
|
2137
|
+
return { ok: !0, dashboard: r };
|
|
2138
|
+
}
|
|
2139
|
+
function qr(e, t) {
|
|
2140
|
+
const r = e.sheets ?? [], n = r.findIndex((s) => s.id === t.sheetId), o = r[n];
|
|
2141
|
+
if (!o)
|
|
2142
|
+
return Q("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
|
|
2143
|
+
if (ft(o))
|
|
2144
|
+
return Q("sheet_not_a_grid", "This sheet is a document: add to it through the document.");
|
|
2145
|
+
const { frame: i } = t;
|
|
2146
|
+
if (r.some((s) => (s.frames ?? []).some((u) => u.id === i.id)))
|
|
2147
|
+
return Q("frame_id_taken", `A frame with id ${i.id} is already on this dashboard.`);
|
|
2148
|
+
const a = t.placement ?? "end", c = {
|
|
2149
|
+
...o,
|
|
2150
|
+
frames: zr(o.frames ?? [], i, a),
|
|
2151
|
+
layouts: Hr(o, i, a)
|
|
2152
|
+
};
|
|
2153
|
+
return {
|
|
2154
|
+
ok: !0,
|
|
2155
|
+
dashboard: {
|
|
2156
|
+
...e,
|
|
2157
|
+
sheets: r.map((s, u) => u === n ? c : s)
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
function zr(e, t, r) {
|
|
2162
|
+
if (r === "start") return [t, ...e];
|
|
2163
|
+
if (r === "end") return [...e, t];
|
|
2164
|
+
const n = e.findIndex((o) => o.id === r.beside);
|
|
2165
|
+
return n < 0 ? [...e, t] : [...e.slice(0, n + 1), t, ...e.slice(n + 1)];
|
|
2166
|
+
}
|
|
2167
|
+
function Hr(e, t, r) {
|
|
2168
|
+
return (typeof r == "object" ? Kt({ sourceId: r.beside, duplicatedId: t.id, layouts: e.layouts }) : void 0) ?? Et({
|
|
2169
|
+
id: t.id,
|
|
2170
|
+
layouts: e.layouts,
|
|
2171
|
+
x: 0,
|
|
2172
|
+
y: r === "start" ? 0 : 1 / 0,
|
|
2173
|
+
frame: t
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
function Q(e, t) {
|
|
2177
|
+
return { ok: !1, failure: { code: e, message: t } };
|
|
2178
|
+
}
|
|
2179
|
+
export {
|
|
2180
|
+
rr as $,
|
|
2181
|
+
Ut as A,
|
|
2182
|
+
He as B,
|
|
2183
|
+
Xt as C,
|
|
2184
|
+
bn as D,
|
|
2185
|
+
Yt as E,
|
|
2186
|
+
ie as F,
|
|
2187
|
+
Tn as G,
|
|
2188
|
+
Mn as H,
|
|
2189
|
+
hn as I,
|
|
2190
|
+
Bn as J,
|
|
2191
|
+
Ve as K,
|
|
2192
|
+
wr as L,
|
|
2193
|
+
Ln as M,
|
|
2194
|
+
jr as N,
|
|
2195
|
+
Dn as O,
|
|
2196
|
+
mr as P,
|
|
2197
|
+
se as Q,
|
|
2198
|
+
On as R,
|
|
2199
|
+
En as S,
|
|
2200
|
+
Nn as T,
|
|
2201
|
+
_n as U,
|
|
2202
|
+
Re as V,
|
|
2203
|
+
Cr as W,
|
|
2204
|
+
Br as X,
|
|
2205
|
+
_ as Y,
|
|
2206
|
+
Kn as Z,
|
|
2207
|
+
Vn as _,
|
|
2208
|
+
gn as a,
|
|
2209
|
+
dr as a0,
|
|
2210
|
+
Tr as a1,
|
|
2211
|
+
Or as a2,
|
|
2212
|
+
kn as a3,
|
|
2213
|
+
te as a4,
|
|
2214
|
+
xr as a5,
|
|
2215
|
+
wn as a6,
|
|
2216
|
+
Sn as a7,
|
|
2217
|
+
An as a8,
|
|
2218
|
+
ar as a9,
|
|
2219
|
+
ir as aa,
|
|
2220
|
+
Rr as ab,
|
|
2221
|
+
ee as ac,
|
|
2222
|
+
xn as ad,
|
|
2223
|
+
zt as ae,
|
|
2224
|
+
pn as af,
|
|
2225
|
+
Wt as ag,
|
|
2226
|
+
Pn as ah,
|
|
2227
|
+
q as ai,
|
|
2228
|
+
N as aj,
|
|
2229
|
+
vn as ak,
|
|
2230
|
+
Rn as al,
|
|
2231
|
+
br as am,
|
|
2232
|
+
In as an,
|
|
2233
|
+
hr as ao,
|
|
2234
|
+
Cn as ap,
|
|
2235
|
+
yn as b,
|
|
2236
|
+
fn as c,
|
|
2237
|
+
cn as d,
|
|
2238
|
+
un as e,
|
|
2239
|
+
ln as f,
|
|
2240
|
+
Fn as g,
|
|
2241
|
+
jt as h,
|
|
2242
|
+
Kr as i,
|
|
2243
|
+
_r as j,
|
|
2244
|
+
Nr as k,
|
|
2245
|
+
jn as l,
|
|
2246
|
+
Vr as m,
|
|
2247
|
+
mn as n,
|
|
2248
|
+
kr as o,
|
|
2249
|
+
qn as p,
|
|
2250
|
+
Lr as q,
|
|
2251
|
+
_t as r,
|
|
2252
|
+
dn as s,
|
|
2253
|
+
zn as t,
|
|
2254
|
+
Hn as u,
|
|
2255
|
+
Dr as v,
|
|
2256
|
+
Pr as w,
|
|
2257
|
+
j as x,
|
|
2258
|
+
Gt as y,
|
|
2259
|
+
Ht as z
|
|
2260
|
+
};
|