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