react-semaphor 0.1.541 → 0.1.542
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.js +75 -75
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.js +51 -49
- package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
- package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-oHF5lTjA.js} +12 -12
- package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
- package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
- package/dist/chunks/comparison-window-caption-ChIyd_-L.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
- package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-CIn22Qgp.js} +69 -70
- package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
- package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-ZUYsIExq.js} +4 -4
- package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-s5WJBcK8.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-C6MJVyoI.js} +2382 -4975
- package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-DLdereA7.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/{index-DaQlghLY.js → index-CV5rHq5D.js} +824 -1351
- package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
- package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
- package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
- package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
- package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
- package/dist/chunks/numeric-presentation-BSAqPpHt.js +5227 -0
- package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
- package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-BBlAfBA0.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
- package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-MRUWpMcJ.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-DjPqgFly.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-BWSpRsPj.js} +37489 -39476
- package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-CQbFLm3q.js} +6 -6
- package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
- package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
- package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
- package/dist/chunks/table-export-sheet-BHSnuZHd.js +949 -0
- package/dist/chunks/table-settings-CLZocegs.js +501 -0
- package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
- package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BJDNqdOh.js} +151 -151
- package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +462 -457
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.js +346 -241
- package/dist/index.js +174 -175
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +5 -3
- package/dist/types/index.js +48 -48
- package/dist/types/lib/api/exports-api.d.ts +11 -65
- package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
- package/dist/types/lib/types/explorer-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
- package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
- package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
- package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
- package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
- package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
- package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
- package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
- package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
- package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
- package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
- package/package.json +2 -1
- package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
- package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
- package/dist/chunks/common-types-CUf03Htv.js +0 -288
- package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
- package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
- package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
- package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
- package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
- package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
|
@@ -0,0 +1,1618 @@
|
|
|
1
|
+
var Je = Object.defineProperty;
|
|
2
|
+
var Qe = (e, t, r) => t in e ? Je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var fe = (e, t, r) => Qe(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { i as et, j as V, m as tt, Q as oe, f as Ie, F as $e, P as rt, r as nt, M as ot, v as at, c as st, p as it, J as lt, a as j, G as ct, I as ut } from "./temporal-bucket-D7NBrrtL.js";
|
|
5
|
+
import { i as _e, m as te, j as De, k as mt, l as Re, a as ge, d as dt, n as $ } from "./matrix-formatter-BnsTX90d.js";
|
|
6
|
+
import { j as Z, Y as Pe, a as ft, Q as pe, O as gt, P as ye, g as pt, p as yt, m as ht, I as bt, K as wt, R as vt, a2 as O } from "./pivot-result-lifecycle-BBlAfBA0.js";
|
|
7
|
+
import { aC as U, l as Tt, w as X, aB as Ct, y as ae, x as xt } from "./validators-DMHTpf7a.js";
|
|
8
|
+
import "./matrix-operation-contract-8OIO4gob.js";
|
|
9
|
+
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
10
|
+
import "zod";
|
|
11
|
+
import { PDF_SAFETY_LIMIT_EXCEEDED as Ne, getUtf8ByteLength as St, FAST_PDF_POLICY as Et } from "../pdf-export-policy/index.js";
|
|
12
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as kt } from "../value-format-preferences/index.js";
|
|
13
|
+
import { z as At, g as Lt } from "./zoned-wall-clock-MulfA26h.js";
|
|
14
|
+
import { p as Ft } from "./pivot-header-presentation-DHcx1XGQ.js";
|
|
15
|
+
import { d as Mt, c as he } from "./pivot-result-identity-DJhXXcns.js";
|
|
16
|
+
import { v as It } from "./raw-temporal-contract-C51YG48G.js";
|
|
17
|
+
function $t(e, t, r) {
|
|
18
|
+
const n = {
|
|
19
|
+
...t,
|
|
20
|
+
locale: t.locale ?? r
|
|
21
|
+
};
|
|
22
|
+
if (n.type === "number")
|
|
23
|
+
return V(e, n);
|
|
24
|
+
const { prefix: o, suffix: i, ...a } = n;
|
|
25
|
+
return `${o ?? ""}${V(e, {
|
|
26
|
+
...a,
|
|
27
|
+
negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
|
|
28
|
+
})}${i ?? ""}`;
|
|
29
|
+
}
|
|
30
|
+
function q(e, t, r) {
|
|
31
|
+
return e === null ? { value: e, text: null } : !t || !et(t) && t.type !== "duration" ? {
|
|
32
|
+
value: e,
|
|
33
|
+
text: V(e, { type: "number", locale: r })
|
|
34
|
+
} : t.type === "duration" ? {
|
|
35
|
+
value: e,
|
|
36
|
+
text: tt(e, {
|
|
37
|
+
inputUnit: t.inputUnit,
|
|
38
|
+
outputStyle: t.outputStyle,
|
|
39
|
+
largestUnit: t.largestUnit,
|
|
40
|
+
smallestUnit: t.smallestUnit,
|
|
41
|
+
maxUnits: t.maxUnits,
|
|
42
|
+
prefix: t.prefix,
|
|
43
|
+
suffix: t.suffix,
|
|
44
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
45
|
+
})
|
|
46
|
+
} : { value: e, text: $t(e, t, r) };
|
|
47
|
+
}
|
|
48
|
+
function be(e, t, r, n) {
|
|
49
|
+
return e === null ? { value: e, text: null } : n === "percent" ? {
|
|
50
|
+
value: e,
|
|
51
|
+
text: V(e, {
|
|
52
|
+
type: "percent",
|
|
53
|
+
locale: r,
|
|
54
|
+
minimumFractionDigits: t,
|
|
55
|
+
maximumFractionDigits: t,
|
|
56
|
+
percentValueMode: "fraction"
|
|
57
|
+
})
|
|
58
|
+
} : {
|
|
59
|
+
value: e,
|
|
60
|
+
text: V(e, {
|
|
61
|
+
type: "number",
|
|
62
|
+
locale: r,
|
|
63
|
+
minimumFractionDigits: t,
|
|
64
|
+
maximumFractionDigits: t,
|
|
65
|
+
suffix: "×"
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function we(e, t) {
|
|
70
|
+
if (e === void 0) return t;
|
|
71
|
+
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
72
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
function un(e, t) {
|
|
76
|
+
const r = {
|
|
77
|
+
mode: t.displayMode,
|
|
78
|
+
current: q(
|
|
79
|
+
e.currentValue,
|
|
80
|
+
t.metricFormat,
|
|
81
|
+
t.locale
|
|
82
|
+
),
|
|
83
|
+
comparison: q(
|
|
84
|
+
e.comparisonValue,
|
|
85
|
+
t.metricFormat,
|
|
86
|
+
t.locale
|
|
87
|
+
)
|
|
88
|
+
};
|
|
89
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = q(
|
|
90
|
+
e.delta,
|
|
91
|
+
t.metricFormat,
|
|
92
|
+
t.locale
|
|
93
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = be(
|
|
94
|
+
e.percentChange,
|
|
95
|
+
we(t.precision, 1),
|
|
96
|
+
t.locale,
|
|
97
|
+
"percent"
|
|
98
|
+
)), t.displayMode === "ratio" && (r.ratio = be(
|
|
99
|
+
e.ratio,
|
|
100
|
+
we(t.precision, 2),
|
|
101
|
+
t.locale,
|
|
102
|
+
"ratio"
|
|
103
|
+
)), r;
|
|
104
|
+
}
|
|
105
|
+
const _t = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
|
|
106
|
+
function Dt(e) {
|
|
107
|
+
const { presentation: t } = e;
|
|
108
|
+
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" ? _t.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";
|
|
109
|
+
}
|
|
110
|
+
function Rt(e) {
|
|
111
|
+
const t = (o, i) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : i, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
|
|
112
|
+
return n === 0 ? "" : `.${"0".repeat(n)}`;
|
|
113
|
+
}
|
|
114
|
+
function J(e) {
|
|
115
|
+
return `"${e.replace(/"/g, "")}"`;
|
|
116
|
+
}
|
|
117
|
+
function Pt(e) {
|
|
118
|
+
let t;
|
|
119
|
+
try {
|
|
120
|
+
t = new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
121
|
+
style: "currency",
|
|
122
|
+
currency: e.currency || "USD"
|
|
123
|
+
}).formatToParts(1);
|
|
124
|
+
} catch {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const r = t.findIndex((i) => i.type === "currency"), n = t.findIndex((i) => i.type === "integer");
|
|
128
|
+
if (r < 0 || n < 0) return;
|
|
129
|
+
const o = (i, a) => t.slice(i, a).filter((l) => l.type === "literal").map((l) => l.value.replace(/\s/g, " ")).join("");
|
|
130
|
+
return r < n ? { side: "before", text: t[r].value + o(r + 1, n) } : {
|
|
131
|
+
side: "after",
|
|
132
|
+
text: o(n + 1, r) + t[r].value
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function Nt(e) {
|
|
136
|
+
const t = Rt(e);
|
|
137
|
+
let r;
|
|
138
|
+
if (e.type === "scientific")
|
|
139
|
+
r = `0${t}E+00`;
|
|
140
|
+
else {
|
|
141
|
+
const n = `${e.useGrouping === !1 ? "0" : "#,##0"}${t}`;
|
|
142
|
+
if (e.type === "currency") {
|
|
143
|
+
const o = Pt(e);
|
|
144
|
+
r = o ? o.side === "before" ? `${J(o.text)}${n}` : `${n}${J(o.text)}` : n;
|
|
145
|
+
} else e.type === "percent" ? r = e.percentValueMode === "whole" ? `${n}${J("%")}` : `${n}%` : r = n;
|
|
146
|
+
}
|
|
147
|
+
return e.negativeStyle === "parentheses" ? `${r};(${r})` : r;
|
|
148
|
+
}
|
|
149
|
+
function Ot(e, t) {
|
|
150
|
+
if (!e.formattedValues) return;
|
|
151
|
+
const { presentation: r } = e;
|
|
152
|
+
if (t === "number" || t === "by_value")
|
|
153
|
+
return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : Nt(r.format);
|
|
154
|
+
if (t === "date") {
|
|
155
|
+
if ((r == null ? void 0 : r.kind) === "temporal_bucket")
|
|
156
|
+
return r.grain === "day" ? "yyyy-mm-dd" : r.grain === "month" ? "mmm yyyy" : "yyyy-mm-dd hh:mm";
|
|
157
|
+
if ((r == null ? void 0 : r.kind) === "datetime")
|
|
158
|
+
return r.dateOnly ? "yyyy-mm-dd" : "yyyy-mm-dd hh:mm:ss";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function ve(e) {
|
|
162
|
+
const t = Dt(e), r = Ot(e, t);
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
key: e.key,
|
|
165
|
+
label: e.label,
|
|
166
|
+
cellType: t,
|
|
167
|
+
...r === void 0 ? {} : { numberFormat: r }
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const Vt = 15, Ut = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
171
|
+
function Oe(e) {
|
|
172
|
+
return Ut.test(e) ? e : void 0;
|
|
173
|
+
}
|
|
174
|
+
function Te(e) {
|
|
175
|
+
const r = e.replace(/^-/, "").replace(/[eE].*$/, "").replace(".", "").replace(/^0+/, "").replace(/0+$/, "");
|
|
176
|
+
if (r.length > Vt) return !1;
|
|
177
|
+
const n = Number(e);
|
|
178
|
+
return Number.isFinite(n) && (n !== 0 || r.length === 0);
|
|
179
|
+
}
|
|
180
|
+
const Kt = Date.UTC(1900, 2, 1), Bt = Date.UTC(1e4, 0, 1), zt = Date.UTC(1899, 11, 30), jt = 864e5;
|
|
181
|
+
function Gt(e) {
|
|
182
|
+
const t = Date.UTC(
|
|
183
|
+
e.year,
|
|
184
|
+
e.month - 1,
|
|
185
|
+
e.day,
|
|
186
|
+
e.hour,
|
|
187
|
+
e.minute,
|
|
188
|
+
e.second
|
|
189
|
+
);
|
|
190
|
+
if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Kt || t >= Bt))
|
|
191
|
+
return (t - zt) / jt;
|
|
192
|
+
}
|
|
193
|
+
function Ce(e, t, r) {
|
|
194
|
+
if (typeof e == "number")
|
|
195
|
+
return Number.isFinite(e) ? { kind: "number", text: t, value: e } : void 0;
|
|
196
|
+
if (U(e))
|
|
197
|
+
return Te(e.value) ? { kind: "number", text: t, value: e } : void 0;
|
|
198
|
+
if (r && typeof e == "string") {
|
|
199
|
+
const n = Oe(e);
|
|
200
|
+
return n !== void 0 && Te(n) ? { kind: "number", text: t, value: n } : void 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function P(e) {
|
|
204
|
+
const { value: t, text: r, column: n } = e;
|
|
205
|
+
if (r === "") return { kind: "empty" };
|
|
206
|
+
const o = { kind: "text", text: r };
|
|
207
|
+
switch (n.cellType) {
|
|
208
|
+
case "text":
|
|
209
|
+
return o;
|
|
210
|
+
case "date": {
|
|
211
|
+
const i = e.wallClock ? Gt(e.wallClock) : void 0;
|
|
212
|
+
return i === void 0 ? o : { kind: "date", text: r, serial: i };
|
|
213
|
+
}
|
|
214
|
+
case "number":
|
|
215
|
+
return Ce(t, r, !0) ?? o;
|
|
216
|
+
case "boolean":
|
|
217
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : o;
|
|
218
|
+
case "by_value":
|
|
219
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : Ce(t, r, !1) ?? o;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function mn(e) {
|
|
223
|
+
return e.kind === "empty" ? "" : e.text;
|
|
224
|
+
}
|
|
225
|
+
const Ht = 1e4, dn = 1e6, fn = 5e6, gn = 1024 ** 3, pn = 1024 ** 3;
|
|
226
|
+
function yn(e) {
|
|
227
|
+
return e > Ht;
|
|
228
|
+
}
|
|
229
|
+
const hn = {
|
|
230
|
+
rowLabels: "tabular",
|
|
231
|
+
subtotals: "after"
|
|
232
|
+
};
|
|
233
|
+
function bn(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, i]) => [
|
|
244
|
+
o,
|
|
245
|
+
{ ...i, position: t.subtotals }
|
|
246
|
+
])
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const Xt = 2;
|
|
253
|
+
function Wt(e) {
|
|
254
|
+
return typeof e == "number" ? Number.isInteger(e) : U(e) ? !e.value.includes(".") : !0;
|
|
255
|
+
}
|
|
256
|
+
function Yt(e, t, r) {
|
|
257
|
+
const n = e.descriptors.measures.filter(
|
|
258
|
+
(a) => r.measureFormats[a.id] === void 0 && a.semanticFormat === void 0 && Tt(a.column.dataType) === "number"
|
|
259
|
+
);
|
|
260
|
+
if (n.length === 0) return r;
|
|
261
|
+
const o = /* @__PURE__ */ new Set();
|
|
262
|
+
e.columns.forEach((a, l) => {
|
|
263
|
+
if (!(a.kind !== "measure" || o.has(a.measureId)))
|
|
264
|
+
for (const m of t) {
|
|
265
|
+
const u = m.values[l];
|
|
266
|
+
if ((u == null ? void 0 : u.kind) === "value" && !Wt(u.value)) {
|
|
267
|
+
o.add(a.measureId);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const i = { ...r.measureFormats };
|
|
273
|
+
for (const { id: a } of n) {
|
|
274
|
+
const l = o.has(a) ? Xt : 0;
|
|
275
|
+
i[a] = {
|
|
276
|
+
type: "number",
|
|
277
|
+
minimumFractionDigits: l,
|
|
278
|
+
maximumFractionDigits: l,
|
|
279
|
+
useGrouping: !0
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return { ...r, measureFormats: i };
|
|
283
|
+
}
|
|
284
|
+
function G(e) {
|
|
285
|
+
return X(e.slice(0, -1));
|
|
286
|
+
}
|
|
287
|
+
function Zt(e, t) {
|
|
288
|
+
return t.length > e.length && X(t.slice(0, e.length)) === X(e);
|
|
289
|
+
}
|
|
290
|
+
function qt(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" || Zt(n.rowPath, t.rowPath)) return !0;
|
|
296
|
+
const o = e[r - 2];
|
|
297
|
+
return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || G(o.rowPath) !== G(n.rowPath)) && t.rowPath.length === n.rowPath.length && G(t.rowPath) === G(n.rowPath);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const Jt = "pdf-group-continuation";
|
|
301
|
+
function Qt(e) {
|
|
302
|
+
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
303
|
+
return !0;
|
|
304
|
+
for (let t = 0; t <= e.levelIndex; t++)
|
|
305
|
+
if (e.getValue(e.row, t) !== e.getValue(e.previousRow, t))
|
|
306
|
+
return !0;
|
|
307
|
+
return !1;
|
|
308
|
+
}
|
|
309
|
+
function Ve(e, t, r) {
|
|
310
|
+
return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || U(t.value)) ? e : Z(e);
|
|
311
|
+
}
|
|
312
|
+
function er(e, t, r) {
|
|
313
|
+
const n = _e(e.descriptors, t.presentation, r), o = e.columns.map((d) => {
|
|
314
|
+
var s;
|
|
315
|
+
return d.kind === "measure" && ((s = n.measureSemantics.get(d.measureId)) == null ? void 0 : s.isNumeric) === !0;
|
|
316
|
+
}), i = (d) => te([d], n.levels), a = (d, s, f) => De(d, s, t.presentation.totals[f], n.levels), l = e.columns.map((d) => {
|
|
317
|
+
if (d.kind !== "measure") return d.label;
|
|
318
|
+
const s = d.columnPath.map(i);
|
|
319
|
+
return d.role !== "member" && s.push(a(d.columnPath, d.role, "columns")), [...s, d.label].join(" / ");
|
|
320
|
+
}), m = Math.min(t.spec.columns.length, Math.max(
|
|
321
|
+
0,
|
|
322
|
+
...e.columns.map((d) => d.kind === "measure" ? d.columnPath.length + (d.role !== "member" ? 1 : 0) : 0)
|
|
323
|
+
)), u = Array.from({ length: m + 1 }, (d, s) => e.columns.map((f) => s === m ? f.label : f.kind !== "measure" ? "" : s < f.columnPath.length ? i(f.columnPath[s]) : s === f.columnPath.length && f.role !== "member" ? a(f.columnPath, f.role, "columns") : "")), g = (d, s) => mt({
|
|
324
|
+
path: d.rowPath,
|
|
325
|
+
role: d.kind === "layout" ? d.role : "member",
|
|
326
|
+
levelCount: Math.max(1, t.spec.rows.length),
|
|
327
|
+
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
328
|
+
previousPath: s == null ? void 0 : s.rowPath
|
|
329
|
+
}), p = (d, s) => {
|
|
330
|
+
if (d.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
331
|
+
if (d.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
332
|
+
const f = g(d, s);
|
|
333
|
+
return e.columns.map((b, y) => {
|
|
334
|
+
if (b.kind === "hierarchy")
|
|
335
|
+
return `${" ".repeat(Math.max(0, d.rowPath.length - 1))}${a(d.rowPath, d.role, "rows")}`;
|
|
336
|
+
if (b.kind === "level") {
|
|
337
|
+
const C = t.spec.rows.findIndex((F) => F.id === b.levelId), x = f[C];
|
|
338
|
+
return x != null && x.visible ? x.total ? a(d.rowPath, d.role, "rows") : te(x.path, n.levels) : "";
|
|
339
|
+
}
|
|
340
|
+
const S = d.values[y], w = n.measures.get(b.measureId);
|
|
341
|
+
if (S.kind === "value" && !w)
|
|
342
|
+
throw new Error("Matrix value is missing its measure descriptor.");
|
|
343
|
+
return Re(S, w, t.presentation.absence);
|
|
344
|
+
});
|
|
345
|
+
}, v = (d, s) => p(d, s).map((f, b) => {
|
|
346
|
+
const y = e.columns[b];
|
|
347
|
+
return y.kind === "measure" ? Ve(f, d.values[b], n.measureSemantics.get(y.measureId)) : Z(f);
|
|
348
|
+
});
|
|
349
|
+
return {
|
|
350
|
+
headers: l,
|
|
351
|
+
headerBands: u,
|
|
352
|
+
numericColumns: o,
|
|
353
|
+
/** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
|
|
354
|
+
formatting: n,
|
|
355
|
+
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
356
|
+
row: (d, s) => p(d, s),
|
|
357
|
+
/**
|
|
358
|
+
* Level columns whose group label the row above shows, so this row
|
|
359
|
+
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
360
|
+
* row continues one: a total prints as a band, and its rules stay whole
|
|
361
|
+
* above and below it.
|
|
362
|
+
*/
|
|
363
|
+
continuedColumns: (d, s) => {
|
|
364
|
+
const f = (y) => (y == null ? void 0 : y.kind) === "layout" && y.role === "member";
|
|
365
|
+
if (!f(d) || !f(s)) return [];
|
|
366
|
+
const b = g(d, s);
|
|
367
|
+
return e.columns.flatMap((y, S) => {
|
|
368
|
+
var C;
|
|
369
|
+
if (y.kind !== "level") return [];
|
|
370
|
+
const w = t.spec.rows.findIndex((x) => x.id === y.levelId);
|
|
371
|
+
return w < d.rowPath.length && ((C = b[w]) == null ? void 0 : C.visible) === !1 ? [S] : [];
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
csvRow: (d) => v(d),
|
|
375
|
+
/**
|
|
376
|
+
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
377
|
+
* continuation, so a tabular layout prints each label once across the
|
|
378
|
+
* whole file. Retries are pure: suppression never relies on mutable
|
|
379
|
+
* formatter state or an earlier worker. Without it, the first row prints
|
|
380
|
+
* its labels.
|
|
381
|
+
*/
|
|
382
|
+
csvRows: (d, s) => d.map((f, b) => v(f, b ? d[b - 1] : s ?? void 0))
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function wn(e) {
|
|
386
|
+
return e.columns.map((t) => Z(t.label));
|
|
387
|
+
}
|
|
388
|
+
function vn(e, t, r) {
|
|
389
|
+
return tr(e, t, r).map((n, o) => {
|
|
390
|
+
const i = t.columns[o];
|
|
391
|
+
return i.kind === "measure" ? Ve(n, e.values[o], r.measureSemantics.get(i.measureId)) : Z(n);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function tr(e, t, r) {
|
|
395
|
+
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
396
|
+
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
397
|
+
const n = [...e.rowPath, ...e.columnPath];
|
|
398
|
+
return t.columns.map((o, i) => {
|
|
399
|
+
if (o.kind === "measure") {
|
|
400
|
+
const l = e.values[i], m = r.measures.get(o.measureId);
|
|
401
|
+
if (l.kind === "value" && !m) throw new Error("Matrix value is missing its measure descriptor.");
|
|
402
|
+
return Re(l, m, r.absence);
|
|
403
|
+
}
|
|
404
|
+
const a = o.kind === "level" ? n.find((l) => l.levelId === o.levelId) : void 0;
|
|
405
|
+
if (!a) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
406
|
+
return te([a], r.levels);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
function rr(e) {
|
|
410
|
+
const t = er(e.layout, e.request, e.report), r = e.layout.columns.map((a, l) => ({
|
|
411
|
+
index: l,
|
|
412
|
+
columnId: `matrix:${l}`,
|
|
413
|
+
label: t.headers[l],
|
|
414
|
+
isNumeric: t.numericColumns[l]
|
|
415
|
+
})), n = (a, l, m) => ({
|
|
416
|
+
text: a,
|
|
417
|
+
colspan: 1,
|
|
418
|
+
rowspan: 1,
|
|
419
|
+
columnId: r[l].columnId,
|
|
420
|
+
isHeader: m,
|
|
421
|
+
isNumeric: r[l].isNumeric,
|
|
422
|
+
className: r[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
423
|
+
}), o = [], i = e.layout.columns.findIndex((a) => a.kind === "measure");
|
|
424
|
+
e.request.spec.columns.length && i >= 0 && o.push({
|
|
425
|
+
repeatHeader: !0,
|
|
426
|
+
headerType: "pivot-axis",
|
|
427
|
+
headerRowIndex: 0,
|
|
428
|
+
cells: [
|
|
429
|
+
...i ? [{ ...n("", 0, !0), colspan: i }] : [],
|
|
430
|
+
{
|
|
431
|
+
...n(e.request.spec.columns.map((a) => Pe(a, e.request.presentation)).join(" / "), i, !0),
|
|
432
|
+
colspan: e.layout.columns.length - i,
|
|
433
|
+
isNumeric: !1,
|
|
434
|
+
className: ""
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
for (const [a, l] of t.headerBands.entries())
|
|
439
|
+
o.push({
|
|
440
|
+
repeatHeader: !0,
|
|
441
|
+
headerType: a === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
442
|
+
headerRowIndex: o.length,
|
|
443
|
+
cells: l.map((m, u) => n(m, u, !0))
|
|
444
|
+
});
|
|
445
|
+
return {
|
|
446
|
+
headers: o,
|
|
447
|
+
rows: e.rows.map((a, l) => {
|
|
448
|
+
const m = new Set(t.continuedColumns(a, e.rows[l - 1]));
|
|
449
|
+
return {
|
|
450
|
+
index: l,
|
|
451
|
+
type: a.kind === "layout" && a.role !== "member" ? "subtotal" : "data",
|
|
452
|
+
subtotalLevel: String(a.rowPath.length),
|
|
453
|
+
// A tabular layout prints each label once unless it repeats them; the
|
|
454
|
+
// blank cell continues its group, so a grid draws no rule above it.
|
|
455
|
+
cells: t.row(a, e.rows[l - 1]).map((u, g) => m.has(g) ? { ...n(u, g, !1), className: Jt } : n(u, g, !1))
|
|
456
|
+
};
|
|
457
|
+
}),
|
|
458
|
+
grandTotal: null,
|
|
459
|
+
// Totals are already in the ordered body at their authored position.
|
|
460
|
+
metadata: {
|
|
461
|
+
tableType: "pivot",
|
|
462
|
+
totalRows: e.rows.length,
|
|
463
|
+
totalColumns: r.length,
|
|
464
|
+
rowLevels: e.layout.columns.filter((a) => a.kind !== "measure").length,
|
|
465
|
+
pivotLevels: e.request.spec.columns.length,
|
|
466
|
+
hasGrandTotal: !1,
|
|
467
|
+
columnOrder: r.map((a) => a.columnId),
|
|
468
|
+
columns: r
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function nr(e, t, r) {
|
|
473
|
+
const { levels: n } = _e(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, i = [], a = [], l = e.columns.map((u, g) => {
|
|
474
|
+
if (u.kind !== "measure") return null;
|
|
475
|
+
const p = o ? `${u.role}:${X(u.columnPath)}` : `measure:${g}`;
|
|
476
|
+
let v = i.indexOf(p);
|
|
477
|
+
return v < 0 && (v = i.push(p) - 1, a.push(o ? De(u.columnPath, u.role, t.presentation.totals.columns, n) : u.label)), v;
|
|
478
|
+
}), m = t.spec.columns[t.spec.columns.length - 1];
|
|
479
|
+
return {
|
|
480
|
+
columnGroups: l,
|
|
481
|
+
groupLabels: a,
|
|
482
|
+
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
483
|
+
groupLevelLabel: m ? Pe(m, t.presentation) : "Measures"
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function Tn(e) {
|
|
487
|
+
const { layout: t, rows: r, report: n } = e, o = {
|
|
488
|
+
...e.request,
|
|
489
|
+
presentation: Yt(t, r, e.request.presentation)
|
|
490
|
+
}, i = rr({ layout: t, rows: r, request: o, report: n }), a = qt(r), l = nr(t, o, n), m = {
|
|
491
|
+
...i,
|
|
492
|
+
rows: i.rows.map((u, g) => ({ ...u, keepWithPrevious: a[g] })),
|
|
493
|
+
metadata: { ...i.metadata, ...l }
|
|
494
|
+
};
|
|
495
|
+
return { request: o, table: m, ...l };
|
|
496
|
+
}
|
|
497
|
+
class or extends Error {
|
|
498
|
+
constructor() {
|
|
499
|
+
super(...arguments);
|
|
500
|
+
fe(this, "code", Ne);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function xe(e) {
|
|
504
|
+
if (!e || typeof e != "object")
|
|
505
|
+
return;
|
|
506
|
+
const { error: t, message: r, detail: n } = e;
|
|
507
|
+
for (const o of [t, r, n])
|
|
508
|
+
if (typeof o == "string" && o.trim())
|
|
509
|
+
return o.trim();
|
|
510
|
+
}
|
|
511
|
+
async function ar(e) {
|
|
512
|
+
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
|
|
513
|
+
try {
|
|
514
|
+
if (r.includes("application/json")) {
|
|
515
|
+
const o = await e.json(), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
516
|
+
return { message: xe(o) || t, code: i };
|
|
517
|
+
}
|
|
518
|
+
const n = await e.text();
|
|
519
|
+
if (!n.trim())
|
|
520
|
+
return { message: t };
|
|
521
|
+
try {
|
|
522
|
+
const o = JSON.parse(n), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
523
|
+
return {
|
|
524
|
+
message: xe(o) || n.trim(),
|
|
525
|
+
code: i
|
|
526
|
+
};
|
|
527
|
+
} catch {
|
|
528
|
+
return { message: n.trim() };
|
|
529
|
+
}
|
|
530
|
+
} catch {
|
|
531
|
+
return { message: t };
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
async function Cn(e) {
|
|
535
|
+
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
536
|
+
if (St(e.serializedPayload) > Et.maxRequestBytes)
|
|
537
|
+
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
538
|
+
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
539
|
+
method: "POST",
|
|
540
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
541
|
+
body: e.serializedPayload,
|
|
542
|
+
signal: e.signal
|
|
543
|
+
});
|
|
544
|
+
if (!t.ok) {
|
|
545
|
+
const n = await ar(t);
|
|
546
|
+
throw n.code === Ne ? new or(n.message) : new Error(n.message);
|
|
547
|
+
}
|
|
548
|
+
const r = await t.json();
|
|
549
|
+
if (r != null && r.error) throw new Error(r.error);
|
|
550
|
+
if (typeof (r == null ? void 0 : r.url) != "string" || !r.url.trim())
|
|
551
|
+
throw new Error("Fast-path PDF response missing download URL");
|
|
552
|
+
return r;
|
|
553
|
+
}
|
|
554
|
+
const sr = /* @__PURE__ */ new Set(["short", "medium", "long"]), ir = /^(\d{4})-(\d{2})-(\d{2})$/, lr = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, cr = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, se = " – ";
|
|
555
|
+
function xn(e) {
|
|
556
|
+
if (!rt(e)) return;
|
|
557
|
+
const t = Object.keys(e);
|
|
558
|
+
if (e.mode === "period_label" && t.length === 1)
|
|
559
|
+
return { mode: "period_label" };
|
|
560
|
+
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && sr.has(e.dateStyle))
|
|
561
|
+
return { mode: "style", dateStyle: e.dateStyle };
|
|
562
|
+
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && ur(e.pattern) === null)
|
|
563
|
+
return {
|
|
564
|
+
mode: "pattern",
|
|
565
|
+
dialect: "semaphor_tokens",
|
|
566
|
+
pattern: e.pattern
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function ur(e) {
|
|
570
|
+
try {
|
|
571
|
+
return at({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
572
|
+
} catch (t) {
|
|
573
|
+
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function Sn(e) {
|
|
577
|
+
const { value: t, part: r, presentation: n, preferences: o, calendar: i } = e;
|
|
578
|
+
if ((n == null ? void 0 : n.mode) === "period_label" && t.periodLabel && r === "range")
|
|
579
|
+
return { ok: !0, text: t.periodLabel };
|
|
580
|
+
const [a, l] = t.bounds, u = l === void 0 || r === "start" ? [{ raw: a, role: "start" }] : r === "end" ? [{ raw: l, role: "end" }] : [
|
|
581
|
+
{ raw: a, role: "start" },
|
|
582
|
+
{ raw: l, role: "end" }
|
|
583
|
+
], g = u.map(({ raw: s }) => gr(s, i.tz));
|
|
584
|
+
if (g.some((s) => s === null))
|
|
585
|
+
return {
|
|
586
|
+
ok: !1,
|
|
587
|
+
text: u.map(({ raw: s }) => s).join(se),
|
|
588
|
+
diagnostic: {
|
|
589
|
+
code: "invalid_temporal_input_value",
|
|
590
|
+
message: "A date input bound is not a date or an instant."
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const p = t.precision === "day" ? g.map(
|
|
594
|
+
(s, f) => yr(s, u[f].role, i.tz)
|
|
595
|
+
) : [], v = p.length > 0 && p.every((s) => s !== null) ? p : null;
|
|
596
|
+
return { ok: !0, text: v ? mr(v, n, o, i) : dr(
|
|
597
|
+
g.map((s) => pr(s, i.tz)),
|
|
598
|
+
n,
|
|
599
|
+
o,
|
|
600
|
+
i
|
|
601
|
+
) };
|
|
602
|
+
}
|
|
603
|
+
function mr(e, t, r, n) {
|
|
604
|
+
const [o, i = o] = e;
|
|
605
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
606
|
+
return Be(
|
|
607
|
+
e.map(
|
|
608
|
+
(m) => Ke(re(m), "date", t.pattern, r, n)
|
|
609
|
+
)
|
|
610
|
+
);
|
|
611
|
+
const a = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateStyle;
|
|
612
|
+
if (!t || t.mode === "period_label") {
|
|
613
|
+
const m = hr(o, i, n);
|
|
614
|
+
if (m)
|
|
615
|
+
return Ie({
|
|
616
|
+
value: re(o),
|
|
617
|
+
metadata: {
|
|
618
|
+
kind: "temporal_bucket",
|
|
619
|
+
granularity: m,
|
|
620
|
+
calendar: { tz: n.tz, weekStart: n.weekStart ?? 1 }
|
|
621
|
+
},
|
|
622
|
+
format: $e({
|
|
623
|
+
metadata: {
|
|
624
|
+
kind: "temporal_bucket",
|
|
625
|
+
granularity: m,
|
|
626
|
+
calendar: { tz: n.tz, weekStart: n.weekStart ?? 1 }
|
|
627
|
+
},
|
|
628
|
+
locale: r.locale,
|
|
629
|
+
styles: { dateStyle: a, dateTime: { ...r.dateTime } }
|
|
630
|
+
}).format
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
const l = new Intl.DateTimeFormat(r.locale, {
|
|
634
|
+
calendar: "gregory",
|
|
635
|
+
timeZone: "UTC",
|
|
636
|
+
dateStyle: a
|
|
637
|
+
});
|
|
638
|
+
return wr(o, i) ? l.format(H(o)) : Ue(l, H(o), H(i));
|
|
639
|
+
}
|
|
640
|
+
function dr(e, t, r, n) {
|
|
641
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
642
|
+
return Be(
|
|
643
|
+
e.map(
|
|
644
|
+
(l) => Ke(
|
|
645
|
+
l.toISOString(),
|
|
646
|
+
"instant",
|
|
647
|
+
t.pattern,
|
|
648
|
+
r,
|
|
649
|
+
n
|
|
650
|
+
)
|
|
651
|
+
)
|
|
652
|
+
);
|
|
653
|
+
const o = new Intl.DateTimeFormat(r.locale, {
|
|
654
|
+
calendar: "gregory",
|
|
655
|
+
timeZone: n.tz,
|
|
656
|
+
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateTime.dateStyle,
|
|
657
|
+
timeStyle: r.dateTime.timeStyle
|
|
658
|
+
}), [i, a] = e;
|
|
659
|
+
return a && a.getTime() !== i.getTime() ? Ue(o, i, a) : o.format(i);
|
|
660
|
+
}
|
|
661
|
+
function Ue(e, t, r) {
|
|
662
|
+
const n = e;
|
|
663
|
+
return typeof n.formatRange == "function" ? n.formatRange(t, r) : `${e.format(t)}${se}${e.format(r)}`;
|
|
664
|
+
}
|
|
665
|
+
function Ke(e, t, r, n, o) {
|
|
666
|
+
const i = nt({
|
|
667
|
+
format: {
|
|
668
|
+
type: "raw_temporal",
|
|
669
|
+
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: r }
|
|
670
|
+
},
|
|
671
|
+
// Temporal formatting reads no currency.
|
|
672
|
+
preferences: {
|
|
673
|
+
...n,
|
|
674
|
+
defaultCurrency: kt.defaultCurrency
|
|
675
|
+
},
|
|
676
|
+
calendar: { tz: o.tz }
|
|
677
|
+
}), a = t === "date" && fr(r) ? "instant" : t;
|
|
678
|
+
return ot({
|
|
679
|
+
value: a === t ? e : oe(`${e}T00:00:00`, o.tz).toISOString(),
|
|
680
|
+
metadata: { kind: "raw_temporal", valueKind: a },
|
|
681
|
+
format: i
|
|
682
|
+
}).text;
|
|
683
|
+
}
|
|
684
|
+
function fr(e) {
|
|
685
|
+
return /HH|mm|ss/.test(e);
|
|
686
|
+
}
|
|
687
|
+
function Be(e) {
|
|
688
|
+
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(se);
|
|
689
|
+
}
|
|
690
|
+
function gr(e, t) {
|
|
691
|
+
const r = ir.exec(e);
|
|
692
|
+
if (r) {
|
|
693
|
+
const o = {
|
|
694
|
+
year: Number(r[1]),
|
|
695
|
+
month: Number(r[2]),
|
|
696
|
+
day: Number(r[3])
|
|
697
|
+
};
|
|
698
|
+
return vr(o) ? { kind: "date", date: o } : null;
|
|
699
|
+
}
|
|
700
|
+
const n = cr.test(e) ? new Date(e.replace(" ", "T")) : lr.test(e) ? oe(e.replace(" ", "T"), t) : null;
|
|
701
|
+
return n && !Number.isNaN(n.getTime()) ? { kind: "instant", instant: n } : null;
|
|
702
|
+
}
|
|
703
|
+
function pr(e, t) {
|
|
704
|
+
return e.kind === "instant" ? e.instant : oe(`${re(e.date)}T00:00:00`, t);
|
|
705
|
+
}
|
|
706
|
+
function yr(e, t, r) {
|
|
707
|
+
if (e.kind === "date") return e.date;
|
|
708
|
+
const n = At(e.instant, r), o = { year: n.year, month: n.month, day: n.day };
|
|
709
|
+
if (n.hour === 0 && n.minute === 0 && n.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? o : br(o, -1);
|
|
710
|
+
const a = n.hour === 23 && n.minute === 59 && n.second === 59;
|
|
711
|
+
return t === "end" && a ? o : null;
|
|
712
|
+
}
|
|
713
|
+
function hr(e, t, r) {
|
|
714
|
+
return r.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== ze(t.year, t.month) ? null : e.month === t.month ? "month" : e.month % 3 === 1 && t.month === e.month + 2 ? "quarter" : e.month === 1 && t.month === 12 ? "year" : null;
|
|
715
|
+
}
|
|
716
|
+
function re(e) {
|
|
717
|
+
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
718
|
+
}
|
|
719
|
+
function H(e) {
|
|
720
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
721
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
722
|
+
}
|
|
723
|
+
function br(e, t) {
|
|
724
|
+
const r = H(e);
|
|
725
|
+
return r.setUTCDate(r.getUTCDate() + t), {
|
|
726
|
+
year: r.getUTCFullYear(),
|
|
727
|
+
month: r.getUTCMonth() + 1,
|
|
728
|
+
day: r.getUTCDate()
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function wr(e, t) {
|
|
732
|
+
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
733
|
+
}
|
|
734
|
+
function ze(e, t) {
|
|
735
|
+
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
736
|
+
}
|
|
737
|
+
function vr(e) {
|
|
738
|
+
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= ze(e.year, e.month);
|
|
739
|
+
}
|
|
740
|
+
const Tr = "__TOTAL__";
|
|
741
|
+
function W(e) {
|
|
742
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
743
|
+
}
|
|
744
|
+
function ne(e) {
|
|
745
|
+
return e === Tr;
|
|
746
|
+
}
|
|
747
|
+
function Cr(e) {
|
|
748
|
+
const t = /* @__PURE__ */ new Map(), r = (e.groupByColumns ?? []).map((o, i) => {
|
|
749
|
+
var u, g, p;
|
|
750
|
+
if (!W(o))
|
|
751
|
+
throw new Error(`Aggregate groupByColumns[${i}] is invalid`);
|
|
752
|
+
const a = typeof o.id == "string" && o.id.length > 0 ? o.id : void 0, l = a ? (p = (g = (u = e.columnKeyMap) == null ? void 0 : u.byRole) == null ? void 0 : g.groupby) == null ? void 0 : p[a] : void 0, m = (l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || (typeof o.alias == "string" && o.alias.length > 0 ? o.alias : typeof o.name == "string" && o.name.length > 0 ? o.name : void 0);
|
|
753
|
+
if (!m)
|
|
754
|
+
throw new Error(`Aggregate groupByColumns[${i}] has no output key`);
|
|
755
|
+
return [a, o.alias, o.name, m].forEach((v) => {
|
|
756
|
+
typeof v == "string" && v.length > 0 && t.set(v, m);
|
|
757
|
+
}), m;
|
|
758
|
+
}), n = (e.rowAggregates ?? []).flatMap((o) => !W(o) || typeof o.function != "string" || typeof o.groupLevel != "string" ? [] : [
|
|
759
|
+
{
|
|
760
|
+
function: o.function,
|
|
761
|
+
groupLevel: o.groupLevel === "ALL" ? "ALL" : t.get(o.groupLevel) || o.groupLevel,
|
|
762
|
+
...typeof o.label == "string" ? { label: o.label } : {}
|
|
763
|
+
}
|
|
764
|
+
]);
|
|
765
|
+
return { groupColumnKeys: r, rowAggregates: n };
|
|
766
|
+
}
|
|
767
|
+
function je(e) {
|
|
768
|
+
return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
769
|
+
}
|
|
770
|
+
function xr(e) {
|
|
771
|
+
var r;
|
|
772
|
+
if (e.customLabel) return e.customLabel;
|
|
773
|
+
const t = je(e.aggregateFunction);
|
|
774
|
+
if (e.levelValue !== void 0 && !ne(e.levelValue)) {
|
|
775
|
+
if (e.levelValue === null) {
|
|
776
|
+
const o = (r = e.formatValue) == null ? void 0 : r.call(e, null);
|
|
777
|
+
return o ? `Subtotal ${o}` : `Subtotal ${t}`;
|
|
778
|
+
}
|
|
779
|
+
const n = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
|
|
780
|
+
if (n) return `Subtotal (${n})`;
|
|
781
|
+
}
|
|
782
|
+
return `Subtotal ${t}`;
|
|
783
|
+
}
|
|
784
|
+
function Sr(e, t) {
|
|
785
|
+
return t || `Grand ${je(e)}`;
|
|
786
|
+
}
|
|
787
|
+
function En(e) {
|
|
788
|
+
const t = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
789
|
+
if (t < 0)
|
|
790
|
+
throw new Error(
|
|
791
|
+
`Aggregate group column "${e.columnKey}" is unknown`
|
|
792
|
+
);
|
|
793
|
+
return Qt({
|
|
794
|
+
row: e.row,
|
|
795
|
+
previousRow: e.previousRow,
|
|
796
|
+
levelIndex: t,
|
|
797
|
+
getValue: (r, n) => r[e.context.groupColumnKeys[n]]
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
function Ge(e) {
|
|
801
|
+
var n, o;
|
|
802
|
+
const t = e.context.groupColumnKeys, r = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
|
|
803
|
+
if (e.row.isGrandTotal === !0) {
|
|
804
|
+
const i = (n = e.context.rowAggregates.find(
|
|
805
|
+
(a) => a.groupLevel === "ALL"
|
|
806
|
+
)) == null ? void 0 : n.label;
|
|
807
|
+
return {
|
|
808
|
+
kind: "grand-total",
|
|
809
|
+
cells: t.map((a, l) => ({
|
|
810
|
+
columnKey: a,
|
|
811
|
+
text: l === 0 ? Sr(r, i) : "",
|
|
812
|
+
placement: l === 0 ? "label" : "empty",
|
|
813
|
+
colSpan: l === 0 ? t.length : 1
|
|
814
|
+
}))
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
if (e.row.isSubtotal === !0) {
|
|
818
|
+
if (typeof e.row.subtotalLevel != "string")
|
|
819
|
+
throw new Error("Aggregate subtotal row is missing subtotalLevel");
|
|
820
|
+
const i = t.indexOf(e.row.subtotalLevel);
|
|
821
|
+
if (i < 0)
|
|
822
|
+
throw new Error(
|
|
823
|
+
`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
|
|
824
|
+
);
|
|
825
|
+
const a = W(e.row.subtotalContext) ? e.row.subtotalContext : void 0, l = W(a == null ? void 0 : a.groupByValues) ? a.groupByValues : {}, m = (o = e.context.rowAggregates.find(
|
|
826
|
+
(u) => u.groupLevel === e.row.subtotalLevel && u.function === r
|
|
827
|
+
)) == null ? void 0 : o.label;
|
|
828
|
+
return {
|
|
829
|
+
kind: "subtotal",
|
|
830
|
+
cells: t.map((u, g) => {
|
|
831
|
+
if (g > i)
|
|
832
|
+
return {
|
|
833
|
+
columnKey: u,
|
|
834
|
+
text: "",
|
|
835
|
+
placement: "empty",
|
|
836
|
+
colSpan: 1
|
|
837
|
+
};
|
|
838
|
+
if (g < i) {
|
|
839
|
+
const p = e.row[u];
|
|
840
|
+
return {
|
|
841
|
+
columnKey: u,
|
|
842
|
+
text: p === void 0 || ne(p) ? "" : e.formatValue(p, u),
|
|
843
|
+
placement: "value",
|
|
844
|
+
colSpan: 1
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
columnKey: u,
|
|
849
|
+
text: xr({
|
|
850
|
+
aggregateFunction: r,
|
|
851
|
+
customLabel: m,
|
|
852
|
+
levelValue: l[u],
|
|
853
|
+
formatValue: (p) => e.formatLabelValue ? e.formatLabelValue(p, u) : String(e.formatValue(p, u) ?? "")
|
|
854
|
+
}),
|
|
855
|
+
placement: "label",
|
|
856
|
+
colSpan: t.length - i
|
|
857
|
+
};
|
|
858
|
+
})
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
return {
|
|
862
|
+
kind: "data",
|
|
863
|
+
cells: t.map((i) => {
|
|
864
|
+
const a = e.row[i];
|
|
865
|
+
return {
|
|
866
|
+
columnKey: i,
|
|
867
|
+
text: a === void 0 || ne(a) ? "" : e.formatValue(a, i),
|
|
868
|
+
placement: "value",
|
|
869
|
+
colSpan: 1
|
|
870
|
+
};
|
|
871
|
+
})
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
function kn(e) {
|
|
875
|
+
const t = Ge(e).cells.find(
|
|
876
|
+
(r) => r.columnKey === e.columnKey
|
|
877
|
+
);
|
|
878
|
+
if (!t)
|
|
879
|
+
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
880
|
+
return t.text;
|
|
881
|
+
}
|
|
882
|
+
function Er(e) {
|
|
883
|
+
return Ge(e).cells.map((t) => t.text);
|
|
884
|
+
}
|
|
885
|
+
function kr(e) {
|
|
886
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
887
|
+
}
|
|
888
|
+
function Ar(e, t) {
|
|
889
|
+
if ((e == null ? void 0 : e.cardType) !== "aggregateTable") return;
|
|
890
|
+
const r = kr(e.cardConfig) ? e.cardConfig : void 0, n = r == null ? void 0 : r.groupByColumns, o = r == null ? void 0 : r.rowAggregates;
|
|
891
|
+
if (n !== void 0 && !Array.isArray(n))
|
|
892
|
+
throw new Error("Aggregate export groupByColumns is invalid");
|
|
893
|
+
if (o !== void 0 && !Array.isArray(o))
|
|
894
|
+
throw new Error("Aggregate export rowAggregates is invalid");
|
|
895
|
+
return Cr({
|
|
896
|
+
groupByColumns: n,
|
|
897
|
+
rowAggregates: o,
|
|
898
|
+
columnKeyMap: t
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
function Lr(e) {
|
|
902
|
+
if (!e.aggregateContext || !e.useFormattedValues || e.row.isSubtotal !== !0 && e.row.isGrandTotal !== !0)
|
|
903
|
+
return;
|
|
904
|
+
const t = Er({
|
|
905
|
+
row: e.row,
|
|
906
|
+
context: e.aggregateContext,
|
|
907
|
+
formatValue: (r, n) => e.visibleColumnKeys.has(n) ? e.formatGroupValue(r, n) : ""
|
|
908
|
+
});
|
|
909
|
+
return new Map(
|
|
910
|
+
e.aggregateContext.groupColumnKeys.map((r, n) => [
|
|
911
|
+
r,
|
|
912
|
+
t[n]
|
|
913
|
+
])
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
function Fr(e, t) {
|
|
917
|
+
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === void 0;
|
|
918
|
+
}
|
|
919
|
+
function He(e) {
|
|
920
|
+
return new Map(
|
|
921
|
+
e.presentationExecutionSnapshot.resolvedFormats.flatMap(
|
|
922
|
+
(t) => t.format.type === "raw_temporal" && t.target.kind === "column" && Fr(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
|
|
923
|
+
)
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
function Xe(e) {
|
|
927
|
+
const t = e == null ? void 0 : e.sql, r = e == null ? void 0 : e.python;
|
|
928
|
+
return (e == null ? void 0 : e.resultOwner) === "freeform" && typeof t == "string" && !!t.trim() && (typeof r != "string" || !r.trim());
|
|
929
|
+
}
|
|
930
|
+
function An(e) {
|
|
931
|
+
return e.formatting.useFormattedValues !== !1 && Xe(e.queryPayload) && He(e.formatting).size > 0;
|
|
932
|
+
}
|
|
933
|
+
function Mr(e, t) {
|
|
934
|
+
return e.map((r, n) => {
|
|
935
|
+
if (!Object.prototype.hasOwnProperty.call(r, t) || r[t] === void 0)
|
|
936
|
+
throw new Error(
|
|
937
|
+
`missing_raw_temporal_result_contract: Row ${n} is missing declared temporal column "${t}".`
|
|
938
|
+
);
|
|
939
|
+
const o = r[t];
|
|
940
|
+
return o === null || typeof o == "string" ? o : String(o);
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
function Ir(e) {
|
|
944
|
+
if (e.formatting.useFormattedValues === !1)
|
|
945
|
+
return {
|
|
946
|
+
activatedColumnKeys: /* @__PURE__ */ new Set(),
|
|
947
|
+
byColumnKey: /* @__PURE__ */ new Map()
|
|
948
|
+
};
|
|
949
|
+
const t = He(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
950
|
+
if (t.size === 0)
|
|
951
|
+
return { activatedColumnKeys: r, byColumnKey: n };
|
|
952
|
+
const o = new Map(
|
|
953
|
+
e.columns.flatMap((l) => {
|
|
954
|
+
const m = l.key || l.field;
|
|
955
|
+
return m ? [[m, l]] : [];
|
|
956
|
+
})
|
|
957
|
+
), i = Xe(e.queryPayload), a = /* @__PURE__ */ new Map();
|
|
958
|
+
for (const [l, m] of t) {
|
|
959
|
+
const u = o.get(l);
|
|
960
|
+
let g;
|
|
961
|
+
if (u != null && u.rawTemporal)
|
|
962
|
+
g = It(u, {
|
|
963
|
+
metadataRequired: !0
|
|
964
|
+
}), r.add(l);
|
|
965
|
+
else if (i) {
|
|
966
|
+
r.add(l);
|
|
967
|
+
const p = st({
|
|
968
|
+
columnKey: l,
|
|
969
|
+
values: Mr(e.records, l)
|
|
970
|
+
});
|
|
971
|
+
a.set(l, p), p.status === "classified" && (g = p.metadata);
|
|
972
|
+
} else
|
|
973
|
+
continue;
|
|
974
|
+
g && n.set(l, {
|
|
975
|
+
metadata: g,
|
|
976
|
+
format: m,
|
|
977
|
+
formatValue: it({ metadata: g, format: m })
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
return {
|
|
981
|
+
activatedColumnKeys: r,
|
|
982
|
+
byColumnKey: n,
|
|
983
|
+
...i ? {
|
|
984
|
+
sqlChunkEvidence: lt(a)
|
|
985
|
+
} : {}
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
function $r(e) {
|
|
989
|
+
if (!e.resolution.activatedColumnKeys.has(e.columnKey))
|
|
990
|
+
return;
|
|
991
|
+
if (e.value === void 0)
|
|
992
|
+
throw new Error(
|
|
993
|
+
`missing_raw_temporal_result_contract: Row ${e.rowIndex} is missing temporal column "${e.columnKey}".`
|
|
994
|
+
);
|
|
995
|
+
const t = e.resolution.byColumnKey.get(e.columnKey);
|
|
996
|
+
if (!t)
|
|
997
|
+
return { text: e.value === null ? "" : String(e.value) };
|
|
998
|
+
if (e.value !== null && typeof e.value != "string")
|
|
999
|
+
return { text: String(e.value) };
|
|
1000
|
+
const r = t.formatValue(e.value);
|
|
1001
|
+
return r.ok && r.wallClock ? { text: r.text, wallClock: r.wallClock } : { text: r.text };
|
|
1002
|
+
}
|
|
1003
|
+
function Se(e, t) {
|
|
1004
|
+
const r = e.byColumnKey.get(t);
|
|
1005
|
+
return r ? r.metadata.valueKind === "date" : void 0;
|
|
1006
|
+
}
|
|
1007
|
+
const _r = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), Dr = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, Rr = /^\d{4}-\d{2}-\d{2}$/, We = "MM/dd/yyyy";
|
|
1008
|
+
function Y(e) {
|
|
1009
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1010
|
+
}
|
|
1011
|
+
function N(e) {
|
|
1012
|
+
return e.key || e.field || void 0;
|
|
1013
|
+
}
|
|
1014
|
+
function Q(e) {
|
|
1015
|
+
return e == null ? "" : typeof e == "string" ? e : U(e) ? e.value : e instanceof Date ? e.toISOString() : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
1016
|
+
}
|
|
1017
|
+
function Ee(e, t) {
|
|
1018
|
+
var n;
|
|
1019
|
+
const r = (n = e.columnSettings) == null ? void 0 : n[t];
|
|
1020
|
+
if (!(!Y(r) || r.type !== "date"))
|
|
1021
|
+
return Y(r.dateFormat) ? r.dateFormat : {};
|
|
1022
|
+
}
|
|
1023
|
+
function ke(e) {
|
|
1024
|
+
return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || We;
|
|
1025
|
+
}
|
|
1026
|
+
function Ae(e, t) {
|
|
1027
|
+
return e && e !== "auto" ? e : t;
|
|
1028
|
+
}
|
|
1029
|
+
function Pr(e) {
|
|
1030
|
+
return !/[HhKkmsSa]/.test(e.replace(/'[^']*'/g, ""));
|
|
1031
|
+
}
|
|
1032
|
+
function Nr(e) {
|
|
1033
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
1034
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
1035
|
+
const t = Number(e);
|
|
1036
|
+
return Number.isFinite(t) ? t : null;
|
|
1037
|
+
}
|
|
1038
|
+
function Or(e) {
|
|
1039
|
+
const t = Oe(e);
|
|
1040
|
+
if (t !== void 0)
|
|
1041
|
+
try {
|
|
1042
|
+
return Ct(t, /[.eE]/.test(t) ? "decimal" : "integer");
|
|
1043
|
+
} catch {
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function Vr(e) {
|
|
1048
|
+
return e.calendar.fiscalCalendar && (e.granularity === "quarter" || e.granularity === "year") ? "fiscal" : e.granularity;
|
|
1049
|
+
}
|
|
1050
|
+
function Ln(e) {
|
|
1051
|
+
const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, i = (s) => ft({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: s } }), a = (s) => gt({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: s } });
|
|
1052
|
+
function l(s) {
|
|
1053
|
+
var b;
|
|
1054
|
+
if ((b = t.visibleColumns) != null && b.length) return t.visibleColumns;
|
|
1055
|
+
const f = s.columns.map(N).filter((y) => !!y);
|
|
1056
|
+
return f.length > 0 ? f : s.records[0] ? Object.keys(s.records[0]) : [];
|
|
1057
|
+
}
|
|
1058
|
+
function m(s, f) {
|
|
1059
|
+
return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, s) && t.columnLabels[s] || void 0 || u(f) || (f == null ? void 0 : f.label) || (f == null ? void 0 : f.headerName) || s;
|
|
1060
|
+
}
|
|
1061
|
+
function u(s, f) {
|
|
1062
|
+
const b = s == null ? void 0 : s.pivotIdentity;
|
|
1063
|
+
if (!b || !b.members || b.members.length === 0) return;
|
|
1064
|
+
const y = he({ identity: b, columnKey: (s == null ? void 0 : s.key) || (s == null ? void 0 : s.field) || "" });
|
|
1065
|
+
return Ft({
|
|
1066
|
+
members: y,
|
|
1067
|
+
metricLabel: (s == null ? void 0 : s.label) || (s == null ? void 0 : s.headerName),
|
|
1068
|
+
mode: n ? "formatted" : "canonical",
|
|
1069
|
+
resolveTemporalFormat: (S) => {
|
|
1070
|
+
const w = y.find((x) => x.fieldId === S);
|
|
1071
|
+
if (!(w != null && w.temporalBucket)) return;
|
|
1072
|
+
const C = pe({
|
|
1073
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
1074
|
+
scope: o,
|
|
1075
|
+
target: { kind: "field", fieldId: S, role: "pivotby" }
|
|
1076
|
+
});
|
|
1077
|
+
return C ? g(w.temporalBucket, C) : void 0;
|
|
1078
|
+
}
|
|
1079
|
+
}).flattenedLabel;
|
|
1080
|
+
}
|
|
1081
|
+
function g(s, f) {
|
|
1082
|
+
return $e({
|
|
1083
|
+
metadata: s,
|
|
1084
|
+
cardFormat: f,
|
|
1085
|
+
locale: f.locale,
|
|
1086
|
+
...f.presentation.mode === "auto" ? { styles: f.presentation.styles } : {}
|
|
1087
|
+
}).format;
|
|
1088
|
+
}
|
|
1089
|
+
function p(s, f) {
|
|
1090
|
+
const { records: b, columns: y } = s, S = Y(r.cardConfig) ? r.cardConfig : void 0;
|
|
1091
|
+
if (s.pivotResultKind === "not_pivot") {
|
|
1092
|
+
const c = S == null ? void 0 : S.pivotByColumns, h = Array.isArray(c) ? c.flatMap(
|
|
1093
|
+
(T) => Y(T) && typeof T.id == "string" && T.id ? [T.id] : []
|
|
1094
|
+
) : [];
|
|
1095
|
+
Mt(
|
|
1096
|
+
y.map((T) => ({ key: N(T) || "<unknown>", pivotIdentity: T.pivotIdentity })),
|
|
1097
|
+
{
|
|
1098
|
+
expectedPivotFieldIds: h,
|
|
1099
|
+
columnClassifications: s.columnMetadata
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
const w = l(s), C = new Set(w), x = new Map(
|
|
1104
|
+
y.flatMap((c) => {
|
|
1105
|
+
const h = N(c);
|
|
1106
|
+
return h ? [[h, c]] : [];
|
|
1107
|
+
})
|
|
1108
|
+
), F = new Map(s.resultColumns.map((c) => [c.key, c.dataType])), M = Ir({
|
|
1109
|
+
records: b,
|
|
1110
|
+
columns: y,
|
|
1111
|
+
formatting: t,
|
|
1112
|
+
queryPayload: r
|
|
1113
|
+
}), K = new Map(
|
|
1114
|
+
y.flatMap((c) => {
|
|
1115
|
+
const h = N(c);
|
|
1116
|
+
return h && c.temporalBucket ? [[h, c.temporalBucket]] : [];
|
|
1117
|
+
})
|
|
1118
|
+
), le = /* @__PURE__ */ new Map();
|
|
1119
|
+
for (const c of w) {
|
|
1120
|
+
const h = pe({
|
|
1121
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
1122
|
+
scope: o,
|
|
1123
|
+
target: { kind: "column", columnKey: c }
|
|
1124
|
+
}), T = K.get(c);
|
|
1125
|
+
if (n) {
|
|
1126
|
+
if (h && !T) throw new Error(`Missing temporal bucket metadata for column "${c}"`);
|
|
1127
|
+
if (T && !h) throw new Error(`Missing resolved temporal presentation for column "${c}"`);
|
|
1128
|
+
}
|
|
1129
|
+
h && T && le.set(c, g(T, h));
|
|
1130
|
+
}
|
|
1131
|
+
const Ze = K.size > 0 && e.cardType === "aggregateTable" ? Ar(r, s.columnKeyMap) : void 0, B = w.map((c) => {
|
|
1132
|
+
const h = F.get(c), T = h && _r.has(h) ? h : "unknown", E = n ? v(c, M, K) : void 0, k = m(c, x.get(c)), A = n && M.activatedColumnKeys.has(c) && Se(M, c) === void 0;
|
|
1133
|
+
return {
|
|
1134
|
+
key: c,
|
|
1135
|
+
label: k,
|
|
1136
|
+
dataType: T,
|
|
1137
|
+
...E ? { presentation: E } : {},
|
|
1138
|
+
xlsx: ve({ key: c, label: k, formattedValues: n, dataType: T, presentation: E }),
|
|
1139
|
+
...A ? { xlsxPending: !0 } : {}
|
|
1140
|
+
};
|
|
1141
|
+
});
|
|
1142
|
+
function ce(c, h, T, E) {
|
|
1143
|
+
if (!n) return { text: Q(c), value: c };
|
|
1144
|
+
const k = $r({ value: c, columnKey: h, rowIndex: T, resolution: M });
|
|
1145
|
+
if (k !== void 0) return { text: k.text, value: c, ...k.wallClock ? { wallClock: k.wallClock } : {} };
|
|
1146
|
+
const A = K.get(h);
|
|
1147
|
+
if (A) {
|
|
1148
|
+
const L = le.get(h);
|
|
1149
|
+
if (!L) throw new Error(`Missing resolved temporal presentation for column "${h}"`);
|
|
1150
|
+
if (c != null && typeof c != "string")
|
|
1151
|
+
throw new Error(`Canonical temporal column "${h}" must contain a string or null`);
|
|
1152
|
+
const D = c ?? null, R = ct(D, A);
|
|
1153
|
+
return {
|
|
1154
|
+
text: Ie({ value: D, metadata: A, format: L }),
|
|
1155
|
+
value: c,
|
|
1156
|
+
...R ? { wallClock: R } : {}
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
if (c == null) return { text: "", value: c };
|
|
1160
|
+
const _ = a(h);
|
|
1161
|
+
if (_ && typeof c == "number" && Number.isFinite(c))
|
|
1162
|
+
return {
|
|
1163
|
+
text: ge(
|
|
1164
|
+
new Date(c).toISOString(),
|
|
1165
|
+
_.pattern || We,
|
|
1166
|
+
Ae(_.timezone, t.timezone),
|
|
1167
|
+
"UTC"
|
|
1168
|
+
),
|
|
1169
|
+
value: c
|
|
1170
|
+
};
|
|
1171
|
+
const I = i(h);
|
|
1172
|
+
if (typeof c == "number")
|
|
1173
|
+
return { text: I ? j(c, I) : String(c), value: c };
|
|
1174
|
+
if (U(c))
|
|
1175
|
+
return { text: I ? j(c, I) : c.value, value: c };
|
|
1176
|
+
const z = Ee(t, h);
|
|
1177
|
+
if (z && (c instanceof Date || typeof c == "string" && Dr.test(c))) {
|
|
1178
|
+
const L = c instanceof Date ? c.toISOString() : c, D = typeof c == "string" && Rr.test(c), R = D ? "UTC" : Ae(z.timezone, t.timezone), me = D ? "UTC" : z.sourceTimezone || "auto", de = dt(L, R, me);
|
|
1179
|
+
return {
|
|
1180
|
+
text: ge(L, ke(z), R, me),
|
|
1181
|
+
value: c,
|
|
1182
|
+
...de ? { wallClock: de } : {}
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
if (typeof c == "string" && I && E.dataType === "number") {
|
|
1186
|
+
const L = Or(c);
|
|
1187
|
+
if (L) return { text: j(L, I), value: c };
|
|
1188
|
+
}
|
|
1189
|
+
return { text: Q(c), value: c };
|
|
1190
|
+
}
|
|
1191
|
+
const qe = b.map((c, h) => {
|
|
1192
|
+
const T = Lr({
|
|
1193
|
+
row: c,
|
|
1194
|
+
aggregateContext: Ze,
|
|
1195
|
+
useFormattedValues: n,
|
|
1196
|
+
visibleColumnKeys: C,
|
|
1197
|
+
formatGroupValue: (E, k) => {
|
|
1198
|
+
const A = B.find((_) => _.key === k);
|
|
1199
|
+
return A ? ce(E, k, h, A).text : Q(E);
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
return B.map((E) => {
|
|
1203
|
+
const k = T == null ? void 0 : T.get(E.key);
|
|
1204
|
+
if (k !== void 0) return P({ value: k, text: k, column: E.xlsx });
|
|
1205
|
+
const A = ce(c[E.key], E.key, h, E);
|
|
1206
|
+
return P({ value: A.value, text: A.text, column: E.xlsx, wallClock: A.wallClock });
|
|
1207
|
+
});
|
|
1208
|
+
}), ue = (f == null ? void 0 : f.withHeader) !== !1 && t.includeHeaders;
|
|
1209
|
+
if (ue && s.pivotResultKind === "not_pivot")
|
|
1210
|
+
for (const c of w) {
|
|
1211
|
+
const h = x.get(c);
|
|
1212
|
+
h != null && h.pivotIdentity && he({ identity: h.pivotIdentity, columnKey: N(h) || c });
|
|
1213
|
+
}
|
|
1214
|
+
return {
|
|
1215
|
+
...ue ? { header: B.map((c) => c.label) } : {},
|
|
1216
|
+
columns: B,
|
|
1217
|
+
rows: qe,
|
|
1218
|
+
...M.sqlChunkEvidence ? { rawTemporalClassification: M.sqlChunkEvidence } : {}
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
function v(s, f, b) {
|
|
1222
|
+
if (f.activatedColumnKeys.has(s)) {
|
|
1223
|
+
const C = Se(f, s);
|
|
1224
|
+
return C === void 0 ? { kind: "text" } : { kind: "datetime", dateOnly: C };
|
|
1225
|
+
}
|
|
1226
|
+
const y = b.get(s);
|
|
1227
|
+
if (y) return { kind: "temporal_bucket", grain: Vr(y) };
|
|
1228
|
+
if (a(s)) return { kind: "text" };
|
|
1229
|
+
const S = Ee(t, s);
|
|
1230
|
+
if (S) return { kind: "datetime", dateOnly: Pr(ke(S)) };
|
|
1231
|
+
const w = i(s);
|
|
1232
|
+
return w ? { kind: "measure", format: w } : void 0;
|
|
1233
|
+
}
|
|
1234
|
+
function d(s, f) {
|
|
1235
|
+
if (!Number.isInteger(f) || f < 0)
|
|
1236
|
+
throw new Error("totalRows must be a non-negative integer");
|
|
1237
|
+
return f === 0 ? void 0 : (t.visibleColumns ?? Object.keys(s)).map((y) => {
|
|
1238
|
+
const w = Object.prototype.hasOwnProperty.call(s, y) ? s[y] : y === t.tableTotalsLabelColumnKey ? "Total" : null, C = n ? i(y) : void 0, x = ve({
|
|
1239
|
+
key: y,
|
|
1240
|
+
label: y,
|
|
1241
|
+
formattedValues: n,
|
|
1242
|
+
dataType: "unknown",
|
|
1243
|
+
...C ? { presentation: { kind: "measure", format: C } } : {}
|
|
1244
|
+
});
|
|
1245
|
+
if (w == null) return { kind: "empty" };
|
|
1246
|
+
if (!n) return P({ value: w, text: String(w), column: x });
|
|
1247
|
+
const F = C ? Nr(w) : null;
|
|
1248
|
+
return P(C && F !== null ? { value: F, text: j(F, C), column: x } : { value: w, text: String(w), column: x });
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
return { format: p, totals: d };
|
|
1252
|
+
}
|
|
1253
|
+
const Ur = /* @__PURE__ */ new Set([
|
|
1254
|
+
"scope",
|
|
1255
|
+
"useFormattedValues",
|
|
1256
|
+
"timezone",
|
|
1257
|
+
"presentationExecutionSnapshot",
|
|
1258
|
+
"delimiter",
|
|
1259
|
+
"csvEncoding",
|
|
1260
|
+
"includeHeaders",
|
|
1261
|
+
"columnSettings",
|
|
1262
|
+
"visibleColumns",
|
|
1263
|
+
"columnLabels",
|
|
1264
|
+
"tableTotalsLabelColumnKey",
|
|
1265
|
+
"fileFormat",
|
|
1266
|
+
"title"
|
|
1267
|
+
]);
|
|
1268
|
+
function ie(e) {
|
|
1269
|
+
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
1270
|
+
}
|
|
1271
|
+
function Le(e, t) {
|
|
1272
|
+
if (e !== void 0) {
|
|
1273
|
+
if (!ie(e))
|
|
1274
|
+
throw new Error(`formatting.${t} must be an object`);
|
|
1275
|
+
return e;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
function Fn(e) {
|
|
1279
|
+
if (!ie(e))
|
|
1280
|
+
throw new Error("formatting must be an object");
|
|
1281
|
+
const t = ["reportContext", "resolvedFormats"].find(
|
|
1282
|
+
(s) => Object.prototype.hasOwnProperty.call(e, s)
|
|
1283
|
+
);
|
|
1284
|
+
if (t)
|
|
1285
|
+
throw new ye(
|
|
1286
|
+
`formatting.${t} is retired; formatting.presentationExecutionSnapshot is authoritative.`
|
|
1287
|
+
);
|
|
1288
|
+
const r = Object.keys(e).find((s) => !Ur.has(s));
|
|
1289
|
+
if (r)
|
|
1290
|
+
throw new Error(`formatting contains unknown property "${r}"`);
|
|
1291
|
+
const n = typeof e.timezone == "string" ? e.timezone.trim() : "";
|
|
1292
|
+
if (!n)
|
|
1293
|
+
throw new Error("formatting.timezone must be a non-empty string");
|
|
1294
|
+
const o = pt(e.delimiter);
|
|
1295
|
+
if (!o)
|
|
1296
|
+
throw new Error("formatting.delimiter must be a comma, semicolon or tab");
|
|
1297
|
+
const i = yt(e.csvEncoding);
|
|
1298
|
+
if (!i)
|
|
1299
|
+
throw new Error("formatting.csvEncoding must be 'utf-8-bom' or 'utf-8'");
|
|
1300
|
+
if (typeof e.includeHeaders != "boolean")
|
|
1301
|
+
throw new Error("formatting.includeHeaders must be a boolean");
|
|
1302
|
+
if (e.useFormattedValues !== void 0 && typeof e.useFormattedValues != "boolean")
|
|
1303
|
+
throw new Error("formatting.useFormattedValues must be a boolean");
|
|
1304
|
+
const a = e.fileFormat === void 0 ? void 0 : ht(e.fileFormat);
|
|
1305
|
+
if (e.fileFormat !== void 0 && !a)
|
|
1306
|
+
throw new Error("formatting.fileFormat must be 'csv' or 'xlsx'");
|
|
1307
|
+
if (e.title !== void 0 && typeof e.title != "string")
|
|
1308
|
+
throw new Error("formatting.title must be a string");
|
|
1309
|
+
const l = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((s) => typeof s == "string") ? e.visibleColumns : void 0;
|
|
1310
|
+
if (e.visibleColumns !== void 0 && !l)
|
|
1311
|
+
throw new Error("formatting.visibleColumns must be an array of strings");
|
|
1312
|
+
const m = Le(e.columnLabels, "columnLabels");
|
|
1313
|
+
if (m && Object.values(m).some((s) => typeof s != "string"))
|
|
1314
|
+
throw new Error("formatting.columnLabels values must be strings");
|
|
1315
|
+
const u = Le(e.columnSettings, "columnSettings"), g = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey.trim() : null;
|
|
1316
|
+
if (g === null)
|
|
1317
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must be a non-empty string");
|
|
1318
|
+
if (g && !(l != null && l.includes(g)))
|
|
1319
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must identify a visible column");
|
|
1320
|
+
const p = bt(e.scope, "formatting.scope");
|
|
1321
|
+
if (!p.cardId || p.attachmentIndex !== void 0)
|
|
1322
|
+
throw new Error("formatting.scope must identify exactly one dashboard card");
|
|
1323
|
+
const v = e.useFormattedValues !== !1, d = wt(e.presentationExecutionSnapshot);
|
|
1324
|
+
if (n !== d.reportContext.calendar.tz)
|
|
1325
|
+
throw new Error(
|
|
1326
|
+
"formatting.timezone must equal presentationExecutionSnapshot.reportContext.calendar.tz"
|
|
1327
|
+
);
|
|
1328
|
+
try {
|
|
1329
|
+
vt({
|
|
1330
|
+
snapshot: d,
|
|
1331
|
+
expectedScope: { dashboardId: p.dashboardId, cardId: p.cardId },
|
|
1332
|
+
visibleColumns: l,
|
|
1333
|
+
useFormattedValues: v
|
|
1334
|
+
});
|
|
1335
|
+
} catch (s) {
|
|
1336
|
+
throw new ye(
|
|
1337
|
+
`formatting.presentationExecutionSnapshot.${s instanceof Error ? s.message : String(s)}`
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
return {
|
|
1341
|
+
scope: { dashboardId: p.dashboardId, cardId: p.cardId },
|
|
1342
|
+
useFormattedValues: v,
|
|
1343
|
+
timezone: n,
|
|
1344
|
+
presentationExecutionSnapshot: d,
|
|
1345
|
+
delimiter: o,
|
|
1346
|
+
csvEncoding: i,
|
|
1347
|
+
includeHeaders: e.includeHeaders,
|
|
1348
|
+
...u ? { columnSettings: u } : {},
|
|
1349
|
+
...l ? { visibleColumns: l } : {},
|
|
1350
|
+
...m ? { columnLabels: m } : {},
|
|
1351
|
+
...g ? { tableTotalsLabelColumnKey: g } : {},
|
|
1352
|
+
...a ? { fileFormat: a } : {},
|
|
1353
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
function Mn(e) {
|
|
1357
|
+
const t = e.formatOptions, r = (n) => ie(n) ? n : void 0;
|
|
1358
|
+
return {
|
|
1359
|
+
scope: { dashboardId: e.dashboardId, cardId: e.cardId },
|
|
1360
|
+
useFormattedValues: t.useFormattedValues !== !1,
|
|
1361
|
+
timezone: t.presentationExecutionSnapshot.reportContext.calendar.tz,
|
|
1362
|
+
presentationExecutionSnapshot: t.presentationExecutionSnapshot,
|
|
1363
|
+
delimiter: typeof t.delimiter == "string" ? t.delimiter : ",",
|
|
1364
|
+
csvEncoding: t.csvEncoding,
|
|
1365
|
+
includeHeaders: t.includeHeaders !== !1,
|
|
1366
|
+
columnSettings: r(t.columnSettings),
|
|
1367
|
+
visibleColumns: Array.isArray(t.visibleColumns) ? t.visibleColumns : void 0,
|
|
1368
|
+
columnLabels: r(t.columnLabels),
|
|
1369
|
+
tableTotalsLabelColumnKey: typeof t.tableTotalsLabelColumnKey == "string" ? t.tableTotalsLabelColumnKey : void 0,
|
|
1370
|
+
...e.fileFormat ? { fileFormat: e.fileFormat } : {},
|
|
1371
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
const Kr = /^\d{4}-\d{2}-\d{2}$/;
|
|
1375
|
+
function Ye(e) {
|
|
1376
|
+
const t = e.split(".");
|
|
1377
|
+
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(" ");
|
|
1378
|
+
}
|
|
1379
|
+
const Fe = 10;
|
|
1380
|
+
function ee(e, t) {
|
|
1381
|
+
const r = e.slice(0, Fe).map(t).join(", "), n = e.length - Fe;
|
|
1382
|
+
return n > 0 ? `${r}, and ${n} more` : r;
|
|
1383
|
+
}
|
|
1384
|
+
function Br(e) {
|
|
1385
|
+
if (e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between")
|
|
1386
|
+
return;
|
|
1387
|
+
const t = ae(e.relativeMeta);
|
|
1388
|
+
if (t)
|
|
1389
|
+
return xt(t) || t.unit === "quarter" || t.unit === "year" ? t : void 0;
|
|
1390
|
+
}
|
|
1391
|
+
function zr(e, t) {
|
|
1392
|
+
if (t !== "label") return Br(e);
|
|
1393
|
+
if (!(e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between"))
|
|
1394
|
+
return ae(e.relativeMeta);
|
|
1395
|
+
}
|
|
1396
|
+
function Me(e, t = {}) {
|
|
1397
|
+
const { name: r, operation: n, values: o, valueType: i } = e, a = t.label ?? Ye(r), l = zr(e, t.relativeDates);
|
|
1398
|
+
if (l) {
|
|
1399
|
+
const u = Lt(l);
|
|
1400
|
+
if (u)
|
|
1401
|
+
return n === "between" ? `${a}: ${u}` : `${a} not in ${u}`;
|
|
1402
|
+
}
|
|
1403
|
+
if (!o || o.length === 0)
|
|
1404
|
+
return n === "is null" ? `${a} is empty` : n === "is not null" ? `${a} is not empty` : "";
|
|
1405
|
+
const m = (u) => {
|
|
1406
|
+
if (i === "date" && u) {
|
|
1407
|
+
const g = e.temporalPrecision === "minute", p = {
|
|
1408
|
+
year: "numeric",
|
|
1409
|
+
month: "short",
|
|
1410
|
+
day: "numeric",
|
|
1411
|
+
...g ? {
|
|
1412
|
+
hour: "numeric",
|
|
1413
|
+
minute: "2-digit"
|
|
1414
|
+
} : {}
|
|
1415
|
+
};
|
|
1416
|
+
if (typeof u == "string" && Kr.test(u)) {
|
|
1417
|
+
const [d, s, f] = u.split("-").map(Number);
|
|
1418
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1419
|
+
year: "numeric",
|
|
1420
|
+
month: "short",
|
|
1421
|
+
day: "numeric",
|
|
1422
|
+
timeZone: "UTC"
|
|
1423
|
+
}).format(new Date(Date.UTC(d, s - 1, f)));
|
|
1424
|
+
}
|
|
1425
|
+
if (typeof u == "string" && ut(u) === "wall_datetime") {
|
|
1426
|
+
const [d, s, f, b, y] = u.split(/[-T :.]/).map(Number);
|
|
1427
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1428
|
+
...p,
|
|
1429
|
+
timeZone: "UTC"
|
|
1430
|
+
}).format(new Date(Date.UTC(d, s - 1, f, b, y)));
|
|
1431
|
+
}
|
|
1432
|
+
const v = new Date(u);
|
|
1433
|
+
if (!isNaN(v.getTime()))
|
|
1434
|
+
try {
|
|
1435
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1436
|
+
...p,
|
|
1437
|
+
...t.timezone ? { timeZone: t.timezone } : {}
|
|
1438
|
+
}).format(v);
|
|
1439
|
+
} catch {
|
|
1440
|
+
return g ? v.toLocaleString(void 0, p) : v.toLocaleDateString(void 0, p);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
return String(u);
|
|
1444
|
+
};
|
|
1445
|
+
switch (n) {
|
|
1446
|
+
case "=":
|
|
1447
|
+
return `${a}: ${m(o[0])}`;
|
|
1448
|
+
case "!=":
|
|
1449
|
+
return `${a} ≠ ${m(o[0])}`;
|
|
1450
|
+
case ">":
|
|
1451
|
+
return `${a} > ${m(o[0])}`;
|
|
1452
|
+
case "<":
|
|
1453
|
+
return `${a} < ${m(o[0])}`;
|
|
1454
|
+
case ">=":
|
|
1455
|
+
return `${a} ≥ ${m(o[0])}`;
|
|
1456
|
+
case "<=":
|
|
1457
|
+
return `${a} ≤ ${m(o[0])}`;
|
|
1458
|
+
case "between":
|
|
1459
|
+
case "not between": {
|
|
1460
|
+
const u = `${m(o[0])} - ${m(o[1])}`;
|
|
1461
|
+
return n === "between" ? `${a}: ${u}` : `${a} not in ${u}`;
|
|
1462
|
+
}
|
|
1463
|
+
case "in":
|
|
1464
|
+
return o.length === 1 ? `${a}: ${m(o[0])}` : `${a}: ${ee(o, m)}`;
|
|
1465
|
+
case "not in":
|
|
1466
|
+
return `${a} not in (${ee(o, m)})`;
|
|
1467
|
+
case "like":
|
|
1468
|
+
return `${a} contains "${o[0]}"`;
|
|
1469
|
+
case "not like":
|
|
1470
|
+
return `${a} doesn't contain "${o[0]}"`;
|
|
1471
|
+
default:
|
|
1472
|
+
return `${a}: ${ee(o, m)}`;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function In(e, t = {}) {
|
|
1476
|
+
if (!e || e.length === 0)
|
|
1477
|
+
return "";
|
|
1478
|
+
const r = /* @__PURE__ */ new Map();
|
|
1479
|
+
e.forEach((o) => {
|
|
1480
|
+
const i = r.get(o.name) || [];
|
|
1481
|
+
i.push(o), r.set(o.name, i);
|
|
1482
|
+
});
|
|
1483
|
+
const n = [];
|
|
1484
|
+
return r.forEach((o, i) => {
|
|
1485
|
+
if (o.length === 1) {
|
|
1486
|
+
const a = Me(o[0], t);
|
|
1487
|
+
a && n.push(a);
|
|
1488
|
+
} else {
|
|
1489
|
+
const a = Ye(i), l = o.map((m) => Me(m, t).replace(`${a}: `, "").replace(`${a} `, "")).filter(Boolean);
|
|
1490
|
+
l.length > 0 && n.push(`${a}: ${l.join(" and ")}`);
|
|
1491
|
+
}
|
|
1492
|
+
}), n.join(" | ");
|
|
1493
|
+
}
|
|
1494
|
+
function $n(e) {
|
|
1495
|
+
return ((e == null ? void 0 : e.filterValues) ?? []).filter(jr).map(Gr);
|
|
1496
|
+
}
|
|
1497
|
+
function jr(e) {
|
|
1498
|
+
return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
|
|
1499
|
+
}
|
|
1500
|
+
function Gr(e) {
|
|
1501
|
+
if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
|
|
1502
|
+
const { relativeMeta: t, ...r } = e, n = ae(t);
|
|
1503
|
+
return n ? { ...r, relativeMeta: n } : r;
|
|
1504
|
+
}
|
|
1505
|
+
const Hr = /* @__PURE__ */ new Set([
|
|
1506
|
+
"day",
|
|
1507
|
+
"week",
|
|
1508
|
+
"month",
|
|
1509
|
+
"quarter",
|
|
1510
|
+
"year"
|
|
1511
|
+
]);
|
|
1512
|
+
function Xr(e, t) {
|
|
1513
|
+
try {
|
|
1514
|
+
const r = $(
|
|
1515
|
+
O(e),
|
|
1516
|
+
t,
|
|
1517
|
+
"yyyy-MM-dd"
|
|
1518
|
+
), [n, o, i] = r.split("-").map(Number), a = new Date(Date.UTC(n, o - 1, i));
|
|
1519
|
+
return a.setUTCDate(a.getUTCDate() - 1), $(a, "UTC", "yyyy-MM-dd");
|
|
1520
|
+
} catch {
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
function _n(e, t, r, n = !1) {
|
|
1525
|
+
const o = Wr(
|
|
1526
|
+
e,
|
|
1527
|
+
t,
|
|
1528
|
+
r,
|
|
1529
|
+
n
|
|
1530
|
+
);
|
|
1531
|
+
return `${o.start} - ${o.end}`;
|
|
1532
|
+
}
|
|
1533
|
+
function Wr(e, t, r, n = !1) {
|
|
1534
|
+
try {
|
|
1535
|
+
if (r && Hr.has(r)) {
|
|
1536
|
+
const o = Xr(e.end, t);
|
|
1537
|
+
if (o) {
|
|
1538
|
+
const i = n ? "MMM d" : "MMM d, yyyy";
|
|
1539
|
+
return {
|
|
1540
|
+
start: $(
|
|
1541
|
+
O(e.start),
|
|
1542
|
+
t,
|
|
1543
|
+
i
|
|
1544
|
+
),
|
|
1545
|
+
end: $(
|
|
1546
|
+
O(`${o}T00:00:00Z`),
|
|
1547
|
+
"UTC",
|
|
1548
|
+
"MMM d, yyyy"
|
|
1549
|
+
)
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
if (r === "second" || r === "minute" || r === "hour") {
|
|
1554
|
+
const o = n ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
1555
|
+
return {
|
|
1556
|
+
start: $(O(e.start), t, o),
|
|
1557
|
+
end: `before ${$(
|
|
1558
|
+
O(e.end),
|
|
1559
|
+
t,
|
|
1560
|
+
o
|
|
1561
|
+
)}`
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
} catch {
|
|
1565
|
+
}
|
|
1566
|
+
return { start: e.start, end: `before ${e.end}` };
|
|
1567
|
+
}
|
|
1568
|
+
export {
|
|
1569
|
+
Fn as A,
|
|
1570
|
+
Mn as B,
|
|
1571
|
+
An as C,
|
|
1572
|
+
Ht as D,
|
|
1573
|
+
Fe as E,
|
|
1574
|
+
dn as F,
|
|
1575
|
+
Br as G,
|
|
1576
|
+
Me as H,
|
|
1577
|
+
In as I,
|
|
1578
|
+
$n as J,
|
|
1579
|
+
Tr as K,
|
|
1580
|
+
ne as L,
|
|
1581
|
+
fn as M,
|
|
1582
|
+
Cr as N,
|
|
1583
|
+
xr as O,
|
|
1584
|
+
Jt as P,
|
|
1585
|
+
Sr as Q,
|
|
1586
|
+
En as R,
|
|
1587
|
+
Ge as S,
|
|
1588
|
+
kn as T,
|
|
1589
|
+
Er as U,
|
|
1590
|
+
Qt as V,
|
|
1591
|
+
Wr as W,
|
|
1592
|
+
un as a,
|
|
1593
|
+
gn as b,
|
|
1594
|
+
pn as c,
|
|
1595
|
+
yn as d,
|
|
1596
|
+
mn as e,
|
|
1597
|
+
_n as f,
|
|
1598
|
+
wn as g,
|
|
1599
|
+
vn as h,
|
|
1600
|
+
rr as i,
|
|
1601
|
+
Tn as j,
|
|
1602
|
+
hn as k,
|
|
1603
|
+
bn as l,
|
|
1604
|
+
tr as m,
|
|
1605
|
+
Xt as n,
|
|
1606
|
+
Yt as o,
|
|
1607
|
+
er as p,
|
|
1608
|
+
qt as q,
|
|
1609
|
+
ve as r,
|
|
1610
|
+
or as s,
|
|
1611
|
+
P as t,
|
|
1612
|
+
ar as u,
|
|
1613
|
+
Cn as v,
|
|
1614
|
+
xn as w,
|
|
1615
|
+
ur as x,
|
|
1616
|
+
Sn as y,
|
|
1617
|
+
Ln as z
|
|
1618
|
+
};
|