react-semaphor 0.1.555 → 0.1.557
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/DATA_APP_SDK.md +6 -29
- package/dist/analytics-protocol/index.js +20 -21
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +426 -444
- package/dist/briefings/index.js +56 -57
- package/dist/chunks/{analytics-base-schemas-BKs3flFS.js → analytics-base-schemas-BUFUoO6G.js} +2 -2
- package/dist/chunks/{assistant-chat-8NZP6m-u.js → assistant-chat-WMTpYirZ.js} +79 -81
- package/dist/chunks/{bookmark-state-BAeGKd3s.js → bookmark-state-PjQpxbG7.js} +3 -3
- package/dist/chunks/{braces-o9UiRQes.js → braces-BOErQVyi.js} +1 -1
- package/dist/chunks/comparison-window-caption-Dc7BaCMz.js +1218 -0
- package/dist/chunks/{context-BerEBuFR.js → context-DVy4HOU0.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-Gw-Ggg3O.js → custom-visual-inputs-CxYI-gFa.js} +31 -33
- package/dist/chunks/{dashboard-Ds68ckO3.js → dashboard-4D8Vy4pL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DlTr-VGc.js → dashboard-briefing-launcher-C4EmOfxs.js} +149 -151
- package/dist/chunks/{dashboard-controls-oNXJZN6x.js → dashboard-controls-DBWykmvL.js} +171 -173
- package/dist/chunks/{dashboard-json-CW7Q_efH.js → dashboard-json-DiX-p0F7.js} +21 -22
- package/dist/chunks/{document-dashboard-inputs-C21mL3ib.js → document-dashboard-inputs-DP5hquBR.js} +32 -32
- package/dist/chunks/{edit-dashboard-visual-BnnT_oKR.js → edit-dashboard-visual-n1jLV_7V.js} +5842 -5955
- package/dist/chunks/{filter-reach-copy-DlNPHbE-.js → filter-reach-copy-BB9iakLA.js} +915 -986
- package/dist/chunks/{filter-value-text-DMrpj4h9.js → filter-value-text-CUBpotVN.js} +5 -5
- package/dist/chunks/{global-date-filter-utils-7OboTgrM.js → global-date-filter-utils-Cc5tqkoW.js} +2908 -3112
- package/dist/chunks/{index-B2k6KtUN.js → index-CgjhzkKM.js} +72 -80
- package/dist/chunks/{index-CtoK1Lgu.js → index-dIV-Gdsb.js} +159 -161
- package/dist/chunks/{layout-grid-Bgzth8vd.js → layout-grid-CcNklCwL.js} +1 -1
- package/dist/chunks/{list-filter-DsaTbM3J.js → list-filter-Ds_4UTpD.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DPVGg1mU.js → matrix-analytical-definition-4GTUDheD.js} +22 -22
- package/dist/chunks/{matrix-card-D9bsdAye.js → matrix-card-fS_4O7zA.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-DRWcJ8Mi.js → matrix-member-presentation-Dj7HaAHC.js} +1 -1
- package/dist/chunks/{matrix-operation-contract--lMaLlpV.js → matrix-operation-contract-CpgLZ7E5.js} +52 -52
- package/dist/chunks/{metric-comparison-CYIt2F5X.js → metric-comparison-C8LY7GG5.js} +4 -4
- package/dist/chunks/{model-change-B0rAK-5w.js → model-change-CJEj3ZD6.js} +1 -1
- package/dist/chunks/{palette-D10o_yYX.js → palette-DMkIhagj.js} +1 -1
- package/dist/chunks/{matrix-formatter-K2OVPJQI.js → pivot-result-contract-expectations-DMk-mKhG.js} +451 -402
- package/dist/chunks/pivot-result-identity-CrQ54Xbj.js +77 -0
- package/dist/chunks/{raw-temporal-presentation-CivONfcO.js → raw-temporal-presentation-DdEpgPRB.js} +25 -26
- package/dist/chunks/report-preferences-dialog-CFg5VFLk.js +2109 -0
- package/dist/chunks/{report-runtime-context-BaIKSaja.js → report-runtime-context-CohdtiMg.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-CIm9A8_j.js → resolve-dashboard-input-context-Djl3kCFL.js} +1396 -1550
- package/dist/chunks/{save-CfJpQQ68.js → save-D1EpMcwT.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-akb9JfOL.js → saved-dashboard-context-umlQFevH.js} +9 -9
- package/dist/chunks/selection-reducer-_d6aKJnj.js +46 -0
- package/dist/chunks/{semaphor-ready-indicator-Ba7dwP5_.js → semaphor-ready-indicator-4cOp6sla.js} +54479 -63899
- package/dist/chunks/{shelf-drop-preview-context-5rg3pJHW.js → shelf-drop-preview-context-DAtRuvR7.js} +7 -7
- package/dist/chunks/{source-entity-resolution-CGymm5td.js → source-entity-resolution-DXW1HpKf.js} +1 -1
- package/dist/chunks/{switch-B-UTI6v-.js → switch-9CJt5EF_.js} +1431 -1342
- package/dist/chunks/{table-export-sheet-CgO6gaSM.js → table-export-sheet-CTCTA_bd.js} +1 -1
- package/dist/chunks/{table-settings-DOT_Bv1m.js → table-settings-DF1gdVQR.js} +3 -3
- package/dist/chunks/temporal-input-presentation-DoSniQj1.js +2939 -0
- package/dist/chunks/{token-types-DYECHYGH.js → token-types-DFyLflLY.js} +1 -1
- package/dist/chunks/{upload-BFX7apKV.js → upload-LSNKpt0w.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BHNs0wl7.js → use-create-flow-overlay-state-esyMT9vU.js} +125 -127
- package/dist/chunks/{validators-ClKLGDGZ.js → validators-hmfNNQz8.js} +305 -307
- package/dist/chunks/zoned-wall-clock-E35Frf9v.js +191 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +168 -169
- package/dist/data-app-sdk/index.js +789 -4154
- 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 +234 -253
- package/dist/index.js +233 -235
- package/dist/layouts/index.js +1 -1
- package/dist/pdf-export-policy/index.js +9 -11
- 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/brand-studio/brand-studio-draft.d.ts +0 -3
- package/dist/types/brand-studio/index.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -1
- package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -6
- package/dist/types/data-app-sdk/contracts.d.ts +0 -146
- package/dist/types/data-app-sdk/index.d.ts +0 -2
- package/dist/types/index.js +27 -28
- package/dist/types/lib/api/exports-api.d.ts +1 -1
- package/dist/types/lib/charts/table-chart-types.d.ts +1 -1
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +0 -3
- package/dist/types/lib/document/document-edits.d.ts +1 -1
- package/dist/types/lib/document/document-section-kinds.d.ts +2 -4
- package/dist/types/lib/document/document-table-data-policy.d.ts +1 -2
- package/dist/types/lib/formatters/grouped-temporal-activation.d.ts +3 -3
- package/dist/types/lib/formatters/grouped-temporal-presentation.d.ts +0 -6
- package/dist/types/lib/query-context/card-server-request.d.ts +0 -1
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +1 -1
- package/dist/types/lib/types/common-types.d.ts +0 -7
- package/dist/types/lib/types/explorer-types.d.ts +1 -14
- package/dist/types/lib/utils/card-config-utils.d.ts +11 -1
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +1 -2
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +1 -7
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +9 -4
- package/dist/types/shared/format-utils/grouped-table-presentation.d.ts +0 -14
- package/dist/types/shared/format-utils/index.d.ts +0 -2
- package/dist/types/shared/format-utils/pdf-export-policy.d.ts +1 -1
- package/dist/types/shared/format-utils/pivot-result-contract-expectations.d.ts +2 -20
- package/dist/types/shared/format-utils/pivot-result-identity.d.ts +0 -20
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +0 -1
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +0 -4
- package/package.json +2 -4
- package/src/data-app-sdk/README.md +7 -31
- package/dist/chunks/comparison-window-caption-C2WNTlxK.js +0 -1433
- package/dist/chunks/pivot-header-presentation-CX4fkRuG.js +0 -42
- package/dist/chunks/pivot-result-identity-BHJGZwIc.js +0 -94
- package/dist/chunks/pivot-result-lifecycle-BygCpOhk.js +0 -1238
- package/dist/chunks/raw-temporal-contract-WuXA8jBP.js +0 -64
- package/dist/chunks/report-preferences-dialog-D_KyuEFx.js +0 -2261
- package/dist/chunks/selection-reducer-yw_JgICP.js +0 -111
- package/dist/chunks/temporal-bucket-C4rqmwaQ.js +0 -2071
- package/dist/chunks/x-4f5U2XwU.js +0 -100
- package/dist/chunks/zoned-wall-clock-MulfA26h.js +0 -129
- package/dist/types/components/visual/pivot-table/types.d.ts +0 -80
- package/dist/types/data-app-sdk/devtools/index.d.ts +0 -49
- package/dist/types/data-app-sdk/devtools.d.ts +0 -1
- package/dist/types/shared/format-utils/aggregate-table-row-presentation.d.ts +0 -85
- package/dist/types/shared/format-utils/pivot-result-lifecycle.d.ts +0 -55
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
var Ke = Object.defineProperty;
|
|
2
|
+
var Ve = (e, t, r) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var ae = (e, t, r) => Ve(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { i as Ue, k as N, n as je, ad as Ee, c as Be, p as ze, a6 as He, a as Xe, b as V, Q as se, a1 as Ge, O as qe, a2 as We, a3 as Ye, P as ie, I as Ze, K as Je, S as Qe, a5 as et, aj as R } from "./temporal-input-presentation-DoSniQj1.js";
|
|
5
|
+
import { i as Se, m as J, l as Fe, n as tt, o as ke, a as le, d as rt, j as nt, q as L } from "./pivot-result-contract-expectations-DMk-mKhG.js";
|
|
6
|
+
import { h as H, e as ot, p as at, k as st } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
+
import { aI as O, ab as it, t as B, aH as lt, v as Q, u as ct } from "./validators-hmfNNQz8.js";
|
|
8
|
+
import "./matrix-operation-contract-CpgLZ7E5.js";
|
|
9
|
+
import "./analytics-base-schemas-BUFUoO6G.js";
|
|
10
|
+
import "zod";
|
|
11
|
+
import { PDF_SAFETY_LIMIT_EXCEEDED as Me, getUtf8ByteLength as ut, FAST_PDF_POLICY as mt } from "../pdf-export-policy/index.js";
|
|
12
|
+
import { c as dt, b as ce } from "./pivot-result-identity-CrQ54Xbj.js";
|
|
13
|
+
import { v as ft, g as pt } from "./zoned-wall-clock-E35Frf9v.js";
|
|
14
|
+
function yt(e, t, r) {
|
|
15
|
+
const n = {
|
|
16
|
+
...t,
|
|
17
|
+
locale: t.locale ?? r
|
|
18
|
+
};
|
|
19
|
+
if (n.type === "number")
|
|
20
|
+
return N(e, n);
|
|
21
|
+
const { prefix: o, suffix: l, ...s } = n;
|
|
22
|
+
return `${o ?? ""}${N(e, {
|
|
23
|
+
...s,
|
|
24
|
+
negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
|
|
25
|
+
})}${l ?? ""}`;
|
|
26
|
+
}
|
|
27
|
+
function W(e, t, r) {
|
|
28
|
+
return e === null ? { value: e, text: null } : !t || !Ue(t) && t.type !== "duration" ? {
|
|
29
|
+
value: e,
|
|
30
|
+
text: N(e, { type: "number", locale: r })
|
|
31
|
+
} : t.type === "duration" ? {
|
|
32
|
+
value: e,
|
|
33
|
+
text: je(e, {
|
|
34
|
+
inputUnit: t.inputUnit,
|
|
35
|
+
outputStyle: t.outputStyle,
|
|
36
|
+
largestUnit: t.largestUnit,
|
|
37
|
+
smallestUnit: t.smallestUnit,
|
|
38
|
+
maxUnits: t.maxUnits,
|
|
39
|
+
prefix: t.prefix,
|
|
40
|
+
suffix: t.suffix,
|
|
41
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
42
|
+
})
|
|
43
|
+
} : { value: e, text: yt(e, t, r) };
|
|
44
|
+
}
|
|
45
|
+
function ue(e, t, r, n) {
|
|
46
|
+
return e === null ? { value: e, text: null } : n === "percent" ? {
|
|
47
|
+
value: e,
|
|
48
|
+
text: N(e, {
|
|
49
|
+
type: "percent",
|
|
50
|
+
locale: r,
|
|
51
|
+
minimumFractionDigits: t,
|
|
52
|
+
maximumFractionDigits: t,
|
|
53
|
+
percentValueMode: "fraction"
|
|
54
|
+
})
|
|
55
|
+
} : {
|
|
56
|
+
value: e,
|
|
57
|
+
text: N(e, {
|
|
58
|
+
type: "number",
|
|
59
|
+
locale: r,
|
|
60
|
+
minimumFractionDigits: t,
|
|
61
|
+
maximumFractionDigits: t,
|
|
62
|
+
suffix: "×"
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function me(e, t) {
|
|
67
|
+
if (e === void 0) return t;
|
|
68
|
+
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
69
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
70
|
+
return e;
|
|
71
|
+
}
|
|
72
|
+
function wr(e, t) {
|
|
73
|
+
const r = {
|
|
74
|
+
mode: t.displayMode,
|
|
75
|
+
current: W(
|
|
76
|
+
e.currentValue,
|
|
77
|
+
t.metricFormat,
|
|
78
|
+
t.locale
|
|
79
|
+
),
|
|
80
|
+
comparison: W(
|
|
81
|
+
e.comparisonValue,
|
|
82
|
+
t.metricFormat,
|
|
83
|
+
t.locale
|
|
84
|
+
)
|
|
85
|
+
};
|
|
86
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = W(
|
|
87
|
+
e.delta,
|
|
88
|
+
t.metricFormat,
|
|
89
|
+
t.locale
|
|
90
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = ue(
|
|
91
|
+
e.percentChange,
|
|
92
|
+
me(t.precision, 1),
|
|
93
|
+
t.locale,
|
|
94
|
+
"percent"
|
|
95
|
+
)), t.displayMode === "ratio" && (r.ratio = ue(
|
|
96
|
+
e.ratio,
|
|
97
|
+
me(t.precision, 2),
|
|
98
|
+
t.locale,
|
|
99
|
+
"ratio"
|
|
100
|
+
)), r;
|
|
101
|
+
}
|
|
102
|
+
const bt = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
|
|
103
|
+
function ht(e) {
|
|
104
|
+
const { presentation: t } = e;
|
|
105
|
+
return e.formattedValues ? (t == null ? void 0 : t.kind) === "text" || (t == null ? void 0 : t.kind) === "measure" && t.format.type === "duration" ? "text" : (t == null ? void 0 : t.kind) === "temporal_bucket" ? bt.has(t.grain) ? "date" : "text" : (t == null ? void 0 : t.kind) === "datetime" ? "date" : e.dataType === "number" ? "number" : e.dataType === "boolean" ? "boolean" : e.dataType === "unknown" ? "by_value" : "text" : "by_value";
|
|
106
|
+
}
|
|
107
|
+
function gt(e) {
|
|
108
|
+
const t = (o, l) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : l, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
|
|
109
|
+
return n === 0 ? "" : `.${"0".repeat(n)}`;
|
|
110
|
+
}
|
|
111
|
+
function Y(e) {
|
|
112
|
+
return `"${e.replace(/"/g, "")}"`;
|
|
113
|
+
}
|
|
114
|
+
function wt(e) {
|
|
115
|
+
let t;
|
|
116
|
+
try {
|
|
117
|
+
t = new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
118
|
+
style: "currency",
|
|
119
|
+
currency: e.currency || "USD"
|
|
120
|
+
}).formatToParts(1);
|
|
121
|
+
} catch {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const r = t.findIndex((l) => l.type === "currency"), n = t.findIndex((l) => l.type === "integer");
|
|
125
|
+
if (r < 0 || n < 0) return;
|
|
126
|
+
const o = (l, s) => t.slice(l, s).filter((c) => c.type === "literal").map((c) => c.value.replace(/\s/g, " ")).join("");
|
|
127
|
+
return r < n ? { side: "before", text: t[r].value + o(r + 1, n) } : {
|
|
128
|
+
side: "after",
|
|
129
|
+
text: o(n + 1, r) + t[r].value
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function vt(e) {
|
|
133
|
+
const t = gt(e);
|
|
134
|
+
let r;
|
|
135
|
+
if (e.type === "scientific")
|
|
136
|
+
r = `0${t}E+00`;
|
|
137
|
+
else {
|
|
138
|
+
const n = `${e.useGrouping === !1 ? "0" : "#,##0"}${t}`;
|
|
139
|
+
if (e.type === "currency") {
|
|
140
|
+
const o = wt(e);
|
|
141
|
+
r = o ? o.side === "before" ? `${Y(o.text)}${n}` : `${n}${Y(o.text)}` : n;
|
|
142
|
+
} else e.type === "percent" ? r = e.percentValueMode === "whole" ? `${n}${Y("%")}` : `${n}%` : r = n;
|
|
143
|
+
}
|
|
144
|
+
return e.negativeStyle === "parentheses" ? `${r};(${r})` : r;
|
|
145
|
+
}
|
|
146
|
+
function Ct(e, t) {
|
|
147
|
+
if (!e.formattedValues) return;
|
|
148
|
+
const { presentation: r } = e;
|
|
149
|
+
if (t === "number" || t === "by_value")
|
|
150
|
+
return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : vt(r.format);
|
|
151
|
+
if (t === "date") {
|
|
152
|
+
if ((r == null ? void 0 : r.kind) === "temporal_bucket")
|
|
153
|
+
return r.grain === "day" ? "yyyy-mm-dd" : r.grain === "month" ? "mmm yyyy" : "yyyy-mm-dd hh:mm";
|
|
154
|
+
if ((r == null ? void 0 : r.kind) === "datetime")
|
|
155
|
+
return r.dateOnly ? "yyyy-mm-dd" : "yyyy-mm-dd hh:mm:ss";
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function de(e) {
|
|
159
|
+
const t = ht(e), r = Ct(e, t);
|
|
160
|
+
return Object.freeze({
|
|
161
|
+
key: e.key,
|
|
162
|
+
label: e.label,
|
|
163
|
+
cellType: t,
|
|
164
|
+
...r === void 0 ? {} : { numberFormat: r }
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const xt = 15, Tt = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
168
|
+
function Ie(e) {
|
|
169
|
+
return Tt.test(e) ? e : void 0;
|
|
170
|
+
}
|
|
171
|
+
function fe(e) {
|
|
172
|
+
const r = e.replace(/^-/, "").replace(/[eE].*$/, "").replace(".", "").replace(/^0+/, "").replace(/0+$/, "");
|
|
173
|
+
if (r.length > xt) return !1;
|
|
174
|
+
const n = Number(e);
|
|
175
|
+
return Number.isFinite(n) && (n !== 0 || r.length === 0);
|
|
176
|
+
}
|
|
177
|
+
const Et = Date.UTC(1900, 2, 1), St = Date.UTC(1e4, 0, 1), Ft = Date.UTC(1899, 11, 30), kt = 864e5;
|
|
178
|
+
function Mt(e) {
|
|
179
|
+
const t = Date.UTC(
|
|
180
|
+
e.year,
|
|
181
|
+
e.month - 1,
|
|
182
|
+
e.day,
|
|
183
|
+
e.hour,
|
|
184
|
+
e.minute,
|
|
185
|
+
e.second
|
|
186
|
+
);
|
|
187
|
+
if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Et || t >= St))
|
|
188
|
+
return (t - Ft) / kt;
|
|
189
|
+
}
|
|
190
|
+
function pe(e, t, r) {
|
|
191
|
+
if (typeof e == "number")
|
|
192
|
+
return Number.isFinite(e) ? { kind: "number", text: t, value: e } : void 0;
|
|
193
|
+
if (O(e))
|
|
194
|
+
return fe(e.value) ? { kind: "number", text: t, value: e } : void 0;
|
|
195
|
+
if (r && typeof e == "string") {
|
|
196
|
+
const n = Ie(e);
|
|
197
|
+
return n !== void 0 && fe(n) ? { kind: "number", text: t, value: n } : void 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function U(e) {
|
|
201
|
+
const { value: t, text: r, column: n } = e;
|
|
202
|
+
if (r === "") return { kind: "empty" };
|
|
203
|
+
const o = { kind: "text", text: r };
|
|
204
|
+
switch (n.cellType) {
|
|
205
|
+
case "text":
|
|
206
|
+
return o;
|
|
207
|
+
case "date": {
|
|
208
|
+
const l = e.wallClock ? Mt(e.wallClock) : void 0;
|
|
209
|
+
return l === void 0 ? o : { kind: "date", text: r, serial: l };
|
|
210
|
+
}
|
|
211
|
+
case "number":
|
|
212
|
+
return pe(t, r, !0) ?? o;
|
|
213
|
+
case "boolean":
|
|
214
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : o;
|
|
215
|
+
case "by_value":
|
|
216
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : pe(t, r, !1) ?? o;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function vr(e) {
|
|
220
|
+
return e.kind === "empty" ? "" : e.text;
|
|
221
|
+
}
|
|
222
|
+
const $e = 1e4, It = 1e6, Cr = 5e6, xr = 1024 ** 3, Tr = 1024 ** 3;
|
|
223
|
+
function Er(e) {
|
|
224
|
+
return e > $e;
|
|
225
|
+
}
|
|
226
|
+
function Sr(e) {
|
|
227
|
+
return e.cardType === "matrixTable" ? "try-direct" : e.loadedRowCount === null || e.loadedRowCount <= $e ? "direct" : e.loadedRowCount <= It ? "background" : "blocked";
|
|
228
|
+
}
|
|
229
|
+
const Fr = {
|
|
230
|
+
rowLabels: "tabular",
|
|
231
|
+
subtotals: "after"
|
|
232
|
+
};
|
|
233
|
+
function kr(e, t) {
|
|
234
|
+
const r = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
|
|
235
|
+
return {
|
|
236
|
+
...e,
|
|
237
|
+
layout: r,
|
|
238
|
+
totals: {
|
|
239
|
+
...e.totals,
|
|
240
|
+
rows: {
|
|
241
|
+
...n,
|
|
242
|
+
levels: Object.fromEntries(
|
|
243
|
+
Object.entries(n.levels).map(([o, l]) => [
|
|
244
|
+
o,
|
|
245
|
+
{ ...l, position: t.subtotals }
|
|
246
|
+
])
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const $t = 2;
|
|
253
|
+
function Lt(e) {
|
|
254
|
+
return typeof e == "number" ? Number.isInteger(e) : O(e) ? !e.value.includes(".") : !0;
|
|
255
|
+
}
|
|
256
|
+
function Pt(e, t, r) {
|
|
257
|
+
const n = e.descriptors.measures.filter(
|
|
258
|
+
(s) => r.measureFormats[s.id] === void 0 && s.semanticFormat === void 0 && it(s.column.dataType) === "number"
|
|
259
|
+
);
|
|
260
|
+
if (n.length === 0) return r;
|
|
261
|
+
const o = /* @__PURE__ */ new Set();
|
|
262
|
+
e.columns.forEach((s, c) => {
|
|
263
|
+
if (!(s.kind !== "measure" || o.has(s.measureId)))
|
|
264
|
+
for (const f of t) {
|
|
265
|
+
const d = f.values[c];
|
|
266
|
+
if ((d == null ? void 0 : d.kind) === "value" && !Lt(d.value)) {
|
|
267
|
+
o.add(s.measureId);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const l = { ...r.measureFormats };
|
|
273
|
+
for (const { id: s } of n) {
|
|
274
|
+
const c = o.has(s) ? $t : 0;
|
|
275
|
+
l[s] = {
|
|
276
|
+
type: "number",
|
|
277
|
+
minimumFractionDigits: c,
|
|
278
|
+
maximumFractionDigits: c,
|
|
279
|
+
useGrouping: !0
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return { ...r, measureFormats: l };
|
|
283
|
+
}
|
|
284
|
+
function j(e) {
|
|
285
|
+
return B(e.slice(0, -1));
|
|
286
|
+
}
|
|
287
|
+
function Dt(e, t) {
|
|
288
|
+
return t.length > e.length && B(t.slice(0, e.length)) === B(e);
|
|
289
|
+
}
|
|
290
|
+
function _t(e) {
|
|
291
|
+
return e.map((t, r) => {
|
|
292
|
+
if (r === 0 || t.kind !== "layout") return !1;
|
|
293
|
+
const n = e[r - 1];
|
|
294
|
+
if (n.kind !== "layout") return !1;
|
|
295
|
+
if (t.role !== "member" || Dt(n.rowPath, t.rowPath)) return !0;
|
|
296
|
+
const o = e[r - 2];
|
|
297
|
+
return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || j(o.rowPath) !== j(n.rowPath)) && t.rowPath.length === n.rowPath.length && j(t.rowPath) === j(n.rowPath);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const At = "pdf-group-continuation";
|
|
301
|
+
function Le(e, t, r) {
|
|
302
|
+
return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || O(t.value)) ? e : H(e);
|
|
303
|
+
}
|
|
304
|
+
function Rt(e, t, r) {
|
|
305
|
+
const n = Se(e.descriptors, t.presentation, r), o = e.columns.map((u) => {
|
|
306
|
+
var a;
|
|
307
|
+
return u.kind === "measure" && ((a = n.measureSemantics.get(u.measureId)) == null ? void 0 : a.isNumeric) === !0;
|
|
308
|
+
}), l = (u) => J([u], n.levels), s = (u, a, m) => Fe(u, a, t.presentation.totals[m], n.levels), c = e.columns.map((u) => {
|
|
309
|
+
if (u.kind !== "measure") return u.label;
|
|
310
|
+
const a = u.columnPath.map(l);
|
|
311
|
+
return u.role !== "member" && a.push(s(u.columnPath, u.role, "columns")), [...a, u.label].join(" / ");
|
|
312
|
+
}), f = Math.min(t.spec.columns.length, Math.max(
|
|
313
|
+
0,
|
|
314
|
+
...e.columns.map((u) => u.kind === "measure" ? u.columnPath.length + (u.role !== "member" ? 1 : 0) : 0)
|
|
315
|
+
)), d = Array.from({ length: f + 1 }, (u, a) => e.columns.map((m) => a === f ? m.label : m.kind !== "measure" ? "" : a < m.columnPath.length ? l(m.columnPath[a]) : a === m.columnPath.length && m.role !== "member" ? s(m.columnPath, m.role, "columns") : "")), h = (u, a) => tt({
|
|
316
|
+
path: u.rowPath,
|
|
317
|
+
role: u.kind === "layout" ? u.role : "member",
|
|
318
|
+
levelCount: Math.max(1, t.spec.rows.length),
|
|
319
|
+
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
320
|
+
previousPath: a == null ? void 0 : a.rowPath
|
|
321
|
+
}), w = (u, a) => {
|
|
322
|
+
if (u.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
323
|
+
if (u.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
324
|
+
const m = h(u, a);
|
|
325
|
+
return e.columns.map((b, p) => {
|
|
326
|
+
if (b.kind === "hierarchy")
|
|
327
|
+
return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${s(u.rowPath, u.role, "rows")}`;
|
|
328
|
+
if (b.kind === "level") {
|
|
329
|
+
const v = t.spec.rows.findIndex((F) => F.id === b.levelId), C = m[v];
|
|
330
|
+
return C != null && C.visible ? C.total ? s(u.rowPath, u.role, "rows") : J(C.path, n.levels) : "";
|
|
331
|
+
}
|
|
332
|
+
const T = u.values[p], g = n.measures.get(b.measureId);
|
|
333
|
+
if (T.kind === "value" && !g)
|
|
334
|
+
throw new Error("Matrix value is missing its measure descriptor.");
|
|
335
|
+
return ke(T, g, t.presentation.absence);
|
|
336
|
+
});
|
|
337
|
+
}, x = (u, a) => w(u, a).map((m, b) => {
|
|
338
|
+
const p = e.columns[b];
|
|
339
|
+
return p.kind === "measure" ? Le(m, u.values[b], n.measureSemantics.get(p.measureId)) : H(m);
|
|
340
|
+
});
|
|
341
|
+
return {
|
|
342
|
+
headers: c,
|
|
343
|
+
headerBands: d,
|
|
344
|
+
numericColumns: o,
|
|
345
|
+
/** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
|
|
346
|
+
formatting: n,
|
|
347
|
+
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
348
|
+
row: (u, a) => w(u, a),
|
|
349
|
+
/**
|
|
350
|
+
* Level columns whose group label the row above shows, so this row
|
|
351
|
+
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
352
|
+
* row continues one: a total prints as a band, and its rules stay whole
|
|
353
|
+
* above and below it.
|
|
354
|
+
*/
|
|
355
|
+
continuedColumns: (u, a) => {
|
|
356
|
+
const m = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
|
|
357
|
+
if (!m(u) || !m(a)) return [];
|
|
358
|
+
const b = h(u, a);
|
|
359
|
+
return e.columns.flatMap((p, T) => {
|
|
360
|
+
var v;
|
|
361
|
+
if (p.kind !== "level") return [];
|
|
362
|
+
const g = t.spec.rows.findIndex((C) => C.id === p.levelId);
|
|
363
|
+
return g < u.rowPath.length && ((v = b[g]) == null ? void 0 : v.visible) === !1 ? [T] : [];
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
csvRow: (u) => x(u),
|
|
367
|
+
/**
|
|
368
|
+
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
369
|
+
* continuation, so a tabular layout prints each label once across the
|
|
370
|
+
* whole file. Retries are pure: suppression never relies on mutable
|
|
371
|
+
* formatter state or an earlier worker. Without it, the first row prints
|
|
372
|
+
* its labels.
|
|
373
|
+
*/
|
|
374
|
+
csvRows: (u, a) => u.map((m, b) => x(m, b ? u[b - 1] : a ?? void 0))
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function Mr(e) {
|
|
378
|
+
return e.columns.map((t) => H(t.label));
|
|
379
|
+
}
|
|
380
|
+
function Ir(e, t, r) {
|
|
381
|
+
return Nt(e, t, r).map((n, o) => {
|
|
382
|
+
const l = t.columns[o];
|
|
383
|
+
return l.kind === "measure" ? Le(n, e.values[o], r.measureSemantics.get(l.measureId)) : H(n);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function Nt(e, t, r) {
|
|
387
|
+
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
388
|
+
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
389
|
+
const n = [...e.rowPath, ...e.columnPath];
|
|
390
|
+
return t.columns.map((o, l) => {
|
|
391
|
+
if (o.kind === "measure") {
|
|
392
|
+
const c = e.values[l], f = r.measures.get(o.measureId);
|
|
393
|
+
if (c.kind === "value" && !f) throw new Error("Matrix value is missing its measure descriptor.");
|
|
394
|
+
return ke(c, f, r.absence);
|
|
395
|
+
}
|
|
396
|
+
const s = o.kind === "level" ? n.find((c) => c.levelId === o.levelId) : void 0;
|
|
397
|
+
if (!s) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
398
|
+
return J([s], r.levels);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function Ot(e) {
|
|
402
|
+
const t = Rt(e.layout, e.request, e.report), r = e.layout.columns.map((s, c) => ({
|
|
403
|
+
index: c,
|
|
404
|
+
columnId: `matrix:${c}`,
|
|
405
|
+
label: t.headers[c],
|
|
406
|
+
isNumeric: t.numericColumns[c]
|
|
407
|
+
})), n = (s, c, f) => ({
|
|
408
|
+
text: s,
|
|
409
|
+
colspan: 1,
|
|
410
|
+
rowspan: 1,
|
|
411
|
+
columnId: r[c].columnId,
|
|
412
|
+
isHeader: f,
|
|
413
|
+
isNumeric: r[c].isNumeric,
|
|
414
|
+
className: r[c].isNumeric ? "numeric" : e.layout.columns[c].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
415
|
+
}), o = [], l = e.layout.columns.findIndex((s) => s.kind === "measure");
|
|
416
|
+
e.request.spec.columns.length && l >= 0 && o.push({
|
|
417
|
+
repeatHeader: !0,
|
|
418
|
+
headerType: "pivot-axis",
|
|
419
|
+
headerRowIndex: 0,
|
|
420
|
+
cells: [
|
|
421
|
+
...l ? [{ ...n("", 0, !0), colspan: l }] : [],
|
|
422
|
+
{
|
|
423
|
+
...n(e.request.spec.columns.map((s) => Ee(s, e.request.presentation)).join(" / "), l, !0),
|
|
424
|
+
colspan: e.layout.columns.length - l,
|
|
425
|
+
isNumeric: !1,
|
|
426
|
+
className: ""
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
});
|
|
430
|
+
for (const [s, c] of t.headerBands.entries())
|
|
431
|
+
o.push({
|
|
432
|
+
repeatHeader: !0,
|
|
433
|
+
headerType: s === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
434
|
+
headerRowIndex: o.length,
|
|
435
|
+
cells: c.map((f, d) => n(f, d, !0))
|
|
436
|
+
});
|
|
437
|
+
return {
|
|
438
|
+
headers: o,
|
|
439
|
+
rows: e.rows.map((s, c) => {
|
|
440
|
+
const f = new Set(t.continuedColumns(s, e.rows[c - 1]));
|
|
441
|
+
return {
|
|
442
|
+
index: c,
|
|
443
|
+
type: s.kind === "layout" && s.role !== "member" ? "subtotal" : "data",
|
|
444
|
+
subtotalLevel: String(s.rowPath.length),
|
|
445
|
+
// A tabular layout prints each label once unless it repeats them; the
|
|
446
|
+
// blank cell continues its group, so a grid draws no rule above it.
|
|
447
|
+
cells: t.row(s, e.rows[c - 1]).map((d, h) => f.has(h) ? { ...n(d, h, !1), className: At } : n(d, h, !1))
|
|
448
|
+
};
|
|
449
|
+
}),
|
|
450
|
+
grandTotal: null,
|
|
451
|
+
// Totals are already in the ordered body at their authored position.
|
|
452
|
+
metadata: {
|
|
453
|
+
tableType: "pivot",
|
|
454
|
+
totalRows: e.rows.length,
|
|
455
|
+
totalColumns: r.length,
|
|
456
|
+
rowLevels: e.layout.columns.filter((s) => s.kind !== "measure").length,
|
|
457
|
+
pivotLevels: e.request.spec.columns.length,
|
|
458
|
+
hasGrandTotal: !1,
|
|
459
|
+
columnOrder: r.map((s) => s.columnId),
|
|
460
|
+
columns: r
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function Kt(e, t, r) {
|
|
465
|
+
const { levels: n } = Se(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, l = [], s = [], c = e.columns.map((d, h) => {
|
|
466
|
+
if (d.kind !== "measure") return null;
|
|
467
|
+
const w = o ? `${d.role}:${B(d.columnPath)}` : `measure:${h}`;
|
|
468
|
+
let x = l.indexOf(w);
|
|
469
|
+
return x < 0 && (x = l.push(w) - 1, s.push(o ? Fe(d.columnPath, d.role, t.presentation.totals.columns, n) : d.label)), x;
|
|
470
|
+
}), f = t.spec.columns[t.spec.columns.length - 1];
|
|
471
|
+
return {
|
|
472
|
+
columnGroups: c,
|
|
473
|
+
groupLabels: s,
|
|
474
|
+
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
475
|
+
groupLevelLabel: f ? Ee(f, t.presentation) : "Measures"
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function $r(e) {
|
|
479
|
+
const { layout: t, rows: r, report: n } = e, o = {
|
|
480
|
+
...e.request,
|
|
481
|
+
presentation: Pt(t, r, e.request.presentation)
|
|
482
|
+
}, l = Ot({ layout: t, rows: r, request: o, report: n }), s = _t(r), c = Kt(t, o, n), f = {
|
|
483
|
+
...l,
|
|
484
|
+
rows: l.rows.map((d, h) => ({ ...d, keepWithPrevious: s[h] })),
|
|
485
|
+
metadata: { ...l.metadata, ...c }
|
|
486
|
+
};
|
|
487
|
+
return { request: o, table: f, ...c };
|
|
488
|
+
}
|
|
489
|
+
class Vt extends Error {
|
|
490
|
+
constructor() {
|
|
491
|
+
super(...arguments);
|
|
492
|
+
ae(this, "code", Me);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function ye(e) {
|
|
496
|
+
if (!e || typeof e != "object")
|
|
497
|
+
return;
|
|
498
|
+
const { error: t, message: r, detail: n } = e;
|
|
499
|
+
for (const o of [t, r, n])
|
|
500
|
+
if (typeof o == "string" && o.trim())
|
|
501
|
+
return o.trim();
|
|
502
|
+
}
|
|
503
|
+
async function Ut(e) {
|
|
504
|
+
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
|
|
505
|
+
try {
|
|
506
|
+
if (r.includes("application/json")) {
|
|
507
|
+
const o = await e.json(), l = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
508
|
+
return { message: ye(o) || t, code: l };
|
|
509
|
+
}
|
|
510
|
+
const n = await e.text();
|
|
511
|
+
if (!n.trim())
|
|
512
|
+
return { message: t };
|
|
513
|
+
try {
|
|
514
|
+
const o = JSON.parse(n), l = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
515
|
+
return {
|
|
516
|
+
message: ye(o) || n.trim(),
|
|
517
|
+
code: l
|
|
518
|
+
};
|
|
519
|
+
} catch {
|
|
520
|
+
return { message: n.trim() };
|
|
521
|
+
}
|
|
522
|
+
} catch {
|
|
523
|
+
return { message: t };
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
async function Lr(e) {
|
|
527
|
+
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
528
|
+
if (ut(e.serializedPayload) > mt.maxRequestBytes)
|
|
529
|
+
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
530
|
+
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
531
|
+
method: "POST",
|
|
532
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
533
|
+
body: e.serializedPayload,
|
|
534
|
+
signal: e.signal
|
|
535
|
+
});
|
|
536
|
+
if (!t.ok) {
|
|
537
|
+
const n = await Ut(t);
|
|
538
|
+
throw n.code === Me ? new Vt(n.message) : new Error(n.message);
|
|
539
|
+
}
|
|
540
|
+
const r = await t.json();
|
|
541
|
+
if (r != null && r.error) throw new Error(r.error);
|
|
542
|
+
if (typeof (r == null ? void 0 : r.url) != "string" || !r.url.trim())
|
|
543
|
+
throw new Error("Fast-path PDF response missing download URL");
|
|
544
|
+
return r;
|
|
545
|
+
}
|
|
546
|
+
function jt(e, t) {
|
|
547
|
+
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === void 0;
|
|
548
|
+
}
|
|
549
|
+
function Pe(e) {
|
|
550
|
+
return new Map(
|
|
551
|
+
e.presentationExecutionSnapshot.resolvedFormats.flatMap(
|
|
552
|
+
(t) => t.format.type === "raw_temporal" && t.target.kind === "column" && jt(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
|
|
553
|
+
)
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
function De(e) {
|
|
557
|
+
const t = e == null ? void 0 : e.sql, r = e == null ? void 0 : e.python;
|
|
558
|
+
return (e == null ? void 0 : e.resultOwner) === "freeform" && typeof t == "string" && !!t.trim() && (typeof r != "string" || !r.trim());
|
|
559
|
+
}
|
|
560
|
+
function Pr(e) {
|
|
561
|
+
return e.formatting.useFormattedValues !== !1 && De(e.queryPayload) && Pe(e.formatting).size > 0;
|
|
562
|
+
}
|
|
563
|
+
function Bt(e, t) {
|
|
564
|
+
return e.map((r, n) => {
|
|
565
|
+
if (!Object.prototype.hasOwnProperty.call(r, t) || r[t] === void 0)
|
|
566
|
+
throw new Error(
|
|
567
|
+
`missing_raw_temporal_result_contract: Row ${n} is missing declared temporal column "${t}".`
|
|
568
|
+
);
|
|
569
|
+
const o = r[t];
|
|
570
|
+
return o === null || typeof o == "string" ? o : String(o);
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function zt(e) {
|
|
574
|
+
if (e.formatting.useFormattedValues === !1)
|
|
575
|
+
return {
|
|
576
|
+
activatedColumnKeys: /* @__PURE__ */ new Set(),
|
|
577
|
+
byColumnKey: /* @__PURE__ */ new Map()
|
|
578
|
+
};
|
|
579
|
+
const t = Pe(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
580
|
+
if (t.size === 0)
|
|
581
|
+
return { activatedColumnKeys: r, byColumnKey: n };
|
|
582
|
+
const o = new Map(
|
|
583
|
+
e.columns.flatMap((c) => {
|
|
584
|
+
const f = c.key || c.field;
|
|
585
|
+
return f ? [[f, c]] : [];
|
|
586
|
+
})
|
|
587
|
+
), l = De(e.queryPayload), s = /* @__PURE__ */ new Map();
|
|
588
|
+
for (const [c, f] of t) {
|
|
589
|
+
const d = o.get(c);
|
|
590
|
+
let h;
|
|
591
|
+
if (d != null && d.rawTemporal)
|
|
592
|
+
h = ft(d, {
|
|
593
|
+
metadataRequired: !0
|
|
594
|
+
}), r.add(c);
|
|
595
|
+
else if (l) {
|
|
596
|
+
r.add(c);
|
|
597
|
+
const w = Be({
|
|
598
|
+
columnKey: c,
|
|
599
|
+
values: Bt(e.records, c)
|
|
600
|
+
});
|
|
601
|
+
s.set(c, w), w.status === "classified" && (h = w.metadata);
|
|
602
|
+
} else
|
|
603
|
+
continue;
|
|
604
|
+
h && n.set(c, {
|
|
605
|
+
metadata: h,
|
|
606
|
+
format: f,
|
|
607
|
+
formatValue: ze({ metadata: h, format: f })
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
activatedColumnKeys: r,
|
|
612
|
+
byColumnKey: n,
|
|
613
|
+
...l ? {
|
|
614
|
+
sqlChunkEvidence: He(s)
|
|
615
|
+
} : {}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function Ht(e) {
|
|
619
|
+
if (!e.resolution.activatedColumnKeys.has(e.columnKey))
|
|
620
|
+
return;
|
|
621
|
+
if (e.value === void 0)
|
|
622
|
+
throw new Error(
|
|
623
|
+
`missing_raw_temporal_result_contract: Row ${e.rowIndex} is missing temporal column "${e.columnKey}".`
|
|
624
|
+
);
|
|
625
|
+
const t = e.resolution.byColumnKey.get(e.columnKey);
|
|
626
|
+
if (!t)
|
|
627
|
+
return { text: e.value === null ? "" : String(e.value) };
|
|
628
|
+
if (e.value !== null && typeof e.value != "string")
|
|
629
|
+
return { text: String(e.value) };
|
|
630
|
+
const r = t.formatValue(e.value);
|
|
631
|
+
return r.ok && r.wallClock ? { text: r.text, wallClock: r.wallClock } : { text: r.text };
|
|
632
|
+
}
|
|
633
|
+
function be(e, t) {
|
|
634
|
+
const r = e.byColumnKey.get(t);
|
|
635
|
+
return r ? r.metadata.valueKind === "date" : void 0;
|
|
636
|
+
}
|
|
637
|
+
const Xt = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), Gt = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, qt = /^\d{4}-\d{2}-\d{2}$/, _e = "MM/dd/yyyy";
|
|
638
|
+
function z(e) {
|
|
639
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
640
|
+
}
|
|
641
|
+
function A(e) {
|
|
642
|
+
return e.key || e.field || void 0;
|
|
643
|
+
}
|
|
644
|
+
function he(e) {
|
|
645
|
+
return e == null ? "" : typeof e == "string" ? e : O(e) ? e.value : e instanceof Date ? e.toISOString() : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
646
|
+
}
|
|
647
|
+
function ge(e, t) {
|
|
648
|
+
var n;
|
|
649
|
+
const r = (n = e.columnSettings) == null ? void 0 : n[t];
|
|
650
|
+
if (!(!z(r) || r.type !== "date"))
|
|
651
|
+
return z(r.dateFormat) ? r.dateFormat : {};
|
|
652
|
+
}
|
|
653
|
+
function we(e) {
|
|
654
|
+
return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || _e;
|
|
655
|
+
}
|
|
656
|
+
function ve(e, t) {
|
|
657
|
+
return e && e !== "auto" ? e : t;
|
|
658
|
+
}
|
|
659
|
+
function Wt(e) {
|
|
660
|
+
return !/[HhKkmsSa]/.test(e.replace(/'[^']*'/g, ""));
|
|
661
|
+
}
|
|
662
|
+
function Yt(e) {
|
|
663
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
664
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
665
|
+
const t = Number(e);
|
|
666
|
+
return Number.isFinite(t) ? t : null;
|
|
667
|
+
}
|
|
668
|
+
function Zt(e) {
|
|
669
|
+
const t = Ie(e);
|
|
670
|
+
if (t !== void 0)
|
|
671
|
+
try {
|
|
672
|
+
return lt(t, /[.eE]/.test(t) ? "decimal" : "integer");
|
|
673
|
+
} catch {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function Jt(e) {
|
|
678
|
+
return e.calendar.fiscalCalendar && (e.granularity === "quarter" || e.granularity === "year") ? "fiscal" : e.granularity;
|
|
679
|
+
}
|
|
680
|
+
function Dr(e) {
|
|
681
|
+
const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, l = (a) => Xe({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } }), s = (a) => qe({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } });
|
|
682
|
+
function c(a) {
|
|
683
|
+
var b;
|
|
684
|
+
if ((b = t.visibleColumns) != null && b.length) return t.visibleColumns;
|
|
685
|
+
const m = a.columns.map(A).filter((p) => !!p);
|
|
686
|
+
return m.length > 0 ? m : a.records[0] ? Object.keys(a.records[0]) : [];
|
|
687
|
+
}
|
|
688
|
+
function f(a, m) {
|
|
689
|
+
return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, a) && t.columnLabels[a] || void 0 || d(m) || (m == null ? void 0 : m.label) || (m == null ? void 0 : m.headerName) || a;
|
|
690
|
+
}
|
|
691
|
+
function d(a, m) {
|
|
692
|
+
const b = a == null ? void 0 : a.pivotIdentity;
|
|
693
|
+
if (!b || !b.members || b.members.length === 0) return;
|
|
694
|
+
const p = ce({ identity: b, columnKey: (a == null ? void 0 : a.key) || (a == null ? void 0 : a.field) || "" });
|
|
695
|
+
return nt({
|
|
696
|
+
members: p,
|
|
697
|
+
metricLabel: (a == null ? void 0 : a.label) || (a == null ? void 0 : a.headerName),
|
|
698
|
+
mode: n ? "formatted" : "canonical",
|
|
699
|
+
resolveTemporalFormat: (T) => {
|
|
700
|
+
const g = p.find((C) => C.fieldId === T);
|
|
701
|
+
if (!(g != null && g.temporalBucket)) return;
|
|
702
|
+
const v = se({
|
|
703
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
704
|
+
scope: o,
|
|
705
|
+
target: { kind: "field", fieldId: T, role: "pivotby" }
|
|
706
|
+
});
|
|
707
|
+
return v ? h(g.temporalBucket, v) : void 0;
|
|
708
|
+
}
|
|
709
|
+
}).flattenedLabel;
|
|
710
|
+
}
|
|
711
|
+
function h(a, m) {
|
|
712
|
+
return Ge({
|
|
713
|
+
metadata: a,
|
|
714
|
+
cardFormat: m,
|
|
715
|
+
locale: m.locale,
|
|
716
|
+
...m.presentation.mode === "auto" ? { styles: m.presentation.styles } : {}
|
|
717
|
+
}).format;
|
|
718
|
+
}
|
|
719
|
+
function w(a, m) {
|
|
720
|
+
const { records: b, columns: p } = a, T = z(r.cardConfig) ? r.cardConfig : void 0, g = T == null ? void 0 : T.pivotByColumns, v = Array.isArray(g) ? g.flatMap(
|
|
721
|
+
(i) => z(i) && typeof i.id == "string" && i.id ? [i.id] : []
|
|
722
|
+
) : [];
|
|
723
|
+
dt(
|
|
724
|
+
p.map((i) => ({ key: A(i) || "<unknown>", pivotIdentity: i.pivotIdentity })),
|
|
725
|
+
{ expectedPivotFieldIds: v }
|
|
726
|
+
);
|
|
727
|
+
const C = c(a), F = new Map(
|
|
728
|
+
p.flatMap((i) => {
|
|
729
|
+
const y = A(i);
|
|
730
|
+
return y ? [[y, i]] : [];
|
|
731
|
+
})
|
|
732
|
+
), Re = new Map(a.resultColumns.map((i) => [i.key, i.dataType])), I = zt({
|
|
733
|
+
records: b,
|
|
734
|
+
columns: p,
|
|
735
|
+
formatting: t,
|
|
736
|
+
queryPayload: r
|
|
737
|
+
}), X = new Map(
|
|
738
|
+
p.flatMap((i) => {
|
|
739
|
+
const y = A(i);
|
|
740
|
+
return y && i.temporalBucket ? [[y, i.temporalBucket]] : [];
|
|
741
|
+
})
|
|
742
|
+
), te = /* @__PURE__ */ new Map();
|
|
743
|
+
for (const i of C) {
|
|
744
|
+
const y = se({
|
|
745
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
746
|
+
scope: o,
|
|
747
|
+
target: { kind: "column", columnKey: i }
|
|
748
|
+
}), E = X.get(i);
|
|
749
|
+
if (n) {
|
|
750
|
+
if (y && !E) throw new Error(`Missing temporal bucket metadata for column "${i}"`);
|
|
751
|
+
if (E && !y) throw new Error(`Missing resolved temporal presentation for column "${i}"`);
|
|
752
|
+
}
|
|
753
|
+
y && E && te.set(i, h(E, y));
|
|
754
|
+
}
|
|
755
|
+
const G = C.map((i) => {
|
|
756
|
+
const y = Re.get(i), E = y && Xt.has(y) ? y : "unknown", S = n ? x(i, I, X) : void 0, M = f(i, F.get(i)), P = n && I.activatedColumnKeys.has(i) && be(I, i) === void 0;
|
|
757
|
+
return {
|
|
758
|
+
key: i,
|
|
759
|
+
label: M,
|
|
760
|
+
dataType: E,
|
|
761
|
+
...S ? { presentation: S } : {},
|
|
762
|
+
xlsx: de({ key: i, label: M, formattedValues: n, dataType: E, presentation: S }),
|
|
763
|
+
...P ? { xlsxPending: !0 } : {}
|
|
764
|
+
};
|
|
765
|
+
});
|
|
766
|
+
function Ne(i, y, E, S) {
|
|
767
|
+
if (!n) return { text: he(i), value: i };
|
|
768
|
+
const M = Ht({ value: i, columnKey: y, rowIndex: E, resolution: I });
|
|
769
|
+
if (M !== void 0) return { text: M.text, value: i, ...M.wallClock ? { wallClock: M.wallClock } : {} };
|
|
770
|
+
const P = X.get(y);
|
|
771
|
+
if (P) {
|
|
772
|
+
const k = te.get(y);
|
|
773
|
+
if (!k) throw new Error(`Missing resolved temporal presentation for column "${y}"`);
|
|
774
|
+
if (i != null && typeof i != "string")
|
|
775
|
+
throw new Error(`Canonical temporal column "${y}" must contain a string or null`);
|
|
776
|
+
const D = i ?? null, _ = We(D, P);
|
|
777
|
+
return {
|
|
778
|
+
text: Ye({ value: D, metadata: P, format: k }),
|
|
779
|
+
value: i,
|
|
780
|
+
..._ ? { wallClock: _ } : {}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
if (i == null) return { text: "", value: i };
|
|
784
|
+
const q = s(y);
|
|
785
|
+
if (q && typeof i == "number" && Number.isFinite(i))
|
|
786
|
+
return {
|
|
787
|
+
text: le(
|
|
788
|
+
new Date(i).toISOString(),
|
|
789
|
+
q.pattern || _e,
|
|
790
|
+
ve(q.timezone, t.timezone),
|
|
791
|
+
"UTC"
|
|
792
|
+
),
|
|
793
|
+
value: i
|
|
794
|
+
};
|
|
795
|
+
const $ = l(y);
|
|
796
|
+
if (typeof i == "number")
|
|
797
|
+
return { text: $ ? V(i, $) : String(i), value: i };
|
|
798
|
+
if (O(i))
|
|
799
|
+
return { text: $ ? V(i, $) : i.value, value: i };
|
|
800
|
+
const K = ge(t, y);
|
|
801
|
+
if (K && (i instanceof Date || typeof i == "string" && Gt.test(i))) {
|
|
802
|
+
const k = i instanceof Date ? i.toISOString() : i, D = typeof i == "string" && qt.test(i), _ = D ? "UTC" : ve(K.timezone, t.timezone), ne = D ? "UTC" : K.sourceTimezone || "auto", oe = rt(k, _, ne);
|
|
803
|
+
return {
|
|
804
|
+
text: le(k, we(K), _, ne),
|
|
805
|
+
value: i,
|
|
806
|
+
...oe ? { wallClock: oe } : {}
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
if (typeof i == "string" && $ && S.dataType === "number") {
|
|
810
|
+
const k = Zt(i);
|
|
811
|
+
if (k) return { text: V(k, $), value: i };
|
|
812
|
+
}
|
|
813
|
+
return { text: he(i), value: i };
|
|
814
|
+
}
|
|
815
|
+
const Oe = b.map(
|
|
816
|
+
(i, y) => G.map((E) => {
|
|
817
|
+
const S = Ne(i[E.key], E.key, y, E);
|
|
818
|
+
return U({ value: S.value, text: S.text, column: E.xlsx, wallClock: S.wallClock });
|
|
819
|
+
})
|
|
820
|
+
), re = (m == null ? void 0 : m.withHeader) !== !1 && t.includeHeaders;
|
|
821
|
+
if (re)
|
|
822
|
+
for (const i of C) {
|
|
823
|
+
const y = F.get(i);
|
|
824
|
+
y != null && y.pivotIdentity && ce({ identity: y.pivotIdentity, columnKey: A(y) || i });
|
|
825
|
+
}
|
|
826
|
+
return {
|
|
827
|
+
...re ? { header: G.map((i) => i.label) } : {},
|
|
828
|
+
columns: G,
|
|
829
|
+
rows: Oe,
|
|
830
|
+
...I.sqlChunkEvidence ? { rawTemporalClassification: I.sqlChunkEvidence } : {}
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
function x(a, m, b) {
|
|
834
|
+
if (m.activatedColumnKeys.has(a)) {
|
|
835
|
+
const v = be(m, a);
|
|
836
|
+
return v === void 0 ? { kind: "text" } : { kind: "datetime", dateOnly: v };
|
|
837
|
+
}
|
|
838
|
+
const p = b.get(a);
|
|
839
|
+
if (p) return { kind: "temporal_bucket", grain: Jt(p) };
|
|
840
|
+
if (s(a)) return { kind: "text" };
|
|
841
|
+
const T = ge(t, a);
|
|
842
|
+
if (T) return { kind: "datetime", dateOnly: Wt(we(T)) };
|
|
843
|
+
const g = l(a);
|
|
844
|
+
return g ? { kind: "measure", format: g } : void 0;
|
|
845
|
+
}
|
|
846
|
+
function u(a, m) {
|
|
847
|
+
if (!Number.isInteger(m) || m < 0)
|
|
848
|
+
throw new Error("totalRows must be a non-negative integer");
|
|
849
|
+
return m === 0 ? void 0 : (t.visibleColumns ?? Object.keys(a)).map((p) => {
|
|
850
|
+
const g = Object.prototype.hasOwnProperty.call(a, p) ? a[p] : p === t.tableTotalsLabelColumnKey ? "Total" : null, v = n ? l(p) : void 0, C = de({
|
|
851
|
+
key: p,
|
|
852
|
+
label: p,
|
|
853
|
+
formattedValues: n,
|
|
854
|
+
dataType: "unknown",
|
|
855
|
+
...v ? { presentation: { kind: "measure", format: v } } : {}
|
|
856
|
+
});
|
|
857
|
+
if (g == null) return { kind: "empty" };
|
|
858
|
+
if (!n) return U({ value: g, text: String(g), column: C });
|
|
859
|
+
const F = v ? Yt(g) : null;
|
|
860
|
+
return U(v && F !== null ? { value: F, text: V(F, v), column: C } : { value: g, text: String(g), column: C });
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
return { format: w, totals: u };
|
|
864
|
+
}
|
|
865
|
+
const Qt = /* @__PURE__ */ new Set([
|
|
866
|
+
"scope",
|
|
867
|
+
"useFormattedValues",
|
|
868
|
+
"timezone",
|
|
869
|
+
"presentationExecutionSnapshot",
|
|
870
|
+
"delimiter",
|
|
871
|
+
"csvEncoding",
|
|
872
|
+
"includeHeaders",
|
|
873
|
+
"columnSettings",
|
|
874
|
+
"visibleColumns",
|
|
875
|
+
"columnLabels",
|
|
876
|
+
"tableTotalsLabelColumnKey",
|
|
877
|
+
"fileFormat",
|
|
878
|
+
"title"
|
|
879
|
+
]);
|
|
880
|
+
function ee(e) {
|
|
881
|
+
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
882
|
+
}
|
|
883
|
+
function Ce(e, t) {
|
|
884
|
+
if (e !== void 0) {
|
|
885
|
+
if (!ee(e))
|
|
886
|
+
throw new Error(`formatting.${t} must be an object`);
|
|
887
|
+
return e;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
function _r(e) {
|
|
891
|
+
if (!ee(e))
|
|
892
|
+
throw new Error("formatting must be an object");
|
|
893
|
+
const t = ["reportContext", "resolvedFormats"].find(
|
|
894
|
+
(a) => Object.prototype.hasOwnProperty.call(e, a)
|
|
895
|
+
);
|
|
896
|
+
if (t)
|
|
897
|
+
throw new ie(
|
|
898
|
+
`formatting.${t} is retired; formatting.presentationExecutionSnapshot is authoritative.`
|
|
899
|
+
);
|
|
900
|
+
const r = Object.keys(e).find((a) => !Qt.has(a));
|
|
901
|
+
if (r)
|
|
902
|
+
throw new Error(`formatting contains unknown property "${r}"`);
|
|
903
|
+
const n = typeof e.timezone == "string" ? e.timezone.trim() : "";
|
|
904
|
+
if (!n)
|
|
905
|
+
throw new Error("formatting.timezone must be a non-empty string");
|
|
906
|
+
const o = ot(e.delimiter);
|
|
907
|
+
if (!o)
|
|
908
|
+
throw new Error("formatting.delimiter must be a comma, semicolon or tab");
|
|
909
|
+
const l = at(e.csvEncoding);
|
|
910
|
+
if (!l)
|
|
911
|
+
throw new Error("formatting.csvEncoding must be 'utf-8-bom' or 'utf-8'");
|
|
912
|
+
if (typeof e.includeHeaders != "boolean")
|
|
913
|
+
throw new Error("formatting.includeHeaders must be a boolean");
|
|
914
|
+
if (e.useFormattedValues !== void 0 && typeof e.useFormattedValues != "boolean")
|
|
915
|
+
throw new Error("formatting.useFormattedValues must be a boolean");
|
|
916
|
+
const s = e.fileFormat === void 0 ? void 0 : st(e.fileFormat);
|
|
917
|
+
if (e.fileFormat !== void 0 && !s)
|
|
918
|
+
throw new Error("formatting.fileFormat must be 'csv' or 'xlsx'");
|
|
919
|
+
if (e.title !== void 0 && typeof e.title != "string")
|
|
920
|
+
throw new Error("formatting.title must be a string");
|
|
921
|
+
const c = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((a) => typeof a == "string") ? e.visibleColumns : void 0;
|
|
922
|
+
if (e.visibleColumns !== void 0 && !c)
|
|
923
|
+
throw new Error("formatting.visibleColumns must be an array of strings");
|
|
924
|
+
const f = Ce(e.columnLabels, "columnLabels");
|
|
925
|
+
if (f && Object.values(f).some((a) => typeof a != "string"))
|
|
926
|
+
throw new Error("formatting.columnLabels values must be strings");
|
|
927
|
+
const d = Ce(e.columnSettings, "columnSettings"), h = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey : null;
|
|
928
|
+
if (h === null)
|
|
929
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must be a non-empty string");
|
|
930
|
+
if (h && !(c != null && c.includes(h)))
|
|
931
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must identify a visible column");
|
|
932
|
+
const w = Ze(e.scope, "formatting.scope");
|
|
933
|
+
if (!w.cardId || w.attachmentIndex !== void 0)
|
|
934
|
+
throw new Error("formatting.scope must identify exactly one dashboard card");
|
|
935
|
+
const x = e.useFormattedValues !== !1, u = Je(e.presentationExecutionSnapshot);
|
|
936
|
+
if (n !== u.reportContext.calendar.tz)
|
|
937
|
+
throw new Error(
|
|
938
|
+
"formatting.timezone must equal presentationExecutionSnapshot.reportContext.calendar.tz"
|
|
939
|
+
);
|
|
940
|
+
try {
|
|
941
|
+
Qe({
|
|
942
|
+
snapshot: u,
|
|
943
|
+
expectedScope: { dashboardId: w.dashboardId, cardId: w.cardId },
|
|
944
|
+
visibleColumns: c,
|
|
945
|
+
useFormattedValues: x
|
|
946
|
+
});
|
|
947
|
+
} catch (a) {
|
|
948
|
+
throw new ie(
|
|
949
|
+
`formatting.presentationExecutionSnapshot.${a instanceof Error ? a.message : String(a)}`
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
return {
|
|
953
|
+
scope: { dashboardId: w.dashboardId, cardId: w.cardId },
|
|
954
|
+
useFormattedValues: x,
|
|
955
|
+
timezone: n,
|
|
956
|
+
presentationExecutionSnapshot: u,
|
|
957
|
+
delimiter: o,
|
|
958
|
+
csvEncoding: l,
|
|
959
|
+
includeHeaders: e.includeHeaders,
|
|
960
|
+
...d ? { columnSettings: d } : {},
|
|
961
|
+
...c ? { visibleColumns: c } : {},
|
|
962
|
+
...f ? { columnLabels: f } : {},
|
|
963
|
+
...h ? { tableTotalsLabelColumnKey: h } : {},
|
|
964
|
+
...s ? { fileFormat: s } : {},
|
|
965
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
function Ar(e) {
|
|
969
|
+
const t = e.formatOptions, r = (n) => ee(n) ? n : void 0;
|
|
970
|
+
return {
|
|
971
|
+
scope: { dashboardId: e.dashboardId, cardId: e.cardId },
|
|
972
|
+
useFormattedValues: t.useFormattedValues !== !1,
|
|
973
|
+
timezone: t.presentationExecutionSnapshot.reportContext.calendar.tz,
|
|
974
|
+
presentationExecutionSnapshot: t.presentationExecutionSnapshot,
|
|
975
|
+
delimiter: typeof t.delimiter == "string" ? t.delimiter : ",",
|
|
976
|
+
csvEncoding: t.csvEncoding,
|
|
977
|
+
includeHeaders: t.includeHeaders !== !1,
|
|
978
|
+
columnSettings: r(t.columnSettings),
|
|
979
|
+
visibleColumns: Array.isArray(t.visibleColumns) ? t.visibleColumns : void 0,
|
|
980
|
+
columnLabels: r(t.columnLabels),
|
|
981
|
+
tableTotalsLabelColumnKey: typeof t.tableTotalsLabelColumnKey == "string" ? t.tableTotalsLabelColumnKey : void 0,
|
|
982
|
+
...e.fileFormat ? { fileFormat: e.fileFormat } : {},
|
|
983
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
const er = /^\d{4}-\d{2}-\d{2}$/;
|
|
987
|
+
function Ae(e) {
|
|
988
|
+
const t = e.split(".");
|
|
989
|
+
return t[t.length - 1].replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").map((o) => o.charAt(0).toUpperCase() + o.slice(1).toLowerCase()).join(" ");
|
|
990
|
+
}
|
|
991
|
+
const xe = 10;
|
|
992
|
+
function Z(e, t) {
|
|
993
|
+
const r = e.slice(0, xe).map(t).join(", "), n = e.length - xe;
|
|
994
|
+
return n > 0 ? `${r}, and ${n} more` : r;
|
|
995
|
+
}
|
|
996
|
+
function tr(e) {
|
|
997
|
+
if (e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between")
|
|
998
|
+
return;
|
|
999
|
+
const t = Q(e.relativeMeta);
|
|
1000
|
+
if (t)
|
|
1001
|
+
return ct(t) || t.unit === "quarter" || t.unit === "year" ? t : void 0;
|
|
1002
|
+
}
|
|
1003
|
+
function rr(e, t) {
|
|
1004
|
+
if (t !== "label") return tr(e);
|
|
1005
|
+
if (!(e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between"))
|
|
1006
|
+
return Q(e.relativeMeta);
|
|
1007
|
+
}
|
|
1008
|
+
function Te(e, t = {}) {
|
|
1009
|
+
const { name: r, operation: n, values: o, valueType: l } = e, s = t.label ?? Ae(r), c = rr(e, t.relativeDates);
|
|
1010
|
+
if (c) {
|
|
1011
|
+
const d = pt(c);
|
|
1012
|
+
if (d)
|
|
1013
|
+
return n === "between" ? `${s}: ${d}` : `${s} not in ${d}`;
|
|
1014
|
+
}
|
|
1015
|
+
if (!o || o.length === 0)
|
|
1016
|
+
return n === "is null" ? `${s} is empty` : n === "is not null" ? `${s} is not empty` : "";
|
|
1017
|
+
const f = (d) => {
|
|
1018
|
+
if (l === "date" && d) {
|
|
1019
|
+
const h = e.temporalPrecision === "minute", w = {
|
|
1020
|
+
year: "numeric",
|
|
1021
|
+
month: "short",
|
|
1022
|
+
day: "numeric",
|
|
1023
|
+
...h ? {
|
|
1024
|
+
hour: "numeric",
|
|
1025
|
+
minute: "2-digit"
|
|
1026
|
+
} : {}
|
|
1027
|
+
};
|
|
1028
|
+
if (typeof d == "string" && er.test(d)) {
|
|
1029
|
+
const [u, a, m] = d.split("-").map(Number);
|
|
1030
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1031
|
+
year: "numeric",
|
|
1032
|
+
month: "short",
|
|
1033
|
+
day: "numeric",
|
|
1034
|
+
timeZone: "UTC"
|
|
1035
|
+
}).format(new Date(Date.UTC(u, a - 1, m)));
|
|
1036
|
+
}
|
|
1037
|
+
if (typeof d == "string" && et(d) === "wall_datetime") {
|
|
1038
|
+
const [u, a, m, b, p] = d.split(/[-T :.]/).map(Number);
|
|
1039
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1040
|
+
...w,
|
|
1041
|
+
timeZone: "UTC"
|
|
1042
|
+
}).format(new Date(Date.UTC(u, a - 1, m, b, p)));
|
|
1043
|
+
}
|
|
1044
|
+
const x = new Date(d);
|
|
1045
|
+
if (!isNaN(x.getTime()))
|
|
1046
|
+
try {
|
|
1047
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1048
|
+
...w,
|
|
1049
|
+
...t.timezone ? { timeZone: t.timezone } : {}
|
|
1050
|
+
}).format(x);
|
|
1051
|
+
} catch {
|
|
1052
|
+
return h ? x.toLocaleString(void 0, w) : x.toLocaleDateString(void 0, w);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return String(d);
|
|
1056
|
+
};
|
|
1057
|
+
switch (n) {
|
|
1058
|
+
case "=":
|
|
1059
|
+
return `${s}: ${f(o[0])}`;
|
|
1060
|
+
case "!=":
|
|
1061
|
+
return `${s} ≠ ${f(o[0])}`;
|
|
1062
|
+
case ">":
|
|
1063
|
+
return `${s} > ${f(o[0])}`;
|
|
1064
|
+
case "<":
|
|
1065
|
+
return `${s} < ${f(o[0])}`;
|
|
1066
|
+
case ">=":
|
|
1067
|
+
return `${s} ≥ ${f(o[0])}`;
|
|
1068
|
+
case "<=":
|
|
1069
|
+
return `${s} ≤ ${f(o[0])}`;
|
|
1070
|
+
case "between":
|
|
1071
|
+
case "not between": {
|
|
1072
|
+
const d = `${f(o[0])} - ${f(o[1])}`;
|
|
1073
|
+
return n === "between" ? `${s}: ${d}` : `${s} not in ${d}`;
|
|
1074
|
+
}
|
|
1075
|
+
case "in":
|
|
1076
|
+
return o.length === 1 ? `${s}: ${f(o[0])}` : `${s}: ${Z(o, f)}`;
|
|
1077
|
+
case "not in":
|
|
1078
|
+
return `${s} not in (${Z(o, f)})`;
|
|
1079
|
+
case "like":
|
|
1080
|
+
return `${s} contains "${o[0]}"`;
|
|
1081
|
+
case "not like":
|
|
1082
|
+
return `${s} doesn't contain "${o[0]}"`;
|
|
1083
|
+
default:
|
|
1084
|
+
return `${s}: ${Z(o, f)}`;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
function Rr(e, t = {}) {
|
|
1088
|
+
if (!e || e.length === 0)
|
|
1089
|
+
return "";
|
|
1090
|
+
const r = /* @__PURE__ */ new Map();
|
|
1091
|
+
e.forEach((o) => {
|
|
1092
|
+
const l = r.get(o.name) || [];
|
|
1093
|
+
l.push(o), r.set(o.name, l);
|
|
1094
|
+
});
|
|
1095
|
+
const n = [];
|
|
1096
|
+
return r.forEach((o, l) => {
|
|
1097
|
+
if (o.length === 1) {
|
|
1098
|
+
const s = Te(o[0], t);
|
|
1099
|
+
s && n.push(s);
|
|
1100
|
+
} else {
|
|
1101
|
+
const s = Ae(l), c = o.map((f) => Te(f, t).replace(`${s}: `, "").replace(`${s} `, "")).filter(Boolean);
|
|
1102
|
+
c.length > 0 && n.push(`${s}: ${c.join(" and ")}`);
|
|
1103
|
+
}
|
|
1104
|
+
}), n.join(" | ");
|
|
1105
|
+
}
|
|
1106
|
+
function Nr(e) {
|
|
1107
|
+
return ((e == null ? void 0 : e.filterValues) ?? []).filter(nr).map(or);
|
|
1108
|
+
}
|
|
1109
|
+
function nr(e) {
|
|
1110
|
+
return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
|
|
1111
|
+
}
|
|
1112
|
+
function or(e) {
|
|
1113
|
+
if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
|
|
1114
|
+
const { relativeMeta: t, ...r } = e, n = Q(t);
|
|
1115
|
+
return n ? { ...r, relativeMeta: n } : r;
|
|
1116
|
+
}
|
|
1117
|
+
const ar = /* @__PURE__ */ new Set([
|
|
1118
|
+
"day",
|
|
1119
|
+
"week",
|
|
1120
|
+
"month",
|
|
1121
|
+
"quarter",
|
|
1122
|
+
"year"
|
|
1123
|
+
]);
|
|
1124
|
+
function sr(e, t) {
|
|
1125
|
+
try {
|
|
1126
|
+
const r = L(
|
|
1127
|
+
R(e),
|
|
1128
|
+
t,
|
|
1129
|
+
"yyyy-MM-dd"
|
|
1130
|
+
), [n, o, l] = r.split("-").map(Number), s = new Date(Date.UTC(n, o - 1, l));
|
|
1131
|
+
return s.setUTCDate(s.getUTCDate() - 1), L(s, "UTC", "yyyy-MM-dd");
|
|
1132
|
+
} catch {
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function Or(e, t, r, n = !1) {
|
|
1137
|
+
const o = ir(
|
|
1138
|
+
e,
|
|
1139
|
+
t,
|
|
1140
|
+
r,
|
|
1141
|
+
n
|
|
1142
|
+
);
|
|
1143
|
+
return `${o.start} - ${o.end}`;
|
|
1144
|
+
}
|
|
1145
|
+
function ir(e, t, r, n = !1) {
|
|
1146
|
+
try {
|
|
1147
|
+
if (r && ar.has(r)) {
|
|
1148
|
+
const o = sr(e.end, t);
|
|
1149
|
+
if (o) {
|
|
1150
|
+
const l = n ? "MMM d" : "MMM d, yyyy";
|
|
1151
|
+
return {
|
|
1152
|
+
start: L(
|
|
1153
|
+
R(e.start),
|
|
1154
|
+
t,
|
|
1155
|
+
l
|
|
1156
|
+
),
|
|
1157
|
+
end: L(
|
|
1158
|
+
R(`${o}T00:00:00Z`),
|
|
1159
|
+
"UTC",
|
|
1160
|
+
"MMM d, yyyy"
|
|
1161
|
+
)
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
if (r === "second" || r === "minute" || r === "hour") {
|
|
1166
|
+
const o = n ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
1167
|
+
return {
|
|
1168
|
+
start: L(R(e.start), t, o),
|
|
1169
|
+
end: `before ${L(
|
|
1170
|
+
R(e.end),
|
|
1171
|
+
t,
|
|
1172
|
+
o
|
|
1173
|
+
)}`
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
} catch {
|
|
1177
|
+
}
|
|
1178
|
+
return { start: e.start, end: `before ${e.end}` };
|
|
1179
|
+
}
|
|
1180
|
+
export {
|
|
1181
|
+
Pr as A,
|
|
1182
|
+
xe as B,
|
|
1183
|
+
tr as C,
|
|
1184
|
+
$e as D,
|
|
1185
|
+
Te as E,
|
|
1186
|
+
It as F,
|
|
1187
|
+
Rr as G,
|
|
1188
|
+
Nr as H,
|
|
1189
|
+
ir as I,
|
|
1190
|
+
Cr as M,
|
|
1191
|
+
At as P,
|
|
1192
|
+
wr as a,
|
|
1193
|
+
xr as b,
|
|
1194
|
+
Tr as c,
|
|
1195
|
+
Er as d,
|
|
1196
|
+
vr as e,
|
|
1197
|
+
Or as f,
|
|
1198
|
+
Sr as g,
|
|
1199
|
+
Mr as h,
|
|
1200
|
+
Ir as i,
|
|
1201
|
+
Ot as j,
|
|
1202
|
+
$r as k,
|
|
1203
|
+
Fr as l,
|
|
1204
|
+
Nt as m,
|
|
1205
|
+
kr as n,
|
|
1206
|
+
$t as o,
|
|
1207
|
+
Rt as p,
|
|
1208
|
+
Pt as q,
|
|
1209
|
+
de as r,
|
|
1210
|
+
_t as s,
|
|
1211
|
+
U as t,
|
|
1212
|
+
Vt as u,
|
|
1213
|
+
Ut as v,
|
|
1214
|
+
Lr as w,
|
|
1215
|
+
Dr as x,
|
|
1216
|
+
_r as y,
|
|
1217
|
+
Ar as z
|
|
1218
|
+
};
|