react-semaphor 0.1.537 → 0.1.539
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 +352 -341
- package/dist/assistant-context/index.js +10 -0
- package/dist/assistant-protocol/index.js +104 -0
- package/dist/brand-studio/index.js +35 -31
- package/dist/briefings/index.js +46 -45
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
- package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
- package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
- package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
- package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
- package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
- package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
- package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
- package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
- package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
- package/dist/chunks/context-HD9usB1P.js +349 -0
- package/dist/chunks/conversation-sQiWYUOb.js +16 -0
- package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
- package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
- package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
- package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
- package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
- package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
- package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
- package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
- package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
- package/dist/chunks/index-CqMiAkay.js +3164 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
- package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
- package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
- package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
- package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
- package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
- package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
- package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
- package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
- package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
- package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
- package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
- package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
- package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
- package/dist/chunks/save-CfJpQQ68.js +21 -0
- package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
- package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
- package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
- package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
- package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
- package/dist/chunks/switch-CvItuC1Q.js +8199 -0
- package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
- package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
- package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
- package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
- package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
- package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
- package/dist/chunks/x-4f5U2XwU.js +100 -0
- package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +823 -661
- package/dist/data-app-sdk/index.js +32 -30
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +23 -22
- package/dist/format-utils/index.js +173 -168
- package/dist/index.js +267 -258
- package/dist/layouts/index.js +236 -24
- 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/assistant-context.d.ts +2 -0
- package/dist/types/assistant-protocol.d.ts +2 -0
- package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
- package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
- package/dist/types/components/assistant/assistant-store.d.ts +52 -0
- package/dist/types/components/assistant/use-assistant.d.ts +38 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/surfboard/filter/types.d.ts +5 -2
- package/dist/types/index.js +50 -51
- package/dist/types/lib/api/invalidate-token.d.ts +7 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
- package/dist/types/lib/charts/types.d.ts +7 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
- package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
- package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
- package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
- package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
- package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
- package/dist/types/lib/print/print-inputs.d.ts +4 -2
- package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
- package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
- package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
- package/dist/types/lib/stores/editor-store.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +11 -0
- package/dist/types/lib/utils/card-type-change.d.ts +30 -0
- package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
- package/dist/types/shared/assistant-context/index.d.ts +9 -0
- package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
- package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
- package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
- package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
- package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
- package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
- package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
- package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
- package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
- package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
- package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
- package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
- package/dist/types/shared/format-utils/index.d.ts +3 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
- package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
- package/dist/types/shared/layouts/index.d.ts +1 -0
- package/package.json +12 -2
- package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
- package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
- package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
- package/dist/chunks/constants-DNWVy8Y3.js +0 -9
- package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
- package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
- package/dist/chunks/index-DTcTAGGM.js +0 -4101
- package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
- package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
- package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
- package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
- package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
- package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
- package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
- package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
- package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
- package/dist/chunks/save-kO6cIaob.js +0 -34
- package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
- package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
- package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
- package/dist/chunks/x-CXDkqdur.js +0 -149
- package/dist/types/lib/class-utils.d.ts +0 -2
- package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
- package/dist/types/lib/utils.d.ts +0 -51
|
@@ -0,0 +1,979 @@
|
|
|
1
|
+
var ae = Object.defineProperty;
|
|
2
|
+
var ne = (e, t, o) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var N = (e, t, o) => ne(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { i as se, g as S, k as le, B as R, q as ie, A as ue, y as ce, s as me } from "./raw-temporal-D61lr48Y.js";
|
|
5
|
+
import { h as G, m as _, i as j, j as de, k as X, l as b } from "./matrix-formatter-DQ8avoIQ.js";
|
|
6
|
+
import { h as E } from "./csv-utils-GUfKyT1J.js";
|
|
7
|
+
import { l as fe, aD as Z, w as M, A as ge, z as he } from "./validators-Ej1DdCXa.js";
|
|
8
|
+
import "./matrix-operation-contract-B8PBF1Gd.js";
|
|
9
|
+
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
10
|
+
import "zod";
|
|
11
|
+
import { g as W, p as v } from "./matrix-definition-DQDI2okF.js";
|
|
12
|
+
import { PDF_SAFETY_LIMIT_EXCEEDED as K, getUtf8ByteLength as ye, FAST_PDF_POLICY as pe } from "../pdf-export-policy/index.js";
|
|
13
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as we } from "../value-format-preferences/index.js";
|
|
14
|
+
import { f as be, c as Te, g as ve } from "./temporal-bucket-D8JF7zKz.js";
|
|
15
|
+
import { z as Se, g as Le } from "./zoned-wall-clock-MulfA26h.js";
|
|
16
|
+
function Ce(e, t, o) {
|
|
17
|
+
const a = {
|
|
18
|
+
...t,
|
|
19
|
+
locale: t.locale ?? o
|
|
20
|
+
};
|
|
21
|
+
if (a.type === "number")
|
|
22
|
+
return S(e, a);
|
|
23
|
+
const { prefix: r, suffix: s, ...n } = a;
|
|
24
|
+
return `${r ?? ""}${S(e, {
|
|
25
|
+
...n,
|
|
26
|
+
negativeStyle: a.type === "currency" ? a.negativeStyle : "minus"
|
|
27
|
+
})}${s ?? ""}`;
|
|
28
|
+
}
|
|
29
|
+
function P(e, t, o) {
|
|
30
|
+
return e === null ? { value: e, text: null } : !t || !se(t) && t.type !== "duration" ? {
|
|
31
|
+
value: e,
|
|
32
|
+
text: S(e, { type: "number", locale: o })
|
|
33
|
+
} : t.type === "duration" ? {
|
|
34
|
+
value: e,
|
|
35
|
+
text: le(e, {
|
|
36
|
+
inputUnit: t.inputUnit,
|
|
37
|
+
outputStyle: t.outputStyle,
|
|
38
|
+
largestUnit: t.largestUnit,
|
|
39
|
+
smallestUnit: t.smallestUnit,
|
|
40
|
+
maxUnits: t.maxUnits,
|
|
41
|
+
prefix: t.prefix,
|
|
42
|
+
suffix: t.suffix,
|
|
43
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
44
|
+
})
|
|
45
|
+
} : { value: e, text: Ce(e, t, o) };
|
|
46
|
+
}
|
|
47
|
+
function U(e, t, o, a) {
|
|
48
|
+
return e === null ? { value: e, text: null } : a === "percent" ? {
|
|
49
|
+
value: e,
|
|
50
|
+
text: S(e, {
|
|
51
|
+
type: "percent",
|
|
52
|
+
locale: o,
|
|
53
|
+
minimumFractionDigits: t,
|
|
54
|
+
maximumFractionDigits: t,
|
|
55
|
+
percentValueMode: "fraction"
|
|
56
|
+
})
|
|
57
|
+
} : {
|
|
58
|
+
value: e,
|
|
59
|
+
text: S(e, {
|
|
60
|
+
type: "number",
|
|
61
|
+
locale: o,
|
|
62
|
+
minimumFractionDigits: t,
|
|
63
|
+
maximumFractionDigits: t,
|
|
64
|
+
suffix: "×"
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function V(e, t) {
|
|
69
|
+
if (e === void 0) return t;
|
|
70
|
+
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
71
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
72
|
+
return e;
|
|
73
|
+
}
|
|
74
|
+
function Tt(e, t) {
|
|
75
|
+
const o = {
|
|
76
|
+
mode: t.displayMode,
|
|
77
|
+
current: P(
|
|
78
|
+
e.currentValue,
|
|
79
|
+
t.metricFormat,
|
|
80
|
+
t.locale
|
|
81
|
+
),
|
|
82
|
+
comparison: P(
|
|
83
|
+
e.comparisonValue,
|
|
84
|
+
t.metricFormat,
|
|
85
|
+
t.locale
|
|
86
|
+
)
|
|
87
|
+
};
|
|
88
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (o.difference = P(
|
|
89
|
+
e.delta,
|
|
90
|
+
t.metricFormat,
|
|
91
|
+
t.locale
|
|
92
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (o.percentChange = U(
|
|
93
|
+
e.percentChange,
|
|
94
|
+
V(t.precision, 1),
|
|
95
|
+
t.locale,
|
|
96
|
+
"percent"
|
|
97
|
+
)), t.displayMode === "ratio" && (o.ratio = U(
|
|
98
|
+
e.ratio,
|
|
99
|
+
V(t.precision, 2),
|
|
100
|
+
t.locale,
|
|
101
|
+
"ratio"
|
|
102
|
+
)), o;
|
|
103
|
+
}
|
|
104
|
+
const ke = 1e4, vt = 1e6, St = 5e6, Lt = 1024 ** 3, Ct = 1024 ** 3;
|
|
105
|
+
function kt(e) {
|
|
106
|
+
return e > ke;
|
|
107
|
+
}
|
|
108
|
+
const At = {
|
|
109
|
+
rowLabels: "tabular",
|
|
110
|
+
subtotals: "after"
|
|
111
|
+
};
|
|
112
|
+
function Mt(e, t) {
|
|
113
|
+
const o = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, a = e.totals.rows;
|
|
114
|
+
return {
|
|
115
|
+
...e,
|
|
116
|
+
layout: o,
|
|
117
|
+
totals: {
|
|
118
|
+
...e.totals,
|
|
119
|
+
rows: {
|
|
120
|
+
...a,
|
|
121
|
+
levels: Object.fromEntries(
|
|
122
|
+
Object.entries(a.levels).map(([r, s]) => [
|
|
123
|
+
r,
|
|
124
|
+
{ ...s, position: t.subtotals }
|
|
125
|
+
])
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const Ae = 2;
|
|
132
|
+
function Me(e) {
|
|
133
|
+
return typeof e == "number" ? Number.isInteger(e) : Z(e) ? !e.value.includes(".") : !0;
|
|
134
|
+
}
|
|
135
|
+
function $e(e, t, o) {
|
|
136
|
+
const a = e.descriptors.measures.filter(
|
|
137
|
+
(n) => o.measureFormats[n.id] === void 0 && n.semanticFormat === void 0 && fe(n.column.dataType) === "number"
|
|
138
|
+
);
|
|
139
|
+
if (a.length === 0) return o;
|
|
140
|
+
const r = /* @__PURE__ */ new Set();
|
|
141
|
+
e.columns.forEach((n, l) => {
|
|
142
|
+
if (!(n.kind !== "measure" || r.has(n.measureId)))
|
|
143
|
+
for (const c of t) {
|
|
144
|
+
const i = c.values[l];
|
|
145
|
+
if ((i == null ? void 0 : i.kind) === "value" && !Me(i.value)) {
|
|
146
|
+
r.add(n.measureId);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const s = { ...o.measureFormats };
|
|
152
|
+
for (const { id: n } of a) {
|
|
153
|
+
const l = r.has(n) ? Ae : 0;
|
|
154
|
+
s[n] = {
|
|
155
|
+
type: "number",
|
|
156
|
+
minimumFractionDigits: l,
|
|
157
|
+
maximumFractionDigits: l,
|
|
158
|
+
useGrouping: !0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { ...o, measureFormats: s };
|
|
162
|
+
}
|
|
163
|
+
function k(e) {
|
|
164
|
+
return M(e.slice(0, -1));
|
|
165
|
+
}
|
|
166
|
+
function Ee(e, t) {
|
|
167
|
+
return t.length > e.length && M(t.slice(0, e.length)) === M(e);
|
|
168
|
+
}
|
|
169
|
+
function Pe(e) {
|
|
170
|
+
return e.map((t, o) => {
|
|
171
|
+
if (o === 0 || t.kind !== "layout") return !1;
|
|
172
|
+
const a = e[o - 1];
|
|
173
|
+
if (a.kind !== "layout") return !1;
|
|
174
|
+
if (t.role !== "member" || Ee(a.rowPath, t.rowPath)) return !0;
|
|
175
|
+
const r = e[o - 2];
|
|
176
|
+
return a.role === "member" && (!r || r.kind !== "layout" || r.role !== "member" || k(r.rowPath) !== k(a.rowPath)) && t.rowPath.length === a.rowPath.length && k(t.rowPath) === k(a.rowPath);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const xe = "pdf-group-continuation";
|
|
180
|
+
function _e(e) {
|
|
181
|
+
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
182
|
+
return !0;
|
|
183
|
+
for (let t = 0; t <= e.levelIndex; t++)
|
|
184
|
+
if (e.getValue(e.row, t) !== e.getValue(e.previousRow, t))
|
|
185
|
+
return !0;
|
|
186
|
+
return !1;
|
|
187
|
+
}
|
|
188
|
+
function Y(e, t, o) {
|
|
189
|
+
return !(o != null && o.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || Z(t.value)) ? e : E(e);
|
|
190
|
+
}
|
|
191
|
+
function Ie(e, t, o) {
|
|
192
|
+
const a = G(e.descriptors, t.presentation, o), r = e.columns.map((u) => {
|
|
193
|
+
var m;
|
|
194
|
+
return u.kind === "measure" && ((m = a.measureSemantics.get(u.measureId)) == null ? void 0 : m.isNumeric) === !0;
|
|
195
|
+
}), s = (u) => _([u], a.levels), n = (u, m, d) => j(u, m, t.presentation.totals[d], a.levels), l = e.columns.map((u) => {
|
|
196
|
+
if (u.kind !== "measure") return u.label;
|
|
197
|
+
const m = u.columnPath.map(s);
|
|
198
|
+
return u.role !== "member" && m.push(n(u.columnPath, u.role, "columns")), [...m, u.label].join(" / ");
|
|
199
|
+
}), c = Math.min(t.spec.columns.length, Math.max(
|
|
200
|
+
0,
|
|
201
|
+
...e.columns.map((u) => u.kind === "measure" ? u.columnPath.length + (u.role !== "member" ? 1 : 0) : 0)
|
|
202
|
+
)), i = Array.from({ length: c + 1 }, (u, m) => e.columns.map((d) => m === c ? d.label : d.kind !== "measure" ? "" : m < d.columnPath.length ? s(d.columnPath[m]) : m === d.columnPath.length && d.role !== "member" ? n(d.columnPath, d.role, "columns") : "")), g = (u, m) => de({
|
|
203
|
+
path: u.rowPath,
|
|
204
|
+
role: u.kind === "layout" ? u.role : "member",
|
|
205
|
+
levelCount: Math.max(1, t.spec.rows.length),
|
|
206
|
+
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
207
|
+
previousPath: m == null ? void 0 : m.rowPath
|
|
208
|
+
}), f = (u, m) => {
|
|
209
|
+
if (u.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
210
|
+
if (u.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
211
|
+
const d = g(u, m);
|
|
212
|
+
return e.columns.map((y, p) => {
|
|
213
|
+
if (y.kind === "hierarchy")
|
|
214
|
+
return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${n(u.rowPath, u.role, "rows")}`;
|
|
215
|
+
if (y.kind === "level") {
|
|
216
|
+
const C = t.spec.rows.findIndex((oe) => oe.id === y.levelId), w = d[C];
|
|
217
|
+
return w != null && w.visible ? w.total ? n(u.rowPath, u.role, "rows") : _(w.path, a.levels) : "";
|
|
218
|
+
}
|
|
219
|
+
const L = u.values[p], T = a.measures.get(y.measureId);
|
|
220
|
+
if (L.kind === "value" && !T)
|
|
221
|
+
throw new Error("Matrix value is missing its measure descriptor.");
|
|
222
|
+
return X(L, T, t.presentation.absence);
|
|
223
|
+
});
|
|
224
|
+
}, h = (u, m) => f(u, m).map((d, y) => {
|
|
225
|
+
const p = e.columns[y];
|
|
226
|
+
return p.kind === "measure" ? Y(d, u.values[y], a.measureSemantics.get(p.measureId)) : E(d);
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
headers: l,
|
|
230
|
+
headerBands: i,
|
|
231
|
+
numericColumns: r,
|
|
232
|
+
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
233
|
+
row: (u, m) => f(u, m),
|
|
234
|
+
/**
|
|
235
|
+
* Level columns whose group label the row above shows, so this row
|
|
236
|
+
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
237
|
+
* row continues one: a total prints as a band, and its rules stay whole
|
|
238
|
+
* above and below it.
|
|
239
|
+
*/
|
|
240
|
+
continuedColumns: (u, m) => {
|
|
241
|
+
const d = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
|
|
242
|
+
if (!d(u) || !d(m)) return [];
|
|
243
|
+
const y = g(u, m);
|
|
244
|
+
return e.columns.flatMap((p, L) => {
|
|
245
|
+
var C;
|
|
246
|
+
if (p.kind !== "level") return [];
|
|
247
|
+
const T = t.spec.rows.findIndex((w) => w.id === p.levelId);
|
|
248
|
+
return T < u.rowPath.length && ((C = y[T]) == null ? void 0 : C.visible) === !1 ? [L] : [];
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
csvRow: (u) => h(u),
|
|
252
|
+
/**
|
|
253
|
+
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
254
|
+
* continuation, so a tabular layout prints each label once across the
|
|
255
|
+
* whole file. Retries are pure: suppression never relies on mutable
|
|
256
|
+
* formatter state or an earlier worker. Without it, the first row prints
|
|
257
|
+
* its labels.
|
|
258
|
+
*/
|
|
259
|
+
csvRows: (u, m) => u.map((d, y) => h(d, y ? u[y - 1] : m ?? void 0))
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function $t(e) {
|
|
263
|
+
return e.columns.map((t) => E(t.label));
|
|
264
|
+
}
|
|
265
|
+
function Et(e, t, o) {
|
|
266
|
+
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
267
|
+
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
268
|
+
const a = [...e.rowPath, ...e.columnPath];
|
|
269
|
+
return t.columns.map((r, s) => {
|
|
270
|
+
if (r.kind === "measure") {
|
|
271
|
+
const l = e.values[s], c = o.measures.get(r.measureId);
|
|
272
|
+
if (l.kind === "value" && !c) throw new Error("Matrix value is missing its measure descriptor.");
|
|
273
|
+
return Y(
|
|
274
|
+
X(l, c, o.absence),
|
|
275
|
+
l,
|
|
276
|
+
o.measureSemantics.get(r.measureId)
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
const n = r.kind === "level" ? a.find((l) => l.levelId === r.levelId) : void 0;
|
|
280
|
+
if (!n) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
281
|
+
return E(_([n], o.levels));
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function De(e) {
|
|
285
|
+
const t = Ie(e.layout, e.request, e.report), o = e.layout.columns.map((n, l) => ({
|
|
286
|
+
index: l,
|
|
287
|
+
columnId: `matrix:${l}`,
|
|
288
|
+
label: t.headers[l],
|
|
289
|
+
isNumeric: t.numericColumns[l]
|
|
290
|
+
})), a = (n, l, c) => ({
|
|
291
|
+
text: n,
|
|
292
|
+
colspan: 1,
|
|
293
|
+
rowspan: 1,
|
|
294
|
+
columnId: o[l].columnId,
|
|
295
|
+
isHeader: c,
|
|
296
|
+
isNumeric: o[l].isNumeric,
|
|
297
|
+
className: o[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
298
|
+
}), r = [], s = e.layout.columns.findIndex((n) => n.kind === "measure");
|
|
299
|
+
e.request.spec.columns.length && s >= 0 && r.push({
|
|
300
|
+
repeatHeader: !0,
|
|
301
|
+
headerType: "pivot-axis",
|
|
302
|
+
headerRowIndex: 0,
|
|
303
|
+
cells: [
|
|
304
|
+
...s ? [{ ...a("", 0, !0), colspan: s }] : [],
|
|
305
|
+
{
|
|
306
|
+
...a(e.request.spec.columns.map((n) => W(n, e.request.presentation)).join(" / "), s, !0),
|
|
307
|
+
colspan: e.layout.columns.length - s,
|
|
308
|
+
isNumeric: !1,
|
|
309
|
+
className: ""
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
});
|
|
313
|
+
for (const [n, l] of t.headerBands.entries())
|
|
314
|
+
r.push({
|
|
315
|
+
repeatHeader: !0,
|
|
316
|
+
headerType: n === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
317
|
+
headerRowIndex: r.length,
|
|
318
|
+
cells: l.map((c, i) => a(c, i, !0))
|
|
319
|
+
});
|
|
320
|
+
return {
|
|
321
|
+
headers: r,
|
|
322
|
+
rows: e.rows.map((n, l) => {
|
|
323
|
+
const c = new Set(t.continuedColumns(n, e.rows[l - 1]));
|
|
324
|
+
return {
|
|
325
|
+
index: l,
|
|
326
|
+
type: n.kind === "layout" && n.role !== "member" ? "subtotal" : "data",
|
|
327
|
+
subtotalLevel: String(n.rowPath.length),
|
|
328
|
+
// A tabular layout prints each label once unless it repeats them; the
|
|
329
|
+
// blank cell continues its group, so a grid draws no rule above it.
|
|
330
|
+
cells: t.row(n, e.rows[l - 1]).map((i, g) => c.has(g) ? { ...a(i, g, !1), className: xe } : a(i, g, !1))
|
|
331
|
+
};
|
|
332
|
+
}),
|
|
333
|
+
grandTotal: null,
|
|
334
|
+
// Totals are already in the ordered body at their authored position.
|
|
335
|
+
metadata: {
|
|
336
|
+
tableType: "pivot",
|
|
337
|
+
totalRows: e.rows.length,
|
|
338
|
+
totalColumns: o.length,
|
|
339
|
+
rowLevels: e.layout.columns.filter((n) => n.kind !== "measure").length,
|
|
340
|
+
pivotLevels: e.request.spec.columns.length,
|
|
341
|
+
hasGrandTotal: !1,
|
|
342
|
+
columnOrder: o.map((n) => n.columnId),
|
|
343
|
+
columns: o
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function Re(e, t, o) {
|
|
348
|
+
const { levels: a } = G(e.descriptors, t.presentation, o), r = t.spec.columns.length > 0, s = [], n = [], l = e.columns.map((i, g) => {
|
|
349
|
+
if (i.kind !== "measure") return null;
|
|
350
|
+
const f = r ? `${i.role}:${M(i.columnPath)}` : `measure:${g}`;
|
|
351
|
+
let h = s.indexOf(f);
|
|
352
|
+
return h < 0 && (h = s.push(f) - 1, n.push(r ? j(i.columnPath, i.role, t.presentation.totals.columns, a) : i.label)), h;
|
|
353
|
+
}), c = t.spec.columns[t.spec.columns.length - 1];
|
|
354
|
+
return {
|
|
355
|
+
columnGroups: l,
|
|
356
|
+
groupLabels: n,
|
|
357
|
+
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
358
|
+
groupLevelLabel: c ? W(c, t.presentation) : "Measures"
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function Pt(e) {
|
|
362
|
+
const { layout: t, rows: o, report: a } = e, r = {
|
|
363
|
+
...e.request,
|
|
364
|
+
presentation: $e(t, o, e.request.presentation)
|
|
365
|
+
}, s = De({ layout: t, rows: o, request: r, report: a }), n = Pe(o), l = Re(t, r, a), c = {
|
|
366
|
+
...s,
|
|
367
|
+
rows: s.rows.map((i, g) => ({ ...i, keepWithPrevious: n[g] })),
|
|
368
|
+
metadata: { ...s.metadata, ...l }
|
|
369
|
+
};
|
|
370
|
+
return { request: r, table: c, ...l };
|
|
371
|
+
}
|
|
372
|
+
class Fe extends Error {
|
|
373
|
+
constructor() {
|
|
374
|
+
super(...arguments);
|
|
375
|
+
N(this, "code", K);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function O(e) {
|
|
379
|
+
if (!e || typeof e != "object")
|
|
380
|
+
return;
|
|
381
|
+
const { error: t, message: o, detail: a } = e;
|
|
382
|
+
for (const r of [t, o, a])
|
|
383
|
+
if (typeof r == "string" && r.trim())
|
|
384
|
+
return r.trim();
|
|
385
|
+
}
|
|
386
|
+
async function Ne(e) {
|
|
387
|
+
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), o = e.headers.get("content-type") || "";
|
|
388
|
+
try {
|
|
389
|
+
if (o.includes("application/json")) {
|
|
390
|
+
const r = await e.json(), s = typeof r.code == "string" ? r.code : typeof r.errorCode == "string" ? r.errorCode : void 0;
|
|
391
|
+
return { message: O(r) || t, code: s };
|
|
392
|
+
}
|
|
393
|
+
const a = await e.text();
|
|
394
|
+
if (!a.trim())
|
|
395
|
+
return { message: t };
|
|
396
|
+
try {
|
|
397
|
+
const r = JSON.parse(a), s = typeof r.code == "string" ? r.code : typeof r.errorCode == "string" ? r.errorCode : void 0;
|
|
398
|
+
return {
|
|
399
|
+
message: O(r) || a.trim(),
|
|
400
|
+
code: s
|
|
401
|
+
};
|
|
402
|
+
} catch {
|
|
403
|
+
return { message: a.trim() };
|
|
404
|
+
}
|
|
405
|
+
} catch {
|
|
406
|
+
return { message: t };
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
async function xt(e) {
|
|
410
|
+
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
411
|
+
if (ye(e.serializedPayload) > pe.maxRequestBytes)
|
|
412
|
+
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
413
|
+
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
414
|
+
method: "POST",
|
|
415
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
416
|
+
body: e.serializedPayload,
|
|
417
|
+
signal: e.signal
|
|
418
|
+
});
|
|
419
|
+
if (!t.ok) {
|
|
420
|
+
const a = await Ne(t);
|
|
421
|
+
throw a.code === K ? new Fe(a.message) : new Error(a.message);
|
|
422
|
+
}
|
|
423
|
+
const o = await t.json();
|
|
424
|
+
if (o != null && o.error) throw new Error(o.error);
|
|
425
|
+
if (typeof (o == null ? void 0 : o.url) != "string" || !o.url.trim())
|
|
426
|
+
throw new Error("Fast-path PDF response missing download URL");
|
|
427
|
+
return o;
|
|
428
|
+
}
|
|
429
|
+
const Ue = /* @__PURE__ */ new Set(["short", "medium", "long"]), Ve = /^(\d{4})-(\d{2})-(\d{2})$/, Oe = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, Be = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, F = " – ";
|
|
430
|
+
function _t(e) {
|
|
431
|
+
if (!ve(e)) return;
|
|
432
|
+
const t = Object.keys(e);
|
|
433
|
+
if (e.mode === "period_label" && t.length === 1)
|
|
434
|
+
return { mode: "period_label" };
|
|
435
|
+
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && Ue.has(e.dateStyle))
|
|
436
|
+
return { mode: "style", dateStyle: e.dateStyle };
|
|
437
|
+
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && ze(e.pattern) === null)
|
|
438
|
+
return {
|
|
439
|
+
mode: "pattern",
|
|
440
|
+
dialect: "semaphor_tokens",
|
|
441
|
+
pattern: e.pattern
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function ze(e) {
|
|
445
|
+
try {
|
|
446
|
+
return ce({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
447
|
+
} catch (t) {
|
|
448
|
+
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function It(e) {
|
|
452
|
+
const { value: t, part: o, presentation: a, preferences: r, calendar: s } = e;
|
|
453
|
+
if ((a == null ? void 0 : a.mode) === "period_label" && t.periodLabel && o === "range")
|
|
454
|
+
return { ok: !0, text: t.periodLabel };
|
|
455
|
+
const [n, l] = t.bounds, i = l === void 0 || o === "start" ? [{ raw: n, role: "start" }] : o === "end" ? [{ raw: l, role: "end" }] : [
|
|
456
|
+
{ raw: n, role: "start" },
|
|
457
|
+
{ raw: l, role: "end" }
|
|
458
|
+
], g = i.map(({ raw: m }) => Ze(m, s.tz));
|
|
459
|
+
if (g.some((m) => m === null))
|
|
460
|
+
return {
|
|
461
|
+
ok: !1,
|
|
462
|
+
text: i.map(({ raw: m }) => m).join(F),
|
|
463
|
+
diagnostic: {
|
|
464
|
+
code: "invalid_temporal_input_value",
|
|
465
|
+
message: "A date input bound is not a date or an instant."
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
const f = t.precision === "day" ? g.map(
|
|
469
|
+
(m, d) => Ke(m, i[d].role, s.tz)
|
|
470
|
+
) : [], h = f.length > 0 && f.every((m) => m !== null) ? f : null;
|
|
471
|
+
return { ok: !0, text: h ? Ge(h, a, r, s) : je(
|
|
472
|
+
g.map((m) => We(m, s.tz)),
|
|
473
|
+
a,
|
|
474
|
+
r,
|
|
475
|
+
s
|
|
476
|
+
) };
|
|
477
|
+
}
|
|
478
|
+
function Ge(e, t, o, a) {
|
|
479
|
+
const [r, s = r] = e;
|
|
480
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
481
|
+
return J(
|
|
482
|
+
e.map(
|
|
483
|
+
(c) => H(I(c), "date", t.pattern, o, a)
|
|
484
|
+
)
|
|
485
|
+
);
|
|
486
|
+
const n = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : o.dateStyle;
|
|
487
|
+
if (!t || t.mode === "period_label") {
|
|
488
|
+
const c = Ye(r, s, a);
|
|
489
|
+
if (c)
|
|
490
|
+
return be({
|
|
491
|
+
value: I(r),
|
|
492
|
+
metadata: {
|
|
493
|
+
kind: "temporal_bucket",
|
|
494
|
+
granularity: c,
|
|
495
|
+
calendar: { tz: a.tz, weekStart: a.weekStart ?? 1 }
|
|
496
|
+
},
|
|
497
|
+
format: Te({
|
|
498
|
+
metadata: {
|
|
499
|
+
kind: "temporal_bucket",
|
|
500
|
+
granularity: c,
|
|
501
|
+
calendar: { tz: a.tz, weekStart: a.weekStart ?? 1 }
|
|
502
|
+
},
|
|
503
|
+
locale: o.locale,
|
|
504
|
+
styles: { dateStyle: n, dateTime: { ...o.dateTime } }
|
|
505
|
+
}).format
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
const l = new Intl.DateTimeFormat(o.locale, {
|
|
509
|
+
calendar: "gregory",
|
|
510
|
+
timeZone: "UTC",
|
|
511
|
+
dateStyle: n
|
|
512
|
+
});
|
|
513
|
+
return He(r, s) ? l.format(A(r)) : q(l, A(r), A(s));
|
|
514
|
+
}
|
|
515
|
+
function je(e, t, o, a) {
|
|
516
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
517
|
+
return J(
|
|
518
|
+
e.map(
|
|
519
|
+
(l) => H(
|
|
520
|
+
l.toISOString(),
|
|
521
|
+
"instant",
|
|
522
|
+
t.pattern,
|
|
523
|
+
o,
|
|
524
|
+
a
|
|
525
|
+
)
|
|
526
|
+
)
|
|
527
|
+
);
|
|
528
|
+
const r = new Intl.DateTimeFormat(o.locale, {
|
|
529
|
+
calendar: "gregory",
|
|
530
|
+
timeZone: a.tz,
|
|
531
|
+
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : o.dateTime.dateStyle,
|
|
532
|
+
timeStyle: o.dateTime.timeStyle
|
|
533
|
+
}), [s, n] = e;
|
|
534
|
+
return n && n.getTime() !== s.getTime() ? q(r, s, n) : r.format(s);
|
|
535
|
+
}
|
|
536
|
+
function q(e, t, o) {
|
|
537
|
+
const a = e;
|
|
538
|
+
return typeof a.formatRange == "function" ? a.formatRange(t, o) : `${e.format(t)}${F}${e.format(o)}`;
|
|
539
|
+
}
|
|
540
|
+
function H(e, t, o, a, r) {
|
|
541
|
+
const s = ie({
|
|
542
|
+
format: {
|
|
543
|
+
type: "raw_temporal",
|
|
544
|
+
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: o }
|
|
545
|
+
},
|
|
546
|
+
// Temporal formatting reads no currency.
|
|
547
|
+
preferences: {
|
|
548
|
+
...a,
|
|
549
|
+
defaultCurrency: we.defaultCurrency
|
|
550
|
+
},
|
|
551
|
+
calendar: { tz: r.tz }
|
|
552
|
+
}), n = t === "date" && Xe(o) ? "instant" : t;
|
|
553
|
+
return ue({
|
|
554
|
+
value: n === t ? e : R(`${e}T00:00:00`, r.tz).toISOString(),
|
|
555
|
+
metadata: { kind: "raw_temporal", valueKind: n },
|
|
556
|
+
format: s
|
|
557
|
+
}).text;
|
|
558
|
+
}
|
|
559
|
+
function Xe(e) {
|
|
560
|
+
return /HH|mm|ss/.test(e);
|
|
561
|
+
}
|
|
562
|
+
function J(e) {
|
|
563
|
+
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(F);
|
|
564
|
+
}
|
|
565
|
+
function Ze(e, t) {
|
|
566
|
+
const o = Ve.exec(e);
|
|
567
|
+
if (o) {
|
|
568
|
+
const r = {
|
|
569
|
+
year: Number(o[1]),
|
|
570
|
+
month: Number(o[2]),
|
|
571
|
+
day: Number(o[3])
|
|
572
|
+
};
|
|
573
|
+
return Je(r) ? { kind: "date", date: r } : null;
|
|
574
|
+
}
|
|
575
|
+
const a = Be.test(e) ? new Date(e.replace(" ", "T")) : Oe.test(e) ? R(e.replace(" ", "T"), t) : null;
|
|
576
|
+
return a && !Number.isNaN(a.getTime()) ? { kind: "instant", instant: a } : null;
|
|
577
|
+
}
|
|
578
|
+
function We(e, t) {
|
|
579
|
+
return e.kind === "instant" ? e.instant : R(`${I(e.date)}T00:00:00`, t);
|
|
580
|
+
}
|
|
581
|
+
function Ke(e, t, o) {
|
|
582
|
+
if (e.kind === "date") return e.date;
|
|
583
|
+
const a = Se(e.instant, o), r = { year: a.year, month: a.month, day: a.day };
|
|
584
|
+
if (a.hour === 0 && a.minute === 0 && a.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? r : qe(r, -1);
|
|
585
|
+
const n = a.hour === 23 && a.minute === 59 && a.second === 59;
|
|
586
|
+
return t === "end" && n ? r : null;
|
|
587
|
+
}
|
|
588
|
+
function Ye(e, t, o) {
|
|
589
|
+
return o.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== Q(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;
|
|
590
|
+
}
|
|
591
|
+
function I(e) {
|
|
592
|
+
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
593
|
+
}
|
|
594
|
+
function A(e) {
|
|
595
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
596
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
597
|
+
}
|
|
598
|
+
function qe(e, t) {
|
|
599
|
+
const o = A(e);
|
|
600
|
+
return o.setUTCDate(o.getUTCDate() + t), {
|
|
601
|
+
year: o.getUTCFullYear(),
|
|
602
|
+
month: o.getUTCMonth() + 1,
|
|
603
|
+
day: o.getUTCDate()
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function He(e, t) {
|
|
607
|
+
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
608
|
+
}
|
|
609
|
+
function Q(e, t) {
|
|
610
|
+
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
611
|
+
}
|
|
612
|
+
function Je(e) {
|
|
613
|
+
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= Q(e.year, e.month);
|
|
614
|
+
}
|
|
615
|
+
const Qe = /^\d{4}-\d{2}-\d{2}$/;
|
|
616
|
+
function ee(e) {
|
|
617
|
+
const t = e.split(".");
|
|
618
|
+
return t[t.length - 1].replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase()).join(" ");
|
|
619
|
+
}
|
|
620
|
+
const B = 10;
|
|
621
|
+
function x(e, t) {
|
|
622
|
+
const o = e.slice(0, B).map(t).join(", "), a = e.length - B;
|
|
623
|
+
return a > 0 ? `${o}, and ${a} more` : o;
|
|
624
|
+
}
|
|
625
|
+
function et(e) {
|
|
626
|
+
if (e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between")
|
|
627
|
+
return;
|
|
628
|
+
const t = ge(e.relativeMeta);
|
|
629
|
+
if (t)
|
|
630
|
+
return he(t) || t.unit === "quarter" || t.unit === "year" ? t : void 0;
|
|
631
|
+
}
|
|
632
|
+
function z(e, t = {}) {
|
|
633
|
+
const { name: o, operation: a, values: r, valueType: s } = e, n = t.label ?? ee(o), l = et(e);
|
|
634
|
+
if (l) {
|
|
635
|
+
const i = Le(l);
|
|
636
|
+
if (i)
|
|
637
|
+
return a === "between" ? `${n}: ${i}` : `${n} not in ${i}`;
|
|
638
|
+
}
|
|
639
|
+
if (!r || r.length === 0)
|
|
640
|
+
return a === "is null" ? `${n} is empty` : a === "is not null" ? `${n} is not empty` : "";
|
|
641
|
+
const c = (i) => {
|
|
642
|
+
if (s === "date" && i) {
|
|
643
|
+
const g = e.temporalPrecision === "minute", f = {
|
|
644
|
+
year: "numeric",
|
|
645
|
+
month: "short",
|
|
646
|
+
day: "numeric",
|
|
647
|
+
...g ? {
|
|
648
|
+
hour: "numeric",
|
|
649
|
+
minute: "2-digit"
|
|
650
|
+
} : {}
|
|
651
|
+
};
|
|
652
|
+
if (typeof i == "string" && Qe.test(i)) {
|
|
653
|
+
const [u, m, d] = i.split("-").map(Number);
|
|
654
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
655
|
+
year: "numeric",
|
|
656
|
+
month: "short",
|
|
657
|
+
day: "numeric",
|
|
658
|
+
timeZone: "UTC"
|
|
659
|
+
}).format(new Date(Date.UTC(u, m - 1, d)));
|
|
660
|
+
}
|
|
661
|
+
if (typeof i == "string" && me(i) === "wall_datetime") {
|
|
662
|
+
const [u, m, d, y, p] = i.split(/[-T :.]/).map(Number);
|
|
663
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
664
|
+
...f,
|
|
665
|
+
timeZone: "UTC"
|
|
666
|
+
}).format(new Date(Date.UTC(u, m - 1, d, y, p)));
|
|
667
|
+
}
|
|
668
|
+
const h = new Date(i);
|
|
669
|
+
if (!isNaN(h.getTime()))
|
|
670
|
+
try {
|
|
671
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
672
|
+
...f,
|
|
673
|
+
...t.timezone ? { timeZone: t.timezone } : {}
|
|
674
|
+
}).format(h);
|
|
675
|
+
} catch {
|
|
676
|
+
return g ? h.toLocaleString(void 0, f) : h.toLocaleDateString(void 0, f);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return String(i);
|
|
680
|
+
};
|
|
681
|
+
switch (a) {
|
|
682
|
+
case "=":
|
|
683
|
+
return `${n}: ${c(r[0])}`;
|
|
684
|
+
case "!=":
|
|
685
|
+
return `${n} ≠ ${c(r[0])}`;
|
|
686
|
+
case ">":
|
|
687
|
+
return `${n} > ${c(r[0])}`;
|
|
688
|
+
case "<":
|
|
689
|
+
return `${n} < ${c(r[0])}`;
|
|
690
|
+
case ">=":
|
|
691
|
+
return `${n} ≥ ${c(r[0])}`;
|
|
692
|
+
case "<=":
|
|
693
|
+
return `${n} ≤ ${c(r[0])}`;
|
|
694
|
+
case "between":
|
|
695
|
+
case "not between": {
|
|
696
|
+
const i = `${c(r[0])} - ${c(r[1])}`;
|
|
697
|
+
return a === "between" ? `${n}: ${i}` : `${n} not in ${i}`;
|
|
698
|
+
}
|
|
699
|
+
case "in":
|
|
700
|
+
return r.length === 1 ? `${n}: ${c(r[0])}` : `${n}: ${x(r, c)}`;
|
|
701
|
+
case "not in":
|
|
702
|
+
return `${n} not in (${x(r, c)})`;
|
|
703
|
+
case "like":
|
|
704
|
+
return `${n} contains "${r[0]}"`;
|
|
705
|
+
case "not like":
|
|
706
|
+
return `${n} doesn't contain "${r[0]}"`;
|
|
707
|
+
default:
|
|
708
|
+
return `${n}: ${x(r, c)}`;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
function Dt(e, t = {}) {
|
|
712
|
+
if (!e || e.length === 0)
|
|
713
|
+
return "";
|
|
714
|
+
const o = /* @__PURE__ */ new Map();
|
|
715
|
+
e.forEach((r) => {
|
|
716
|
+
const s = o.get(r.name) || [];
|
|
717
|
+
s.push(r), o.set(r.name, s);
|
|
718
|
+
});
|
|
719
|
+
const a = [];
|
|
720
|
+
return o.forEach((r, s) => {
|
|
721
|
+
if (r.length === 1) {
|
|
722
|
+
const n = z(r[0], t);
|
|
723
|
+
n && a.push(n);
|
|
724
|
+
} else {
|
|
725
|
+
const n = ee(s), l = r.map((c) => z(c, t).replace(`${n}: `, "").replace(`${n} `, "")).filter(Boolean);
|
|
726
|
+
l.length > 0 && a.push(`${n}: ${l.join(" and ")}`);
|
|
727
|
+
}
|
|
728
|
+
}), a.join(" | ");
|
|
729
|
+
}
|
|
730
|
+
const tt = /* @__PURE__ */ new Set([
|
|
731
|
+
"day",
|
|
732
|
+
"week",
|
|
733
|
+
"month",
|
|
734
|
+
"quarter",
|
|
735
|
+
"year"
|
|
736
|
+
]);
|
|
737
|
+
function rt(e, t) {
|
|
738
|
+
try {
|
|
739
|
+
const o = b(
|
|
740
|
+
v(e),
|
|
741
|
+
t,
|
|
742
|
+
"yyyy-MM-dd"
|
|
743
|
+
), [a, r, s] = o.split("-").map(Number), n = new Date(Date.UTC(a, r - 1, s));
|
|
744
|
+
return n.setUTCDate(n.getUTCDate() - 1), b(n, "UTC", "yyyy-MM-dd");
|
|
745
|
+
} catch {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function Rt(e, t, o, a = !1) {
|
|
750
|
+
const r = ot(
|
|
751
|
+
e,
|
|
752
|
+
t,
|
|
753
|
+
o,
|
|
754
|
+
a
|
|
755
|
+
);
|
|
756
|
+
return `${r.start} - ${r.end}`;
|
|
757
|
+
}
|
|
758
|
+
function ot(e, t, o, a = !1) {
|
|
759
|
+
try {
|
|
760
|
+
if (o && tt.has(o)) {
|
|
761
|
+
const r = rt(e.end, t);
|
|
762
|
+
if (r) {
|
|
763
|
+
const s = a ? "MMM d" : "MMM d, yyyy";
|
|
764
|
+
return {
|
|
765
|
+
start: b(
|
|
766
|
+
v(e.start),
|
|
767
|
+
t,
|
|
768
|
+
s
|
|
769
|
+
),
|
|
770
|
+
end: b(
|
|
771
|
+
v(`${r}T00:00:00Z`),
|
|
772
|
+
"UTC",
|
|
773
|
+
"MMM d, yyyy"
|
|
774
|
+
)
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (o === "second" || o === "minute" || o === "hour") {
|
|
779
|
+
const r = a ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
780
|
+
return {
|
|
781
|
+
start: b(v(e.start), t, r),
|
|
782
|
+
end: `before ${b(
|
|
783
|
+
v(e.end),
|
|
784
|
+
t,
|
|
785
|
+
r
|
|
786
|
+
)}`
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
} catch {
|
|
790
|
+
}
|
|
791
|
+
return { start: e.start, end: `before ${e.end}` };
|
|
792
|
+
}
|
|
793
|
+
const at = "__TOTAL__";
|
|
794
|
+
function $(e) {
|
|
795
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
796
|
+
}
|
|
797
|
+
function D(e) {
|
|
798
|
+
return e === at;
|
|
799
|
+
}
|
|
800
|
+
function Ft(e) {
|
|
801
|
+
const t = /* @__PURE__ */ new Map(), o = (e.groupByColumns ?? []).map((r, s) => {
|
|
802
|
+
var i, g, f;
|
|
803
|
+
if (!$(r))
|
|
804
|
+
throw new Error(`Aggregate groupByColumns[${s}] is invalid`);
|
|
805
|
+
const n = typeof r.id == "string" && r.id.length > 0 ? r.id : void 0, l = n ? (f = (g = (i = e.columnKeyMap) == null ? void 0 : i.byRole) == null ? void 0 : g.groupby) == null ? void 0 : f[n] : void 0, c = (l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || (typeof r.alias == "string" && r.alias.length > 0 ? r.alias : typeof r.name == "string" && r.name.length > 0 ? r.name : void 0);
|
|
806
|
+
if (!c)
|
|
807
|
+
throw new Error(`Aggregate groupByColumns[${s}] has no output key`);
|
|
808
|
+
return [n, r.alias, r.name, c].forEach((h) => {
|
|
809
|
+
typeof h == "string" && h.length > 0 && t.set(h, c);
|
|
810
|
+
}), c;
|
|
811
|
+
}), a = (e.rowAggregates ?? []).flatMap((r) => !$(r) || typeof r.function != "string" || typeof r.groupLevel != "string" ? [] : [
|
|
812
|
+
{
|
|
813
|
+
function: r.function,
|
|
814
|
+
groupLevel: r.groupLevel === "ALL" ? "ALL" : t.get(r.groupLevel) || r.groupLevel,
|
|
815
|
+
...typeof r.label == "string" ? { label: r.label } : {}
|
|
816
|
+
}
|
|
817
|
+
]);
|
|
818
|
+
return { groupColumnKeys: o, rowAggregates: a };
|
|
819
|
+
}
|
|
820
|
+
function te(e) {
|
|
821
|
+
return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
822
|
+
}
|
|
823
|
+
function nt(e) {
|
|
824
|
+
var o;
|
|
825
|
+
if (e.customLabel) return e.customLabel;
|
|
826
|
+
const t = te(e.aggregateFunction);
|
|
827
|
+
if (e.levelValue !== void 0 && !D(e.levelValue)) {
|
|
828
|
+
if (e.levelValue === null) {
|
|
829
|
+
const r = (o = e.formatValue) == null ? void 0 : o.call(e, null);
|
|
830
|
+
return r ? `Subtotal ${r}` : `Subtotal ${t}`;
|
|
831
|
+
}
|
|
832
|
+
const a = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
|
|
833
|
+
if (a) return `Subtotal (${a})`;
|
|
834
|
+
}
|
|
835
|
+
return `Subtotal ${t}`;
|
|
836
|
+
}
|
|
837
|
+
function st(e, t) {
|
|
838
|
+
return t || `Grand ${te(e)}`;
|
|
839
|
+
}
|
|
840
|
+
function Nt(e) {
|
|
841
|
+
const t = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
842
|
+
if (t < 0)
|
|
843
|
+
throw new Error(
|
|
844
|
+
`Aggregate group column "${e.columnKey}" is unknown`
|
|
845
|
+
);
|
|
846
|
+
return _e({
|
|
847
|
+
row: e.row,
|
|
848
|
+
previousRow: e.previousRow,
|
|
849
|
+
levelIndex: t,
|
|
850
|
+
getValue: (o, a) => o[e.context.groupColumnKeys[a]]
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function re(e) {
|
|
854
|
+
var a, r;
|
|
855
|
+
const t = e.context.groupColumnKeys, o = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
|
|
856
|
+
if (e.row.isGrandTotal === !0) {
|
|
857
|
+
const s = (a = e.context.rowAggregates.find(
|
|
858
|
+
(n) => n.groupLevel === "ALL"
|
|
859
|
+
)) == null ? void 0 : a.label;
|
|
860
|
+
return {
|
|
861
|
+
kind: "grand-total",
|
|
862
|
+
cells: t.map((n, l) => ({
|
|
863
|
+
columnKey: n,
|
|
864
|
+
text: l === 0 ? st(o, s) : "",
|
|
865
|
+
placement: l === 0 ? "label" : "empty",
|
|
866
|
+
colSpan: l === 0 ? t.length : 1
|
|
867
|
+
}))
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
if (e.row.isSubtotal === !0) {
|
|
871
|
+
if (typeof e.row.subtotalLevel != "string")
|
|
872
|
+
throw new Error("Aggregate subtotal row is missing subtotalLevel");
|
|
873
|
+
const s = t.indexOf(e.row.subtotalLevel);
|
|
874
|
+
if (s < 0)
|
|
875
|
+
throw new Error(
|
|
876
|
+
`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
|
|
877
|
+
);
|
|
878
|
+
const n = $(e.row.subtotalContext) ? e.row.subtotalContext : void 0, l = $(n == null ? void 0 : n.groupByValues) ? n.groupByValues : {}, c = (r = e.context.rowAggregates.find(
|
|
879
|
+
(i) => i.groupLevel === e.row.subtotalLevel && i.function === o
|
|
880
|
+
)) == null ? void 0 : r.label;
|
|
881
|
+
return {
|
|
882
|
+
kind: "subtotal",
|
|
883
|
+
cells: t.map((i, g) => {
|
|
884
|
+
if (g > s)
|
|
885
|
+
return {
|
|
886
|
+
columnKey: i,
|
|
887
|
+
text: "",
|
|
888
|
+
placement: "empty",
|
|
889
|
+
colSpan: 1
|
|
890
|
+
};
|
|
891
|
+
if (g < s) {
|
|
892
|
+
const f = e.row[i];
|
|
893
|
+
return {
|
|
894
|
+
columnKey: i,
|
|
895
|
+
text: f === void 0 || D(f) ? "" : e.formatValue(f, i),
|
|
896
|
+
placement: "value",
|
|
897
|
+
colSpan: 1
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
return {
|
|
901
|
+
columnKey: i,
|
|
902
|
+
text: nt({
|
|
903
|
+
aggregateFunction: o,
|
|
904
|
+
customLabel: c,
|
|
905
|
+
levelValue: l[i],
|
|
906
|
+
formatValue: (f) => e.formatLabelValue ? e.formatLabelValue(f, i) : String(e.formatValue(f, i) ?? "")
|
|
907
|
+
}),
|
|
908
|
+
placement: "label",
|
|
909
|
+
colSpan: t.length - s
|
|
910
|
+
};
|
|
911
|
+
})
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
kind: "data",
|
|
916
|
+
cells: t.map((s) => {
|
|
917
|
+
const n = e.row[s];
|
|
918
|
+
return {
|
|
919
|
+
columnKey: s,
|
|
920
|
+
text: n === void 0 || D(n) ? "" : e.formatValue(n, s),
|
|
921
|
+
placement: "value",
|
|
922
|
+
colSpan: 1
|
|
923
|
+
};
|
|
924
|
+
})
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
function Ut(e) {
|
|
928
|
+
const t = re(e).cells.find(
|
|
929
|
+
(o) => o.columnKey === e.columnKey
|
|
930
|
+
);
|
|
931
|
+
if (!t)
|
|
932
|
+
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
933
|
+
return t.text;
|
|
934
|
+
}
|
|
935
|
+
function Vt(e) {
|
|
936
|
+
return re(e).cells.map((t) => t.text);
|
|
937
|
+
}
|
|
938
|
+
export {
|
|
939
|
+
at as A,
|
|
940
|
+
Ft as B,
|
|
941
|
+
nt as C,
|
|
942
|
+
ke as D,
|
|
943
|
+
st as E,
|
|
944
|
+
vt as F,
|
|
945
|
+
Nt as G,
|
|
946
|
+
re as H,
|
|
947
|
+
Ut as I,
|
|
948
|
+
Vt as J,
|
|
949
|
+
_e as K,
|
|
950
|
+
ot as L,
|
|
951
|
+
St as M,
|
|
952
|
+
xe as P,
|
|
953
|
+
Tt as a,
|
|
954
|
+
Lt as b,
|
|
955
|
+
Ct as c,
|
|
956
|
+
Et as d,
|
|
957
|
+
De as e,
|
|
958
|
+
Rt as f,
|
|
959
|
+
Pt as g,
|
|
960
|
+
At as h,
|
|
961
|
+
Mt as i,
|
|
962
|
+
Ae as j,
|
|
963
|
+
$e as k,
|
|
964
|
+
Pe as l,
|
|
965
|
+
$t as m,
|
|
966
|
+
Fe as n,
|
|
967
|
+
Ne as o,
|
|
968
|
+
Ie as p,
|
|
969
|
+
xt as q,
|
|
970
|
+
kt as r,
|
|
971
|
+
_t as s,
|
|
972
|
+
It as t,
|
|
973
|
+
B as u,
|
|
974
|
+
ze as v,
|
|
975
|
+
et as w,
|
|
976
|
+
z as x,
|
|
977
|
+
Dt as y,
|
|
978
|
+
D as z
|
|
979
|
+
};
|