react-semaphor 0.1.558 → 0.1.560
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 +368 -358
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/analytics-base-schemas-CHLxsPfX.js +630 -0
- package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
- package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
- package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
- package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
- package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
- package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
- package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
- package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
- package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
- package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
- package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
- package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
- package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
- package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
- package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
- package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
- package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
- package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
- package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
- package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
- package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
- package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
- package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
- package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
- package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
- package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
- package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
- package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
- package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
- package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
- package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
- package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
- package/dist/chunks/validators-CXTneCA4.js +3453 -0
- package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2207 -1496
- package/dist/data-app-sdk/index.js +20 -20
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +6 -6
- package/dist/format-utils/index.js +181 -176
- package/dist/index.js +22 -22
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
- package/dist/types/index.js +6 -6
- package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
- package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
- package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
- package/dist/types/lib/stores/editor-store.d.ts +39 -9
- package/dist/types/lib/stores/table-actions.d.ts +9 -3
- package/dist/types/lib/table-formatting/index.d.ts +0 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
- package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
- package/dist/types/lib/types/common-types.d.ts +40 -47
- package/dist/types/lib/types/explorer-types.d.ts +13 -44
- package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
- package/dist/types/lib/utils/card-definition.d.ts +9 -187
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
- package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
- package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
- package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
- package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
- package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
- package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
- package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
- package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
- package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
- package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
- package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
- package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
- package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
- package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
- package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
- package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
- package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
- package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
- package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
- package/package.json +1 -1
- package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
- package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
- package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
- package/dist/chunks/validators-hmfNNQz8.js +0 -3595
- package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
- package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
|
@@ -1,3411 +0,0 @@
|
|
|
1
|
-
import { al as oi, am as si, an as li, ao as dt, ap as ci, aq as K, ar as ft, as as ui, at as di, au as Se, av as fi, aw as mt, ax as mi, ay as pi, az as hi, aA as gi, aB as yi, aC as bi, aD as pt, aE as vi, aF as Fi, aG as Ci, aH as ge, aI as Ii, aJ as xi, aK as Si, b as Mi, aL as Di, v as Ti, z as wi, aM as Pi, aN as Oi } from "./resolve-dashboard-input-context-BZYI1hB0.js";
|
|
2
|
-
import { ab as ht, f as Ai, e as _i, a8 as gt, am as Ni, v as Ei } from "./validators-hmfNNQz8.js";
|
|
3
|
-
import "./matrix-operation-contract-CpgLZ7E5.js";
|
|
4
|
-
import { r as Ri, C as Vi } from "./metric-comparison-C8LY7GG5.js";
|
|
5
|
-
import "./analytics-base-schemas-BUFUoO6G.js";
|
|
6
|
-
import "zod";
|
|
7
|
-
import { d as yt, n as ki, j as Bi, e as Fe, g as Ki, i as R, H as _, R as Li, v as qi, r as $i, L as zi, X as ji } from "./temporal-input-presentation-DoSniQj1.js";
|
|
8
|
-
import { f as W } from "./pivot-result-contract-expectations-DMk-mKhG.js";
|
|
9
|
-
import "../value-format-preferences/index.js";
|
|
10
|
-
import { L as Hi, w as de } from "./table-settings-DF1gdVQR.js";
|
|
11
|
-
import { dm as bt, du as vt, dv as Ui, dw as Gi, cR as Me, dx as Wi, cS as Qi, dy as A, as as Yi, dz as Ft, dA as De, dB as Ji, dC as Xi, dD as Ue, dE as Zi, dF as Ge, dG as en, dH as tn, Q as Ct, dI as It, dJ as xt, v as St, dK as We, Y as $, dL as Te, c$ as Qe, d1 as we, cY as Ye, dM as Je, dq as nn, bb as Pe, dN as rn, dO as an, dP as on, cV as G, be as Xe, dQ as sn, a2 as Mt, a3 as Dt, d as ln, dR as z, bg as cn, dS as un, bh as dn, aA as Tt, dT as fn, dU as mn, dV as pn, dW as hn, b as wt, dp as gn, dX as yn, dY as bn, d6 as Ce, dZ as vn, d_ as ye, c7 as Pt, d$ as Ze, e0 as Fn, bH as Cn, ca as et, c9 as In, e1 as xn } from "./global-date-filter-utils-BsFqnnbA.js";
|
|
12
|
-
import { r as Sn } from "./pivot-result-identity-CrQ54Xbj.js";
|
|
13
|
-
import { g as Mn } from "./_commonjsHelpers-DimLPMtv.js";
|
|
14
|
-
import { e as Dn, d as Tn } from "./raw-temporal-presentation-BI2z2LlB.js";
|
|
15
|
-
import "./index-CJW5BdWT.js";
|
|
16
|
-
import "./index-CuHybtft.js";
|
|
17
|
-
import { i as wn } from "./source-entity-resolution-DXW1HpKf.js";
|
|
18
|
-
import { R as Pn } from "./matrix-analytical-definition-4GTUDheD.js";
|
|
19
|
-
import { r as Ot } from "./applied-constraints-DU-wndZ7.js";
|
|
20
|
-
const Ha = 15, On = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, An = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, _n = /\bwhere\b/i;
|
|
21
|
-
function Nn(e) {
|
|
22
|
-
return e != null && e.trim() ? On.test(e) || An.test(e) : !1;
|
|
23
|
-
}
|
|
24
|
-
function Ua(e) {
|
|
25
|
-
return !(e != null && e.trim()) || Nn(e) ? null : _n.test(e) ? {
|
|
26
|
-
helper: "{{ filters | and }}",
|
|
27
|
-
description: "For queries with an existing WHERE clause."
|
|
28
|
-
} : {
|
|
29
|
-
helper: "{{ filters | where }}",
|
|
30
|
-
description: "For queries without a WHERE clause."
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const tt = [10, 20, 50, 100, 500, 1e3], En = 50;
|
|
34
|
-
function Rn(e) {
|
|
35
|
-
return e && e > 0 ? e : En;
|
|
36
|
-
}
|
|
37
|
-
function Ga(e) {
|
|
38
|
-
const t = Rn(e), i = [...tt];
|
|
39
|
-
return tt.includes(
|
|
40
|
-
t
|
|
41
|
-
) || (i.push(t), i.sort((n, r) => n - r)), i;
|
|
42
|
-
}
|
|
43
|
-
function Wa(e) {
|
|
44
|
-
var t, i;
|
|
45
|
-
return !!((e.type === "table" || e.type === "detailTable") && e.sql && !bt(e.config) && !((i = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && i.forceClientPagination));
|
|
46
|
-
}
|
|
47
|
-
function Vn(e, t) {
|
|
48
|
-
var n, r, a, o;
|
|
49
|
-
if (t === "table-print")
|
|
50
|
-
return "disabled";
|
|
51
|
-
if ((r = (n = e.preferences) == null ? void 0 : n.tablePrefs) != null && r.forceClientPagination)
|
|
52
|
-
return "client";
|
|
53
|
-
const i = bt(e.config);
|
|
54
|
-
return e.sql && !i ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : i && oi(e) ? "server" : "client";
|
|
55
|
-
}
|
|
56
|
-
const At = Object.freeze({}), Qa = {
|
|
57
|
-
access: "session-only",
|
|
58
|
-
printMode: !1,
|
|
59
|
-
baseline: null,
|
|
60
|
-
applied: null,
|
|
61
|
-
appliedBookmark: null,
|
|
62
|
-
tableSettings: At,
|
|
63
|
-
notices: [],
|
|
64
|
-
isFavorite: !1,
|
|
65
|
-
fetchedAt: 0
|
|
66
|
-
};
|
|
67
|
-
function Ya(e) {
|
|
68
|
-
return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
|
|
69
|
-
}
|
|
70
|
-
function kn(e) {
|
|
71
|
-
return e.isDashboardEditing ? At : e.viewer.tableSettings;
|
|
72
|
-
}
|
|
73
|
-
function Bn(e, t) {
|
|
74
|
-
return kn(e)[t];
|
|
75
|
-
}
|
|
76
|
-
function Ja(e, t, i) {
|
|
77
|
-
if (!(i.isEditorPreview || e.isDashboardEditing) && Hi(e.dashboard, t))
|
|
78
|
-
return { settings: Bn(e, t) };
|
|
79
|
-
}
|
|
80
|
-
function Kn(e) {
|
|
81
|
-
var t;
|
|
82
|
-
return si({
|
|
83
|
-
card: e.card,
|
|
84
|
-
paginationMode: Vn(e.card) === "server" ? "server" : "client",
|
|
85
|
-
result: {
|
|
86
|
-
keys: e.keys ?? li(e.records),
|
|
87
|
-
rows: e.records,
|
|
88
|
-
columns: e.resultColumns,
|
|
89
|
-
columnKeyMap: e.columnKeyMap,
|
|
90
|
-
comparisonMetadata: e.comparisonMetadata
|
|
91
|
-
},
|
|
92
|
-
settings: (t = e.viewerTable) == null ? void 0 : t.settings,
|
|
93
|
-
projection: "export"
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
const Ln = () => ({
|
|
97
|
-
urlTemplate: "{value}",
|
|
98
|
-
// Default: use cell value as-is
|
|
99
|
-
labelType: "value",
|
|
100
|
-
// Default: show cell value as label
|
|
101
|
-
staticLabel: "",
|
|
102
|
-
labelColumn: "",
|
|
103
|
-
openInNewTab: !0
|
|
104
|
-
// Default: open in new tab (current behavior)
|
|
105
|
-
}), Oe = () => ({
|
|
106
|
-
type: "none",
|
|
107
|
-
inheritMetricFormat: !0,
|
|
108
|
-
textAlign: "left",
|
|
109
|
-
width: 150,
|
|
110
|
-
// Default width in pixels
|
|
111
|
-
minWidth: 50,
|
|
112
|
-
maxWidth: 500,
|
|
113
|
-
textOverflow: "ellipsis",
|
|
114
|
-
textWrap: "default",
|
|
115
|
-
numberFormat: {
|
|
116
|
-
style: "decimal",
|
|
117
|
-
currency: "USD",
|
|
118
|
-
locale: "en-US",
|
|
119
|
-
minimumFractionDigits: 0,
|
|
120
|
-
maximumFractionDigits: 2,
|
|
121
|
-
useGrouping: !0,
|
|
122
|
-
percentValueMode: "whole",
|
|
123
|
-
showDataBar: !1,
|
|
124
|
-
showHeatmap: !1,
|
|
125
|
-
dataBarColor: "#3b82f6",
|
|
126
|
-
// Default blue color
|
|
127
|
-
dataBarMinValue: void 0,
|
|
128
|
-
dataBarMaxValue: void 0
|
|
129
|
-
},
|
|
130
|
-
dateFormat: {
|
|
131
|
-
format: "MM/dd/yyyy",
|
|
132
|
-
useCustomFormat: !1,
|
|
133
|
-
customFormat: "yyyy-MM-dd'T'HH:mm:ss",
|
|
134
|
-
useRelativeTime: !1,
|
|
135
|
-
timezone: "auto",
|
|
136
|
-
// Default to auto (use context or browser timezone for display)
|
|
137
|
-
sourceTimezone: "auto"
|
|
138
|
-
// Default to auto (use explicit timezone if present, otherwise assume UTC)
|
|
139
|
-
},
|
|
140
|
-
linkFormat: Ln(),
|
|
141
|
-
colorRanges: []
|
|
142
|
-
});
|
|
143
|
-
function Xa(e, t, i, n) {
|
|
144
|
-
return t && t !== "auto" ? t : i;
|
|
145
|
-
}
|
|
146
|
-
const Za = (e) => !e || e === "auto" ? "local time" : {
|
|
147
|
-
"America/New_York": "Eastern Time",
|
|
148
|
-
"America/Chicago": "Central Time",
|
|
149
|
-
"America/Denver": "Mountain Time",
|
|
150
|
-
"America/Los_Angeles": "Pacific Time",
|
|
151
|
-
"Europe/London": "London Time",
|
|
152
|
-
"Europe/Paris": "Central European Time",
|
|
153
|
-
"Asia/Tokyo": "Japan Time",
|
|
154
|
-
"Asia/Shanghai": "China Time",
|
|
155
|
-
UTC: "UTC"
|
|
156
|
-
}[e] || e;
|
|
157
|
-
function qn(e) {
|
|
158
|
-
const t = W(e == null ? void 0 : e.format);
|
|
159
|
-
return !!(t && yt(t));
|
|
160
|
-
}
|
|
161
|
-
function $n(e, t) {
|
|
162
|
-
var o, s;
|
|
163
|
-
if (!(e != null && e.config) || e.type === "matrixTable" || (o = e.sql) != null && o.trim() || (s = e.python) != null && s.trim())
|
|
164
|
-
return;
|
|
165
|
-
const i = e.type === "detailTable" ? (e.config.detailColumns || []).map((l) => ({
|
|
166
|
-
field: l,
|
|
167
|
-
role: "detail"
|
|
168
|
-
})) : [
|
|
169
|
-
...(e.type === "table" ? e.config.detailColumns || [] : []).map(
|
|
170
|
-
(l) => ({ field: l, role: "detail" })
|
|
171
|
-
),
|
|
172
|
-
...(e.config.metricColumns || []).map((l) => ({
|
|
173
|
-
field: l,
|
|
174
|
-
role: "metric"
|
|
175
|
-
})),
|
|
176
|
-
...(e.config.groupByColumns || []).map((l) => ({
|
|
177
|
-
field: l,
|
|
178
|
-
role: "groupby"
|
|
179
|
-
}))
|
|
180
|
-
], n = t.fieldRole ? i.filter((l) => l.role === t.fieldRole) : i, r = (l) => l.length === 1 ? l[0].field : void 0;
|
|
181
|
-
if (t.fieldId)
|
|
182
|
-
return r(
|
|
183
|
-
n.filter(
|
|
184
|
-
({ field: l, role: c }) => l.id === t.fieldId && (!t.fieldRole || c === t.fieldRole)
|
|
185
|
-
)
|
|
186
|
-
);
|
|
187
|
-
if (t.metricId)
|
|
188
|
-
return r(
|
|
189
|
-
n.filter(
|
|
190
|
-
({ field: l, role: c }) => c === (e.type === "detailTable" ? "detail" : "metric") && l.id === t.metricId
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
if (t.columnKeyMap) {
|
|
194
|
-
const l = [
|
|
195
|
-
t.columnId,
|
|
196
|
-
t.metricAlias,
|
|
197
|
-
...t.columnIds || []
|
|
198
|
-
].filter((f) => f !== void 0), c = n.map((f) => {
|
|
199
|
-
var d, g;
|
|
200
|
-
return {
|
|
201
|
-
...f,
|
|
202
|
-
bindings: [
|
|
203
|
-
Sn(
|
|
204
|
-
t.columnKeyMap,
|
|
205
|
-
f.field.id,
|
|
206
|
-
f.role
|
|
207
|
-
),
|
|
208
|
-
f.role === "metric" && f.field.alias ? (g = (d = t.columnKeyMap) == null ? void 0 : d.byMetricAlias) == null ? void 0 : g[f.field.alias] : void 0
|
|
209
|
-
]
|
|
210
|
-
};
|
|
211
|
-
}), u = c.filter(
|
|
212
|
-
(f) => f.bindings.some(
|
|
213
|
-
(d) => (d == null ? void 0 : d.outputKey) !== void 0 && l.includes(d.outputKey)
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
return u.length ? r(u) : r(
|
|
217
|
-
c.filter(
|
|
218
|
-
(f) => f.bindings.some(
|
|
219
|
-
(d) => (d == null ? void 0 : d.rawKey) !== void 0 && l.includes(d.rawKey)
|
|
220
|
-
)
|
|
221
|
-
)
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
const a = (l) => l == null ? void 0 : l.trim().toLowerCase();
|
|
225
|
-
return r(
|
|
226
|
-
n.filter(
|
|
227
|
-
({ field: l }) => [t.columnId, t.metricAlias, ...t.columnIds || []].some(
|
|
228
|
-
(c) => c !== void 0 && [
|
|
229
|
-
l.id,
|
|
230
|
-
l.alias,
|
|
231
|
-
l.name,
|
|
232
|
-
l.qualifiedFieldName,
|
|
233
|
-
l.label
|
|
234
|
-
].some(
|
|
235
|
-
(u) => u !== void 0 && a(u) === a(c)
|
|
236
|
-
)
|
|
237
|
-
)
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
function _t(e, t) {
|
|
242
|
-
const i = typeof e.decimalPlaces == "number", n = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : i ? e.decimalPlaces : t.min, r = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : i ? e.decimalPlaces : t.max;
|
|
243
|
-
return {
|
|
244
|
-
minimumFractionDigits: n,
|
|
245
|
-
maximumFractionDigits: Math.max(n, r)
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
function le(e, t) {
|
|
249
|
-
const i = _t(e, t), n = typeof e.suffix == "string" && e.suffix.length > 0;
|
|
250
|
-
return {
|
|
251
|
-
style: "decimal",
|
|
252
|
-
locale: e.locale,
|
|
253
|
-
currency: e.currency,
|
|
254
|
-
minimumFractionDigits: i.minimumFractionDigits,
|
|
255
|
-
maximumFractionDigits: i.maximumFractionDigits,
|
|
256
|
-
useGrouping: e.useGrouping,
|
|
257
|
-
// Preserve legacy behavior: explicit custom suffix should not trigger compacting.
|
|
258
|
-
useSuffix: !!(e.useSuffix && !n),
|
|
259
|
-
prefix: e.prefix,
|
|
260
|
-
suffix: e.suffix,
|
|
261
|
-
negativeInParentheses: e.negativeInParentheses,
|
|
262
|
-
multiplyBy: e.multiplyBy,
|
|
263
|
-
percentValueMode: e.percentValueMode
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function Nt(e, t = "auto", i = {}) {
|
|
267
|
-
switch (t === "auto" && (t = Gn(e, i)), t) {
|
|
268
|
-
case "number":
|
|
269
|
-
return Et(e, i);
|
|
270
|
-
case "currency":
|
|
271
|
-
return Rt(e, i);
|
|
272
|
-
case "percent":
|
|
273
|
-
return zn(e, i);
|
|
274
|
-
case "date":
|
|
275
|
-
return jn(e, i);
|
|
276
|
-
case "scientific":
|
|
277
|
-
return Hn(e, i);
|
|
278
|
-
case "duration":
|
|
279
|
-
return Un(e, i);
|
|
280
|
-
default:
|
|
281
|
-
return String(e);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
function Et(e, t = {}) {
|
|
285
|
-
return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${Fe(
|
|
286
|
-
Math.abs(e),
|
|
287
|
-
le(t, {
|
|
288
|
-
min: 0,
|
|
289
|
-
max: 0
|
|
290
|
-
})
|
|
291
|
-
)}` : Fe(
|
|
292
|
-
e,
|
|
293
|
-
le(t, {
|
|
294
|
-
min: 0,
|
|
295
|
-
max: 0
|
|
296
|
-
})
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
function Rt(e, t = {}) {
|
|
300
|
-
return Ki(e, {
|
|
301
|
-
...le(t, {
|
|
302
|
-
min: 2,
|
|
303
|
-
max: 2
|
|
304
|
-
}),
|
|
305
|
-
style: "currency",
|
|
306
|
-
currency: t.currency || "USD"
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
function zn(e, t = {}) {
|
|
310
|
-
const i = _t(t, { min: 1, max: 1 }), r = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * r;
|
|
311
|
-
return Fe(a, {
|
|
312
|
-
locale: t.locale,
|
|
313
|
-
minimumFractionDigits: i.minimumFractionDigits,
|
|
314
|
-
maximumFractionDigits: i.maximumFractionDigits,
|
|
315
|
-
useGrouping: t.useGrouping,
|
|
316
|
-
prefix: t.prefix,
|
|
317
|
-
suffix: t.suffix || "%",
|
|
318
|
-
negativeInParentheses: t.negativeInParentheses,
|
|
319
|
-
useSuffix: !1
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
function jn(e, t = {}) {
|
|
323
|
-
const { locale: i = "en-US" } = t;
|
|
324
|
-
try {
|
|
325
|
-
const n = new Date(e);
|
|
326
|
-
return isNaN(n.getTime()) ? String(e) : new Intl.DateTimeFormat(i, {
|
|
327
|
-
dateStyle: "short"
|
|
328
|
-
}).format(n);
|
|
329
|
-
} catch {
|
|
330
|
-
return String(e);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function Hn(e, t = {}) {
|
|
334
|
-
return Bi(
|
|
335
|
-
e,
|
|
336
|
-
le(t, { min: 2, max: 2 })
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
function Un(e, t = {}) {
|
|
340
|
-
return ki(e, {
|
|
341
|
-
inputUnit: t.durationInputUnit,
|
|
342
|
-
outputStyle: t.durationDisplayStyle,
|
|
343
|
-
largestUnit: t.durationLargestUnit,
|
|
344
|
-
smallestUnit: t.durationSmallestUnit,
|
|
345
|
-
maxUnits: t.durationMaxUnits,
|
|
346
|
-
prefix: t.prefix,
|
|
347
|
-
suffix: t.suffix,
|
|
348
|
-
negativeInParentheses: t.negativeInParentheses
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
function Gn(e, t) {
|
|
352
|
-
return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
|
|
353
|
-
}
|
|
354
|
-
function eo(e, t = {}) {
|
|
355
|
-
return (i) => Nt(i, e, t);
|
|
356
|
-
}
|
|
357
|
-
function Wn({
|
|
358
|
-
number: e,
|
|
359
|
-
decimalPlaces: t = 0,
|
|
360
|
-
useSuffix: i = !1,
|
|
361
|
-
customSuffix: n = "",
|
|
362
|
-
currency: r = "",
|
|
363
|
-
locale: a = "en-US"
|
|
364
|
-
}) {
|
|
365
|
-
if (r) {
|
|
366
|
-
const o = Rt(e, {
|
|
367
|
-
currency: r,
|
|
368
|
-
decimalPlaces: t,
|
|
369
|
-
locale: a,
|
|
370
|
-
useSuffix: i && !n
|
|
371
|
-
});
|
|
372
|
-
return i && n ? `${o}${n}` : o;
|
|
373
|
-
}
|
|
374
|
-
return Et(e, {
|
|
375
|
-
decimalPlaces: t,
|
|
376
|
-
useSuffix: i && !n,
|
|
377
|
-
suffix: n,
|
|
378
|
-
locale: a
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
var Qn = function e(t, i) {
|
|
382
|
-
if (t === i) return !0;
|
|
383
|
-
if (t && i && typeof t == "object" && typeof i == "object") {
|
|
384
|
-
if (t.constructor !== i.constructor) return !1;
|
|
385
|
-
var n, r, a;
|
|
386
|
-
if (Array.isArray(t)) {
|
|
387
|
-
if (n = t.length, n != i.length) return !1;
|
|
388
|
-
for (r = n; r-- !== 0; )
|
|
389
|
-
if (!e(t[r], i[r])) return !1;
|
|
390
|
-
return !0;
|
|
391
|
-
}
|
|
392
|
-
if (t.constructor === RegExp) return t.source === i.source && t.flags === i.flags;
|
|
393
|
-
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === i.valueOf();
|
|
394
|
-
if (t.toString !== Object.prototype.toString) return t.toString() === i.toString();
|
|
395
|
-
if (a = Object.keys(t), n = a.length, n !== Object.keys(i).length) return !1;
|
|
396
|
-
for (r = n; r-- !== 0; )
|
|
397
|
-
if (!Object.prototype.hasOwnProperty.call(i, a[r])) return !1;
|
|
398
|
-
for (r = n; r-- !== 0; ) {
|
|
399
|
-
var o = a[r];
|
|
400
|
-
if (!(o === "_owner" && t.$$typeof) && !e(t[o], i[o]))
|
|
401
|
-
return !1;
|
|
402
|
-
}
|
|
403
|
-
return !0;
|
|
404
|
-
}
|
|
405
|
-
return t !== t && i !== i;
|
|
406
|
-
};
|
|
407
|
-
const ce = /* @__PURE__ */ Mn(Qn);
|
|
408
|
-
function Yn(e) {
|
|
409
|
-
if (typeof e == "number")
|
|
410
|
-
return Number.isFinite(e);
|
|
411
|
-
if (typeof e != "string")
|
|
412
|
-
return !1;
|
|
413
|
-
const t = e.trim().replace(/,/g, "");
|
|
414
|
-
return t !== "" && Number.isFinite(Number(t));
|
|
415
|
-
}
|
|
416
|
-
function Jn(e) {
|
|
417
|
-
if (!(e != null && e.length))
|
|
418
|
-
return [];
|
|
419
|
-
const t = /* @__PURE__ */ new Set();
|
|
420
|
-
return e.forEach((i) => {
|
|
421
|
-
Object.keys(i).forEach((n) => t.add(n));
|
|
422
|
-
}), [...t];
|
|
423
|
-
}
|
|
424
|
-
function Xn(e) {
|
|
425
|
-
return Jn(e).filter(
|
|
426
|
-
(i) => e == null ? void 0 : e.some((n) => Yn(n[i]))
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
function Ae(e, t) {
|
|
430
|
-
var i;
|
|
431
|
-
if (t.id)
|
|
432
|
-
return (i = e.sql) != null && i.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
|
|
433
|
-
}
|
|
434
|
-
function Vt(e) {
|
|
435
|
-
const t = e.context.preferences;
|
|
436
|
-
if (!t)
|
|
437
|
-
return e.authoredFormat;
|
|
438
|
-
const i = Ae(e.card, e.metric);
|
|
439
|
-
return _(
|
|
440
|
-
e.authoredFormat,
|
|
441
|
-
t,
|
|
442
|
-
i ? e.context.resolveBoundCurrency(i) : void 0
|
|
443
|
-
);
|
|
444
|
-
}
|
|
445
|
-
function Zn(e) {
|
|
446
|
-
var a, o, s;
|
|
447
|
-
const t = (s = (o = (a = e.card.preferences) == null ? void 0 : a.tablePrefs) == null ? void 0 : o.columnSettingsMap) == null ? void 0 : s[e.columnKey], i = (t == null ? void 0 : t.type) === "number" ? ci(
|
|
448
|
-
{ dataType: "number", format: void 0 },
|
|
449
|
-
t
|
|
450
|
-
) : void 0, n = i == null ? void 0 : i.authoredFormat, r = R(n) ? Vt({
|
|
451
|
-
card: e.card,
|
|
452
|
-
metric: {
|
|
453
|
-
id: e.columnKey
|
|
454
|
-
},
|
|
455
|
-
context: e.context,
|
|
456
|
-
authoredFormat: n
|
|
457
|
-
}) : void 0;
|
|
458
|
-
return {
|
|
459
|
-
id: e.columnKey,
|
|
460
|
-
name: e.columnKey,
|
|
461
|
-
label: e.columnKey,
|
|
462
|
-
alias: e.columnKey,
|
|
463
|
-
dataType: "number",
|
|
464
|
-
role: "metric",
|
|
465
|
-
format: r
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function to(e) {
|
|
469
|
-
var r, a;
|
|
470
|
-
const t = new Set(
|
|
471
|
-
Xn(e.records)
|
|
472
|
-
), i = new Set(
|
|
473
|
-
e.renderedMetricKeys || e.resultKeys
|
|
474
|
-
), n = ((a = (r = e.card.preferences) == null ? void 0 : r.tablePrefs) == null ? void 0 : a.columnSettingsMap) || {};
|
|
475
|
-
return e.resultKeys.filter(
|
|
476
|
-
(o) => {
|
|
477
|
-
var s;
|
|
478
|
-
return i.has(o) && (t.has(o) || ((s = n[o]) == null ? void 0 : s.type) === "number");
|
|
479
|
-
}
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
function io(e) {
|
|
483
|
-
var a, o;
|
|
484
|
-
const { card: t, context: i } = e;
|
|
485
|
-
if (!(i != null && i.preferences) || !vt(t.type))
|
|
486
|
-
return t;
|
|
487
|
-
const n = i.preferences, r = (a = t.sql) != null && a.trim() ? e.resultMetricKeys.map(
|
|
488
|
-
(s) => Zn({
|
|
489
|
-
card: t,
|
|
490
|
-
columnKey: s,
|
|
491
|
-
context: i
|
|
492
|
-
})
|
|
493
|
-
) : (((o = t.config) == null ? void 0 : o.metricColumns) || []).map((s) => {
|
|
494
|
-
const l = dt(t, s), c = l.authoredFormat;
|
|
495
|
-
if (!R(c))
|
|
496
|
-
return s;
|
|
497
|
-
const u = Ae(t, s), f = u ? i.resolveBoundCurrency(u) : void 0;
|
|
498
|
-
return l.source === "inferred" && !f ? s : {
|
|
499
|
-
...s,
|
|
500
|
-
format: l.source === "inferred" ? _(
|
|
501
|
-
c,
|
|
502
|
-
n,
|
|
503
|
-
f
|
|
504
|
-
) : Vt({
|
|
505
|
-
card: t,
|
|
506
|
-
metric: s,
|
|
507
|
-
context: i,
|
|
508
|
-
authoredFormat: c
|
|
509
|
-
})
|
|
510
|
-
};
|
|
511
|
-
});
|
|
512
|
-
return {
|
|
513
|
-
...t,
|
|
514
|
-
config: {
|
|
515
|
-
...t.config || {},
|
|
516
|
-
metricColumns: r
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
function fe(e) {
|
|
521
|
-
var l;
|
|
522
|
-
const { card: t, context: i, formatOptions: n } = e, r = i == null ? void 0 : i.preferences;
|
|
523
|
-
if (!t || !r || !vt(t.type))
|
|
524
|
-
return n;
|
|
525
|
-
if (!n) {
|
|
526
|
-
const c = e.metrics.filter(
|
|
527
|
-
(f) => !!f
|
|
528
|
-
), u = c.some(
|
|
529
|
-
(f) => R(f.format)
|
|
530
|
-
);
|
|
531
|
-
return c.length < 2 || !u ? n : K(
|
|
532
|
-
_({ type: "number" }, r),
|
|
533
|
-
{ preserveOmittedProperties: !0 }
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
if ((l = t.sql) != null && l.trim()) {
|
|
537
|
-
const c = e.metrics.filter(
|
|
538
|
-
(f) => !!f
|
|
539
|
-
), u = c.filter(
|
|
540
|
-
(f) => R(f.format)
|
|
541
|
-
);
|
|
542
|
-
if (u.length === 0)
|
|
543
|
-
return n;
|
|
544
|
-
if (u.length !== c.length)
|
|
545
|
-
return K(
|
|
546
|
-
_({ type: "number" }, r),
|
|
547
|
-
{ preserveOmittedProperties: !0 }
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
const a = ft(n, {
|
|
551
|
-
preserveOmittedProperties: !0
|
|
552
|
-
});
|
|
553
|
-
if (!R(a))
|
|
554
|
-
return n;
|
|
555
|
-
const o = e.metrics.flatMap((c) => {
|
|
556
|
-
if (!c)
|
|
557
|
-
return [];
|
|
558
|
-
const u = Ae(t, c);
|
|
559
|
-
return [
|
|
560
|
-
_(
|
|
561
|
-
a,
|
|
562
|
-
r,
|
|
563
|
-
u ? i.resolveBoundCurrency(u) : void 0
|
|
564
|
-
)
|
|
565
|
-
];
|
|
566
|
-
});
|
|
567
|
-
if (o.length === 0)
|
|
568
|
-
return K(
|
|
569
|
-
_(a, r),
|
|
570
|
-
{ preserveOmittedProperties: !0 }
|
|
571
|
-
);
|
|
572
|
-
const [s] = o;
|
|
573
|
-
if (o.some((c) => !ce(c, s))) {
|
|
574
|
-
const c = _(
|
|
575
|
-
{
|
|
576
|
-
...a,
|
|
577
|
-
type: "number",
|
|
578
|
-
currency: void 0
|
|
579
|
-
},
|
|
580
|
-
r
|
|
581
|
-
);
|
|
582
|
-
return K(c, {
|
|
583
|
-
preserveOmittedProperties: !0
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
return K(s, {
|
|
587
|
-
preserveOmittedProperties: !0
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
const er = /* @__PURE__ */ new Set([
|
|
591
|
-
"horizontalBar",
|
|
592
|
-
"tornado",
|
|
593
|
-
"pyramid",
|
|
594
|
-
"range"
|
|
595
|
-
]), tr = /* @__PURE__ */ new Set([
|
|
596
|
-
"tornado",
|
|
597
|
-
"pyramid",
|
|
598
|
-
"range"
|
|
599
|
-
]), ir = /* @__PURE__ */ new Set([
|
|
600
|
-
"tornado",
|
|
601
|
-
"pyramid",
|
|
602
|
-
"range"
|
|
603
|
-
]);
|
|
604
|
-
function nr(e) {
|
|
605
|
-
const { chartType: t, resultKeys: i, config: n } = e, r = 1 + (n != null && n.enableGrouping && (n.groupKey || i[1]) ? 1 : 0), a = i.slice(r), o = (n == null ? void 0 : n.xMetricKey) ?? a[0], s = (n == null ? void 0 : n.yMetricKey) ?? a[1] ?? a[0], l = t === "bubble" ? (n == null ? void 0 : n.radiusMetricKey) ?? a[2] ?? a[1] ?? a[0] : void 0, c = new Set(i);
|
|
606
|
-
return [o, s, l].filter((u) => !!u).filter((u) => c.has(u));
|
|
607
|
-
}
|
|
608
|
-
function no(e) {
|
|
609
|
-
const { chartType: t, resultKeys: i, preferences: n } = e;
|
|
610
|
-
return t === "scatter" || t === "bubble" ? [
|
|
611
|
-
...new Set(
|
|
612
|
-
nr({
|
|
613
|
-
chartType: t,
|
|
614
|
-
resultKeys: i,
|
|
615
|
-
config: n == null ? void 0 : n.bubbleScatterConfig
|
|
616
|
-
})
|
|
617
|
-
)
|
|
618
|
-
] : ir.has(t || "") ? i.slice(2) : i.length === 1 ? [i[0]] : i.slice(1);
|
|
619
|
-
}
|
|
620
|
-
function te(e, t) {
|
|
621
|
-
var i;
|
|
622
|
-
return ((i = t == null ? void 0 : t.chartOptions) == null ? void 0 : i.indexAxis) === "y" || er.has(e || "") ? "x" : "y";
|
|
623
|
-
}
|
|
624
|
-
function ro(e, t) {
|
|
625
|
-
return te(e, t) === "x";
|
|
626
|
-
}
|
|
627
|
-
function rr(e, t) {
|
|
628
|
-
return te(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (tr.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
|
|
629
|
-
}
|
|
630
|
-
function X(e) {
|
|
631
|
-
return e ? Object.entries(e).some(([t, i]) => i == null || i === "" ? !1 : t === "type" ? i !== "auto" : !0) : !1;
|
|
632
|
-
}
|
|
633
|
-
function kt(e) {
|
|
634
|
-
if (e)
|
|
635
|
-
return e.alias || e.label || e.name;
|
|
636
|
-
}
|
|
637
|
-
function Ie(e, t) {
|
|
638
|
-
var n;
|
|
639
|
-
return (((n = e == null ? void 0 : e.config) == null ? void 0 : n.metricColumns) || []).find((r) => {
|
|
640
|
-
const a = kt(r);
|
|
641
|
-
return t.metricId && r.id === t.metricId || t.metricAlias && a === t.metricAlias || t.metricAlias && r.alias === t.metricAlias || t.columnId && a === t.columnId || t.columnId && r.alias === t.columnId || t.columnId && r.label === t.columnId || t.columnId && r.name === t.columnId;
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
function ie(e, t) {
|
|
645
|
-
var n, r;
|
|
646
|
-
const i = $n(e, t);
|
|
647
|
-
if (!(i && ((r = (n = e == null ? void 0 : e.config) == null ? void 0 : n.groupByColumns) != null && r.includes(i)) && !qn(i)))
|
|
648
|
-
return i;
|
|
649
|
-
}
|
|
650
|
-
function ar(e) {
|
|
651
|
-
return !!e && !(e != null && e.format) && ht(e == null ? void 0 : e.dataType) === "number";
|
|
652
|
-
}
|
|
653
|
-
const or = {
|
|
654
|
-
style: "decimal",
|
|
655
|
-
showDataBar: !1,
|
|
656
|
-
dataBarColor: "#3b82f6"
|
|
657
|
-
};
|
|
658
|
-
function Bt(e) {
|
|
659
|
-
if (!e)
|
|
660
|
-
return;
|
|
661
|
-
const t = Oe();
|
|
662
|
-
return {
|
|
663
|
-
...t,
|
|
664
|
-
...e,
|
|
665
|
-
inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
|
|
666
|
-
numberFormat: {
|
|
667
|
-
...or,
|
|
668
|
-
...e.numberFormat
|
|
669
|
-
},
|
|
670
|
-
dateFormat: {
|
|
671
|
-
...t.dateFormat,
|
|
672
|
-
...e.dateFormat
|
|
673
|
-
},
|
|
674
|
-
linkFormat: {
|
|
675
|
-
...t.linkFormat,
|
|
676
|
-
...e.linkFormat
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
function ao(e) {
|
|
681
|
-
return Object.fromEntries(
|
|
682
|
-
Object.entries(e || {}).map(([t, i]) => [
|
|
683
|
-
t,
|
|
684
|
-
Bt(i)
|
|
685
|
-
])
|
|
686
|
-
);
|
|
687
|
-
}
|
|
688
|
-
function ae(e) {
|
|
689
|
-
return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
|
|
690
|
-
}
|
|
691
|
-
function Kt(e, t, i) {
|
|
692
|
-
if (!ae(i))
|
|
693
|
-
return i;
|
|
694
|
-
const n = ae(e) ? e : {}, r = ae(t) ? t : {}, a = {};
|
|
695
|
-
for (const o of Object.keys(i)) {
|
|
696
|
-
const s = i[o];
|
|
697
|
-
if (s === void 0)
|
|
698
|
-
continue;
|
|
699
|
-
const l = Object.prototype.hasOwnProperty.call(
|
|
700
|
-
n,
|
|
701
|
-
o
|
|
702
|
-
), c = r[o];
|
|
703
|
-
if (l && ce(s, c)) {
|
|
704
|
-
a[o] = n[o];
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
if (!l && ce(s, c))
|
|
708
|
-
continue;
|
|
709
|
-
const u = Kt(
|
|
710
|
-
n[o],
|
|
711
|
-
c,
|
|
712
|
-
s
|
|
713
|
-
);
|
|
714
|
-
ae(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
|
|
715
|
-
}
|
|
716
|
-
return a;
|
|
717
|
-
}
|
|
718
|
-
function sr(e) {
|
|
719
|
-
let t = Kt(
|
|
720
|
-
e.persisted,
|
|
721
|
-
e.baseline,
|
|
722
|
-
e.next
|
|
723
|
-
);
|
|
724
|
-
if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
|
|
725
|
-
const i = e.next.dateFormat.customFormat;
|
|
726
|
-
if (!(i != null && i.trim()))
|
|
727
|
-
throw new Li(
|
|
728
|
-
"invalid_raw_temporal_format",
|
|
729
|
-
"Custom table date formatting requires a non-empty pattern."
|
|
730
|
-
);
|
|
731
|
-
qi({
|
|
732
|
-
dialect: "date_fns",
|
|
733
|
-
pattern: i,
|
|
734
|
-
valueKind: e.rawTemporalValueKind
|
|
735
|
-
}), t = {
|
|
736
|
-
...t,
|
|
737
|
-
dateFormat: {
|
|
738
|
-
...t.dateFormat,
|
|
739
|
-
useCustomFormat: !0,
|
|
740
|
-
customFormat: i
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
return e.next.type === "number" && !ce(e.next.numberFormat, e.baseline.numberFormat) && t.numberFormat ? {
|
|
745
|
-
...t,
|
|
746
|
-
type: "number",
|
|
747
|
-
inheritMetricFormat: e.next.inheritMetricFormat ?? !1
|
|
748
|
-
} : e.next.type === "number" && e.baseline.inheritMetricFormat === !0 && e.next.inheritMetricFormat === !1 ? {
|
|
749
|
-
...t,
|
|
750
|
-
type: "number",
|
|
751
|
-
inheritMetricFormat: !1
|
|
752
|
-
} : e.forcePersistDateType && e.next.type === "date" ? {
|
|
753
|
-
...t,
|
|
754
|
-
type: "date"
|
|
755
|
-
} : t;
|
|
756
|
-
}
|
|
757
|
-
function oo(e) {
|
|
758
|
-
return e.reset ? lr(e.persisted, e.columnId) : {
|
|
759
|
-
...e.persisted,
|
|
760
|
-
[e.columnId]: sr({
|
|
761
|
-
persisted: e.persisted[e.columnId],
|
|
762
|
-
baseline: e.baseline,
|
|
763
|
-
next: e.next,
|
|
764
|
-
forcePersistDateType: e.forcePersistDateType,
|
|
765
|
-
enforceDeclaredSqlTemporalFormat: e.enforceDeclaredSqlTemporalFormat,
|
|
766
|
-
rawTemporalValueKind: e.rawTemporalValueKind
|
|
767
|
-
})
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
function lr(e, t) {
|
|
771
|
-
if (!(t in e))
|
|
772
|
-
return e;
|
|
773
|
-
const i = { ...e };
|
|
774
|
-
return delete i[t], i;
|
|
775
|
-
}
|
|
776
|
-
function cr(e, t) {
|
|
777
|
-
const i = e || Oe(), n = !t;
|
|
778
|
-
return {
|
|
779
|
-
...i,
|
|
780
|
-
type: "number",
|
|
781
|
-
textAlign: i.type === "none" ? "right" : i.textAlign,
|
|
782
|
-
numberFormat: {
|
|
783
|
-
style: "decimal",
|
|
784
|
-
minimumFractionDigits: n ? i.numberFormat.minimumFractionDigits : void 0,
|
|
785
|
-
maximumFractionDigits: n ? i.numberFormat.maximumFractionDigits : void 0,
|
|
786
|
-
useGrouping: i.numberFormat.useGrouping,
|
|
787
|
-
showDataBar: i.numberFormat.showDataBar,
|
|
788
|
-
showHeatmap: i.numberFormat.showHeatmap,
|
|
789
|
-
dataBarColor: i.numberFormat.dataBarColor,
|
|
790
|
-
dataBarMinValue: i.numberFormat.dataBarMinValue,
|
|
791
|
-
dataBarMaxValue: i.numberFormat.dataBarMaxValue
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function be(e) {
|
|
796
|
-
if (e)
|
|
797
|
-
return e.trim().toLowerCase();
|
|
798
|
-
}
|
|
799
|
-
const Lt = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
|
|
800
|
-
function ur(e) {
|
|
801
|
-
const t = e == null ? void 0 : e.trim();
|
|
802
|
-
return t ? t.replace(Lt, "").trim() || t : void 0;
|
|
803
|
-
}
|
|
804
|
-
function dr(e) {
|
|
805
|
-
const t = e == null ? void 0 : e.trim();
|
|
806
|
-
return t ? Lt.test(t) : !1;
|
|
807
|
-
}
|
|
808
|
-
function fr(e, t) {
|
|
809
|
-
return t.metricAlias ? e.find(
|
|
810
|
-
(i) => Ri(i) === t.metricAlias
|
|
811
|
-
) : t.metricId ? e.find((i) => i.id === t.metricId) : void 0;
|
|
812
|
-
}
|
|
813
|
-
function mr(e) {
|
|
814
|
-
var b;
|
|
815
|
-
const {
|
|
816
|
-
card: t,
|
|
817
|
-
metricId: i,
|
|
818
|
-
metricAlias: n,
|
|
819
|
-
datasetIndex: r,
|
|
820
|
-
datasetLabel: a,
|
|
821
|
-
metricKey: o
|
|
822
|
-
} = e, s = ((b = t == null ? void 0 : t.config) == null ? void 0 : b.metricColumns) || [];
|
|
823
|
-
if (n || i)
|
|
824
|
-
return fr(s, {
|
|
825
|
-
metricAlias: n,
|
|
826
|
-
metricId: i
|
|
827
|
-
});
|
|
828
|
-
const l = [o, a], c = l.some(
|
|
829
|
-
(m) => dr(m)
|
|
830
|
-
), u = l.filter(
|
|
831
|
-
(m) => !!m
|
|
832
|
-
);
|
|
833
|
-
for (const m of u) {
|
|
834
|
-
const y = Ie(t, {
|
|
835
|
-
columnId: m,
|
|
836
|
-
metricAlias: m
|
|
837
|
-
});
|
|
838
|
-
if (y)
|
|
839
|
-
return y;
|
|
840
|
-
}
|
|
841
|
-
const f = u.map((m) => be(m)).filter((m) => !!m), d = u.map((m) => ur(m)).filter((m) => !!m);
|
|
842
|
-
for (const m of d) {
|
|
843
|
-
const y = Ie(t, {
|
|
844
|
-
columnId: m,
|
|
845
|
-
metricAlias: m
|
|
846
|
-
});
|
|
847
|
-
if (y)
|
|
848
|
-
return y;
|
|
849
|
-
}
|
|
850
|
-
if (s.length === 1)
|
|
851
|
-
return s[0];
|
|
852
|
-
if (!c && typeof r == "number" && r >= 0 && r < s.length)
|
|
853
|
-
return s[r];
|
|
854
|
-
const g = d.map((m) => be(m)).filter((m) => !!m), v = [
|
|
855
|
-
...f,
|
|
856
|
-
...g
|
|
857
|
-
];
|
|
858
|
-
if (v.length !== 0)
|
|
859
|
-
return s.find((m) => {
|
|
860
|
-
const y = [
|
|
861
|
-
m.alias,
|
|
862
|
-
m.label,
|
|
863
|
-
m.name,
|
|
864
|
-
kt(m)
|
|
865
|
-
].map((C) => be(C)).filter((C) => !!C);
|
|
866
|
-
return v.some(
|
|
867
|
-
(C) => y.includes(C)
|
|
868
|
-
);
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
function pr(e) {
|
|
872
|
-
const t = W(e == null ? void 0 : e.format);
|
|
873
|
-
return K(t);
|
|
874
|
-
}
|
|
875
|
-
function it(e, t) {
|
|
876
|
-
if (t)
|
|
877
|
-
return Ie(e, {
|
|
878
|
-
columnId: t,
|
|
879
|
-
metricAlias: t
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
function nt(e) {
|
|
883
|
-
const t = ft(e);
|
|
884
|
-
if (t)
|
|
885
|
-
return JSON.stringify(t);
|
|
886
|
-
}
|
|
887
|
-
function hr(e, t) {
|
|
888
|
-
const i = nt(e), n = nt(t);
|
|
889
|
-
return !!(i && n && i === n);
|
|
890
|
-
}
|
|
891
|
-
function gr(e) {
|
|
892
|
-
if (e.length === 0)
|
|
893
|
-
return;
|
|
894
|
-
const t = e.map(
|
|
895
|
-
(o) => pr(o)
|
|
896
|
-
);
|
|
897
|
-
if (!t.every(
|
|
898
|
-
(o) => X(o)
|
|
899
|
-
))
|
|
900
|
-
return;
|
|
901
|
-
const n = t, [r] = n;
|
|
902
|
-
return n.every(
|
|
903
|
-
(o) => hr(r, o)
|
|
904
|
-
) ? r : void 0;
|
|
905
|
-
}
|
|
906
|
-
function yr(e) {
|
|
907
|
-
const t = e.formatMode || e.legacyMode;
|
|
908
|
-
return t === "override" ? "override" : t === "inherit" ? "inherit" : e.legacyMode && e.legacyMode !== "auto" && e.legacyMode !== "inherit" && e.legacyMode !== "override" || X(e.formatOptions) ? "override" : "inherit";
|
|
909
|
-
}
|
|
910
|
-
function me(e) {
|
|
911
|
-
const t = yr({
|
|
912
|
-
formatMode: e.formatMode,
|
|
913
|
-
legacyMode: e.legacyMode,
|
|
914
|
-
formatOptions: e.overrideFormatOptions
|
|
915
|
-
});
|
|
916
|
-
if (t === "override" && X(e.overrideFormatOptions))
|
|
917
|
-
return {
|
|
918
|
-
formatOptions: e.overrideFormatOptions || void 0,
|
|
919
|
-
source: "override"
|
|
920
|
-
};
|
|
921
|
-
if (t === "override" && e.legacyMode === "none")
|
|
922
|
-
return {
|
|
923
|
-
formatOptions: void 0,
|
|
924
|
-
source: "override",
|
|
925
|
-
rawValue: !0
|
|
926
|
-
};
|
|
927
|
-
const i = gr(
|
|
928
|
-
e.metrics || []
|
|
929
|
-
);
|
|
930
|
-
if (X(i))
|
|
931
|
-
return {
|
|
932
|
-
formatOptions: i,
|
|
933
|
-
source: "metric"
|
|
934
|
-
};
|
|
935
|
-
const n = Sr(e.preferences);
|
|
936
|
-
return X(n) ? {
|
|
937
|
-
formatOptions: n,
|
|
938
|
-
source: "legacy"
|
|
939
|
-
} : {
|
|
940
|
-
formatOptions: void 0,
|
|
941
|
-
source: "auto"
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
function qt(e) {
|
|
945
|
-
var l, c, u;
|
|
946
|
-
const { card: t, chartType: i, axis: n, preferences: r } = e, a = ((l = t == null ? void 0 : t.config) == null ? void 0 : l.metricColumns) || [], o = (r == null ? void 0 : r.datasetOptions) || [];
|
|
947
|
-
if (!a.length)
|
|
948
|
-
return [];
|
|
949
|
-
if (i === "combo")
|
|
950
|
-
return n === "x" ? [] : a.filter((f, d) => {
|
|
951
|
-
const g = o.find((b) => b.idx === d);
|
|
952
|
-
return ((g == null ? void 0 : g.yAxisId) === "y2" ? "y2" : "y") === n;
|
|
953
|
-
});
|
|
954
|
-
if (i === "bubble" || i === "scatter") {
|
|
955
|
-
if (n === "y2")
|
|
956
|
-
return [];
|
|
957
|
-
const f = it(
|
|
958
|
-
t,
|
|
959
|
-
(c = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : c.xMetricKey
|
|
960
|
-
) || a[0], d = it(
|
|
961
|
-
t,
|
|
962
|
-
(u = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : u.yMetricKey
|
|
963
|
-
) || a[1] || a[0];
|
|
964
|
-
return n === "x" ? f ? [f] : [] : d ? [d] : [];
|
|
965
|
-
}
|
|
966
|
-
const s = te(i, r);
|
|
967
|
-
return i === "radar" ? n === "y" ? a : [] : n !== s ? [] : a;
|
|
968
|
-
}
|
|
969
|
-
function _e(e) {
|
|
970
|
-
const { card: t, chartType: i, axis: n, preferences: r, axisConfig: a } = e, o = qt({
|
|
971
|
-
card: t,
|
|
972
|
-
chartType: i,
|
|
973
|
-
axis: n,
|
|
974
|
-
preferences: r
|
|
975
|
-
}), s = me({
|
|
976
|
-
formatMode: a == null ? void 0 : a.formatMode,
|
|
977
|
-
overrideFormatOptions: a == null ? void 0 : a.formatOptions,
|
|
978
|
-
metrics: o,
|
|
979
|
-
preferences: r
|
|
980
|
-
});
|
|
981
|
-
return {
|
|
982
|
-
...s,
|
|
983
|
-
formatOptions: fe({
|
|
984
|
-
card: t,
|
|
985
|
-
metrics: o,
|
|
986
|
-
formatOptions: s.formatOptions,
|
|
987
|
-
context: e.numericPresentation
|
|
988
|
-
})
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
function $t(e, t) {
|
|
992
|
-
if (!e && (!t || t === "auto" || t === "none"))
|
|
993
|
-
return;
|
|
994
|
-
const i = {
|
|
995
|
-
...e || {}
|
|
996
|
-
};
|
|
997
|
-
return t && t !== "auto" && t !== "none" && !i.type && (i.type = t), i;
|
|
998
|
-
}
|
|
999
|
-
function br(e) {
|
|
1000
|
-
const { preferences: t, metric: i } = e, n = t == null ? void 0 : t.tooltipConfig, r = me({
|
|
1001
|
-
formatMode: n == null ? void 0 : n.formatMode,
|
|
1002
|
-
legacyMode: n == null ? void 0 : n.mode,
|
|
1003
|
-
overrideFormatOptions: n == null ? void 0 : n.formatOptions,
|
|
1004
|
-
metrics: i ? [i] : [],
|
|
1005
|
-
preferences: t
|
|
1006
|
-
});
|
|
1007
|
-
return {
|
|
1008
|
-
...r,
|
|
1009
|
-
formatOptions: fe({
|
|
1010
|
-
card: e.card,
|
|
1011
|
-
metrics: e.metric ? [e.metric] : [],
|
|
1012
|
-
formatOptions: r.formatOptions,
|
|
1013
|
-
context: e.numericPresentation
|
|
1014
|
-
})
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
function Ne(e, t, i) {
|
|
1018
|
-
return t === te(i, e) ? rr(i, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
|
|
1019
|
-
}
|
|
1020
|
-
function Ee(e) {
|
|
1021
|
-
const { chartType: t, preferences: i } = e;
|
|
1022
|
-
return t === "bubble" || t === "scatter" ? "y" : te(t, i);
|
|
1023
|
-
}
|
|
1024
|
-
function zt(e) {
|
|
1025
|
-
switch (e) {
|
|
1026
|
-
case "pie":
|
|
1027
|
-
case "doughnut":
|
|
1028
|
-
case "polarArea":
|
|
1029
|
-
case "funnel":
|
|
1030
|
-
case "treemap":
|
|
1031
|
-
case "heatmap":
|
|
1032
|
-
return !1;
|
|
1033
|
-
default:
|
|
1034
|
-
return !0;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
function so(e) {
|
|
1038
|
-
const { card: t, chartType: i, preferences: n, metric: r } = e, a = br({
|
|
1039
|
-
card: t,
|
|
1040
|
-
preferences: n,
|
|
1041
|
-
metric: r,
|
|
1042
|
-
numericPresentation: e.numericPresentation
|
|
1043
|
-
});
|
|
1044
|
-
if (a.source === "override")
|
|
1045
|
-
return a;
|
|
1046
|
-
const o = e.axis || Ee({ chartType: i, preferences: n }), s = _e({
|
|
1047
|
-
card: t,
|
|
1048
|
-
chartType: i,
|
|
1049
|
-
axis: o,
|
|
1050
|
-
preferences: n,
|
|
1051
|
-
axisConfig: Ne(n, o, i),
|
|
1052
|
-
numericPresentation: e.numericPresentation
|
|
1053
|
-
});
|
|
1054
|
-
return s.source === "override" ? s : a;
|
|
1055
|
-
}
|
|
1056
|
-
function lo(e) {
|
|
1057
|
-
const { card: t, chartType: i, preferences: n, dataLabelsConfig: r } = e, a = i || (t == null ? void 0 : t.type), o = Ee({
|
|
1058
|
-
chartType: a,
|
|
1059
|
-
preferences: n
|
|
1060
|
-
}), s = qt({
|
|
1061
|
-
card: t,
|
|
1062
|
-
chartType: a,
|
|
1063
|
-
axis: o,
|
|
1064
|
-
preferences: n
|
|
1065
|
-
}), l = me({
|
|
1066
|
-
formatMode: r == null ? void 0 : r.formatMode,
|
|
1067
|
-
legacyMode: r == null ? void 0 : r.format,
|
|
1068
|
-
overrideFormatOptions: $t(
|
|
1069
|
-
r == null ? void 0 : r.formatOptions,
|
|
1070
|
-
r == null ? void 0 : r.format
|
|
1071
|
-
),
|
|
1072
|
-
metrics: s,
|
|
1073
|
-
preferences: n
|
|
1074
|
-
}), c = {
|
|
1075
|
-
...l,
|
|
1076
|
-
formatOptions: fe({
|
|
1077
|
-
card: t,
|
|
1078
|
-
metrics: s,
|
|
1079
|
-
formatOptions: l.formatOptions,
|
|
1080
|
-
context: e.numericPresentation
|
|
1081
|
-
})
|
|
1082
|
-
};
|
|
1083
|
-
if (c.source === "override" || !zt(a))
|
|
1084
|
-
return c;
|
|
1085
|
-
const u = _e({
|
|
1086
|
-
card: t,
|
|
1087
|
-
chartType: a,
|
|
1088
|
-
axis: o,
|
|
1089
|
-
preferences: n,
|
|
1090
|
-
axisConfig: Ne(
|
|
1091
|
-
n,
|
|
1092
|
-
o,
|
|
1093
|
-
a
|
|
1094
|
-
),
|
|
1095
|
-
numericPresentation: e.numericPresentation
|
|
1096
|
-
});
|
|
1097
|
-
return u.source === "override" ? u : c;
|
|
1098
|
-
}
|
|
1099
|
-
function vr(e) {
|
|
1100
|
-
const { preferences: t, dataLabelsConfig: i, metric: n } = e, r = me({
|
|
1101
|
-
formatMode: i == null ? void 0 : i.formatMode,
|
|
1102
|
-
legacyMode: i == null ? void 0 : i.format,
|
|
1103
|
-
overrideFormatOptions: $t(
|
|
1104
|
-
i == null ? void 0 : i.formatOptions,
|
|
1105
|
-
i == null ? void 0 : i.format
|
|
1106
|
-
),
|
|
1107
|
-
metrics: n ? [n] : [],
|
|
1108
|
-
preferences: t
|
|
1109
|
-
});
|
|
1110
|
-
return {
|
|
1111
|
-
...r,
|
|
1112
|
-
formatOptions: fe({
|
|
1113
|
-
card: e.card,
|
|
1114
|
-
metrics: e.metric ? [e.metric] : [],
|
|
1115
|
-
formatOptions: r.formatOptions,
|
|
1116
|
-
context: e.numericPresentation
|
|
1117
|
-
})
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
function co(e) {
|
|
1121
|
-
var o, s;
|
|
1122
|
-
const t = mr({
|
|
1123
|
-
card: e.card,
|
|
1124
|
-
metricId: e.metricId,
|
|
1125
|
-
metricAlias: e.metricAlias,
|
|
1126
|
-
datasetIndex: e.datasetIndex,
|
|
1127
|
-
datasetLabel: e.datasetLabel,
|
|
1128
|
-
metricKey: e.metricKey
|
|
1129
|
-
}), i = vr({
|
|
1130
|
-
card: e.card,
|
|
1131
|
-
preferences: e.preferences,
|
|
1132
|
-
dataLabelsConfig: e.dataLabelsConfig,
|
|
1133
|
-
metric: t,
|
|
1134
|
-
numericPresentation: e.numericPresentation
|
|
1135
|
-
});
|
|
1136
|
-
if (i.source === "override")
|
|
1137
|
-
return i;
|
|
1138
|
-
const n = (o = e.card) == null ? void 0 : o.type;
|
|
1139
|
-
if (!zt(n))
|
|
1140
|
-
return i;
|
|
1141
|
-
let r = Ee({
|
|
1142
|
-
chartType: n,
|
|
1143
|
-
preferences: e.preferences
|
|
1144
|
-
});
|
|
1145
|
-
if (n === "combo" && typeof e.datasetIndex == "number") {
|
|
1146
|
-
const c = (((s = e.preferences) == null ? void 0 : s.datasetOptions) || []).find(
|
|
1147
|
-
(u) => u.idx === e.datasetIndex
|
|
1148
|
-
);
|
|
1149
|
-
r = (c == null ? void 0 : c.yAxisId) === "y2" ? "y2" : "y";
|
|
1150
|
-
}
|
|
1151
|
-
const a = _e({
|
|
1152
|
-
card: e.card,
|
|
1153
|
-
chartType: n,
|
|
1154
|
-
axis: r,
|
|
1155
|
-
preferences: e.preferences,
|
|
1156
|
-
axisConfig: Ne(
|
|
1157
|
-
e.preferences,
|
|
1158
|
-
r,
|
|
1159
|
-
n
|
|
1160
|
-
),
|
|
1161
|
-
numericPresentation: e.numericPresentation
|
|
1162
|
-
});
|
|
1163
|
-
return a.source === "override" ? a : i;
|
|
1164
|
-
}
|
|
1165
|
-
function uo(e) {
|
|
1166
|
-
return (e == null ? void 0 : e.rawValue) === !0;
|
|
1167
|
-
}
|
|
1168
|
-
function Fr(e) {
|
|
1169
|
-
const t = e == null ? void 0 : e.numberFormat;
|
|
1170
|
-
if (!t)
|
|
1171
|
-
return;
|
|
1172
|
-
if (t.style === "duration")
|
|
1173
|
-
return K(Se(t), {
|
|
1174
|
-
preserveOmittedProperties: !0
|
|
1175
|
-
});
|
|
1176
|
-
const i = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", n = t.minimumFractionDigits, r = t.maximumFractionDigits;
|
|
1177
|
-
return {
|
|
1178
|
-
type: i,
|
|
1179
|
-
currency: i === "currency" ? t.currency : void 0,
|
|
1180
|
-
locale: t.locale,
|
|
1181
|
-
decimalPlaces: n === r ? r : void 0,
|
|
1182
|
-
minimumFractionDigits: n,
|
|
1183
|
-
maximumFractionDigits: r,
|
|
1184
|
-
useGrouping: t.useGrouping,
|
|
1185
|
-
percentValueMode: i === "percent" ? t.percentValueMode : void 0,
|
|
1186
|
-
multiplyBy: t.scale,
|
|
1187
|
-
useSuffix: t.compact,
|
|
1188
|
-
negativeInParentheses: t.negativeStyle === "parentheses",
|
|
1189
|
-
prefix: t.prefix,
|
|
1190
|
-
suffix: t.suffix
|
|
1191
|
-
};
|
|
1192
|
-
}
|
|
1193
|
-
function Cr(e, t, i = !1) {
|
|
1194
|
-
const n = i ? { preserveOmittedProperties: !0 } : void 0, r = W(e == null ? void 0 : e.format, n), a = mt(
|
|
1195
|
-
r,
|
|
1196
|
-
n
|
|
1197
|
-
);
|
|
1198
|
-
if (!a)
|
|
1199
|
-
return;
|
|
1200
|
-
const o = t || Oe(), s = i ? {
|
|
1201
|
-
showDataBar: o.numberFormat.showDataBar,
|
|
1202
|
-
showHeatmap: o.numberFormat.showHeatmap,
|
|
1203
|
-
dataBarColor: o.numberFormat.dataBarColor,
|
|
1204
|
-
dataBarMinValue: o.numberFormat.dataBarMinValue,
|
|
1205
|
-
dataBarMaxValue: o.numberFormat.dataBarMaxValue
|
|
1206
|
-
} : o.numberFormat, l = o.type && o.type !== "none";
|
|
1207
|
-
return {
|
|
1208
|
-
...o,
|
|
1209
|
-
type: l ? o.type : "number",
|
|
1210
|
-
inheritMetricFormat: o.inheritMetricFormat ?? !0,
|
|
1211
|
-
textAlign: l ? o.textAlign : "right",
|
|
1212
|
-
numberFormat: {
|
|
1213
|
-
...s,
|
|
1214
|
-
...a,
|
|
1215
|
-
showDataBar: s.showDataBar,
|
|
1216
|
-
showHeatmap: s.showHeatmap,
|
|
1217
|
-
dataBarColor: s.dataBarColor,
|
|
1218
|
-
dataBarMinValue: s.dataBarMinValue,
|
|
1219
|
-
dataBarMaxValue: s.dataBarMaxValue
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
function jt(e) {
|
|
1224
|
-
var T, V, N, O;
|
|
1225
|
-
const {
|
|
1226
|
-
card: t,
|
|
1227
|
-
columnId: i,
|
|
1228
|
-
persistedSettings: n,
|
|
1229
|
-
resolvedSettings: r,
|
|
1230
|
-
fallbackSettings: a,
|
|
1231
|
-
metricId: o,
|
|
1232
|
-
metricAlias: s,
|
|
1233
|
-
fieldId: l,
|
|
1234
|
-
fieldRole: c,
|
|
1235
|
-
columnKeyMap: u,
|
|
1236
|
-
valueFormatPreferences: f,
|
|
1237
|
-
boundCurrency: d,
|
|
1238
|
-
preserveOmittedProperties: g
|
|
1239
|
-
} = e, v = n ?? ((N = (V = (T = t == null ? void 0 : t.preferences) == null ? void 0 : T.tablePrefs) == null ? void 0 : V.columnSettingsMap) == null ? void 0 : N[i]), b = !((O = t == null ? void 0 : t.sql) != null && O.trim()) || ui(v), m = b ? f : null, y = b ? d : void 0, C = di(
|
|
1240
|
-
v == null ? void 0 : v.numberFormat
|
|
1241
|
-
), S = r ?? Bt(v);
|
|
1242
|
-
if (S && S.inheritMetricFormat !== !0)
|
|
1243
|
-
return rt(
|
|
1244
|
-
S,
|
|
1245
|
-
m,
|
|
1246
|
-
y,
|
|
1247
|
-
{
|
|
1248
|
-
preserveHistoricalPersistedPrecision: C
|
|
1249
|
-
}
|
|
1250
|
-
);
|
|
1251
|
-
const w = ie(t, {
|
|
1252
|
-
columnId: i,
|
|
1253
|
-
metricId: o,
|
|
1254
|
-
metricAlias: s,
|
|
1255
|
-
columnKeyMap: u,
|
|
1256
|
-
fieldId: l,
|
|
1257
|
-
fieldRole: c
|
|
1258
|
-
}), h = Cr(
|
|
1259
|
-
w,
|
|
1260
|
-
S || a,
|
|
1261
|
-
g ?? !!f
|
|
1262
|
-
), F = !h && m && ar(w) ? cr(
|
|
1263
|
-
S || a,
|
|
1264
|
-
y
|
|
1265
|
-
) : void 0;
|
|
1266
|
-
return rt(
|
|
1267
|
-
h || F || S || a,
|
|
1268
|
-
m,
|
|
1269
|
-
y,
|
|
1270
|
-
{
|
|
1271
|
-
preserveHistoricalPersistedPrecision: !!(S && C && !h && !F)
|
|
1272
|
-
}
|
|
1273
|
-
);
|
|
1274
|
-
}
|
|
1275
|
-
function rt(e, t, i, n) {
|
|
1276
|
-
if (!e || e.type !== "number" || !t)
|
|
1277
|
-
return e;
|
|
1278
|
-
const r = e.numberFormat, a = r ? n != null && n.preserveHistoricalPersistedPrecision ? fi(r) : Se(r, {
|
|
1279
|
-
preserveOmittedProperties: !0
|
|
1280
|
-
}) : { type: "number" };
|
|
1281
|
-
if (!a || !R(a))
|
|
1282
|
-
return e;
|
|
1283
|
-
const o = _(
|
|
1284
|
-
a,
|
|
1285
|
-
t,
|
|
1286
|
-
i
|
|
1287
|
-
), s = mt(o, {
|
|
1288
|
-
preserveOmittedProperties: !0
|
|
1289
|
-
});
|
|
1290
|
-
return s ? {
|
|
1291
|
-
...e,
|
|
1292
|
-
numberFormat: {
|
|
1293
|
-
...r,
|
|
1294
|
-
...s,
|
|
1295
|
-
showDataBar: (r == null ? void 0 : r.showDataBar) ?? s.showDataBar,
|
|
1296
|
-
showHeatmap: r == null ? void 0 : r.showHeatmap,
|
|
1297
|
-
dataBarColor: (r == null ? void 0 : r.dataBarColor) ?? s.dataBarColor,
|
|
1298
|
-
dataBarMinValue: r == null ? void 0 : r.dataBarMinValue,
|
|
1299
|
-
dataBarMaxValue: r == null ? void 0 : r.dataBarMaxValue
|
|
1300
|
-
}
|
|
1301
|
-
} : e;
|
|
1302
|
-
}
|
|
1303
|
-
function ue(e) {
|
|
1304
|
-
if (!e.valueFormatPreferences)
|
|
1305
|
-
return;
|
|
1306
|
-
const t = jt(e);
|
|
1307
|
-
if (!t || t.type !== "number")
|
|
1308
|
-
return;
|
|
1309
|
-
const i = Se(t.numberFormat, {
|
|
1310
|
-
preserveOmittedProperties: !0
|
|
1311
|
-
});
|
|
1312
|
-
if (!(!i || !yt(i)))
|
|
1313
|
-
return i;
|
|
1314
|
-
}
|
|
1315
|
-
function Ir(e) {
|
|
1316
|
-
var n, r;
|
|
1317
|
-
if (!e.presentation.preferences)
|
|
1318
|
-
return;
|
|
1319
|
-
const t = ie(e.card, {
|
|
1320
|
-
columnId: e.columnId,
|
|
1321
|
-
metricId: e.metricId,
|
|
1322
|
-
metricAlias: e.metricAlias,
|
|
1323
|
-
columnKeyMap: e.columnKeyMap
|
|
1324
|
-
});
|
|
1325
|
-
if (e.comparisonValueKind === "percent_change" || e.comparisonValueKind === "ratio") {
|
|
1326
|
-
const a = ue({
|
|
1327
|
-
card: e.card,
|
|
1328
|
-
columnId: e.columnId,
|
|
1329
|
-
persistedSettings: e.persistedSettings,
|
|
1330
|
-
resolvedSettings: e.resolvedSettings,
|
|
1331
|
-
fallbackSettings: e.fallbackSettings,
|
|
1332
|
-
metricId: e.metricId,
|
|
1333
|
-
columnKeyMap: e.columnKeyMap,
|
|
1334
|
-
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1335
|
-
valueFormatPreferences: e.presentation.preferences
|
|
1336
|
-
}), o = hi(e.comparisonPrecision) ?? (R(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
|
|
1337
|
-
return e.comparisonValueKind === "percent_change" ? {
|
|
1338
|
-
type: "percent",
|
|
1339
|
-
locale: e.presentation.preferences.locale,
|
|
1340
|
-
percentValueMode: "fraction",
|
|
1341
|
-
minimumFractionDigits: o,
|
|
1342
|
-
maximumFractionDigits: o
|
|
1343
|
-
} : {
|
|
1344
|
-
type: "number",
|
|
1345
|
-
locale: e.presentation.preferences.locale,
|
|
1346
|
-
minimumFractionDigits: o,
|
|
1347
|
-
maximumFractionDigits: o,
|
|
1348
|
-
suffix: "×"
|
|
1349
|
-
};
|
|
1350
|
-
}
|
|
1351
|
-
const i = gi({
|
|
1352
|
-
card: e.card,
|
|
1353
|
-
columnKey: e.columnId,
|
|
1354
|
-
metricId: e.metricId ?? (t && !((r = (n = e.card.config) == null ? void 0 : n.groupByColumns) != null && r.includes(t)) ? t.id : void 0)
|
|
1355
|
-
});
|
|
1356
|
-
return ue({
|
|
1357
|
-
card: e.card,
|
|
1358
|
-
columnId: e.columnId,
|
|
1359
|
-
persistedSettings: e.persistedSettings,
|
|
1360
|
-
resolvedSettings: e.resolvedSettings,
|
|
1361
|
-
fallbackSettings: e.fallbackSettings,
|
|
1362
|
-
metricId: e.metricId,
|
|
1363
|
-
columnKeyMap: e.columnKeyMap,
|
|
1364
|
-
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1365
|
-
valueFormatPreferences: e.presentation.preferences,
|
|
1366
|
-
boundCurrency: i ? e.presentation.resolveBoundCurrency(i) : void 0
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
function xr(e) {
|
|
1370
|
-
var s, l, c, u, f, d, g;
|
|
1371
|
-
if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
|
|
1372
|
-
const v = e.target, b = yi(e.card, e.matrixCatalog).find(
|
|
1373
|
-
(y) => y.measureId === v.measureId
|
|
1374
|
-
), m = b == null ? void 0 : b.canonical;
|
|
1375
|
-
return m && (m.type === "number" || m.type === "currency") ? _(
|
|
1376
|
-
m,
|
|
1377
|
-
e.valueFormatPreferences,
|
|
1378
|
-
e.boundCurrency
|
|
1379
|
-
) : void 0;
|
|
1380
|
-
}
|
|
1381
|
-
if (e.target.kind === "matrix_measure")
|
|
1382
|
-
return;
|
|
1383
|
-
if (e.card.type === "kpi") {
|
|
1384
|
-
const v = e.target.kind === "metric" ? e.target.metricId : void 0, b = v ? ((l = (s = e.card.config) == null ? void 0 : s.metricColumns) == null ? void 0 : l.findIndex(
|
|
1385
|
-
(C) => C.id === v
|
|
1386
|
-
)) ?? -1 : 0;
|
|
1387
|
-
if (b < 0)
|
|
1388
|
-
return;
|
|
1389
|
-
const m = bi(e.card, {
|
|
1390
|
-
metricIndex: b,
|
|
1391
|
-
resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
|
|
1392
|
-
}), y = m.authoredFormat;
|
|
1393
|
-
return m.currencyBindable && y && R(y) ? _(
|
|
1394
|
-
y,
|
|
1395
|
-
e.valueFormatPreferences,
|
|
1396
|
-
e.boundCurrency
|
|
1397
|
-
) : void 0;
|
|
1398
|
-
}
|
|
1399
|
-
if (!((c = e.card.sql) != null && c.trim()) && !Ui(e.card.type) && e.target.kind === "metric") {
|
|
1400
|
-
const v = e.target.metricId, b = (f = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : f.find(
|
|
1401
|
-
(C) => C.id === v
|
|
1402
|
-
);
|
|
1403
|
-
if (!b)
|
|
1404
|
-
return;
|
|
1405
|
-
const m = dt(
|
|
1406
|
-
e.card,
|
|
1407
|
-
b
|
|
1408
|
-
), y = m.authoredFormat;
|
|
1409
|
-
return m.currencyBindable && y && R(y) ? _(
|
|
1410
|
-
y,
|
|
1411
|
-
e.valueFormatPreferences,
|
|
1412
|
-
e.boundCurrency
|
|
1413
|
-
) : void 0;
|
|
1414
|
-
}
|
|
1415
|
-
const i = ((g = (d = e.card.preferences) == null ? void 0 : d.tablePrefs) == null ? void 0 : g.columnSettingsMap) || {}, n = e.target.kind === "metric" ? e.target.metricId : void 0, r = e.target.kind === "column" ? [e.target.columnKey] : [
|
|
1416
|
-
...e.resultColumnKeys || [],
|
|
1417
|
-
...Object.keys(i),
|
|
1418
|
-
e.target.metricId
|
|
1419
|
-
], a = e.target.kind === "column" ? e.target.columnKey : r.find(
|
|
1420
|
-
(v) => {
|
|
1421
|
-
var b;
|
|
1422
|
-
return ((b = ie(e.card, {
|
|
1423
|
-
columnId: v
|
|
1424
|
-
})) == null ? void 0 : b.id) === n;
|
|
1425
|
-
}
|
|
1426
|
-
) || n, o = ue({
|
|
1427
|
-
card: e.card,
|
|
1428
|
-
columnId: a,
|
|
1429
|
-
metricId: n,
|
|
1430
|
-
persistedSettings: i[a],
|
|
1431
|
-
valueFormatPreferences: e.valueFormatPreferences,
|
|
1432
|
-
boundCurrency: e.boundCurrency
|
|
1433
|
-
});
|
|
1434
|
-
return R(o) ? o : void 0;
|
|
1435
|
-
}
|
|
1436
|
-
function fo(e) {
|
|
1437
|
-
var i, n, r, a, o, s;
|
|
1438
|
-
const t = e.persistedSettings ?? ((a = (r = (n = (i = e.card) == null ? void 0 : i.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : r.columnSettingsMap) == null ? void 0 : a[e.columnId]);
|
|
1439
|
-
if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((o = e.resolvedSettings) == null ? void 0 : o.inheritMetricFormat) === !0) {
|
|
1440
|
-
const l = W(
|
|
1441
|
-
(s = ie(e.card, {
|
|
1442
|
-
columnId: e.columnId,
|
|
1443
|
-
metricId: e.metricId,
|
|
1444
|
-
metricAlias: e.metricAlias,
|
|
1445
|
-
columnKeyMap: e.columnKeyMap
|
|
1446
|
-
})) == null ? void 0 : s.format,
|
|
1447
|
-
{ preserveOmittedProperties: !0 }
|
|
1448
|
-
);
|
|
1449
|
-
if ((l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "duration")
|
|
1450
|
-
return K(l, {
|
|
1451
|
-
preserveOmittedProperties: !0
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
return Fr(
|
|
1455
|
-
jt({
|
|
1456
|
-
...e,
|
|
1457
|
-
persistedSettings: t
|
|
1458
|
-
})
|
|
1459
|
-
);
|
|
1460
|
-
}
|
|
1461
|
-
function Sr(e) {
|
|
1462
|
-
var v, b, m, y, C, S, w;
|
|
1463
|
-
const t = (v = e == null ? void 0 : e.formatNumber) == null ? void 0 : v.enabled, i = typeof t == "string" ? t.trim().toLowerCase() !== "false" : t !== !1, n = mi(e == null ? void 0 : e.numberAxisFormat) || (i ? pi(e == null ? void 0 : e.formatNumber) : void 0), r = K(n);
|
|
1464
|
-
if (!r || !r.type || r.type === "auto")
|
|
1465
|
-
return r;
|
|
1466
|
-
const a = (b = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : b.decimalPlaces, o = i ? (m = e == null ? void 0 : e.formatNumber) == null ? void 0 : m.decimalPlaces : void 0, s = typeof a == "number" ? a : typeof o == "number" ? o : void 0, l = (y = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : y.minimumFractionDigits, c = (C = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : C.maximumFractionDigits, u = i ? (S = e == null ? void 0 : e.formatNumber) == null ? void 0 : S.minimumFractionDigits : void 0, f = i ? (w = e == null ? void 0 : e.formatNumber) == null ? void 0 : w.maximumFractionDigits : void 0, d = typeof s == "number" ? s : typeof l == "number" ? l : typeof u == "number" ? u : 0, g = typeof s == "number" ? s : typeof c == "number" ? c : typeof f == "number" ? f : 0;
|
|
1467
|
-
return {
|
|
1468
|
-
...r,
|
|
1469
|
-
decimalPlaces: d === g ? g : r.decimalPlaces,
|
|
1470
|
-
minimumFractionDigits: d,
|
|
1471
|
-
maximumFractionDigits: Math.max(
|
|
1472
|
-
d,
|
|
1473
|
-
g
|
|
1474
|
-
)
|
|
1475
|
-
};
|
|
1476
|
-
}
|
|
1477
|
-
function mo(e) {
|
|
1478
|
-
var r, a, o, s, l;
|
|
1479
|
-
const { value: t, formatOptions: i, preferences: n } = e;
|
|
1480
|
-
return i != null && i.type && i.type !== "auto" ? Nt(t, i.type, i) : Wn({
|
|
1481
|
-
number: t,
|
|
1482
|
-
decimalPlaces: ((r = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : r.decimalPlaces) ?? 0,
|
|
1483
|
-
useSuffix: !!((a = n == null ? void 0 : n.numberAxisFormat) != null && a.suffix),
|
|
1484
|
-
customSuffix: ((o = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : o.suffix) || "",
|
|
1485
|
-
locale: ((s = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : s.locale) || "en-US",
|
|
1486
|
-
currency: ((l = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : l.currency) || ""
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
function Mr(e) {
|
|
1490
|
-
return Gi({
|
|
1491
|
-
...e,
|
|
1492
|
-
activation: Me({
|
|
1493
|
-
card: e.card,
|
|
1494
|
-
cardConfig: e.cardConfig
|
|
1495
|
-
})
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
function po(e) {
|
|
1499
|
-
return Wi({
|
|
1500
|
-
activation: Me({
|
|
1501
|
-
card: e.card,
|
|
1502
|
-
cardConfig: e.cardConfig
|
|
1503
|
-
}),
|
|
1504
|
-
result: e.result,
|
|
1505
|
-
expectedResultOwner: e.expectedResultOwner
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
function Dr(e) {
|
|
1509
|
-
var n, r;
|
|
1510
|
-
const t = pt(e.card, e.effectiveCardConfig), i = Kn({
|
|
1511
|
-
card: t,
|
|
1512
|
-
records: e.rows,
|
|
1513
|
-
keys: e.rows.length === 0 ? e.resultKeys : void 0,
|
|
1514
|
-
columnKeyMap: e.result.columnKeyMap,
|
|
1515
|
-
resultColumns: e.result.resultColumns,
|
|
1516
|
-
comparisonMetadata: e.result.comparisonMetadata,
|
|
1517
|
-
viewerTable: e.file.viewerTable
|
|
1518
|
-
});
|
|
1519
|
-
return e.rows.length === 0 && !e.resultKeys || i.visibleKeys.length === 0 ? null : {
|
|
1520
|
-
view: i,
|
|
1521
|
-
formatOptions: {
|
|
1522
|
-
useFormattedValues: e.file.useFormattedValues,
|
|
1523
|
-
timezone: e.reportContext.calendar.tz,
|
|
1524
|
-
delimiter: e.file.delimiter,
|
|
1525
|
-
csvEncoding: e.file.csvEncoding,
|
|
1526
|
-
includeHeaders: e.file.includeHeaders,
|
|
1527
|
-
columnSettings: (r = (n = e.card.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : r.columnSettingsMap,
|
|
1528
|
-
visibleColumns: [...i.visibleKeys],
|
|
1529
|
-
columnLabels: Object.fromEntries(i.visibleKeys.map((a) => [a, i.labels[a] ?? a]))
|
|
1530
|
-
}
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
function Tr(e) {
|
|
1534
|
-
var i;
|
|
1535
|
-
const t = (i = e.preferences) == null ? void 0 : i.comparisonPresentation;
|
|
1536
|
-
return {
|
|
1537
|
-
...Vi,
|
|
1538
|
-
...t,
|
|
1539
|
-
...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
|
|
1540
|
-
...t != null && t.colors ? { colors: { ...t.colors } } : {}
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
function wr(e) {
|
|
1544
|
-
var S, w;
|
|
1545
|
-
const t = pt(e.card, e.effectiveCardConfig), { cardId: i, ...n } = e.requestPayloadBase, r = e.formatOptions.visibleColumns ?? [], a = [
|
|
1546
|
-
...r,
|
|
1547
|
-
...Object.keys(e.formatOptions.columnSettings ?? {})
|
|
1548
|
-
], o = vi(
|
|
1549
|
-
e.card,
|
|
1550
|
-
r,
|
|
1551
|
-
e.effectiveCardConfig
|
|
1552
|
-
), s = Fi(
|
|
1553
|
-
e.card,
|
|
1554
|
-
e.effectiveCardConfig,
|
|
1555
|
-
o
|
|
1556
|
-
), l = Ci(
|
|
1557
|
-
t,
|
|
1558
|
-
a
|
|
1559
|
-
), c = new Set(
|
|
1560
|
-
l.eligibleTargets.map(ge)
|
|
1561
|
-
), u = (p) => c.has(ge(p)) ? xi({
|
|
1562
|
-
bindings: n.controlBindings,
|
|
1563
|
-
controls: [
|
|
1564
|
-
...n.controlDefinitions ?? [],
|
|
1565
|
-
...n.cardControlDefinitions ?? []
|
|
1566
|
-
],
|
|
1567
|
-
values: n.controlValues,
|
|
1568
|
-
target: p,
|
|
1569
|
-
knownTargets: l.knownTargets,
|
|
1570
|
-
eligibleTargets: l.eligibleTargets
|
|
1571
|
-
}).currency : void 0, f = Ii({
|
|
1572
|
-
card: e.card,
|
|
1573
|
-
comparisonMetadata: e.comparisonMetadata,
|
|
1574
|
-
columnKeyMap: e.columnKeyMap
|
|
1575
|
-
}), d = Me({
|
|
1576
|
-
card: e.card,
|
|
1577
|
-
cardConfig: e.effectiveCardConfig
|
|
1578
|
-
}), g = Mr({
|
|
1579
|
-
card: e.card,
|
|
1580
|
-
cardConfig: e.effectiveCardConfig,
|
|
1581
|
-
columns: e.resultColumns,
|
|
1582
|
-
columnKeyMap: e.columnKeyMap,
|
|
1583
|
-
resultRowCount: e.totalRows,
|
|
1584
|
-
valueFormatPreferences: e.reportContext.valueFormat
|
|
1585
|
-
}), v = (d == null ? void 0 : d.fields) ?? [], b = new Map(
|
|
1586
|
-
v.map((p) => [
|
|
1587
|
-
`${p.role}:${p.id}`,
|
|
1588
|
-
p
|
|
1589
|
-
])
|
|
1590
|
-
), m = /* @__PURE__ */ new Map();
|
|
1591
|
-
if (e.card.type === "detailTable" && n.resultOwner === "config") {
|
|
1592
|
-
const p = e.resultColumns || [];
|
|
1593
|
-
if (p.filter(
|
|
1594
|
-
(F) => F.rawTemporal
|
|
1595
|
-
).length > 0) {
|
|
1596
|
-
if (!e.columnKeyMap)
|
|
1597
|
-
throw new Error(
|
|
1598
|
-
"Canonical raw temporal export requires an authoritative columnKeyMap."
|
|
1599
|
-
);
|
|
1600
|
-
const F = Dn({
|
|
1601
|
-
cardType: e.card.type,
|
|
1602
|
-
resultOwner: n.resultOwner,
|
|
1603
|
-
effectiveCardConfig: e.effectiveCardConfig,
|
|
1604
|
-
result: {
|
|
1605
|
-
records: [],
|
|
1606
|
-
columns: p,
|
|
1607
|
-
columnKeyMap: e.columnKeyMap
|
|
1608
|
-
},
|
|
1609
|
-
preferences: e.reportContext.valueFormat,
|
|
1610
|
-
calendar: e.reportContext.calendar
|
|
1611
|
-
});
|
|
1612
|
-
if (F.kind === "invalid") throw F.error;
|
|
1613
|
-
if (F.kind === "loaded_empty" || F.kind === "loaded_valid")
|
|
1614
|
-
for (const [D, T] of F.presentation.byColumnKey)
|
|
1615
|
-
m.set(D, T.format);
|
|
1616
|
-
}
|
|
1617
|
-
} else if (n.resultOwner === "freeform" && n.sql.trim() && !n.python.trim())
|
|
1618
|
-
for (const [p, h] of Object.entries(
|
|
1619
|
-
((w = (S = e.card.preferences) == null ? void 0 : S.tablePrefs) == null ? void 0 : w.columnSettingsMap) || {}
|
|
1620
|
-
)) {
|
|
1621
|
-
if (h.type !== "date") continue;
|
|
1622
|
-
const F = Tn(h.dateFormat);
|
|
1623
|
-
F && m.set(
|
|
1624
|
-
p,
|
|
1625
|
-
$i({
|
|
1626
|
-
format: F,
|
|
1627
|
-
preferences: e.reportContext.valueFormat,
|
|
1628
|
-
calendar: e.reportContext.calendar
|
|
1629
|
-
})
|
|
1630
|
-
);
|
|
1631
|
-
}
|
|
1632
|
-
const y = [
|
|
1633
|
-
...new Set(a)
|
|
1634
|
-
].flatMap((p) => {
|
|
1635
|
-
var q, E, re, P, Y, J;
|
|
1636
|
-
if (g.byColumnKey.has(p) || m.has(p))
|
|
1637
|
-
return [];
|
|
1638
|
-
const h = f.columnPresentationOwners.get(p), F = (q = t.sql) != null && q.trim() ? void 0 : ie(t, {
|
|
1639
|
-
columnId: p,
|
|
1640
|
-
columnKeyMap: e.columnKeyMap,
|
|
1641
|
-
metricId: h == null ? void 0 : h.metricId,
|
|
1642
|
-
metricAlias: h == null ? void 0 : h.metricAlias
|
|
1643
|
-
}), D = F ? { kind: "metric", metricId: F.id } : { kind: "column", columnKey: p }, T = c.has(
|
|
1644
|
-
ge(D)
|
|
1645
|
-
), V = u(D), N = (P = (re = (E = t.preferences) == null ? void 0 : E.tablePrefs) == null ? void 0 : re.columnSettingsMap) == null ? void 0 : P[p], O = {
|
|
1646
|
-
dashboardId: e.dashboardId,
|
|
1647
|
-
cardId: t.id
|
|
1648
|
-
}, U = { kind: "column", columnKey: p }, M = F && (!N || N.inheritMetricFormat === !0) ? W(F.format, {
|
|
1649
|
-
preserveOmittedProperties: !0
|
|
1650
|
-
}) : void 0;
|
|
1651
|
-
if ((M == null ? void 0 : M.type) === "date")
|
|
1652
|
-
return [
|
|
1653
|
-
{
|
|
1654
|
-
scope: O,
|
|
1655
|
-
target: U,
|
|
1656
|
-
format: {
|
|
1657
|
-
type: "date",
|
|
1658
|
-
locale: M.locale ?? e.reportContext.valueFormat.locale,
|
|
1659
|
-
...M.pattern ? { pattern: M.pattern } : {},
|
|
1660
|
-
...M.timezone ? { timezone: M.timezone } : {},
|
|
1661
|
-
...M.sourceTimezone ? { sourceTimezone: M.sourceTimezone } : {}
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
];
|
|
1665
|
-
const k = (h ? Ir({
|
|
1666
|
-
card: t,
|
|
1667
|
-
columnId: p,
|
|
1668
|
-
columnKeyMap: e.columnKeyMap,
|
|
1669
|
-
persistedSettings: N,
|
|
1670
|
-
metricId: h.metricId,
|
|
1671
|
-
metricAlias: h.metricAlias,
|
|
1672
|
-
comparisonValueKind: h.kind,
|
|
1673
|
-
comparisonPrecision: (J = (Y = t.preferences) == null ? void 0 : Y.comparisonPresentation) == null ? void 0 : J.precision,
|
|
1674
|
-
presentation: {
|
|
1675
|
-
preferences: e.reportContext.valueFormat,
|
|
1676
|
-
resolveBoundCurrency: u
|
|
1677
|
-
}
|
|
1678
|
-
}) : void 0) ?? (T ? xr({
|
|
1679
|
-
card: t,
|
|
1680
|
-
target: D,
|
|
1681
|
-
resultColumnKeys: a,
|
|
1682
|
-
valueFormatPreferences: e.reportContext.valueFormat,
|
|
1683
|
-
boundCurrency: V
|
|
1684
|
-
}) : void 0) ?? ue({
|
|
1685
|
-
card: t,
|
|
1686
|
-
columnId: p,
|
|
1687
|
-
columnKeyMap: e.columnKeyMap,
|
|
1688
|
-
metricId: h == null ? void 0 : h.metricId,
|
|
1689
|
-
persistedSettings: N,
|
|
1690
|
-
valueFormatPreferences: e.reportContext.valueFormat
|
|
1691
|
-
}), B = (k == null ? void 0 : k.type) === "duration" ? k : k ? _(
|
|
1692
|
-
k,
|
|
1693
|
-
e.reportContext.valueFormat,
|
|
1694
|
-
V
|
|
1695
|
-
) : _(
|
|
1696
|
-
{
|
|
1697
|
-
type: "number",
|
|
1698
|
-
minimumFractionDigits: 0,
|
|
1699
|
-
maximumFractionDigits: 3
|
|
1700
|
-
},
|
|
1701
|
-
e.reportContext.valueFormat
|
|
1702
|
-
);
|
|
1703
|
-
return [
|
|
1704
|
-
B.type === "duration" ? { scope: O, target: U, format: B } : { scope: O, target: U, format: B }
|
|
1705
|
-
];
|
|
1706
|
-
});
|
|
1707
|
-
y.push(
|
|
1708
|
-
...[...g.byColumnKey.values()].map((p) => {
|
|
1709
|
-
const h = b.get(
|
|
1710
|
-
`${p.role ?? "groupby"}:${p.fieldId}`
|
|
1711
|
-
);
|
|
1712
|
-
if (!h)
|
|
1713
|
-
throw new Error(
|
|
1714
|
-
`Unable to resolve temporal export field "${p.fieldId}".`
|
|
1715
|
-
);
|
|
1716
|
-
return {
|
|
1717
|
-
scope: {
|
|
1718
|
-
dashboardId: e.dashboardId,
|
|
1719
|
-
cardId: e.card.id
|
|
1720
|
-
},
|
|
1721
|
-
target: { kind: "column", columnKey: p.columnKey },
|
|
1722
|
-
format: Qi(
|
|
1723
|
-
h,
|
|
1724
|
-
{
|
|
1725
|
-
dateStyle: e.reportContext.valueFormat.dateStyle,
|
|
1726
|
-
dateTime: { ...e.reportContext.valueFormat.dateTime }
|
|
1727
|
-
},
|
|
1728
|
-
e.reportContext.valueFormat.locale
|
|
1729
|
-
)
|
|
1730
|
-
};
|
|
1731
|
-
})
|
|
1732
|
-
), y.push(
|
|
1733
|
-
...[...m].map(([p, h]) => ({
|
|
1734
|
-
scope: { dashboardId: e.dashboardId, cardId: e.card.id },
|
|
1735
|
-
target: { kind: "column", columnKey: p },
|
|
1736
|
-
format: h
|
|
1737
|
-
}))
|
|
1738
|
-
);
|
|
1739
|
-
const C = zi({
|
|
1740
|
-
reportContext: e.reportContext,
|
|
1741
|
-
resolvedFormats: y
|
|
1742
|
-
});
|
|
1743
|
-
return {
|
|
1744
|
-
formatOptions: {
|
|
1745
|
-
...e.formatOptions,
|
|
1746
|
-
...o ? { tableTotalsLabelColumnKey: o } : {},
|
|
1747
|
-
comparisonPresentation: Tr(e.card),
|
|
1748
|
-
presentationExecutionSnapshot: C
|
|
1749
|
-
},
|
|
1750
|
-
...s ? { tableTotalsRequest: s } : {}
|
|
1751
|
-
};
|
|
1752
|
-
}
|
|
1753
|
-
function Pr(e) {
|
|
1754
|
-
const t = Mi(
|
|
1755
|
-
e.card,
|
|
1756
|
-
e.requestPayloadBase
|
|
1757
|
-
), { cardId: i, ...n } = t.requestPayloadBase, r = wr(e);
|
|
1758
|
-
return {
|
|
1759
|
-
type: "card",
|
|
1760
|
-
dashboardId: e.dashboardId,
|
|
1761
|
-
cardId: e.card.id,
|
|
1762
|
-
title: e.title,
|
|
1763
|
-
connection_id: t.connectionId,
|
|
1764
|
-
...n,
|
|
1765
|
-
...r.tableTotalsRequest ? { tableTotalsRequest: r.tableTotalsRequest } : {},
|
|
1766
|
-
totalRows: e.totalRows,
|
|
1767
|
-
format: e.format,
|
|
1768
|
-
formatOptions: r.formatOptions
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
function ho(e) {
|
|
1772
|
-
const { card: t, result: i } = e;
|
|
1773
|
-
if (t.type !== "table" && t.type !== "detailTable")
|
|
1774
|
-
return { status: "refused", reason: "not_a_table" };
|
|
1775
|
-
if (Si({ card: t, comparisonMetadata: i.comparisonMetadata }))
|
|
1776
|
-
return { status: "refused", reason: "comparison_metadata_missing" };
|
|
1777
|
-
const n = Dr({
|
|
1778
|
-
card: t,
|
|
1779
|
-
effectiveCardConfig: e.effectiveCardConfig,
|
|
1780
|
-
rows: e.rows,
|
|
1781
|
-
resultKeys: i.resultColumns.map((r) => r.key),
|
|
1782
|
-
result: i,
|
|
1783
|
-
reportContext: e.reportContext,
|
|
1784
|
-
file: e.file
|
|
1785
|
-
});
|
|
1786
|
-
return n ? {
|
|
1787
|
-
status: "ready",
|
|
1788
|
-
request: Pr({
|
|
1789
|
-
card: t,
|
|
1790
|
-
dashboardId: e.dashboardId,
|
|
1791
|
-
title: e.title,
|
|
1792
|
-
reportContext: e.reportContext,
|
|
1793
|
-
totalRows: i.totalRows,
|
|
1794
|
-
format: e.file.format,
|
|
1795
|
-
formatOptions: n.formatOptions,
|
|
1796
|
-
comparisonMetadata: i.comparisonMetadata,
|
|
1797
|
-
requestPayloadBase: e.query,
|
|
1798
|
-
resultColumns: [...i.resultColumns],
|
|
1799
|
-
columnKeyMap: i.columnKeyMap,
|
|
1800
|
-
effectiveCardConfig: e.effectiveCardConfig
|
|
1801
|
-
})
|
|
1802
|
-
} : { status: "refused", reason: "columns_unresolved" };
|
|
1803
|
-
}
|
|
1804
|
-
function Or(e, t, i) {
|
|
1805
|
-
if (Ai(
|
|
1806
|
-
_i(t),
|
|
1807
|
-
e.aggregateOrigin
|
|
1808
|
-
))
|
|
1809
|
-
return { aggregate: void 0, aggregateOrigin: void 0 };
|
|
1810
|
-
const n = i === "selection" && e.role === "metric" ? t.aggregate : void 0;
|
|
1811
|
-
return {
|
|
1812
|
-
aggregate: e.aggregate ?? n,
|
|
1813
|
-
aggregateOrigin: e.aggregate ? e.aggregateOrigin : n ? t.aggregateOrigin : void 0
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
function Ar(e, t, i) {
|
|
1817
|
-
var n, r, a, o, s, l;
|
|
1818
|
-
if (i === "domain")
|
|
1819
|
-
return {
|
|
1820
|
-
filters: (n = t.parameters) == null ? void 0 : n.filters,
|
|
1821
|
-
windowTransform: (r = e.parameters) == null ? void 0 : r.windowTransform
|
|
1822
|
-
};
|
|
1823
|
-
if (!(!e.parameters && !t.parameters))
|
|
1824
|
-
return {
|
|
1825
|
-
filters: ((a = e.parameters) == null ? void 0 : a.filters) ?? ((o = t.parameters) == null ? void 0 : o.filters),
|
|
1826
|
-
windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((l = t.parameters) == null ? void 0 : l.windowTransform)
|
|
1827
|
-
};
|
|
1828
|
-
}
|
|
1829
|
-
function go(e, t, i) {
|
|
1830
|
-
const n = e;
|
|
1831
|
-
return {
|
|
1832
|
-
id: e.id,
|
|
1833
|
-
role: e.role,
|
|
1834
|
-
// Result-column names belong to the selection's consumer (for example,
|
|
1835
|
-
// range bounds). They do not identify or redefine the catalog calculation.
|
|
1836
|
-
...i === "selection" && e.alias ? { alias: e.alias } : {},
|
|
1837
|
-
granularity: e.granularity ?? t.granularity,
|
|
1838
|
-
dateFormat: e.dateFormat,
|
|
1839
|
-
customFormat: e.customFormat,
|
|
1840
|
-
semanticTemporalPresentation: t.semanticTemporalPresentation || e.semanticTemporalPresentation,
|
|
1841
|
-
...Or(e, t, i),
|
|
1842
|
-
...e.role === "metric" ? {
|
|
1843
|
-
aliasTemplate: n.aliasTemplate,
|
|
1844
|
-
valueAliases: n.valueAliases,
|
|
1845
|
-
comparison: n.comparison,
|
|
1846
|
-
comparisonPolarity: n.comparisonPolarity,
|
|
1847
|
-
parameters: Ar(
|
|
1848
|
-
n,
|
|
1849
|
-
t,
|
|
1850
|
-
"domain"
|
|
1851
|
-
)
|
|
1852
|
-
} : {},
|
|
1853
|
-
..._r(e)
|
|
1854
|
-
};
|
|
1855
|
-
}
|
|
1856
|
-
function _r(e) {
|
|
1857
|
-
const t = {
|
|
1858
|
-
...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
|
|
1859
|
-
...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
|
|
1860
|
-
};
|
|
1861
|
-
switch (e.role) {
|
|
1862
|
-
case "pivotby":
|
|
1863
|
-
return {
|
|
1864
|
-
...t,
|
|
1865
|
-
memberOrder: e.memberOrder
|
|
1866
|
-
};
|
|
1867
|
-
case "sortby":
|
|
1868
|
-
return {
|
|
1869
|
-
...t,
|
|
1870
|
-
direction: e.direction
|
|
1871
|
-
};
|
|
1872
|
-
case "detail":
|
|
1873
|
-
return {
|
|
1874
|
-
...t,
|
|
1875
|
-
...e.dateFormat !== void 0 ? { dateFormat: e.dateFormat } : {},
|
|
1876
|
-
...e.customFormat !== void 0 ? { customFormat: e.customFormat } : {}
|
|
1877
|
-
};
|
|
1878
|
-
default:
|
|
1879
|
-
return t;
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
const Nr = "table";
|
|
1883
|
-
function yo({ preferences: e, ...t }) {
|
|
1884
|
-
return {
|
|
1885
|
-
...t,
|
|
1886
|
-
type: Nr,
|
|
1887
|
-
preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
|
|
1888
|
-
sql: "",
|
|
1889
|
-
data: []
|
|
1890
|
-
};
|
|
1891
|
-
}
|
|
1892
|
-
function Er(e, t) {
|
|
1893
|
-
const i = e.sheets ?? [], n = i.findIndex((o) => o.id === t.sheetId), r = i[n];
|
|
1894
|
-
if (!r)
|
|
1895
|
-
throw new A("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
|
|
1896
|
-
if (Yi(r))
|
|
1897
|
-
throw new A(
|
|
1898
|
-
"sheet_not_a_grid",
|
|
1899
|
-
"This sheet is a document: it has no grid to arrange.",
|
|
1900
|
-
"Arrange a grid sheet; Document sheets are laid out in the editor."
|
|
1901
|
-
);
|
|
1902
|
-
const a = Ft(r, { kind: "arrange", keepOrder: t.keepOrder === !0 });
|
|
1903
|
-
return {
|
|
1904
|
-
dashboard: { ...e, sheets: i.map((o, s) => s === n ? a : o) },
|
|
1905
|
-
clauses: [De.arranged(r.title || "the dashboard", t.keepOrder === !0, !(r.frames ?? []).length)]
|
|
1906
|
-
};
|
|
1907
|
-
}
|
|
1908
|
-
function Rr(e) {
|
|
1909
|
-
return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
|
|
1910
|
-
}
|
|
1911
|
-
function j(...e) {
|
|
1912
|
-
return Ji(e.flatMap((t) => t || []));
|
|
1913
|
-
}
|
|
1914
|
-
function Q(e, t) {
|
|
1915
|
-
return {
|
|
1916
|
-
...e,
|
|
1917
|
-
fieldScope: t
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
function Re(e) {
|
|
1921
|
-
return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => Q(t, "sheet"));
|
|
1922
|
-
}
|
|
1923
|
-
function Ht(e) {
|
|
1924
|
-
return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => Q(t, "sheet"));
|
|
1925
|
-
}
|
|
1926
|
-
function Vr(e) {
|
|
1927
|
-
return e ? [
|
|
1928
|
-
...(e.calculatedFields || []).filter(
|
|
1929
|
-
(t) => t.fieldScope === "dashboard"
|
|
1930
|
-
),
|
|
1931
|
-
...(e.frames || []).flatMap((t) => t.calculatedFields || [])
|
|
1932
|
-
].map((t) => Q(t, "dashboard")) : [];
|
|
1933
|
-
}
|
|
1934
|
-
function kr(e) {
|
|
1935
|
-
if (e !== void 0)
|
|
1936
|
-
return j(
|
|
1937
|
-
e.map((t) => Q(t, "dashboard"))
|
|
1938
|
-
);
|
|
1939
|
-
}
|
|
1940
|
-
function bo(e) {
|
|
1941
|
-
var n;
|
|
1942
|
-
const t = [], i = (e.sheets || []).map((r) => {
|
|
1943
|
-
var a;
|
|
1944
|
-
return t.push(...Vr(r)), {
|
|
1945
|
-
...r,
|
|
1946
|
-
calculatedFields: j(
|
|
1947
|
-
Re(r),
|
|
1948
|
-
Ht(r)
|
|
1949
|
-
),
|
|
1950
|
-
frames: (a = r.frames) == null ? void 0 : a.map(
|
|
1951
|
-
(o) => o.calculatedFields === void 0 ? o : { ...o, calculatedFields: void 0 }
|
|
1952
|
-
)
|
|
1953
|
-
};
|
|
1954
|
-
});
|
|
1955
|
-
return {
|
|
1956
|
-
...e,
|
|
1957
|
-
calculatedFields: kr(
|
|
1958
|
-
j(
|
|
1959
|
-
(n = e.calculatedFields) == null ? void 0 : n.map(
|
|
1960
|
-
(r) => Q(r, "dashboard")
|
|
1961
|
-
),
|
|
1962
|
-
t
|
|
1963
|
-
)
|
|
1964
|
-
),
|
|
1965
|
-
sheets: i
|
|
1966
|
-
};
|
|
1967
|
-
}
|
|
1968
|
-
function at(e, t) {
|
|
1969
|
-
var r;
|
|
1970
|
-
if (!((r = e == null ? void 0 : e.frames) != null && r.length))
|
|
1971
|
-
return [];
|
|
1972
|
-
const i = t ? e.frames.find((a) => a.id === t) : void 0, n = e.frames.filter(
|
|
1973
|
-
(a) => !t || a.id !== t
|
|
1974
|
-
);
|
|
1975
|
-
return j(
|
|
1976
|
-
i == null ? void 0 : i.calculatedFields,
|
|
1977
|
-
...n.map((a) => a.calculatedFields)
|
|
1978
|
-
);
|
|
1979
|
-
}
|
|
1980
|
-
function vo(e, t) {
|
|
1981
|
-
return e ? Re(e) : [];
|
|
1982
|
-
}
|
|
1983
|
-
function Fo(e, t) {
|
|
1984
|
-
if (!e)
|
|
1985
|
-
return [];
|
|
1986
|
-
const i = Re(e), n = Ht(e), r = j(
|
|
1987
|
-
i,
|
|
1988
|
-
n
|
|
1989
|
-
);
|
|
1990
|
-
return Rr(e) ? r.length === 0 ? [] : n.length === 0 ? r : j(
|
|
1991
|
-
r,
|
|
1992
|
-
at(e, t)
|
|
1993
|
-
) : at(e, t);
|
|
1994
|
-
}
|
|
1995
|
-
function Br(e) {
|
|
1996
|
-
if (e !== void 0)
|
|
1997
|
-
return j(
|
|
1998
|
-
e.map((t) => Q(t, "sheet"))
|
|
1999
|
-
);
|
|
2000
|
-
}
|
|
2001
|
-
function Co(e) {
|
|
2002
|
-
const { field: t, sheetFields: i = [], dashboardFields: n = [] } = e, r = (s) => s.find(
|
|
2003
|
-
(l) => Xi(l, t, {
|
|
2004
|
-
allowComparableFallback: !0
|
|
2005
|
-
})
|
|
2006
|
-
);
|
|
2007
|
-
if (t.fieldScope === "sheet")
|
|
2008
|
-
return { scope: "sheet", matchedField: r(i) };
|
|
2009
|
-
if (t.fieldScope === "dashboard")
|
|
2010
|
-
return { scope: "dashboard", matchedField: r(n) };
|
|
2011
|
-
const a = r(i);
|
|
2012
|
-
if (a)
|
|
2013
|
-
return { scope: "sheet", matchedField: a };
|
|
2014
|
-
const o = r(n);
|
|
2015
|
-
return o ? { scope: "dashboard", matchedField: o } : { scope: "card" };
|
|
2016
|
-
}
|
|
2017
|
-
function Kr(e, t) {
|
|
2018
|
-
var C, S, w;
|
|
2019
|
-
const i = (e.sheets ?? []).findIndex((p) => p.id === t.sheetId), n = (C = e.sheets) == null ? void 0 : C[i];
|
|
2020
|
-
if (!(n != null && n.frames))
|
|
2021
|
-
throw new A("sheet_not_found", `No sheet ${t.sheetId} with frames on this dashboard.`);
|
|
2022
|
-
const { frame: r } = t, a = n.frames.findIndex((p) => p.id === r.id);
|
|
2023
|
-
if (a === -1)
|
|
2024
|
-
throw new A("frame_not_found", `No frame ${r.id} on sheet ${t.sheetId}.`);
|
|
2025
|
-
const o = n.frames[a], s = Ue(n), l = (p) => p.calculatedFields === void 0 ? p : { ...p, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
|
|
2026
|
-
const p = c.map((h) => h.id === r.id ? r : h);
|
|
2027
|
-
return p.some((h) => h.id === r.id) ? p : [r, ...p];
|
|
2028
|
-
})() : [r], f = new Map(u.map((p) => [p.id, p])), d = Ft(n, { kind: "frame_updated", frame: r, resizeForNewKind: t.resizeLayouts });
|
|
2029
|
-
let g = /* @__PURE__ */ new Set();
|
|
2030
|
-
const v = Zi.produce(e, (p) => {
|
|
2031
|
-
const h = p.sheets[i];
|
|
2032
|
-
d.layouts !== n.layouts && (h.layouts = Ge(d.layouts)), d.customizedBreakpoints !== n.customizedBreakpoints && (h.customizedBreakpoints = d.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (h.calculatedFields = Br(t.sheetCalculatedFields)), h.frames = h.frames.map((D) => {
|
|
2033
|
-
const T = f.get(D.id);
|
|
2034
|
-
return T ? Ge(l(T)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
|
|
2035
|
-
});
|
|
2036
|
-
const F = Ue(h);
|
|
2037
|
-
g = new Set([...s].filter((D) => !F.has(D))), en(p, g), t.dashboardCalculatedFields && (p.calculatedFields = t.dashboardCalculatedFields);
|
|
2038
|
-
}), b = v.sheets[i].frames.find((p) => p.id === r.id), m = [
|
|
2039
|
-
...g.size ? [{ kind: "cards_removed", cardIds: [...g] }] : [],
|
|
2040
|
-
{ kind: "frame_committed", sheetId: t.sheetId, before: o, after: b }
|
|
2041
|
-
], y = ((S = r.cards) == null ? void 0 : S.find((p) => p.id === r.activeCardId)) ?? ((w = r.cards) == null ? void 0 : w[0]);
|
|
2042
|
-
return { dashboard: v, runtimeEffects: m, clauses: [De.committed(y == null ? void 0 : y.title)] };
|
|
2043
|
-
}
|
|
2044
|
-
function Lr(e, t, i) {
|
|
2045
|
-
var a;
|
|
2046
|
-
if (!e || !t || t.customFilterPreferences) return;
|
|
2047
|
-
const n = t.defaultDateFilter;
|
|
2048
|
-
return (t.dateSelectionMode === "day" ? rn(n) : t.dateSelectionMode === "months" && (an(n) || on(n) && n.unit === "month" && (n.mode === "previous" || n.mode === "this" && !n.toDate && !n.boundary))) && ((a = G(t, i)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
|
|
2049
|
-
}
|
|
2050
|
-
function Io(e) {
|
|
2051
|
-
const t = e.createId ?? St, i = t(), n = Di({
|
|
2052
|
-
field: e.field,
|
|
2053
|
-
dataSource: e.dataSource,
|
|
2054
|
-
connectionId: e.connectionId,
|
|
2055
|
-
connectionType: e.connectionType,
|
|
2056
|
-
filterId: t()
|
|
2057
|
-
});
|
|
2058
|
-
return qr({
|
|
2059
|
-
filter: e.label ? { ...n, title: e.label } : n,
|
|
2060
|
-
label: e.label || e.field.label || e.field.name,
|
|
2061
|
-
scope: e.scope,
|
|
2062
|
-
existingInputs: e.existingInputs,
|
|
2063
|
-
createId: () => i
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
function qr(e) {
|
|
2067
|
-
const t = e.createId ?? St, i = e.label || e.filter.title || e.filter.column || e.filter.id, n = tn(i, [
|
|
2068
|
-
...e.existingInputs
|
|
2069
|
-
]), r = {
|
|
2070
|
-
...Ct(e.filter),
|
|
2071
|
-
variableName: n
|
|
2072
|
-
};
|
|
2073
|
-
return {
|
|
2074
|
-
id: t(),
|
|
2075
|
-
kind: "filter",
|
|
2076
|
-
label: i,
|
|
2077
|
-
variableName: n,
|
|
2078
|
-
requiredAtExecution: !1,
|
|
2079
|
-
scope: e.scope,
|
|
2080
|
-
runtimeScope: "shared",
|
|
2081
|
-
presentation: xt(r),
|
|
2082
|
-
filter: r,
|
|
2083
|
-
exports: It(r)
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
function $r(e, t, i, n = { calendar: null }) {
|
|
2087
|
-
var Y, J, Be, Ke, Le, qe, $e, ze;
|
|
2088
|
-
const r = $(e), a = r.findFilterInput(t), o = (x, I) => ({
|
|
2089
|
-
ok: !1,
|
|
2090
|
-
issues: [
|
|
2091
|
-
{
|
|
2092
|
-
code: "invalidSettings",
|
|
2093
|
-
message: x,
|
|
2094
|
-
ref: t,
|
|
2095
|
-
...a ? { inputId: a.input.id } : {},
|
|
2096
|
-
...I ? { contractIssue: I } : {}
|
|
2097
|
-
}
|
|
2098
|
-
]
|
|
2099
|
-
});
|
|
2100
|
-
if (!a)
|
|
2101
|
-
return {
|
|
2102
|
-
ok: !1,
|
|
2103
|
-
issues: [
|
|
2104
|
-
{
|
|
2105
|
-
code: "inputNotFound",
|
|
2106
|
-
ref: t,
|
|
2107
|
-
message: "This filter no longer exists on the dashboard."
|
|
2108
|
-
}
|
|
2109
|
-
]
|
|
2110
|
-
};
|
|
2111
|
-
if (a.origin !== "embeddedInput")
|
|
2112
|
-
return o("This filter can not be edited here.");
|
|
2113
|
-
const s = a.input, l = s.filter;
|
|
2114
|
-
if (((Y = i.mapping) == null ? void 0 : Y.kind) === "save") {
|
|
2115
|
-
if (!i.mapping.draft.acceptance.ok)
|
|
2116
|
-
return { ok: !1, issues: i.mapping.draft.acceptance.issues };
|
|
2117
|
-
if (i.mapping.draft.inputId !== s.id)
|
|
2118
|
-
return o("The card mapping was prepared for another filter.");
|
|
2119
|
-
}
|
|
2120
|
-
const c = i.definition ? Ct(i.definition) : l;
|
|
2121
|
-
if (c.kind === "global-date" && i.scope && !zr(i.scope))
|
|
2122
|
-
return o("The Global Date filter applies to regular tabs only.");
|
|
2123
|
-
const u = (J = n.calendar) == null ? void 0 : J.tz, f = i.definition !== void 0, d = i.forceSelection !== void 0 || f ? Lr(
|
|
2124
|
-
i.forceSelection ?? s.forceSelection,
|
|
2125
|
-
c,
|
|
2126
|
-
u
|
|
2127
|
-
) : s.forceSelection ? !0 : void 0, g = (Array.isArray(e.inputs) ? e.inputs : []).filter((x) => x.id !== s.id), v = i.variableName !== void 0 ? nn(i.variableName, [
|
|
2128
|
-
...g,
|
|
2129
|
-
...r.inputs.filter((x) => x.input.id !== s.id).map((x) => x.input)
|
|
2130
|
-
]) : s.variableName, b = f && (l.title || l.column) !== (c.title || c.column), m = i.label ?? (b ? c.title || c.column || c.id : void 0), y = f && l.hide !== c.hide, C = f && l.toolbarWidth !== c.toolbarWidth, S = (x) => {
|
|
2131
|
-
var je, He;
|
|
2132
|
-
const I = { ...x };
|
|
2133
|
-
if (m !== void 0 && (I.label = m), i.variableName !== void 0 && (I.variableName = v), i.scope && (I.scope = i.scope), y || C) {
|
|
2134
|
-
const he = xt(c);
|
|
2135
|
-
I.presentation = { ...x.presentation }, y && (I.presentation.placement = he.placement), C && (he.widthPx === void 0 ? delete I.presentation.widthPx : I.presentation.widthPx = he.widthPx);
|
|
2136
|
-
}
|
|
2137
|
-
return (i.forceSelection !== void 0 || f) && (d ? I.forceSelection = d : delete I.forceSelection), i.requiredAtExecution !== void 0 && (i.requiredAtExecution ? I.requiredAtExecution = !0 : delete I.requiredAtExecution), ve(I, "optionSource", i.optionSource), ve(I, "optionDependencies", i.optionDependencies), ve(I, "optionPopulation", i.optionPopulation), ((je = i.mapping) == null ? void 0 : je.kind) === "save" && i.mapping.draft.acceptance.ok ? I.application = i.mapping.draft.acceptance.application : ((He = i.mapping) == null ? void 0 : He.kind) === "remove" && delete I.application, I;
|
|
2138
|
-
}, w = i.label !== void 0 && i.label !== s.label && i.label !== c.title ? i.label : void 0, p = f || i.variableName !== void 0 || w !== void 0, h = (x) => ({
|
|
2139
|
-
...x,
|
|
2140
|
-
...i.variableName !== void 0 ? { variableName: v } : {},
|
|
2141
|
-
...w !== void 0 ? { title: w } : {}
|
|
2142
|
-
}), F = Array.isArray(e.inputs) ? [...e.inputs] : [], D = F.findIndex((x) => x.id === s.id), T = F[D];
|
|
2143
|
-
if (D < 0 || (T == null ? void 0 : T.kind) !== "filter" || !T.filter)
|
|
2144
|
-
return o("This filter can not be edited here.");
|
|
2145
|
-
const V = S(
|
|
2146
|
-
p ? {
|
|
2147
|
-
...T,
|
|
2148
|
-
filter: h(c)
|
|
2149
|
-
} : T
|
|
2150
|
-
);
|
|
2151
|
-
f && (V.exports = It(c)), F[D] = V;
|
|
2152
|
-
const N = Pe({
|
|
2153
|
-
inputs: [V],
|
|
2154
|
-
dashboardFilters: []
|
|
2155
|
-
});
|
|
2156
|
-
if (!N.ok)
|
|
2157
|
-
return o(
|
|
2158
|
-
((Be = N.issues[0]) == null ? void 0 : Be.message) ?? "These settings could not be saved.",
|
|
2159
|
-
N.issues[0]
|
|
2160
|
-
);
|
|
2161
|
-
let O = { ...e, inputs: F };
|
|
2162
|
-
const U = $(O), M = U.findFilterInput({ filterId: c.id });
|
|
2163
|
-
if (!M)
|
|
2164
|
-
return o(
|
|
2165
|
-
((Ke = U.issues[0]) == null ? void 0 : Ke.message) ?? "These settings could not be saved."
|
|
2166
|
-
);
|
|
2167
|
-
const k = i.variableName !== void 0 || i.scope !== void 0 ? jr(O, M.input) : void 0;
|
|
2168
|
-
if (k)
|
|
2169
|
-
return o(
|
|
2170
|
-
`Another filter on the same cards is already named "${k}". Choose another name.`
|
|
2171
|
-
);
|
|
2172
|
-
const B = [], q = {
|
|
2173
|
-
id: M.input.id,
|
|
2174
|
-
runtimeScope: M.input.runtimeScope
|
|
2175
|
-
};
|
|
2176
|
-
let E = {
|
|
2177
|
-
defaultInputValues: O.defaultInputValues,
|
|
2178
|
-
dashboardInputValues: {}
|
|
2179
|
-
};
|
|
2180
|
-
const re = ((Le = i.values) == null ? void 0 : Le.target) ?? {}, P = Gr(
|
|
2181
|
-
l,
|
|
2182
|
-
c,
|
|
2183
|
-
{
|
|
2184
|
-
defaultValueChanged: (qe = i.values) == null ? void 0 : qe.defaultChanged,
|
|
2185
|
-
selectionIdentityChanged: ($e = i.values) == null ? void 0 : $e.selectionIdentityChanged,
|
|
2186
|
-
...((ze = i.values) == null ? void 0 : ze.defaultComparisonSelection) !== void 0 ? {
|
|
2187
|
-
defaultComparisonChanged: !0,
|
|
2188
|
-
defaultComparisonSelection: i.values.defaultComparisonSelection ?? void 0
|
|
2189
|
-
} : {}
|
|
2190
|
-
},
|
|
2191
|
-
re,
|
|
2192
|
-
n.calendar ?? void 0
|
|
2193
|
-
);
|
|
2194
|
-
if (P.defaultValueChanged || P.selectionIdentityChanged || P.defaultComparisonChanged) {
|
|
2195
|
-
const x = Ut({
|
|
2196
|
-
state: { ...E, dashboardInputValues: {} },
|
|
2197
|
-
input: q,
|
|
2198
|
-
settings: P
|
|
2199
|
-
});
|
|
2200
|
-
E = { ...E, defaultInputValues: x.defaultInputValues }, P.selectionIdentityChanged && B.push({
|
|
2201
|
-
kind: "clear",
|
|
2202
|
-
inputId: q.id,
|
|
2203
|
-
target: P.target
|
|
2204
|
-
}), P.defaultValueChanged && B.push({
|
|
2205
|
-
kind: "resetToDefault",
|
|
2206
|
-
inputId: q.id,
|
|
2207
|
-
target: P.target,
|
|
2208
|
-
...P.defaultFilterValue ? { filterValue: P.defaultFilterValue } : {}
|
|
2209
|
-
}), P.defaultComparisonChanged && B.push({
|
|
2210
|
-
kind: "setDefaultComparison",
|
|
2211
|
-
inputId: q.id,
|
|
2212
|
-
target: P.target
|
|
2213
|
-
});
|
|
2214
|
-
}
|
|
2215
|
-
if (i.scope && M.input.runtimeScope !== "shared") {
|
|
2216
|
-
const x = Hr(
|
|
2217
|
-
O,
|
|
2218
|
-
s,
|
|
2219
|
-
M.input,
|
|
2220
|
-
E.defaultInputValues
|
|
2221
|
-
);
|
|
2222
|
-
E = {
|
|
2223
|
-
...E,
|
|
2224
|
-
defaultInputValues: x.defaultInputValues
|
|
2225
|
-
}, B.push(
|
|
2226
|
-
...x.dropped.map((I) => ({
|
|
2227
|
-
kind: "dropTargetSlot",
|
|
2228
|
-
inputId: q.id,
|
|
2229
|
-
target: I
|
|
2230
|
-
}))
|
|
2231
|
-
);
|
|
2232
|
-
}
|
|
2233
|
-
return O = Ur(O, E), {
|
|
2234
|
-
ok: !0,
|
|
2235
|
-
dashboard: O,
|
|
2236
|
-
inputId: M.input.id,
|
|
2237
|
-
valueEffects: B
|
|
2238
|
-
};
|
|
2239
|
-
}
|
|
2240
|
-
function xo(e) {
|
|
2241
|
-
let t = We({
|
|
2242
|
-
dashboard: e.before,
|
|
2243
|
-
runtimeValues: e.dashboardInputValues,
|
|
2244
|
-
calendar: e.calendar
|
|
2245
|
-
});
|
|
2246
|
-
const i = $(e.after), n = (r) => {
|
|
2247
|
-
var a;
|
|
2248
|
-
return (a = i.findFilterInput({ inputId: r })) == null ? void 0 : a.input;
|
|
2249
|
-
};
|
|
2250
|
-
for (const r of e.effects)
|
|
2251
|
-
switch (r.kind) {
|
|
2252
|
-
case "resetToDefault":
|
|
2253
|
-
case "clear":
|
|
2254
|
-
case "setDefaultComparison": {
|
|
2255
|
-
const a = n(r.inputId);
|
|
2256
|
-
if (!a) break;
|
|
2257
|
-
t = Ut({
|
|
2258
|
-
state: { dashboardInputValues: t },
|
|
2259
|
-
input: a,
|
|
2260
|
-
settings: {
|
|
2261
|
-
target: r.target,
|
|
2262
|
-
defaultValueChanged: r.kind === "resetToDefault",
|
|
2263
|
-
defaultFilterValue: r.kind === "resetToDefault" ? r.filterValue : void 0,
|
|
2264
|
-
selectionIdentityChanged: r.kind === "clear",
|
|
2265
|
-
defaultComparisonChanged: r.kind === "setDefaultComparison"
|
|
2266
|
-
}
|
|
2267
|
-
}).dashboardInputValues;
|
|
2268
|
-
break;
|
|
2269
|
-
}
|
|
2270
|
-
case "dropTargetSlot": {
|
|
2271
|
-
const a = n(r.inputId);
|
|
2272
|
-
if (!a) break;
|
|
2273
|
-
t = Te(
|
|
2274
|
-
t,
|
|
2275
|
-
a,
|
|
2276
|
-
r.target
|
|
2277
|
-
);
|
|
2278
|
-
break;
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
return We({
|
|
2282
|
-
dashboard: e.after,
|
|
2283
|
-
runtimeValues: t,
|
|
2284
|
-
calendar: e.calendar
|
|
2285
|
-
});
|
|
2286
|
-
}
|
|
2287
|
-
function zr(e) {
|
|
2288
|
-
var t;
|
|
2289
|
-
return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
|
|
2290
|
-
}
|
|
2291
|
-
function ve(e, t, i) {
|
|
2292
|
-
i !== void 0 && (i === null ? delete e[t] : e[t] = i);
|
|
2293
|
-
}
|
|
2294
|
-
function jr(e, t) {
|
|
2295
|
-
const i = [
|
|
2296
|
-
...$(e).inputs.map((r) => r.input),
|
|
2297
|
-
...(Array.isArray(e.inputs) ? e.inputs : []).filter(
|
|
2298
|
-
(r) => r.kind === "control"
|
|
2299
|
-
)
|
|
2300
|
-
].filter(
|
|
2301
|
-
(r) => r.id !== t.id && r.variableName === t.variableName
|
|
2302
|
-
);
|
|
2303
|
-
if (!i.length) return;
|
|
2304
|
-
const n = Xe(e, t);
|
|
2305
|
-
return i.some(
|
|
2306
|
-
(r) => [...Xe(e, r)].some(
|
|
2307
|
-
(a) => n.has(a)
|
|
2308
|
-
)
|
|
2309
|
-
) ? t.variableName : void 0;
|
|
2310
|
-
}
|
|
2311
|
-
function Hr(e, t, i, n) {
|
|
2312
|
-
var u, f;
|
|
2313
|
-
const r = [], a = Mt(e), o = (d) => ot(t, d, a), s = (d) => ot(i, d, a), l = [];
|
|
2314
|
-
if (i.runtimeScope === "perSheet")
|
|
2315
|
-
for (const d of a.values())
|
|
2316
|
-
l.push({ sheetId: d.sheetId, sheetKind: d.sheetKind });
|
|
2317
|
-
else if (i.runtimeScope === "perCard")
|
|
2318
|
-
for (const d of de(e))
|
|
2319
|
-
l.push({
|
|
2320
|
-
sheetId: d.sheetId,
|
|
2321
|
-
cardId: d.cardId,
|
|
2322
|
-
sheetKind: (u = a.get(d.sheetId)) == null ? void 0 : u.sheetKind
|
|
2323
|
-
});
|
|
2324
|
-
else if (i.runtimeScope === "perDocumentSection")
|
|
2325
|
-
for (const d of e.sheets ?? [])
|
|
2326
|
-
for (const g of ((f = d.document) == null ? void 0 : f.sections) ?? [])
|
|
2327
|
-
l.push({
|
|
2328
|
-
sheetId: d.id,
|
|
2329
|
-
sectionId: g.id,
|
|
2330
|
-
sheetKind: "document"
|
|
2331
|
-
});
|
|
2332
|
-
let c = n;
|
|
2333
|
-
for (const d of l) {
|
|
2334
|
-
if (s(d)) continue;
|
|
2335
|
-
const g = !!(c && we(c, i, d));
|
|
2336
|
-
if (g && (c = Te(c, i, d)), g || o(d)) {
|
|
2337
|
-
const { sheetKind: v, ...b } = d;
|
|
2338
|
-
r.push(b);
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
return { defaultInputValues: c, dropped: r };
|
|
2342
|
-
}
|
|
2343
|
-
function ot(e, t, i) {
|
|
2344
|
-
if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
|
|
2345
|
-
const n = i.get(t.sheetId);
|
|
2346
|
-
return n ? Dt(e, n) : !1;
|
|
2347
|
-
}
|
|
2348
|
-
return ln(e, t);
|
|
2349
|
-
}
|
|
2350
|
-
function Ur(e, t) {
|
|
2351
|
-
const i = { ...e };
|
|
2352
|
-
return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? i.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete i.defaultInputValues, i;
|
|
2353
|
-
}
|
|
2354
|
-
function Gr(e, t, i, n, r) {
|
|
2355
|
-
const a = !!(i != null && i.defaultValueChanged || i != null && i.selectionIdentityChanged) || sn(e, t);
|
|
2356
|
-
return {
|
|
2357
|
-
...i,
|
|
2358
|
-
target: (i == null ? void 0 : i.target) ?? n,
|
|
2359
|
-
defaultValueChanged: a,
|
|
2360
|
-
defaultFilterValue: a ? G(t, r) : void 0
|
|
2361
|
-
};
|
|
2362
|
-
}
|
|
2363
|
-
function Ut(e) {
|
|
2364
|
-
const { settings: t } = e;
|
|
2365
|
-
if (!t) return e.state;
|
|
2366
|
-
const i = e.input;
|
|
2367
|
-
let n = e.state.dashboardInputValues, r = e.state.defaultInputValues;
|
|
2368
|
-
if (t.selectionIdentityChanged && (n = Qe(
|
|
2369
|
-
n,
|
|
2370
|
-
i,
|
|
2371
|
-
t.target,
|
|
2372
|
-
{ status: "cleared" }
|
|
2373
|
-
)), t.defaultValueChanged) {
|
|
2374
|
-
const a = we(
|
|
2375
|
-
r,
|
|
2376
|
-
i,
|
|
2377
|
-
t.target
|
|
2378
|
-
);
|
|
2379
|
-
let o = Te(
|
|
2380
|
-
r || {},
|
|
2381
|
-
i,
|
|
2382
|
-
t.target
|
|
2383
|
-
);
|
|
2384
|
-
t.defaultFilterValue ? o = Ye(
|
|
2385
|
-
o,
|
|
2386
|
-
i,
|
|
2387
|
-
t.target,
|
|
2388
|
-
{
|
|
2389
|
-
status: "set",
|
|
2390
|
-
value: {
|
|
2391
|
-
kind: "filter",
|
|
2392
|
-
filterValue: t.defaultFilterValue
|
|
2393
|
-
},
|
|
2394
|
-
...a != null && a.comparisonSelection ? { comparisonSelection: a.comparisonSelection } : {}
|
|
2395
|
-
}
|
|
2396
|
-
) : a != null && a.comparisonSelection && (o = Ye(
|
|
2397
|
-
o,
|
|
2398
|
-
i,
|
|
2399
|
-
t.target,
|
|
2400
|
-
{ comparisonSelection: a.comparisonSelection }
|
|
2401
|
-
)), r = Object.keys(o).length ? o : void 0, n = Qe(
|
|
2402
|
-
n,
|
|
2403
|
-
i,
|
|
2404
|
-
t.target,
|
|
2405
|
-
t.defaultFilterValue ? {
|
|
2406
|
-
status: "set",
|
|
2407
|
-
value: {
|
|
2408
|
-
kind: "filter",
|
|
2409
|
-
filterValue: t.defaultFilterValue
|
|
2410
|
-
}
|
|
2411
|
-
} : { status: "cleared" }
|
|
2412
|
-
);
|
|
2413
|
-
}
|
|
2414
|
-
return t.defaultComparisonChanged && (r = Je(
|
|
2415
|
-
r || {},
|
|
2416
|
-
i,
|
|
2417
|
-
t.target,
|
|
2418
|
-
t.defaultComparisonSelection
|
|
2419
|
-
), Object.keys(r).length || (r = void 0), n = Je(
|
|
2420
|
-
n,
|
|
2421
|
-
i,
|
|
2422
|
-
t.target,
|
|
2423
|
-
void 0
|
|
2424
|
-
)), {
|
|
2425
|
-
...e.state,
|
|
2426
|
-
dashboardInputValues: n,
|
|
2427
|
-
defaultInputValues: r
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
const H = (e) => Array.isArray(e.inputs) ? e.inputs : [];
|
|
2431
|
-
function pe(e, t) {
|
|
2432
|
-
const i = H(e).find((n) => n.id === t);
|
|
2433
|
-
if (!i || i.kind !== "filter")
|
|
2434
|
-
throw new A("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
|
|
2435
|
-
return i;
|
|
2436
|
-
}
|
|
2437
|
-
function Gt(e, t) {
|
|
2438
|
-
var i;
|
|
2439
|
-
return (i = de(e).find((n) => n.cardId === t)) == null ? void 0 : i.card.title;
|
|
2440
|
-
}
|
|
2441
|
-
function Wr(e, t, i) {
|
|
2442
|
-
const n = $(e), r = n.findFilterInput({ inputId: t });
|
|
2443
|
-
return r ? n.reachedCards({ inputId: t }).filter(
|
|
2444
|
-
(a) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
|
|
2445
|
-
Ti(r.input, a.card, i).reach
|
|
2446
|
-
)
|
|
2447
|
-
).length : 0;
|
|
2448
|
-
}
|
|
2449
|
-
function Qr(e, t) {
|
|
2450
|
-
const i = $(e), n = i.findFilterInput({ inputId: t });
|
|
2451
|
-
return n ? i.reachedCards({ inputId: t }).filter((r) => wi(n.input, r.card) === "relationship").length : 0;
|
|
2452
|
-
}
|
|
2453
|
-
function Wt(e, t) {
|
|
2454
|
-
if (t.scope.kind === "allSheets") return "every sheet";
|
|
2455
|
-
if (t.scope.kind !== "sheets") return "its cards";
|
|
2456
|
-
const i = [...Mt(e).values()].filter((n) => Dt(t, n));
|
|
2457
|
-
return Tt(i.map((n) => {
|
|
2458
|
-
var r, a;
|
|
2459
|
-
return ((a = (r = e.sheets) == null ? void 0 : r.find((o) => o.id === n.sheetId)) == null ? void 0 : a.title) ?? n.sheetId;
|
|
2460
|
-
}));
|
|
2461
|
-
}
|
|
2462
|
-
const Qt = (e) => {
|
|
2463
|
-
var t;
|
|
2464
|
-
return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
|
|
2465
|
-
};
|
|
2466
|
-
function Yt(e) {
|
|
2467
|
-
var t, i, n;
|
|
2468
|
-
if ((i = (t = e.filter) == null ? void 0 : t.defaultValues) != null && i.length) return `default ${e.filter.defaultValues.join(", ")}`;
|
|
2469
|
-
if ((n = e.filter) != null && n.defaultDateFilter) return "a default period";
|
|
2470
|
-
}
|
|
2471
|
-
function ne(e) {
|
|
2472
|
-
return De.plain("filter", e);
|
|
2473
|
-
}
|
|
2474
|
-
function Yr(e, t) {
|
|
2475
|
-
const { input: i } = t, n = H(e);
|
|
2476
|
-
if (n.some((l) => l.id === i.id))
|
|
2477
|
-
throw new A("filter_id_taken", `A filter with id ${i.id} is already on this dashboard.`);
|
|
2478
|
-
if ($(e).findFilterInput({ filterId: i.filter.id }))
|
|
2479
|
-
throw new A("filter_id_taken", `A filter definition with id ${i.filter.id} is already on this dashboard.`);
|
|
2480
|
-
const r = { ...e, inputs: [...n, i] }, a = Wr(r, i.id), o = Qr(r, i.id), s = [Qt(i), Yt(i)].filter(Boolean).join(", ");
|
|
2481
|
-
return {
|
|
2482
|
-
dashboard: r,
|
|
2483
|
-
created: [
|
|
2484
|
-
{
|
|
2485
|
-
kind: "filter",
|
|
2486
|
-
id: i.id,
|
|
2487
|
-
title: i.label,
|
|
2488
|
-
...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {}
|
|
2489
|
-
}
|
|
2490
|
-
],
|
|
2491
|
-
clauses: [
|
|
2492
|
-
ne(
|
|
2493
|
-
`adds the filter ${z(i.label)} (${s}) to ${Wt(r, i)}; it filters ${a} card${a === 1 ? "" : "s"}${o ? ` and may filter ${o} more through the domain's relationships` : ""}`
|
|
2494
|
-
)
|
|
2495
|
-
]
|
|
2496
|
-
};
|
|
2497
|
-
}
|
|
2498
|
-
function Jr(e, t, i) {
|
|
2499
|
-
const n = $r(e, { inputId: t.filterId }, t.settings, {
|
|
2500
|
-
calendar: i.calendar
|
|
2501
|
-
});
|
|
2502
|
-
if (!n.ok) {
|
|
2503
|
-
const [o] = n.issues;
|
|
2504
|
-
throw new A(
|
|
2505
|
-
(o == null ? void 0 : o.code) === "inputNotFound" ? "filter_not_found" : "filter_invalid",
|
|
2506
|
-
(o == null ? void 0 : o.message) ?? "These filter settings could not be saved.",
|
|
2507
|
-
(o == null ? void 0 : o.code) === "inputNotFound" ? "Read the outline again and use its filter ids." : "Change the filter settings and propose again.",
|
|
2508
|
-
{ issues: n.issues }
|
|
2509
|
-
);
|
|
2510
|
-
}
|
|
2511
|
-
const r = H(e).find((o) => o.id === n.inputId), a = H(n.dashboard).find((o) => o.id === n.inputId);
|
|
2512
|
-
return {
|
|
2513
|
-
dashboard: n.dashboard,
|
|
2514
|
-
runtimeEffects: [{ kind: "filter_value", effects: n.valueEffects }],
|
|
2515
|
-
clauses: [ne(`changes the filter ${z((r == null ? void 0 : r.label) ?? a.label)}: ${Xr(n.dashboard, r, a)}`)]
|
|
2516
|
-
};
|
|
2517
|
-
}
|
|
2518
|
-
function Xr(e, t, i) {
|
|
2519
|
-
var o, s, l, c, u, f;
|
|
2520
|
-
if (!t) return "updates its settings";
|
|
2521
|
-
const n = [];
|
|
2522
|
-
t.label !== i.label && n.push(`renames it ${z(i.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = i.filter) == null ? void 0 : s.type) ?? "multiple") && n.push(`makes it ${Qt(i)}`);
|
|
2523
|
-
const r = JSON.stringify([((l = t.filter) == null ? void 0 : l.defaultValues) ?? null, ((c = t.filter) == null ? void 0 : c.defaultDateFilter) ?? null]), a = JSON.stringify([((u = i.filter) == null ? void 0 : u.defaultValues) ?? null, ((f = i.filter) == null ? void 0 : f.defaultDateFilter) ?? null]);
|
|
2524
|
-
if (r !== a) {
|
|
2525
|
-
const d = Yt(i);
|
|
2526
|
-
n.push(d ? `sets its ${d.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
|
|
2527
|
-
}
|
|
2528
|
-
return JSON.stringify(t.scope) !== JSON.stringify(i.scope) && n.push(`applies it to ${Wt(e, i)}`), n.length ? Tt(n) : "keeps its settings";
|
|
2529
|
-
}
|
|
2530
|
-
function Zr(e, t) {
|
|
2531
|
-
const i = pe(e, t);
|
|
2532
|
-
return {
|
|
2533
|
-
dashboard: {
|
|
2534
|
-
...e,
|
|
2535
|
-
inputs: H(e).filter((r) => r.id !== t),
|
|
2536
|
-
defaultInputValues: un(e.defaultInputValues, t)
|
|
2537
|
-
},
|
|
2538
|
-
runtimeEffects: [{ kind: "input_removed", inputId: t }],
|
|
2539
|
-
clauses: [ne(`removes the filter ${z(i.label)}`)]
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
function ea(e, t, i) {
|
|
2543
|
-
var o;
|
|
2544
|
-
if (!de(e).some((s) => s.cardId === i))
|
|
2545
|
-
throw new A("card_not_found", `No card ${i} on this dashboard.`, "Read the outline again and use its card ids.");
|
|
2546
|
-
const n = dn(t.scope, i);
|
|
2547
|
-
if (!n)
|
|
2548
|
-
throw new A(
|
|
2549
|
-
"filter_invalid",
|
|
2550
|
-
"This filter applies to Document sections, so it can't leave out one card.",
|
|
2551
|
-
"Change it in the editor."
|
|
2552
|
-
);
|
|
2553
|
-
const r = { ...t, scope: n }, a = Pe({ inputs: [r], dashboardFilters: [] });
|
|
2554
|
-
if (!a.ok)
|
|
2555
|
-
throw new A("filter_invalid", ((o = a.issues[0]) == null ? void 0 : o.message) ?? "This filter could not be saved.", "Change it in the editor.");
|
|
2556
|
-
return {
|
|
2557
|
-
...e,
|
|
2558
|
-
inputs: H(e).map((s) => s.id === t.id ? r : s)
|
|
2559
|
-
};
|
|
2560
|
-
}
|
|
2561
|
-
function Jt(e, t, i, n, r) {
|
|
2562
|
-
var u, f;
|
|
2563
|
-
const a = pe(e, t);
|
|
2564
|
-
if (!de(e).some((d) => d.cardId === i))
|
|
2565
|
-
throw new A("card_not_found", `No card ${i} on this dashboard.`, "Read the outline again and use its card ids.");
|
|
2566
|
-
const o = [...((u = a.application) == null ? void 0 : u.cards) ?? []], s = o.findIndex((d) => d.cardId === i);
|
|
2567
|
-
s >= 0 ? o[s] = n : o.push(n);
|
|
2568
|
-
const l = {
|
|
2569
|
-
...a,
|
|
2570
|
-
...r ? { scope: r } : {},
|
|
2571
|
-
application: { ...a.application ?? { kind: "cardMappings" }, cards: o }
|
|
2572
|
-
}, c = Pe({ inputs: [l], dashboardFilters: [] });
|
|
2573
|
-
if (!c.ok)
|
|
2574
|
-
throw new A(
|
|
2575
|
-
"filter_invalid",
|
|
2576
|
-
((f = c.issues[0]) == null ? void 0 : f.message) ?? "This filter mapping could not be saved.",
|
|
2577
|
-
"Change the mapping and propose again."
|
|
2578
|
-
);
|
|
2579
|
-
return {
|
|
2580
|
-
...e,
|
|
2581
|
-
inputs: H(e).map((d) => d.id === t ? l : d)
|
|
2582
|
-
};
|
|
2583
|
-
}
|
|
2584
|
-
function ta(e) {
|
|
2585
|
-
switch (e.kind) {
|
|
2586
|
-
case "field":
|
|
2587
|
-
return `by ${e.field.name}`;
|
|
2588
|
-
case "relationship":
|
|
2589
|
-
return "through a chosen relationship path";
|
|
2590
|
-
default:
|
|
2591
|
-
return String(e.kind);
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
function ia(e, t) {
|
|
2595
|
-
const i = pe(e, t.filterId), n = { ...t.binding, kind: "bound", cardId: t.cardId }, r = cn(i.scope, t.cardId), a = r !== i.scope;
|
|
2596
|
-
return {
|
|
2597
|
-
dashboard: Jt(e, t.filterId, t.cardId, n, a ? r : void 0),
|
|
2598
|
-
clauses: [
|
|
2599
|
-
ne(
|
|
2600
|
-
`makes ${z(i.label)} filter ${z(Gt(e, t.cardId))} ${ta(n.target)}${a ? ", which it used to leave out" : ""}`
|
|
2601
|
-
)
|
|
2602
|
-
]
|
|
2603
|
-
};
|
|
2604
|
-
}
|
|
2605
|
-
function na(e, t) {
|
|
2606
|
-
var r;
|
|
2607
|
-
const i = pe(e, t.filterId);
|
|
2608
|
-
return {
|
|
2609
|
-
dashboard: ((r = i.filter) == null ? void 0 : r.kind) === "global-date" ? ea(e, i, t.cardId) : Jt(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
|
|
2610
|
-
clauses: [ne(`stops ${z(i.label)} from filtering ${z(Gt(e, t.cardId))}`)]
|
|
2611
|
-
};
|
|
2612
|
-
}
|
|
2613
|
-
function So(e, t, i) {
|
|
2614
|
-
let n = e;
|
|
2615
|
-
const r = [], a = [], o = [];
|
|
2616
|
-
for (const [s, l] of t.entries()) {
|
|
2617
|
-
let c;
|
|
2618
|
-
try {
|
|
2619
|
-
c = ra(n, l, i);
|
|
2620
|
-
} catch (u) {
|
|
2621
|
-
if (!(u instanceof A)) throw u;
|
|
2622
|
-
return {
|
|
2623
|
-
ok: !1,
|
|
2624
|
-
failedAt: {
|
|
2625
|
-
index: s,
|
|
2626
|
-
op: l.op,
|
|
2627
|
-
code: u.code,
|
|
2628
|
-
message: u.message,
|
|
2629
|
-
...u.fix ? { fix: u.fix } : {},
|
|
2630
|
-
...u.details ? { details: u.details } : {}
|
|
2631
|
-
}
|
|
2632
|
-
};
|
|
2633
|
-
}
|
|
2634
|
-
n = c.dashboard, r.push(...c.created ?? []), a.push(...c.runtimeEffects ?? []), o.push({ index: s, changeIndex: l.changeIndex, clauses: c.clauses });
|
|
2635
|
-
}
|
|
2636
|
-
return { ok: !0, dashboard: n, created: r, descriptions: aa(o), runtimeEffects: a };
|
|
2637
|
-
}
|
|
2638
|
-
function ra(e, t, i) {
|
|
2639
|
-
switch (t.op) {
|
|
2640
|
-
case "card.add":
|
|
2641
|
-
return pn(e, t);
|
|
2642
|
-
case "card.remove":
|
|
2643
|
-
return mn(e, t.cardId);
|
|
2644
|
-
case "card.update":
|
|
2645
|
-
return fn(e, t.cardId, t.update);
|
|
2646
|
-
case "layout.arrange":
|
|
2647
|
-
return Er(e, t);
|
|
2648
|
-
case "frame.commit":
|
|
2649
|
-
return Kr(e, t.commit);
|
|
2650
|
-
case "filter.add":
|
|
2651
|
-
return Yr(e, t);
|
|
2652
|
-
case "filter.update":
|
|
2653
|
-
return Jr(e, t, i);
|
|
2654
|
-
case "filter.remove":
|
|
2655
|
-
return Zr(e, t.filterId);
|
|
2656
|
-
case "filter.bind":
|
|
2657
|
-
return ia(e, t);
|
|
2658
|
-
case "filter.exclude":
|
|
2659
|
-
return na(e, t);
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
function aa(e) {
|
|
2663
|
-
const t = [];
|
|
2664
|
-
for (const i of e) {
|
|
2665
|
-
const n = i.changeIndex === void 0 ? void 0 : t.find((r) => r.changeIndex === i.changeIndex);
|
|
2666
|
-
if (n) {
|
|
2667
|
-
n.operations.push(i.index), n.clauses.push(...i.clauses);
|
|
2668
|
-
continue;
|
|
2669
|
-
}
|
|
2670
|
-
t.push({
|
|
2671
|
-
...i.changeIndex !== void 0 ? { changeIndex: i.changeIndex } : {},
|
|
2672
|
-
operations: [i.index],
|
|
2673
|
-
sentence: "",
|
|
2674
|
-
clauses: [...i.clauses]
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2677
|
-
return t.map(({ clauses: i, ...n }) => ({
|
|
2678
|
-
...n,
|
|
2679
|
-
sentence: hn(oa(i))
|
|
2680
|
-
}));
|
|
2681
|
-
}
|
|
2682
|
-
function oa(e) {
|
|
2683
|
-
let t = !1;
|
|
2684
|
-
return e.filter((i) => i.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
|
|
2685
|
-
}
|
|
2686
|
-
function st(e) {
|
|
2687
|
-
return Object.fromEntries(
|
|
2688
|
-
Object.entries(e).filter(
|
|
2689
|
-
(t) => typeof t[1] == "string" && t[1].length > 0
|
|
2690
|
-
)
|
|
2691
|
-
);
|
|
2692
|
-
}
|
|
2693
|
-
function ee(e) {
|
|
2694
|
-
return e.kind === "semantic" ? [
|
|
2695
|
-
e.kind,
|
|
2696
|
-
e.domainId,
|
|
2697
|
-
e.datasetId || "",
|
|
2698
|
-
e.datasetName || "",
|
|
2699
|
-
e.connectionId || ""
|
|
2700
|
-
].join(":") : [
|
|
2701
|
-
e.kind,
|
|
2702
|
-
e.connectionId,
|
|
2703
|
-
e.databaseName || "",
|
|
2704
|
-
e.schemaName || "",
|
|
2705
|
-
e.tableName
|
|
2706
|
-
].join(":");
|
|
2707
|
-
}
|
|
2708
|
-
function sa(e, t) {
|
|
2709
|
-
if (e.kind === "semantic")
|
|
2710
|
-
return {
|
|
2711
|
-
status: "ready",
|
|
2712
|
-
request: st({
|
|
2713
|
-
connection_id: e.connectionId,
|
|
2714
|
-
domain_id: e.domainId,
|
|
2715
|
-
dataset_id: Ni(e),
|
|
2716
|
-
dataset_name: e.datasetName
|
|
2717
|
-
})
|
|
2718
|
-
};
|
|
2719
|
-
const i = wn({
|
|
2720
|
-
source: e,
|
|
2721
|
-
capabilities: t
|
|
2722
|
-
});
|
|
2723
|
-
return i.kind === "incompatible_capabilities" ? {
|
|
2724
|
-
status: "unavailable",
|
|
2725
|
-
message: "Connection capabilities are unavailable for field metadata."
|
|
2726
|
-
} : i.kind === "missing_coordinates" ? {
|
|
2727
|
-
status: "unavailable",
|
|
2728
|
-
message: `Source is missing required field-metadata coordinates: ${i.missing.join(", ")}.`
|
|
2729
|
-
} : {
|
|
2730
|
-
status: "ready",
|
|
2731
|
-
request: st({
|
|
2732
|
-
connection_id: e.connectionId,
|
|
2733
|
-
datamodel_id: "",
|
|
2734
|
-
database_name: i.coordinates.databaseName,
|
|
2735
|
-
schema_name: i.coordinates.schemaName,
|
|
2736
|
-
table_name: i.coordinates.tableName
|
|
2737
|
-
})
|
|
2738
|
-
};
|
|
2739
|
-
}
|
|
2740
|
-
function Mo(e, t = /* @__PURE__ */ new Map()) {
|
|
2741
|
-
const i = /* @__PURE__ */ new Map();
|
|
2742
|
-
for (const { card: n } of e) {
|
|
2743
|
-
const r = wt(n), a = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((o) => o.source) : [];
|
|
2744
|
-
for (const o of a) {
|
|
2745
|
-
const s = ee(o);
|
|
2746
|
-
if (!i.has(s)) {
|
|
2747
|
-
const l = sa(
|
|
2748
|
-
o,
|
|
2749
|
-
o.connectionId ? t.get(o.connectionId) : void 0
|
|
2750
|
-
);
|
|
2751
|
-
i.set(s, {
|
|
2752
|
-
key: s,
|
|
2753
|
-
source: o,
|
|
2754
|
-
...l
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
return Array.from(i.values());
|
|
2760
|
-
}
|
|
2761
|
-
function la(e, t) {
|
|
2762
|
-
if (e.kind !== "semantic" || !e.connectionId) return;
|
|
2763
|
-
const i = (t.qualifiedEntityName || "").split(".").map((r) => r.trim()).filter(Boolean), n = i.at(-1);
|
|
2764
|
-
if (n)
|
|
2765
|
-
return {
|
|
2766
|
-
kind: "physical",
|
|
2767
|
-
connectionId: e.connectionId,
|
|
2768
|
-
tableName: n,
|
|
2769
|
-
...i.length > 1 ? { schemaName: i.at(-2) } : {},
|
|
2770
|
-
...i.length > 2 ? { databaseName: i.at(-3) } : {}
|
|
2771
|
-
};
|
|
2772
|
-
}
|
|
2773
|
-
function oe(e, t) {
|
|
2774
|
-
let i = e.get(t);
|
|
2775
|
-
return i || (i = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, i)), i;
|
|
2776
|
-
}
|
|
2777
|
-
function Xt(e, t) {
|
|
2778
|
-
e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
|
|
2779
|
-
}
|
|
2780
|
-
function xe(e, t, i) {
|
|
2781
|
-
for (const n of t) {
|
|
2782
|
-
const r = n == null ? void 0 : n.trim();
|
|
2783
|
-
if (!r) continue;
|
|
2784
|
-
const a = gt(r), o = e.fields.get(a);
|
|
2785
|
-
o === void 0 ? e.fields.set(a, i) : o !== i && e.fieldConflicts.add(a);
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
function Zt(e, t) {
|
|
2789
|
-
t.sourceLabel && Xt(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
|
|
2790
|
-
for (const [i, n] of t.fields)
|
|
2791
|
-
xe(e, [i], n);
|
|
2792
|
-
for (const i of t.fieldConflicts ?? [])
|
|
2793
|
-
e.fieldConflicts.add(i);
|
|
2794
|
-
}
|
|
2795
|
-
function ei(e) {
|
|
2796
|
-
return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
|
|
2797
|
-
}
|
|
2798
|
-
function Do(e, t) {
|
|
2799
|
-
var n, r;
|
|
2800
|
-
const i = /* @__PURE__ */ new Map();
|
|
2801
|
-
for (const [a, o] of e) {
|
|
2802
|
-
if (o.status !== "ready") continue;
|
|
2803
|
-
const s = t == null ? void 0 : t.get(a), l = s ? ei(s) : void 0;
|
|
2804
|
-
for (const c of o.columns) {
|
|
2805
|
-
const u = (n = c.column_name) == null ? void 0 : n.trim(), f = (r = c.label) == null ? void 0 : r.trim(), d = s ? la(s, c) : void 0;
|
|
2806
|
-
d && l && Xt(
|
|
2807
|
-
oe(i, ee(d)),
|
|
2808
|
-
l
|
|
2809
|
-
), !(!u || !f || f === u) && (xe(
|
|
2810
|
-
oe(i, a),
|
|
2811
|
-
[u, c.sourceField],
|
|
2812
|
-
f
|
|
2813
|
-
), d && xe(
|
|
2814
|
-
oe(i, ee(d)),
|
|
2815
|
-
[c.sourceField, u],
|
|
2816
|
-
f
|
|
2817
|
-
));
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
return i;
|
|
2821
|
-
}
|
|
2822
|
-
function To(...e) {
|
|
2823
|
-
const t = /* @__PURE__ */ new Map();
|
|
2824
|
-
for (const i of e)
|
|
2825
|
-
for (const [n, r] of i ?? [])
|
|
2826
|
-
Zt(oe(t, n), r);
|
|
2827
|
-
return t;
|
|
2828
|
-
}
|
|
2829
|
-
function Ve(e) {
|
|
2830
|
-
return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
|
|
2831
|
-
}
|
|
2832
|
-
function ca(e) {
|
|
2833
|
-
return e.split(":").slice(2).filter(Boolean).join(".");
|
|
2834
|
-
}
|
|
2835
|
-
function ti(e, t) {
|
|
2836
|
-
const i = ee(t), n = e.get(i);
|
|
2837
|
-
if (t.kind !== "physical") return n;
|
|
2838
|
-
const r = `physical:${t.connectionId}:`, a = Ve(t), o = {
|
|
2839
|
-
fields: /* @__PURE__ */ new Map(),
|
|
2840
|
-
fieldConflicts: /* @__PURE__ */ new Set()
|
|
2841
|
-
};
|
|
2842
|
-
let s = !1;
|
|
2843
|
-
for (const [l, c] of e)
|
|
2844
|
-
l.startsWith(r) && (l !== i && !Pn(a, ca(l)) || (Zt(o, c), s = !0));
|
|
2845
|
-
return s ? o : void 0;
|
|
2846
|
-
}
|
|
2847
|
-
function ua(e, t) {
|
|
2848
|
-
var r;
|
|
2849
|
-
if (!e) return;
|
|
2850
|
-
const i = gt(t.name), n = ti(e, t.source);
|
|
2851
|
-
return n && !((r = n.fieldConflicts) != null && r.has(i)) ? n.fields.get(i) : void 0;
|
|
2852
|
-
}
|
|
2853
|
-
function da(e, t) {
|
|
2854
|
-
if (t.kind === "semantic")
|
|
2855
|
-
return ei(t) || t.datasetId || "Dataset";
|
|
2856
|
-
const i = e ? ti(e, t) : void 0;
|
|
2857
|
-
return i != null && i.sourceLabel && !i.sourceLabelConflict ? i.sourceLabel : Ve(t);
|
|
2858
|
-
}
|
|
2859
|
-
function wo(e, t) {
|
|
2860
|
-
const i = ua(e, t);
|
|
2861
|
-
return {
|
|
2862
|
-
name: t.name,
|
|
2863
|
-
...i ? { label: i } : {},
|
|
2864
|
-
entityName: da(e, t.source),
|
|
2865
|
-
...t.source.kind === "physical" ? { qualifiedEntityName: Ve(t.source) } : {},
|
|
2866
|
-
dataType: t.dataType
|
|
2867
|
-
};
|
|
2868
|
-
}
|
|
2869
|
-
function fa(e, t) {
|
|
2870
|
-
var r, a;
|
|
2871
|
-
const i = (r = t.column_name) == null ? void 0 : r.trim(), n = ht(t.data_type);
|
|
2872
|
-
if (!(!i || n === "unknown"))
|
|
2873
|
-
return {
|
|
2874
|
-
kind: "field",
|
|
2875
|
-
field: {
|
|
2876
|
-
name: i,
|
|
2877
|
-
source: { ...e },
|
|
2878
|
-
dataType: n,
|
|
2879
|
-
...(a = t.sourceField) != null && a.trim() ? { sourceField: t.sourceField.trim() } : {}
|
|
2880
|
-
}
|
|
2881
|
-
};
|
|
2882
|
-
}
|
|
2883
|
-
function Po(e) {
|
|
2884
|
-
const t = {};
|
|
2885
|
-
for (const { card: i } of e.cards) {
|
|
2886
|
-
const n = wt(i), r = n.kind === "config" ? n.executableSources : n.kind === "sql" ? n.pinnedCatalogSources.map((s) => s.source) : [];
|
|
2887
|
-
if (!r.length) continue;
|
|
2888
|
-
const a = [];
|
|
2889
|
-
let o;
|
|
2890
|
-
for (const s of r) {
|
|
2891
|
-
const l = e.metadataBySourceKey.get(
|
|
2892
|
-
ee(s)
|
|
2893
|
-
);
|
|
2894
|
-
if (!l || l.status === "unavailable") {
|
|
2895
|
-
o = (l == null ? void 0 : l.status) === "unavailable" ? l.message : "Field metadata is not available yet.";
|
|
2896
|
-
break;
|
|
2897
|
-
}
|
|
2898
|
-
for (const c of l.columns) {
|
|
2899
|
-
const u = fa(s, c);
|
|
2900
|
-
u && a.push(u);
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
t[i.id] = o ? { status: "metadataUnavailable", message: o } : { status: "ready", targets: a };
|
|
2904
|
-
}
|
|
2905
|
-
return t;
|
|
2906
|
-
}
|
|
2907
|
-
function Oo(e) {
|
|
2908
|
-
const { dashboard: t, target: i, calendar: n } = e, r = ni(i), a = ii(t, i, n);
|
|
2909
|
-
return {
|
|
2910
|
-
value: a,
|
|
2911
|
-
mode: Pi(
|
|
2912
|
-
Oi(a == null ? void 0 : a.operation) ? a.operation : r.operation
|
|
2913
|
-
)
|
|
2914
|
-
};
|
|
2915
|
-
}
|
|
2916
|
-
function ii(e, t, i) {
|
|
2917
|
-
var n;
|
|
2918
|
-
switch (t.kind) {
|
|
2919
|
-
case "dashboardInput": {
|
|
2920
|
-
const r = yn({
|
|
2921
|
-
dashboard: e,
|
|
2922
|
-
input: t.input,
|
|
2923
|
-
target: t.scope,
|
|
2924
|
-
calendar: i
|
|
2925
|
-
});
|
|
2926
|
-
return (r == null ? void 0 : r.status) === "set" && r.value.kind === "filter" ? r.value.filterValue : void 0;
|
|
2927
|
-
}
|
|
2928
|
-
case "dashboardFilter": {
|
|
2929
|
-
const r = (n = e.defaultFilterValues) == null ? void 0 : n.find(
|
|
2930
|
-
(a) => a.filterId === t.filter.id
|
|
2931
|
-
);
|
|
2932
|
-
return r ? gn({
|
|
2933
|
-
filterDefinitions: [t.filter],
|
|
2934
|
-
filterValues: [r]
|
|
2935
|
-
})[0] : G(t.filter, i);
|
|
2936
|
-
}
|
|
2937
|
-
case "definition":
|
|
2938
|
-
return G(t.filter, i);
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
function ni(e) {
|
|
2942
|
-
return e.kind === "dashboardInput" ? e.input.filter : e.filter;
|
|
2943
|
-
}
|
|
2944
|
-
function Ao(e) {
|
|
2945
|
-
var a;
|
|
2946
|
-
const { dashboard: t, filter: i, input: n, scope: r } = e;
|
|
2947
|
-
return n && (t.inputs || []).some((o) => o.id === n.id) ? { kind: "dashboardInput", input: n, scope: r } : ((a = $(t).findFilterInput({ filterId: i.id })) == null ? void 0 : a.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: i } : { kind: "definition", filter: i };
|
|
2948
|
-
}
|
|
2949
|
-
function _o(e) {
|
|
2950
|
-
const { dashboard: t, target: i, calendar: n } = e, r = ni(i), a = bn(r), o = ma(t, i);
|
|
2951
|
-
if (!o) return a;
|
|
2952
|
-
if (o === "cleared")
|
|
2953
|
-
return {
|
|
2954
|
-
operation: r.operation,
|
|
2955
|
-
defaultValues: void 0,
|
|
2956
|
-
defaultDateFilter: void 0
|
|
2957
|
-
};
|
|
2958
|
-
const s = ii(t, i, n);
|
|
2959
|
-
if (!s || pa(s, G(r, n)))
|
|
2960
|
-
return a;
|
|
2961
|
-
if (s.valueType === "date") {
|
|
2962
|
-
const l = Ei(
|
|
2963
|
-
"relativeMeta" in s ? s.relativeMeta : void 0
|
|
2964
|
-
) ?? ha(r, s, n);
|
|
2965
|
-
return l ? {
|
|
2966
|
-
operation: s.operation,
|
|
2967
|
-
defaultValues: r.defaultValues,
|
|
2968
|
-
defaultDateFilter: l
|
|
2969
|
-
} : a;
|
|
2970
|
-
}
|
|
2971
|
-
return {
|
|
2972
|
-
operation: s.operation,
|
|
2973
|
-
defaultValues: s.values,
|
|
2974
|
-
defaultDateFilter: r.defaultDateFilter
|
|
2975
|
-
};
|
|
2976
|
-
}
|
|
2977
|
-
function ma(e, t) {
|
|
2978
|
-
var i;
|
|
2979
|
-
if (t.kind === "dashboardInput") {
|
|
2980
|
-
const n = we(
|
|
2981
|
-
e.defaultInputValues,
|
|
2982
|
-
t.input,
|
|
2983
|
-
t.scope
|
|
2984
|
-
);
|
|
2985
|
-
return (n == null ? void 0 : n.status) === "set" || (n == null ? void 0 : n.status) === "cleared" ? n.status : void 0;
|
|
2986
|
-
}
|
|
2987
|
-
if (t.kind === "dashboardFilter")
|
|
2988
|
-
return (i = e.defaultFilterValues) != null && i.some(
|
|
2989
|
-
(n) => n.filterId === t.filter.id
|
|
2990
|
-
) ? "set" : void 0;
|
|
2991
|
-
}
|
|
2992
|
-
function pa(e, t) {
|
|
2993
|
-
return !!(t && e.operation === t.operation && Ce(lt(e), lt(t)) && Ce(
|
|
2994
|
-
"relativeMeta" in e ? e.relativeMeta : void 0,
|
|
2995
|
-
"relativeMeta" in t ? t.relativeMeta : void 0
|
|
2996
|
-
));
|
|
2997
|
-
}
|
|
2998
|
-
function lt(e) {
|
|
2999
|
-
return e.values.map(
|
|
3000
|
-
(t) => t instanceof Date ? t.getTime() : t
|
|
3001
|
-
);
|
|
3002
|
-
}
|
|
3003
|
-
function ha(e, t, i) {
|
|
3004
|
-
const n = vn(i == null ? void 0 : i.tz), r = ye(t.values[0], n);
|
|
3005
|
-
if (!r) return;
|
|
3006
|
-
const [a, o, s] = new Intl.DateTimeFormat("en-CA", {
|
|
3007
|
-
timeZone: n,
|
|
3008
|
-
year: "numeric",
|
|
3009
|
-
month: "2-digit",
|
|
3010
|
-
day: "2-digit"
|
|
3011
|
-
}).format(r).split("-").map(Number), l = [
|
|
3012
|
-
{
|
|
3013
|
-
mode: "fixed",
|
|
3014
|
-
unit: "day",
|
|
3015
|
-
date: `${a}-${String(o).padStart(2, "0")}-${String(s).padStart(2, "0")}`
|
|
3016
|
-
},
|
|
3017
|
-
{ mode: "fixed", unit: "month", year: a, month: o - 1 }
|
|
3018
|
-
], c = t.values.map(
|
|
3019
|
-
(u) => {
|
|
3020
|
-
var f;
|
|
3021
|
-
return (f = ye(u, n)) == null ? void 0 : f.getTime();
|
|
3022
|
-
}
|
|
3023
|
-
);
|
|
3024
|
-
return l.find((u) => {
|
|
3025
|
-
const f = G(
|
|
3026
|
-
{ ...e, defaultDateFilter: u },
|
|
3027
|
-
i
|
|
3028
|
-
);
|
|
3029
|
-
return (f == null ? void 0 : f.operation) === t.operation && Ce(
|
|
3030
|
-
f.values.map(
|
|
3031
|
-
(d) => {
|
|
3032
|
-
var g;
|
|
3033
|
-
return (g = ye(d, n)) == null ? void 0 : g.getTime();
|
|
3034
|
-
}
|
|
3035
|
-
),
|
|
3036
|
-
c
|
|
3037
|
-
);
|
|
3038
|
-
});
|
|
3039
|
-
}
|
|
3040
|
-
function ga(e) {
|
|
3041
|
-
const t = W(e.format);
|
|
3042
|
-
if ((t == null ? void 0 : t.type) === "temporal_bucket") {
|
|
3043
|
-
if (!e.granularity) return {};
|
|
3044
|
-
const i = ji(
|
|
3045
|
-
t,
|
|
3046
|
-
e.granularity
|
|
3047
|
-
);
|
|
3048
|
-
return i ? {
|
|
3049
|
-
granularity: e.granularity,
|
|
3050
|
-
semanticTemporalPresentation: {
|
|
3051
|
-
granularity: e.granularity,
|
|
3052
|
-
format: i
|
|
3053
|
-
}
|
|
3054
|
-
} : {};
|
|
3055
|
-
}
|
|
3056
|
-
return {
|
|
3057
|
-
...e.granularity ? { granularity: e.granularity } : {},
|
|
3058
|
-
...t ? { format: t } : {}
|
|
3059
|
-
};
|
|
3060
|
-
}
|
|
3061
|
-
function ya(e, t) {
|
|
3062
|
-
var r, a;
|
|
3063
|
-
const i = ((r = e.nativeDataType) == null ? void 0 : r.trim()) || ((a = e.native_data_type) == null ? void 0 : a.trim());
|
|
3064
|
-
return i || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
|
|
3065
|
-
}
|
|
3066
|
-
function ri(e) {
|
|
3067
|
-
const t = (e.label ?? "").trim();
|
|
3068
|
-
return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
|
|
3069
|
-
}
|
|
3070
|
-
function ke(e) {
|
|
3071
|
-
return ri(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
|
|
3072
|
-
}
|
|
3073
|
-
function ct(e) {
|
|
3074
|
-
return ke(e).toLowerCase().trim();
|
|
3075
|
-
}
|
|
3076
|
-
function ba(e, t) {
|
|
3077
|
-
return ct(e).localeCompare(ct(t), void 0, {
|
|
3078
|
-
numeric: !0,
|
|
3079
|
-
sensitivity: "base"
|
|
3080
|
-
});
|
|
3081
|
-
}
|
|
3082
|
-
function Z(e) {
|
|
3083
|
-
return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
|
|
3084
|
-
}
|
|
3085
|
-
function No(e, t) {
|
|
3086
|
-
const i = Z(t);
|
|
3087
|
-
return i ? [
|
|
3088
|
-
ke(e),
|
|
3089
|
-
e.label,
|
|
3090
|
-
e.name,
|
|
3091
|
-
e.description,
|
|
3092
|
-
e.entityName,
|
|
3093
|
-
e.qualifiedEntityName,
|
|
3094
|
-
e.entityName && e.name ? `${e.entityName}.${e.name}` : "",
|
|
3095
|
-
e.dataType
|
|
3096
|
-
].some(
|
|
3097
|
-
(r) => !!r && Z(r).includes(i)
|
|
3098
|
-
) : !0;
|
|
3099
|
-
}
|
|
3100
|
-
function ut(e, t) {
|
|
3101
|
-
const i = Z(t);
|
|
3102
|
-
if (!i) return 0;
|
|
3103
|
-
const n = Z(ke(e));
|
|
3104
|
-
return n.startsWith(i) ? 0 : n.includes(i) ? 1 : [e.label, e.name].filter(Boolean).map(Z).some((a) => a.includes(i)) ? 2 : 3;
|
|
3105
|
-
}
|
|
3106
|
-
function Eo(e, t, i) {
|
|
3107
|
-
return ut(e, i) - ut(t, i) || ba(e, t);
|
|
3108
|
-
}
|
|
3109
|
-
function va(e, t) {
|
|
3110
|
-
var a;
|
|
3111
|
-
const i = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, n = i || e.name, r = Ze(
|
|
3112
|
-
e.type === "dataset" && i ? { ...e, name: i } : e
|
|
3113
|
-
);
|
|
3114
|
-
return {
|
|
3115
|
-
entityId: e.id || e.name,
|
|
3116
|
-
entityType: e.type,
|
|
3117
|
-
entityName: n,
|
|
3118
|
-
label: e.label,
|
|
3119
|
-
description: e.description,
|
|
3120
|
-
qualifiedEntityName: r,
|
|
3121
|
-
columns: t.map((o) => {
|
|
3122
|
-
var g;
|
|
3123
|
-
const s = e.type === "dataset" ? o.entityName || n : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? Ze({ ...e, name: s }) : r), c = ya(
|
|
3124
|
-
o,
|
|
3125
|
-
e.type === "dataset" ? "semantic" : "physical"
|
|
3126
|
-
), u = (g = o.label) != null && g.trim() ? o.label : void 0, f = u ? void 0 : Fn(o.column_name);
|
|
3127
|
-
return {
|
|
3128
|
-
id: Cn(s, o.column_name),
|
|
3129
|
-
name: o.column_name,
|
|
3130
|
-
qualifiedFieldName: o.qualifiedFieldName || o.column_name,
|
|
3131
|
-
dataType: o.data_type,
|
|
3132
|
-
...c ? { nativeDataType: c } : {},
|
|
3133
|
-
label: u ?? f ?? o.column_name,
|
|
3134
|
-
...f !== void 0 ? { derivedLabel: f } : {},
|
|
3135
|
-
description: o.description || "",
|
|
3136
|
-
qualifiedEntityName: l,
|
|
3137
|
-
entityId: o.entityId || e.id || e.id || s,
|
|
3138
|
-
entityName: s,
|
|
3139
|
-
entityType: o.entityType || e.type,
|
|
3140
|
-
role: o.role,
|
|
3141
|
-
expression: o.expression,
|
|
3142
|
-
calculatedFormula: o.calculatedFormula,
|
|
3143
|
-
calculationRepresentation: o.calculationRepresentation,
|
|
3144
|
-
derivedField: o.derivedField,
|
|
3145
|
-
fieldScope: o.fieldScope,
|
|
3146
|
-
source: o.source,
|
|
3147
|
-
sourceField: o.sourceField,
|
|
3148
|
-
calculatedFieldOrigin: o.calculatedFieldOrigin,
|
|
3149
|
-
aggregateOrigin: o.aggregateOrigin,
|
|
3150
|
-
labelOrigin: o.labelOrigin,
|
|
3151
|
-
formatOrigin: o.formatOrigin,
|
|
3152
|
-
...ga(o),
|
|
3153
|
-
aggregate: o.aggregate
|
|
3154
|
-
};
|
|
3155
|
-
})
|
|
3156
|
-
};
|
|
3157
|
-
}
|
|
3158
|
-
function Fa(e) {
|
|
3159
|
-
return e.map((t) => ({
|
|
3160
|
-
...t,
|
|
3161
|
-
id: Pt({ ...t }),
|
|
3162
|
-
fieldScope: "domain"
|
|
3163
|
-
}));
|
|
3164
|
-
}
|
|
3165
|
-
function Ca(e) {
|
|
3166
|
-
return e.flatMap(
|
|
3167
|
-
(t) => t.columns.map((i) => {
|
|
3168
|
-
const n = ri(i) ? i.label : void 0, r = n ? void 0 : i.derivedLabel ?? xn(i.name), a = n ?? r ?? i.name;
|
|
3169
|
-
return {
|
|
3170
|
-
...i,
|
|
3171
|
-
id: i.id || `${t.entityId}-${i.name}`,
|
|
3172
|
-
name: i.name,
|
|
3173
|
-
qualifiedFieldName: i.qualifiedFieldName || i.name,
|
|
3174
|
-
dataType: i.dataType,
|
|
3175
|
-
qualifiedEntityName: i.qualifiedEntityName || t.qualifiedEntityName,
|
|
3176
|
-
label: a,
|
|
3177
|
-
...r !== void 0 ? { derivedLabel: r } : {},
|
|
3178
|
-
description: i.description,
|
|
3179
|
-
entityId: i.entityId || t.entityId,
|
|
3180
|
-
entityName: i.entityName || t.entityName,
|
|
3181
|
-
entityType: i.entityType || t.entityType
|
|
3182
|
-
};
|
|
3183
|
-
})
|
|
3184
|
-
);
|
|
3185
|
-
}
|
|
3186
|
-
function Ro(e) {
|
|
3187
|
-
const t = e.map((n) => va(n.target, n.columns || [])).filter((n) => {
|
|
3188
|
-
var r;
|
|
3189
|
-
return ((r = n == null ? void 0 : n.columns) == null ? void 0 : r.length) > 0;
|
|
3190
|
-
}), i = Fa(e.flatMap((n) => n.calculatedFields || []));
|
|
3191
|
-
if (i.length > 0) {
|
|
3192
|
-
const n = /* @__PURE__ */ new Map();
|
|
3193
|
-
i.forEach((r) => {
|
|
3194
|
-
const a = Pt(r);
|
|
3195
|
-
n.has(a) || n.set(a, r);
|
|
3196
|
-
}), t.unshift({
|
|
3197
|
-
entityId: In,
|
|
3198
|
-
entityType: "dataset",
|
|
3199
|
-
entityName: et,
|
|
3200
|
-
label: "Calculated Fields",
|
|
3201
|
-
description: "Domain-level calculated metrics and dimensions",
|
|
3202
|
-
qualifiedEntityName: et,
|
|
3203
|
-
columns: Array.from(n.values())
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
return { columnGroups: t, columns: Ca(t) };
|
|
3207
|
-
}
|
|
3208
|
-
function Vo(e, t) {
|
|
3209
|
-
const i = e.answers.relationshipIds;
|
|
3210
|
-
return !i || !t ? !i && !t : i.length === t.length && i.every((n, r) => t[r] === n);
|
|
3211
|
-
}
|
|
3212
|
-
const Ia = /* @__PURE__ */ new Set([
|
|
3213
|
-
"dataset_not_reachable",
|
|
3214
|
-
"field_not_resolvable",
|
|
3215
|
-
"missing_metadata",
|
|
3216
|
-
"unsupported_calculated_filter",
|
|
3217
|
-
"relationship_unsupported",
|
|
3218
|
-
"relationship_missing",
|
|
3219
|
-
"relationship_ambiguous"
|
|
3220
|
-
]);
|
|
3221
|
-
function L(e) {
|
|
3222
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
3223
|
-
}
|
|
3224
|
-
function xa(e) {
|
|
3225
|
-
if (L(e))
|
|
3226
|
-
switch (e.status) {
|
|
3227
|
-
case "applied": {
|
|
3228
|
-
const t = Ot(e.route);
|
|
3229
|
-
return t ? { status: "applied", route: t } : void 0;
|
|
3230
|
-
}
|
|
3231
|
-
case "skipped":
|
|
3232
|
-
return typeof e.reason == "string" && Ia.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
|
|
3233
|
-
case "needsPath":
|
|
3234
|
-
return { status: "needsPath" };
|
|
3235
|
-
case "blocked":
|
|
3236
|
-
return typeof e.message == "string" ? { status: "blocked", message: e.message } : void 0;
|
|
3237
|
-
case "kept":
|
|
3238
|
-
return { status: "kept" };
|
|
3239
|
-
case "notRelationship":
|
|
3240
|
-
return { status: "notRelationship" };
|
|
3241
|
-
default:
|
|
3242
|
-
return;
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
function ai(e) {
|
|
3246
|
-
if (e !== void 0)
|
|
3247
|
-
return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
|
|
3248
|
-
}
|
|
3249
|
-
function Sa(e) {
|
|
3250
|
-
if (!L(e)) return;
|
|
3251
|
-
const t = Ot(e.route), i = e.target;
|
|
3252
|
-
if (!(!t || !L(i) || i.kind !== "relationship" || !L(i.field) || typeof i.field.name != "string" || !L(i.field.source) || i.field.source.kind !== "semantic" || !ai(i.relationshipIds)))
|
|
3253
|
-
return { route: t, target: i };
|
|
3254
|
-
}
|
|
3255
|
-
function ko(e) {
|
|
3256
|
-
if (!L(e) || !Array.isArray(e.previews)) return { previews: [] };
|
|
3257
|
-
const t = [];
|
|
3258
|
-
for (const n of e.previews) {
|
|
3259
|
-
if (!L(n) || typeof n.cardId != "string" || !n.cardId || !L(n.answers)) continue;
|
|
3260
|
-
const r = ai(n.answers.relationshipIds), a = xa(n.outcome), o = Array.isArray(n.paths) ? n.paths.map(Sa) : [];
|
|
3261
|
-
r === null || !a || !o.every(Boolean) || a.status === "needsPath" && o.length < 2 || t.push({
|
|
3262
|
-
cardId: n.cardId,
|
|
3263
|
-
answers: r ? { relationshipIds: r } : {},
|
|
3264
|
-
outcome: a,
|
|
3265
|
-
paths: o
|
|
3266
|
-
});
|
|
3267
|
-
}
|
|
3268
|
-
const i = L(e.manageRelationships) && typeof e.manageRelationships.href == "string" ? { href: e.manageRelationships.href } : void 0;
|
|
3269
|
-
return { previews: t, ...i ? { manageRelationships: i } : {} };
|
|
3270
|
-
}
|
|
3271
|
-
const se = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
|
|
3272
|
-
function Ma(e) {
|
|
3273
|
-
return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
|
|
3274
|
-
}
|
|
3275
|
-
function Bo(e) {
|
|
3276
|
-
if (e.direction === "to_many") {
|
|
3277
|
-
const i = se(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
|
|
3278
|
-
return `${e.base ? Ma(se(e.base)) : "Rows"} with at least one matching ${i}`;
|
|
3279
|
-
}
|
|
3280
|
-
return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(se).join(", ")}`;
|
|
3281
|
-
}
|
|
3282
|
-
const Ko = "The relationship this card used changed; choose it again";
|
|
3283
|
-
function Lo(e, t) {
|
|
3284
|
-
switch (e) {
|
|
3285
|
-
case "relationship_missing":
|
|
3286
|
-
return t ? `Not related to ${se(t)}` : "Not related to this card";
|
|
3287
|
-
case "relationship_ambiguous":
|
|
3288
|
-
return "Connects through more than one path";
|
|
3289
|
-
case "relationship_unsupported":
|
|
3290
|
-
return "Can't be applied to this card";
|
|
3291
|
-
case "dataset_not_reachable":
|
|
3292
|
-
case "field_not_resolvable":
|
|
3293
|
-
case "missing_metadata":
|
|
3294
|
-
case "unsupported_calculated_filter":
|
|
3295
|
-
return "No matching field on this card";
|
|
3296
|
-
default:
|
|
3297
|
-
return String(e);
|
|
3298
|
-
}
|
|
3299
|
-
}
|
|
3300
|
-
export {
|
|
3301
|
-
mr as $,
|
|
3302
|
-
ke as A,
|
|
3303
|
-
xr as B,
|
|
3304
|
-
yr as C,
|
|
3305
|
-
Ha as D,
|
|
3306
|
-
Co as E,
|
|
3307
|
-
vo as F,
|
|
3308
|
-
j as G,
|
|
3309
|
-
ce as H,
|
|
3310
|
-
Qa as I,
|
|
3311
|
-
kr as J,
|
|
3312
|
-
Br as K,
|
|
3313
|
-
bo as L,
|
|
3314
|
-
xo as M,
|
|
3315
|
-
Nr as N,
|
|
3316
|
-
Bn as O,
|
|
3317
|
-
Vn as P,
|
|
3318
|
-
kn as Q,
|
|
3319
|
-
Ko as R,
|
|
3320
|
-
po as S,
|
|
3321
|
-
ro as T,
|
|
3322
|
-
rr as U,
|
|
3323
|
-
_e as V,
|
|
3324
|
-
eo as W,
|
|
3325
|
-
lo as X,
|
|
3326
|
-
uo as Y,
|
|
3327
|
-
co as Z,
|
|
3328
|
-
Nt as _,
|
|
3329
|
-
So as a,
|
|
3330
|
-
Sr as a0,
|
|
3331
|
-
te as a1,
|
|
3332
|
-
so as a2,
|
|
3333
|
-
fo as a3,
|
|
3334
|
-
Wn as a4,
|
|
3335
|
-
nr as a5,
|
|
3336
|
-
br as a6,
|
|
3337
|
-
vr as a7,
|
|
3338
|
-
mo as a8,
|
|
3339
|
-
Ie as a9,
|
|
3340
|
-
da as aA,
|
|
3341
|
-
ee as aB,
|
|
3342
|
-
Ve as aC,
|
|
3343
|
-
Mo as aD,
|
|
3344
|
-
Po as aE,
|
|
3345
|
-
Do as aF,
|
|
3346
|
-
sa as aG,
|
|
3347
|
-
ya as aH,
|
|
3348
|
-
_o as aI,
|
|
3349
|
-
Ao as aJ,
|
|
3350
|
-
To as aK,
|
|
3351
|
-
ua as aL,
|
|
3352
|
-
Fo as aM,
|
|
3353
|
-
Rr as aN,
|
|
3354
|
-
fr as aO,
|
|
3355
|
-
Eo as aP,
|
|
3356
|
-
ut as aQ,
|
|
3357
|
-
ga as aR,
|
|
3358
|
-
Z as aS,
|
|
3359
|
-
Ya as aT,
|
|
3360
|
-
pr as aa,
|
|
3361
|
-
no as ab,
|
|
3362
|
-
to as ac,
|
|
3363
|
-
io as ad,
|
|
3364
|
-
Xn as ae,
|
|
3365
|
-
Jn as af,
|
|
3366
|
-
ao as ag,
|
|
3367
|
-
jt as ah,
|
|
3368
|
-
$n as ai,
|
|
3369
|
-
Ja as aj,
|
|
3370
|
-
Mr as ak,
|
|
3371
|
-
Rn as al,
|
|
3372
|
-
Ga as am,
|
|
3373
|
-
Ln as an,
|
|
3374
|
-
Oe as ao,
|
|
3375
|
-
Xa as ap,
|
|
3376
|
-
Za as aq,
|
|
3377
|
-
ue as ar,
|
|
3378
|
-
ie as as,
|
|
3379
|
-
Wa as at,
|
|
3380
|
-
oo as au,
|
|
3381
|
-
lr as av,
|
|
3382
|
-
Lr as aw,
|
|
3383
|
-
No as ax,
|
|
3384
|
-
ri as ay,
|
|
3385
|
-
wo as az,
|
|
3386
|
-
Io as b,
|
|
3387
|
-
yo as c,
|
|
3388
|
-
fa as d,
|
|
3389
|
-
qr as e,
|
|
3390
|
-
$r as f,
|
|
3391
|
-
Ua as g,
|
|
3392
|
-
Nn as h,
|
|
3393
|
-
Dr as i,
|
|
3394
|
-
wr as j,
|
|
3395
|
-
Pr as k,
|
|
3396
|
-
ho as l,
|
|
3397
|
-
Or as m,
|
|
3398
|
-
Ar as n,
|
|
3399
|
-
go as o,
|
|
3400
|
-
_r as p,
|
|
3401
|
-
va as q,
|
|
3402
|
-
Oo as r,
|
|
3403
|
-
Fa as s,
|
|
3404
|
-
Ca as t,
|
|
3405
|
-
Ro as u,
|
|
3406
|
-
Vo as v,
|
|
3407
|
-
ko as w,
|
|
3408
|
-
Ma as x,
|
|
3409
|
-
Bo as y,
|
|
3410
|
-
Lo as z
|
|
3411
|
-
};
|