react-semaphor 0.1.603 → 0.1.604
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/activity/index.js +1 -73
- package/dist/analytics-protocol/index.js +1 -1491
- package/dist/appearance/index.js +1 -12
- package/dist/appearance-runtime/index.js +1 -5
- package/dist/assistant-context/index.js +1 -11
- package/dist/assistant-protocol/index.js +1 -152
- package/dist/brand-studio/index.js +4 -1594
- package/dist/briefings/index.js +1 -70
- package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
- package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
- package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
- package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
- package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
- package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
- package/dist/chunks/attribution-BEFSsbNn.js +1 -0
- package/dist/chunks/availability-3AIOf6Z-.js +1 -0
- package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
- package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
- package/dist/chunks/brand-DCaZyRt6.js +1 -0
- package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
- package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
- package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
- package/dist/chunks/context-ALdccLHw.js +2 -0
- package/dist/chunks/conversation-JMK2kyTK.js +1 -0
- package/dist/chunks/dashboard-BX28ld6s.js +1 -0
- package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
- package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
- package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
- package/dist/chunks/dates-D-KP8G-z.js +1 -0
- package/dist/chunks/edit-DEAK0UZo.js +1 -0
- package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
- package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
- package/dist/chunks/filter-line-CwQrqORc.js +1 -0
- package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
- package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
- package/dist/chunks/index-B-VF1ogs.js +1 -0
- package/dist/chunks/index-BE1DfxNs.js +1 -0
- package/dist/chunks/index-DViPGDFj.js +1 -0
- package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
- package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
- package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
- package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
- package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
- package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
- package/dist/chunks/palette-BzC-CGOc.js +6 -0
- package/dist/chunks/pickers-DuBrUht0.js +1 -0
- package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
- package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
- package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
- package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
- package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
- package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
- package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
- package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
- package/dist/chunks/save-DdFUZcbi.js +6 -0
- package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
- package/dist/chunks/schema-MC0cQSAb.js +4 -0
- package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
- package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
- package/dist/chunks/set-DuJfGkbY.js +1 -0
- package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
- package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
- package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
- package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
- package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
- package/dist/chunks/validators-CqV3Yka1.js +1 -0
- package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
- package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
- package/dist/dashboard/index.js +1 -7
- package/dist/dashboard-authoring/index.js +1 -4614
- package/dist/format-utils/index.js +1 -425
- package/dist/index.js +1 -554
- package/dist/layouts/index.js +1 -7
- package/dist/live-channel/index.js +1 -124
- package/dist/pdf-export-policy/index.js +1 -92
- package/dist/pdf-table-layout/index.js +1 -993
- package/dist/report-runtime-context/index.js +1 -9
- package/dist/shared/index.js +1 -6
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -9
- package/dist/types/index.js +1 -88
- package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
- package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
- package/dist/types/lib/types/semantic-types.d.ts +6 -10
- package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
- package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
- package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
- package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
- package/dist/usage-events/index.js +1 -285
- package/dist/value-format-preferences/index.js +1 -635
- package/package.json +4 -1
- package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
- package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
- package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
- package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
- package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
- package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
- package/dist/chunks/attribution-BvoKvhcj.js +0 -32
- package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
- package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
- package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
- package/dist/chunks/brand-BoUV0iHF.js +0 -54
- package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
- package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
- package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
- package/dist/chunks/context-UCQ7sere.js +0 -369
- package/dist/chunks/conversation-sQiWYUOb.js +0 -16
- package/dist/chunks/dashboard-BghI99oY.js +0 -14
- package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
- package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
- package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
- package/dist/chunks/dates-BnrXF4bb.js +0 -185
- package/dist/chunks/edit-9df1zOWe.js +0 -226
- package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
- package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
- package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
- package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
- package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
- package/dist/chunks/index-BVKzKl5d.js +0 -90
- package/dist/chunks/index-CV_Kzou0.js +0 -595
- package/dist/chunks/index-D5rxbtS4.js +0 -2795
- package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
- package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
- package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
- package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
- package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
- package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
- package/dist/chunks/palette-Be62Tkoa.js +0 -23
- package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
- package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
- package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
- package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
- package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
- package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
- package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
- package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
- package/dist/chunks/resolver-DG_tfEpt.js +0 -156
- package/dist/chunks/save-C5A0JnEV.js +0 -21
- package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
- package/dist/chunks/schema-C9NPiIru.js +0 -2568
- package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
- package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
- package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
- package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
- package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
- package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
- package/dist/chunks/token-types-XbM6QByy.js +0 -8
- package/dist/chunks/upload-H15d7uHK.js +0 -15
- package/dist/chunks/validators-Baf3VIf5.js +0 -3686
- package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
- package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
|
@@ -1,2795 +0,0 @@
|
|
|
1
|
-
var Oe = Object.defineProperty;
|
|
2
|
-
var Fe = (e, n, t) => n in e ? Oe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
-
var M = (e, n, t) => Fe(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
-
import { aR as Ne, a2 as Re, at as oe, V as se, k as Me, a1 as Be, Z as N } from "./pivot-result-contract-expectations-BYqAmG9n.js";
|
|
5
|
-
import { U as Z, a6 as Le, T as Ue } from "./validators-Baf3VIf5.js";
|
|
6
|
-
import { l as Pe, C as Ve } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
-
import { z as y } from "zod";
|
|
8
|
-
import { ai as ze, ak as je, X as qe } from "./matrix-operation-contract-DPBj69D8.js";
|
|
9
|
-
import "./analytics-base-schemas-DsUh5Q3C.js";
|
|
10
|
-
import "../value-format-preferences/index.js";
|
|
11
|
-
import { r as Ke } from "./rendered-file-D8xEuVVx.js";
|
|
12
|
-
import { T as de, U as Ge, V as He, W as We, X as Xe, u as Ze, Y as Ye, Z as Je, _ as Qe, $ as et, a0 as tt, a1 as nt, a2 as rt } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
|
|
13
|
-
import { J as ot, K as at } from "./bookmark-state-n7AaNzR_.js";
|
|
14
|
-
import "./pickers-DkqmtnTL.js";
|
|
15
|
-
import "./schema-C9NPiIru.js";
|
|
16
|
-
import "./index-CV_Kzou0.js";
|
|
17
|
-
import "./context-UCQ7sere.js";
|
|
18
|
-
const it = /* @__PURE__ */ new Set(["table", "detailTable"]), ct = /* @__PURE__ */ new Set([
|
|
19
|
-
"bar",
|
|
20
|
-
"horizontalBar",
|
|
21
|
-
"line",
|
|
22
|
-
"area",
|
|
23
|
-
"stackedArea",
|
|
24
|
-
"combo",
|
|
25
|
-
"pie",
|
|
26
|
-
"doughnut",
|
|
27
|
-
"radar",
|
|
28
|
-
"polarArea",
|
|
29
|
-
"bubble",
|
|
30
|
-
"scatter",
|
|
31
|
-
"stackedBar",
|
|
32
|
-
"stackedLine",
|
|
33
|
-
"table",
|
|
34
|
-
"matrixTable",
|
|
35
|
-
"detailTable",
|
|
36
|
-
"kpi",
|
|
37
|
-
"pyramid",
|
|
38
|
-
"tornado",
|
|
39
|
-
"range",
|
|
40
|
-
"funnel",
|
|
41
|
-
"bullet",
|
|
42
|
-
"heatmap",
|
|
43
|
-
"treemap",
|
|
44
|
-
"custom"
|
|
45
|
-
]);
|
|
46
|
-
function Zn(e) {
|
|
47
|
-
var o, a, i;
|
|
48
|
-
const n = ct.has(e.type) && (e.type !== "custom" || !!((o = e.customCardPreferences) != null && o.url));
|
|
49
|
-
let t = !1;
|
|
50
|
-
try {
|
|
51
|
-
t = !!de(e);
|
|
52
|
-
} catch {
|
|
53
|
-
return { formats: [], defaultFormat: null };
|
|
54
|
-
}
|
|
55
|
-
return e.type === "text" || !n || !t && Ge(e) ? { formats: [], defaultFormat: null } : {
|
|
56
|
-
formats: mt({
|
|
57
|
-
cardType: e.type,
|
|
58
|
-
allowDownload: (a = e.preferences) == null ? void 0 : a.allowDownload
|
|
59
|
-
}).filter((c) => c !== "xlsx" || e.type !== "matrixTable" || t),
|
|
60
|
-
defaultFormat: ut({
|
|
61
|
-
cardType: e.type,
|
|
62
|
-
allowDownload: (i = e.preferences) == null ? void 0 : i.allowDownload
|
|
63
|
-
})
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function V(e) {
|
|
67
|
-
return e === "table" || e === "detailTable";
|
|
68
|
-
}
|
|
69
|
-
function Yn(e) {
|
|
70
|
-
let n = null;
|
|
71
|
-
if (e.type === "matrixTable")
|
|
72
|
-
try {
|
|
73
|
-
n = de(e) ?? null;
|
|
74
|
-
} catch {
|
|
75
|
-
n = null;
|
|
76
|
-
}
|
|
77
|
-
return { cardType: e.type, matrixConfig: n };
|
|
78
|
-
}
|
|
79
|
-
function lt(e, n) {
|
|
80
|
-
const { matrix: t, ...r } = e ?? {}, o = { ...r, cardType: n.cardType };
|
|
81
|
-
return n.cardType !== "matrixTable" ? o : t ? { ...o, matrix: t } : n.matrixConfig ? { ...o, matrix: { config: structuredClone(n.matrixConfig), content: "current" } } : o;
|
|
82
|
-
}
|
|
83
|
-
function Jn(e, n) {
|
|
84
|
-
if (e.type !== "card" || !n) return e;
|
|
85
|
-
const t = lt(e.settings, n);
|
|
86
|
-
return e.format === "xlsx" && !t.matrix && !V(t.cardType) ? e : { ...e, settings: t };
|
|
87
|
-
}
|
|
88
|
-
function st(e) {
|
|
89
|
-
var t, r;
|
|
90
|
-
if (e.type !== "card")
|
|
91
|
-
return { kind: "rendered", format: e.format === "png" ? "png" : "pdf" };
|
|
92
|
-
const n = !!((t = e.settings) != null && t.matrix);
|
|
93
|
-
switch (e.format) {
|
|
94
|
-
case "png":
|
|
95
|
-
return { kind: "rendered", format: "png" };
|
|
96
|
-
case "pdf":
|
|
97
|
-
return n ? { kind: "matrix_pdf" } : { kind: "rendered", format: "pdf" };
|
|
98
|
-
case "csv":
|
|
99
|
-
case "xlsx":
|
|
100
|
-
return n || V((r = e.settings) == null ? void 0 : r.cardType) ? { kind: "export_job", format: e.format } : { kind: "card_query", format: "csv" };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function Qn(e) {
|
|
104
|
-
return st(e).kind === "export_job";
|
|
105
|
-
}
|
|
106
|
-
function dt(e) {
|
|
107
|
-
const { label: n, extension: t, contentType: r } = e === "pdf" || e === "png" ? Ke(e) : Pe(e);
|
|
108
|
-
return { label: n, extension: t, contentType: r };
|
|
109
|
-
}
|
|
110
|
-
function mt(e) {
|
|
111
|
-
return e.allowDownload === !1 ? ["pdf", "png"] : e.cardType === "matrixTable" || V(e.cardType) ? ["pdf", "png", "csv", "xlsx"] : ["pdf", "png", "csv"];
|
|
112
|
-
}
|
|
113
|
-
function er(e) {
|
|
114
|
-
return dt(e).label;
|
|
115
|
-
}
|
|
116
|
-
function ut(e) {
|
|
117
|
-
return it.has(e.cardType) && e.allowDownload !== !1 ? "csv" : "pdf";
|
|
118
|
-
}
|
|
119
|
-
function tr(e) {
|
|
120
|
-
const { config: n } = e, t = Ne({
|
|
121
|
-
spec: n.spec,
|
|
122
|
-
presentation: n.presentation,
|
|
123
|
-
defaults: n.defaultView,
|
|
124
|
-
session: e.purpose === "manual" ? e.session : void 0
|
|
125
|
-
});
|
|
126
|
-
return Z.parse({
|
|
127
|
-
spec: t.spec,
|
|
128
|
-
presentation: t.presentation,
|
|
129
|
-
...e.content === "flat" ? { mode: "flat", format: e.format === "xlsx" ? "xlsx" : "csv" } : {
|
|
130
|
-
mode: "layout",
|
|
131
|
-
format: e.format,
|
|
132
|
-
expansion: e.content === "all" ? { kind: "all" } : {
|
|
133
|
-
kind: "current",
|
|
134
|
-
rows: t.view.rows,
|
|
135
|
-
columns: t.view.columns
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const ft = y.object({
|
|
141
|
-
connection_id: y.string().min(1),
|
|
142
|
-
cardType: y.literal("matrixTable"),
|
|
143
|
-
resultOwner: y.literal("config"),
|
|
144
|
-
sql: y.literal("").optional(),
|
|
145
|
-
python: y.literal("").optional(),
|
|
146
|
-
tableStructure: y.never().optional(),
|
|
147
|
-
cardDataSource: y.object({
|
|
148
|
-
connectionId: y.string().min(1),
|
|
149
|
-
connectionType: y.string().min(1),
|
|
150
|
-
mode: y.enum(["database", "semanticDomain"]),
|
|
151
|
-
selectedEntities: y.array(y.unknown()),
|
|
152
|
-
semanticDomainId: y.string().optional()
|
|
153
|
-
}).passthrough(),
|
|
154
|
-
active_filters: y.array(y.unknown()).default([])
|
|
155
|
-
}).passthrough(), nr = ft.extend({
|
|
156
|
-
dashboardId: y.string().min(1),
|
|
157
|
-
cardId: y.string().min(1),
|
|
158
|
-
formatOptions: y.object({
|
|
159
|
-
matrix: Z,
|
|
160
|
-
acquisition: y.literal("continuation").optional(),
|
|
161
|
-
presentationExecutionSnapshot: y.unknown()
|
|
162
|
-
}).passthrough().superRefine((e, n) => {
|
|
163
|
-
e.matrix.format !== "pdf" != (e.acquisition === "continuation") && n.addIssue({
|
|
164
|
-
code: y.ZodIssueCode.custom,
|
|
165
|
-
path: ["acquisition"],
|
|
166
|
-
message: "CSV and Excel require continuation acquisition; PDF must not specify acquisition."
|
|
167
|
-
});
|
|
168
|
-
})
|
|
169
|
-
});
|
|
170
|
-
function rr(e) {
|
|
171
|
-
return {
|
|
172
|
-
...e.controls,
|
|
173
|
-
type: "card",
|
|
174
|
-
dashboardId: e.dashboardId,
|
|
175
|
-
cardId: e.cardId,
|
|
176
|
-
title: e.title,
|
|
177
|
-
cardType: "matrixTable",
|
|
178
|
-
resultOwner: "config",
|
|
179
|
-
sql: "",
|
|
180
|
-
python: "",
|
|
181
|
-
connection_id: e.dataSource.connectionId,
|
|
182
|
-
// Editor metadata can omit mode; the captured source owns dataset identity.
|
|
183
|
-
cardDataSource: {
|
|
184
|
-
...e.dataSource,
|
|
185
|
-
mode: e.matrix.spec.source.kind === "semantic" ? "semanticDomain" : "database",
|
|
186
|
-
semanticDomainId: e.matrix.spec.source.kind === "semantic" ? e.matrix.spec.source.domainId : void 0
|
|
187
|
-
},
|
|
188
|
-
active_filters: e.activeFilters,
|
|
189
|
-
formatOptions: {
|
|
190
|
-
...e.matrix.format !== "pdf" ? {
|
|
191
|
-
acquisition: "continuation",
|
|
192
|
-
...e.csvEncoding ? { csvEncoding: e.csvEncoding } : {}
|
|
193
|
-
} : {},
|
|
194
|
-
matrix: e.matrix,
|
|
195
|
-
delimiter: e.delimiter,
|
|
196
|
-
includeHeaders: e.includeHeaders,
|
|
197
|
-
timezone: e.reportContext.calendar.tz,
|
|
198
|
-
presentationExecutionSnapshot: Re({
|
|
199
|
-
reportContext: e.reportContext,
|
|
200
|
-
resolvedFormats: []
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
const j = y.number().int().nonnegative(), or = y.discriminatedUnion("status", [
|
|
206
|
-
y.object({
|
|
207
|
-
status: y.literal("ok"),
|
|
208
|
-
request: Z,
|
|
209
|
-
layout: ze,
|
|
210
|
-
rows: y.array(je).readonly(),
|
|
211
|
-
usage: y.object({ rows: j, cells: j, bytes: j }).strict()
|
|
212
|
-
}).strict(),
|
|
213
|
-
y.object({
|
|
214
|
-
status: y.literal("failed"),
|
|
215
|
-
failure: y.object({
|
|
216
|
-
code: y.enum(qe),
|
|
217
|
-
limit: y.enum(["rows", "bytes"]).optional(),
|
|
218
|
-
message: y.string().min(1),
|
|
219
|
-
retryable: y.boolean()
|
|
220
|
-
}).strict()
|
|
221
|
-
}).strict()
|
|
222
|
-
]);
|
|
223
|
-
function ae(e) {
|
|
224
|
-
return !e || typeof e != "object" ? !1 : Array.isArray(e.cards);
|
|
225
|
-
}
|
|
226
|
-
function pt(e) {
|
|
227
|
-
if (!e)
|
|
228
|
-
return null;
|
|
229
|
-
if (typeof e == "string")
|
|
230
|
-
try {
|
|
231
|
-
const n = JSON.parse(e);
|
|
232
|
-
return ae(n) ? n : null;
|
|
233
|
-
} catch {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
return ae(e) ? e : null;
|
|
237
|
-
}
|
|
238
|
-
function me(e) {
|
|
239
|
-
var n;
|
|
240
|
-
return (n = e == null ? void 0 : e.cards) != null && n.length ? e.activeCardId && e.cards.find((t) => t.id === e.activeCardId) || e.cards[0] : null;
|
|
241
|
-
}
|
|
242
|
-
function ar(e) {
|
|
243
|
-
var t;
|
|
244
|
-
const n = (e == null ? void 0 : e.frameObject) ?? ((t = e == null ? void 0 : e.visual) == null ? void 0 : t.frameObject);
|
|
245
|
-
return me(pt(n));
|
|
246
|
-
}
|
|
247
|
-
class B extends Error {
|
|
248
|
-
constructor(t) {
|
|
249
|
-
const r = t.cardId ? `card "${t.cardId}"` : t.sheetId ? `sheet "${t.sheetId}"` : `dashboard "${t.dashboardId}"`;
|
|
250
|
-
super(
|
|
251
|
-
`Unable to resolve ${r} while capturing report presentation. Refresh the authoring page and select the attachment again.`
|
|
252
|
-
);
|
|
253
|
-
M(this, "code", "temporal_snapshot_target_not_found");
|
|
254
|
-
M(this, "selection");
|
|
255
|
-
this.name = "TemporalSnapshotSelectionError", this.selection = t;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function ht(e, n) {
|
|
259
|
-
var o;
|
|
260
|
-
const t = [], r = /* @__PURE__ */ new Map();
|
|
261
|
-
for (const a of n) {
|
|
262
|
-
if (a.dashboardId !== e.id)
|
|
263
|
-
throw new B(a);
|
|
264
|
-
const i = (e.sheets || []).filter(
|
|
265
|
-
(l) => !a.sheetId || a.sheetId === l.id
|
|
266
|
-
);
|
|
267
|
-
if (a.sheetId && i.length === 0)
|
|
268
|
-
throw new B(a);
|
|
269
|
-
let c = !a.cardId;
|
|
270
|
-
for (const l of i) {
|
|
271
|
-
const m = (((o = l.document) == null ? void 0 : o.sections) || []).flatMap(
|
|
272
|
-
(p) => at(p)
|
|
273
|
-
), d = (l.frames || []).flatMap(
|
|
274
|
-
(p) => yt(p, a.cardId)
|
|
275
|
-
);
|
|
276
|
-
d.length > 0 && (c = !0);
|
|
277
|
-
const f = [
|
|
278
|
-
...d,
|
|
279
|
-
...(l.cards || []).filter(
|
|
280
|
-
(p) => !a.cardId || a.cardId === p.id
|
|
281
|
-
),
|
|
282
|
-
...m.filter(
|
|
283
|
-
(p) => !a.cardId || a.cardId === p.id
|
|
284
|
-
)
|
|
285
|
-
];
|
|
286
|
-
for (const p of f) {
|
|
287
|
-
c = !0;
|
|
288
|
-
const g = r.get(a.attachmentIndex) ?? /* @__PURE__ */ new Set();
|
|
289
|
-
g.has(p.id) || (g.add(p.id), r.set(a.attachmentIndex, g), t.push({
|
|
290
|
-
card: p,
|
|
291
|
-
...a.attachmentIndex !== void 0 ? { attachmentIndex: a.attachmentIndex } : {}
|
|
292
|
-
}));
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (!c)
|
|
296
|
-
throw new B(a);
|
|
297
|
-
}
|
|
298
|
-
return t;
|
|
299
|
-
}
|
|
300
|
-
function yt(e, n) {
|
|
301
|
-
var i;
|
|
302
|
-
const t = n ? (i = e.cards) == null ? void 0 : i.find((c) => c.id === n) : me(e);
|
|
303
|
-
if (!t) return [];
|
|
304
|
-
const r = et(e, t), o = (e.cards || []).filter(
|
|
305
|
-
(c) => {
|
|
306
|
-
var l;
|
|
307
|
-
return typeof ((l = c.customCardPreferences) == null ? void 0 : l.slotIndex) == "number";
|
|
308
|
-
}
|
|
309
|
-
).length > 1, a = r != null && (tt(r) === "multiple" || o);
|
|
310
|
-
return !r || !a ? [t] : nt(
|
|
311
|
-
rt({
|
|
312
|
-
frame: e,
|
|
313
|
-
configCard: r,
|
|
314
|
-
isMultiInputVisual: !0
|
|
315
|
-
})
|
|
316
|
-
).filter((c) => c !== null);
|
|
317
|
-
}
|
|
318
|
-
function ir(e) {
|
|
319
|
-
return ht(e.dashboard, e.selections).flatMap(
|
|
320
|
-
({ card: n, attachmentIndex: t }) => {
|
|
321
|
-
var d, f;
|
|
322
|
-
const r = ((d = e.resolveCardConfig) == null ? void 0 : d.call(e, n)) ?? n.config, o = He({
|
|
323
|
-
card: n,
|
|
324
|
-
cardConfig: r
|
|
325
|
-
}), a = {
|
|
326
|
-
dashboardId: e.dashboard.id,
|
|
327
|
-
cardId: n.id,
|
|
328
|
-
...t !== void 0 ? { attachmentIndex: t } : {}
|
|
329
|
-
}, i = o ? o.fields.map((p) => ({
|
|
330
|
-
scope: a,
|
|
331
|
-
target: {
|
|
332
|
-
kind: "field",
|
|
333
|
-
fieldId: p.id,
|
|
334
|
-
role: p.role
|
|
335
|
-
},
|
|
336
|
-
format: We(
|
|
337
|
-
p,
|
|
338
|
-
{
|
|
339
|
-
dateStyle: e.valueFormatPreferences.dateStyle,
|
|
340
|
-
dateTime: { ...e.valueFormatPreferences.dateTime }
|
|
341
|
-
},
|
|
342
|
-
e.valueFormatPreferences.locale
|
|
343
|
-
)
|
|
344
|
-
})) : [], c = [], l = Xe(n, r), m = Ze(
|
|
345
|
-
n.python || ""
|
|
346
|
-
);
|
|
347
|
-
if (n.type === "detailTable" && l === "config") {
|
|
348
|
-
const p = (r == null ? void 0 : r.detailColumns) || [], g = ot({
|
|
349
|
-
groupByColumns: r == null ? void 0 : r.groupByColumns,
|
|
350
|
-
metricColumns: r == null ? void 0 : r.metricColumns,
|
|
351
|
-
pivotByColumns: r == null ? void 0 : r.pivotByColumns,
|
|
352
|
-
detailColumns: p
|
|
353
|
-
});
|
|
354
|
-
for (const v of p) {
|
|
355
|
-
const k = Le(v.dataType);
|
|
356
|
-
if (k !== "date" && k !== "datetime") continue;
|
|
357
|
-
const F = g.get(v);
|
|
358
|
-
if (!F) throw new B(a);
|
|
359
|
-
c.push({
|
|
360
|
-
scope: a,
|
|
361
|
-
target: { kind: "column", columnKey: F },
|
|
362
|
-
format: oe({
|
|
363
|
-
// What the table draws: the stored format, or Automatic (ledger P7-07).
|
|
364
|
-
format: Ye(v),
|
|
365
|
-
preferences: e.valueFormatPreferences,
|
|
366
|
-
calendar: e.calendar
|
|
367
|
-
})
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
} else if (l === "freeform" && ((f = n.sql) != null && f.trim()) && !m.trim())
|
|
371
|
-
for (const [p, g] of Object.entries(
|
|
372
|
-
Je(n)
|
|
373
|
-
)) {
|
|
374
|
-
if (g.type !== "date") continue;
|
|
375
|
-
const v = Qe(
|
|
376
|
-
g.dateFormat
|
|
377
|
-
);
|
|
378
|
-
v && c.push({
|
|
379
|
-
scope: a,
|
|
380
|
-
target: { kind: "column", columnKey: p },
|
|
381
|
-
format: oe({
|
|
382
|
-
format: v,
|
|
383
|
-
preferences: e.valueFormatPreferences,
|
|
384
|
-
calendar: e.calendar
|
|
385
|
-
})
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
return [...i, ...c];
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
function gt(e) {
|
|
393
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
394
|
-
}
|
|
395
|
-
function x(e, n, t) {
|
|
396
|
-
return gt(e) ? e : (t.push({ field: n, message: "Expected an object." }), {});
|
|
397
|
-
}
|
|
398
|
-
function S(e, n, t, r) {
|
|
399
|
-
const o = new Set(t);
|
|
400
|
-
Object.keys(e).forEach((a) => {
|
|
401
|
-
o.has(a) || r.push({
|
|
402
|
-
field: `${n}.${a}`,
|
|
403
|
-
message: "Unexpected property."
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
function D(e, n, t, r, o = {}) {
|
|
408
|
-
if (e == null)
|
|
409
|
-
return;
|
|
410
|
-
if (typeof e != "string") {
|
|
411
|
-
r.push({ field: n, message: "Expected a string." });
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
const a = o.trim === !1 ? e : e.trim();
|
|
415
|
-
if (!o.allowEmpty && a.length === 0) {
|
|
416
|
-
r.push({ field: n, message: "Expected a non-empty string." });
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
if (a.length > t) {
|
|
420
|
-
r.push({
|
|
421
|
-
field: n,
|
|
422
|
-
message: `Expected ${t} characters or fewer.`
|
|
423
|
-
});
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
return a;
|
|
427
|
-
}
|
|
428
|
-
function Y(e, n, t) {
|
|
429
|
-
const r = D(e, n, 2e3, t);
|
|
430
|
-
if (r)
|
|
431
|
-
try {
|
|
432
|
-
return new URL(r), r;
|
|
433
|
-
} catch {
|
|
434
|
-
t.push({ field: n, message: "Expected an absolute URL." });
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function ie(e, n, t) {
|
|
439
|
-
const r = x(e, n, t);
|
|
440
|
-
S(r, n, ["tokens", "components"], t);
|
|
441
|
-
const o = {};
|
|
442
|
-
if (r.tokens !== void 0) {
|
|
443
|
-
const a = x(r.tokens, `${n}.tokens`, t);
|
|
444
|
-
S(
|
|
445
|
-
a,
|
|
446
|
-
`${n}.tokens`,
|
|
447
|
-
["color", "typography"],
|
|
448
|
-
t
|
|
449
|
-
);
|
|
450
|
-
const i = {};
|
|
451
|
-
if (a.color !== void 0) {
|
|
452
|
-
const c = x(
|
|
453
|
-
a.color,
|
|
454
|
-
`${n}.tokens.color`,
|
|
455
|
-
t
|
|
456
|
-
), l = [
|
|
457
|
-
"background",
|
|
458
|
-
"foreground",
|
|
459
|
-
"muted",
|
|
460
|
-
"mutedForeground",
|
|
461
|
-
"border",
|
|
462
|
-
"primary",
|
|
463
|
-
"primaryForeground",
|
|
464
|
-
"positive",
|
|
465
|
-
"negative",
|
|
466
|
-
"warning",
|
|
467
|
-
"info"
|
|
468
|
-
];
|
|
469
|
-
S(c, `${n}.tokens.color`, l, t);
|
|
470
|
-
const m = {};
|
|
471
|
-
l.forEach((d) => {
|
|
472
|
-
const f = D(
|
|
473
|
-
c[d],
|
|
474
|
-
`${n}.tokens.color.${d}`,
|
|
475
|
-
120,
|
|
476
|
-
t
|
|
477
|
-
);
|
|
478
|
-
f !== void 0 && (m[d] = f);
|
|
479
|
-
}), i.color = m;
|
|
480
|
-
}
|
|
481
|
-
if (a.typography !== void 0) {
|
|
482
|
-
const c = x(
|
|
483
|
-
a.typography,
|
|
484
|
-
`${n}.tokens.typography`,
|
|
485
|
-
t
|
|
486
|
-
);
|
|
487
|
-
S(
|
|
488
|
-
c,
|
|
489
|
-
`${n}.tokens.typography`,
|
|
490
|
-
["fontFamily", "monoFontFamily"],
|
|
491
|
-
t
|
|
492
|
-
);
|
|
493
|
-
const l = D(
|
|
494
|
-
c.fontFamily,
|
|
495
|
-
`${n}.tokens.typography.fontFamily`,
|
|
496
|
-
500,
|
|
497
|
-
t,
|
|
498
|
-
{ allowEmpty: !0 }
|
|
499
|
-
), m = D(
|
|
500
|
-
c.monoFontFamily,
|
|
501
|
-
`${n}.tokens.typography.monoFontFamily`,
|
|
502
|
-
500,
|
|
503
|
-
t,
|
|
504
|
-
{ allowEmpty: !0 }
|
|
505
|
-
);
|
|
506
|
-
i.typography = {
|
|
507
|
-
...l !== void 0 ? { fontFamily: l } : {},
|
|
508
|
-
...m !== void 0 ? { monoFontFamily: m } : {}
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
o.tokens = i;
|
|
512
|
-
}
|
|
513
|
-
if (r.components !== void 0) {
|
|
514
|
-
const a = x(
|
|
515
|
-
r.components,
|
|
516
|
-
`${n}.components`,
|
|
517
|
-
t
|
|
518
|
-
);
|
|
519
|
-
if (S(a, `${n}.components`, ["chart"], t), a.chart !== void 0) {
|
|
520
|
-
const i = x(
|
|
521
|
-
a.chart,
|
|
522
|
-
`${n}.components.chart`,
|
|
523
|
-
t
|
|
524
|
-
);
|
|
525
|
-
S(i, `${n}.components.chart`, ["palette"], t);
|
|
526
|
-
let c;
|
|
527
|
-
i.palette !== void 0 && (Array.isArray(i.palette) ? i.palette.length > 20 ? t.push({
|
|
528
|
-
field: `${n}.components.chart.palette`,
|
|
529
|
-
message: "Expected 20 colors or fewer."
|
|
530
|
-
}) : c = i.palette.map(
|
|
531
|
-
(l, m) => D(
|
|
532
|
-
l,
|
|
533
|
-
`${n}.components.chart.palette.${m}`,
|
|
534
|
-
120,
|
|
535
|
-
t
|
|
536
|
-
)
|
|
537
|
-
).filter((l) => l !== void 0) : t.push({
|
|
538
|
-
field: `${n}.components.chart.palette`,
|
|
539
|
-
message: "Expected an array."
|
|
540
|
-
})), o.components = {
|
|
541
|
-
chart: c ? { palette: c } : {}
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
return o;
|
|
546
|
-
}
|
|
547
|
-
function bt(e, n) {
|
|
548
|
-
const t = "presentation.appearance", r = x(e, t, n);
|
|
549
|
-
S(r, t, ["version", "schemes"], n);
|
|
550
|
-
const o = {};
|
|
551
|
-
if (r.version !== void 0 && (typeof r.version != "number" || !Number.isFinite(r.version) ? n.push({ field: `${t}.version`, message: "Expected a number." }) : o.version = r.version), r.schemes !== void 0) {
|
|
552
|
-
const a = x(r.schemes, `${t}.schemes`, n);
|
|
553
|
-
S(a, `${t}.schemes`, ["light", "dark"], n), o.schemes = {
|
|
554
|
-
...a.light !== void 0 ? {
|
|
555
|
-
light: ie(
|
|
556
|
-
a.light,
|
|
557
|
-
`${t}.schemes.light`,
|
|
558
|
-
n
|
|
559
|
-
)
|
|
560
|
-
} : {},
|
|
561
|
-
...a.dark !== void 0 ? {
|
|
562
|
-
dark: ie(
|
|
563
|
-
a.dark,
|
|
564
|
-
`${t}.schemes.dark`,
|
|
565
|
-
n
|
|
566
|
-
)
|
|
567
|
-
} : {}
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
return o;
|
|
571
|
-
}
|
|
572
|
-
function Et(e, n) {
|
|
573
|
-
const t = "presentation.brandOverrides", r = x(e, t, n);
|
|
574
|
-
S(r, t, ["brandName", "logoUrl", "link"], n);
|
|
575
|
-
const o = D(
|
|
576
|
-
r.brandName,
|
|
577
|
-
`${t}.brandName`,
|
|
578
|
-
200,
|
|
579
|
-
n
|
|
580
|
-
), a = Y(r.logoUrl, `${t}.logoUrl`, n), i = D(r.link, `${t}.link`, 120, n);
|
|
581
|
-
return {
|
|
582
|
-
...o !== void 0 ? { brandName: o } : {},
|
|
583
|
-
...a !== void 0 ? { logoUrl: a } : {},
|
|
584
|
-
...i !== void 0 ? { link: i } : {}
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function It(e, n) {
|
|
588
|
-
const t = "presentation.fragments", r = x(e, t, n), o = [
|
|
589
|
-
"preHeaderText",
|
|
590
|
-
"headerBannerHtml",
|
|
591
|
-
"signatureHtml",
|
|
592
|
-
"footerHtml",
|
|
593
|
-
"disclaimerHtml",
|
|
594
|
-
"unsubscribeUrl"
|
|
595
|
-
];
|
|
596
|
-
S(r, t, o, n);
|
|
597
|
-
const a = {};
|
|
598
|
-
return o.forEach((i) => {
|
|
599
|
-
const c = i === "unsubscribeUrl" ? Y(r[i], `${t}.${i}`, n) : D(
|
|
600
|
-
r[i],
|
|
601
|
-
`${t}.${i}`,
|
|
602
|
-
i === "preHeaderText" ? 200 : 5e3,
|
|
603
|
-
n,
|
|
604
|
-
{ trim: i === "preHeaderText" }
|
|
605
|
-
);
|
|
606
|
-
c !== void 0 && (a[i] = c);
|
|
607
|
-
}), a;
|
|
608
|
-
}
|
|
609
|
-
function vt(e) {
|
|
610
|
-
const n = [], t = {};
|
|
611
|
-
if (e.appearance !== void 0 && (t.appearance = bt(e.appearance, n)), e.brandOverrides !== void 0 && (t.brandOverrides = Et(e.brandOverrides, n)), e.fragments !== void 0 && (t.fragments = It(e.fragments, n)), e.viewUrl !== void 0) {
|
|
612
|
-
const r = Y(e.viewUrl, "presentation.viewUrl", n);
|
|
613
|
-
r !== void 0 && (t.viewUrl = r);
|
|
614
|
-
}
|
|
615
|
-
return { value: t, issues: n };
|
|
616
|
-
}
|
|
617
|
-
const L = [
|
|
618
|
-
"SUN",
|
|
619
|
-
"MON",
|
|
620
|
-
"TUE",
|
|
621
|
-
"WED",
|
|
622
|
-
"THU",
|
|
623
|
-
"FRI",
|
|
624
|
-
"SAT"
|
|
625
|
-
], ue = new Map(
|
|
626
|
-
L.map((e, n) => [e, n])
|
|
627
|
-
), P = [1, 2, 3, 4, 5], fe = [1, 2, 3, 6, 12], pe = {
|
|
628
|
-
1: "first",
|
|
629
|
-
2: "second",
|
|
630
|
-
3: "third",
|
|
631
|
-
4: "fourth",
|
|
632
|
-
[-1]: "last"
|
|
633
|
-
}, cr = {
|
|
634
|
-
frequency: "weekly",
|
|
635
|
-
hour: 9,
|
|
636
|
-
minute: 0,
|
|
637
|
-
weekdays: [1]
|
|
638
|
-
}, C = { ok: !1, issue: "Choose a supported schedule." };
|
|
639
|
-
function $t(e) {
|
|
640
|
-
if (typeof e != "string" || e.length === 0 || e !== e.trim() || /^(?:(?:UTC|GMT)[+-]|[+-]\d{2}:\d{2}$)/.test(e))
|
|
641
|
-
return !1;
|
|
642
|
-
try {
|
|
643
|
-
return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
|
|
644
|
-
} catch {
|
|
645
|
-
return !1;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
function Ct(e) {
|
|
649
|
-
return Number.isInteger(e.minute) && e.minute >= 0 && e.minute <= 59 && Number.isInteger(e.hour) && e.hour >= 0 && e.hour <= 23;
|
|
650
|
-
}
|
|
651
|
-
function he(e) {
|
|
652
|
-
if (e.length === 0) return null;
|
|
653
|
-
const n = [...e].sort((t, r) => t - r);
|
|
654
|
-
return n.some(
|
|
655
|
-
(t, r) => !Number.isInteger(t) || t < 0 || t > 6 || r > 0 && t === n[r - 1]
|
|
656
|
-
) ? null : n;
|
|
657
|
-
}
|
|
658
|
-
function ye(e) {
|
|
659
|
-
const t = [...e.filter((o) => o !== "last")].sort((o, a) => o - a);
|
|
660
|
-
if (t.some(
|
|
661
|
-
(o, a) => !Number.isInteger(o) || o < 1 || o > 31 || a > 0 && o === t[a - 1]
|
|
662
|
-
) || e.filter((o) => o === "last").length > 1)
|
|
663
|
-
return null;
|
|
664
|
-
const r = e.includes("last") ? [...t, "last"] : t;
|
|
665
|
-
return r.length > 0 ? r : null;
|
|
666
|
-
}
|
|
667
|
-
function O(e, n) {
|
|
668
|
-
const t = [];
|
|
669
|
-
for (let r = 0; r < 12 / e; r += 1)
|
|
670
|
-
t.push((n + r * e) % 12);
|
|
671
|
-
return t.sort((r, o) => r - o);
|
|
672
|
-
}
|
|
673
|
-
function Tt(e, n) {
|
|
674
|
-
return e === 1 ? "*" : O(e, n).map((t) => t + 1).join(",");
|
|
675
|
-
}
|
|
676
|
-
function ge(e, n) {
|
|
677
|
-
return e.every((t) => Ot(t, n));
|
|
678
|
-
}
|
|
679
|
-
function lr(e) {
|
|
680
|
-
if (!Ct(e))
|
|
681
|
-
throw new Error("Choose a valid schedule time.");
|
|
682
|
-
const n = `${e.minute} ${e.hour}`;
|
|
683
|
-
switch (e.frequency) {
|
|
684
|
-
case "daily":
|
|
685
|
-
return e.weekdaysOnly ? `${n} * * ${P.map((t) => L[t]).join(",")}` : `${n} * * *`;
|
|
686
|
-
case "weekly": {
|
|
687
|
-
const t = he(e.weekdays);
|
|
688
|
-
if (!t) throw new Error("Choose at least one weekday.");
|
|
689
|
-
return `${n} * * ${t.map((r) => L[r]).join(",")}`;
|
|
690
|
-
}
|
|
691
|
-
case "monthly": {
|
|
692
|
-
if (!fe.includes(e.interval) || !Number.isInteger(e.startMonth) || e.startMonth < 0 || e.startMonth >= e.interval)
|
|
693
|
-
throw new Error("Choose a valid month cycle.");
|
|
694
|
-
const t = Tt(e.interval, e.startMonth);
|
|
695
|
-
if (e.on.type === "days") {
|
|
696
|
-
const i = ye(e.on.days);
|
|
697
|
-
if (!i) throw new Error("Choose at least one day of the month.");
|
|
698
|
-
const c = O(e.interval, e.startMonth);
|
|
699
|
-
if (!ge(i, c))
|
|
700
|
-
throw new Error("Choose a day that occurs in the chosen months.");
|
|
701
|
-
const l = i.map((m) => m === "last" ? "L" : String(m)).join(",");
|
|
702
|
-
return `${n} ${l} ${t} *`;
|
|
703
|
-
}
|
|
704
|
-
const { ordinal: r, weekday: o } = e.on;
|
|
705
|
-
if (!Number.isInteger(o) || o < 0 || o > 6 || !(r in pe))
|
|
706
|
-
throw new Error("Choose a valid weekday.");
|
|
707
|
-
const a = L[o];
|
|
708
|
-
return `${n} * ${t} ${r === -1 ? `${a}L` : `${a}#${r}`}`;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
function xt(e) {
|
|
713
|
-
if (e === "*") return { interval: 1, startMonth: 0 };
|
|
714
|
-
const n = e.split(",");
|
|
715
|
-
if (n.some((i) => !/^([1-9]|1[0-2])$/.test(i))) return null;
|
|
716
|
-
const t = n.map((i) => Number(i) - 1), r = 12 / t.length;
|
|
717
|
-
if (!fe.includes(r))
|
|
718
|
-
return null;
|
|
719
|
-
const o = t[0], a = O(
|
|
720
|
-
r,
|
|
721
|
-
o
|
|
722
|
-
);
|
|
723
|
-
return o >= r || a.length !== t.length || a.some((i, c) => i !== t[c]) ? null : { interval: r, startMonth: o };
|
|
724
|
-
}
|
|
725
|
-
function St(e) {
|
|
726
|
-
const n = e.split(",");
|
|
727
|
-
if (n.some((o) => !/^(L|[1-9]|[12]\d|3[01])$/.test(o))) return null;
|
|
728
|
-
const t = n.map(
|
|
729
|
-
(o) => o === "L" ? "last" : Number(o)
|
|
730
|
-
), r = ye(t);
|
|
731
|
-
return !r || r.some((o, a) => o !== t[a]) ? null : r;
|
|
732
|
-
}
|
|
733
|
-
function At(e) {
|
|
734
|
-
const n = /^([A-Z]{3})(?:#([1-4])|(L))$/.exec(e);
|
|
735
|
-
if (!n) return null;
|
|
736
|
-
const t = ue.get(n[1]);
|
|
737
|
-
return t === void 0 ? null : {
|
|
738
|
-
weekday: t,
|
|
739
|
-
ordinal: n[3] ? -1 : Number(n[2])
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
function be(e) {
|
|
743
|
-
if (typeof e != "string" || e.length === 0 || e !== e.trim() || e.includes(" "))
|
|
744
|
-
return C;
|
|
745
|
-
const n = e.split(" ");
|
|
746
|
-
if (n.length !== 5) return C;
|
|
747
|
-
const [t, r, o, a, i] = n;
|
|
748
|
-
if (!/^(0|[1-9]\d?)$/.test(t) || !/^(0|[1-9]\d?)$/.test(r))
|
|
749
|
-
return C;
|
|
750
|
-
const c = Number(t), l = Number(r);
|
|
751
|
-
if (c > 59 || l > 23) return C;
|
|
752
|
-
if (a === "*" && o === "*" && i === "*")
|
|
753
|
-
return {
|
|
754
|
-
ok: !0,
|
|
755
|
-
value: { frequency: "daily", hour: l, minute: c, weekdaysOnly: !1 }
|
|
756
|
-
};
|
|
757
|
-
if (a === "*" && o === "*" && !i.includes("#") && !i.endsWith("L")) {
|
|
758
|
-
const f = i.split(",").map((v) => ue.get(v));
|
|
759
|
-
if (f.some((v) => v === void 0)) return C;
|
|
760
|
-
const p = f, g = he(p);
|
|
761
|
-
return !g || g.some((v, k) => v !== p[k]) ? C : g.length === P.length && g.every((v, k) => v === P[k]) ? {
|
|
762
|
-
ok: !0,
|
|
763
|
-
value: { frequency: "daily", hour: l, minute: c, weekdaysOnly: !0 }
|
|
764
|
-
} : {
|
|
765
|
-
ok: !0,
|
|
766
|
-
value: { frequency: "weekly", hour: l, minute: c, weekdays: g }
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
const m = xt(a);
|
|
770
|
-
if (!m) return C;
|
|
771
|
-
if (o !== "*" && i === "*") {
|
|
772
|
-
const d = St(o), f = O(m.interval, m.startMonth);
|
|
773
|
-
return !d || !ge(d, f) ? C : {
|
|
774
|
-
ok: !0,
|
|
775
|
-
value: {
|
|
776
|
-
frequency: "monthly",
|
|
777
|
-
hour: l,
|
|
778
|
-
minute: c,
|
|
779
|
-
...m,
|
|
780
|
-
on: { type: "days", days: d }
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
if (o === "*" && i !== "*") {
|
|
785
|
-
const d = At(i);
|
|
786
|
-
return d ? {
|
|
787
|
-
ok: !0,
|
|
788
|
-
value: {
|
|
789
|
-
frequency: "monthly",
|
|
790
|
-
hour: l,
|
|
791
|
-
minute: c,
|
|
792
|
-
...m,
|
|
793
|
-
on: { type: "weekday", ...d }
|
|
794
|
-
}
|
|
795
|
-
} : C;
|
|
796
|
-
}
|
|
797
|
-
return C;
|
|
798
|
-
}
|
|
799
|
-
function kt(e, n, t) {
|
|
800
|
-
return new Intl.DateTimeFormat(t, {
|
|
801
|
-
hour: "numeric",
|
|
802
|
-
minute: "2-digit",
|
|
803
|
-
timeZone: "UTC"
|
|
804
|
-
}).format(new Date(Date.UTC(2020, 0, 1, e, n)));
|
|
805
|
-
}
|
|
806
|
-
function _t(e, n) {
|
|
807
|
-
var t;
|
|
808
|
-
if (e === "UTC") return "UTC";
|
|
809
|
-
try {
|
|
810
|
-
return ((t = new Intl.DateTimeFormat(n, {
|
|
811
|
-
timeZone: e,
|
|
812
|
-
timeZoneName: "longGeneric"
|
|
813
|
-
}).formatToParts(new Date(Date.UTC(2020, 0, 1))).find((o) => o.type === "timeZoneName")) == null ? void 0 : t.value) ?? e;
|
|
814
|
-
} catch {
|
|
815
|
-
return null;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
function ce(e) {
|
|
819
|
-
return e.length <= 1 ? e.join("") : e.length === 2 ? `${e[0]} and ${e[1]}` : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
|
|
820
|
-
}
|
|
821
|
-
function Dt(e) {
|
|
822
|
-
const n = e % 100;
|
|
823
|
-
return n >= 11 && n <= 13 ? `${e}th` : `${e}${["th", "st", "nd", "rd"][e % 10] ?? "th"}`;
|
|
824
|
-
}
|
|
825
|
-
function wt(e, n, t) {
|
|
826
|
-
const r = (a, i) => new Intl.DateTimeFormat(t, { month: i, timeZone: "UTC" }).format(
|
|
827
|
-
new Date(Date.UTC(2020, a, 1))
|
|
828
|
-
);
|
|
829
|
-
if (e === 1) return "every month";
|
|
830
|
-
if (e === 12) return `${r(n, "long")} each year`;
|
|
831
|
-
const o = O(e, n).map((a) => r(a, "short")).join(", ");
|
|
832
|
-
return e === 3 ? `each quarter (${o})` : `every ${e} months (${o})`;
|
|
833
|
-
}
|
|
834
|
-
function sr(e, n, t = "en-US") {
|
|
835
|
-
const r = be(e);
|
|
836
|
-
if (!r.ok) return null;
|
|
837
|
-
try {
|
|
838
|
-
const o = r.value, a = _t(n, t);
|
|
839
|
-
if (!a) return null;
|
|
840
|
-
const i = `at ${kt(o.hour, o.minute, t)} ${a}`, c = (l) => new Intl.DateTimeFormat(t, {
|
|
841
|
-
weekday: "long",
|
|
842
|
-
timeZone: "UTC"
|
|
843
|
-
}).format(new Date(Date.UTC(2023, 0, 1 + l)));
|
|
844
|
-
switch (o.frequency) {
|
|
845
|
-
case "daily":
|
|
846
|
-
return o.weekdaysOnly ? `Every weekday, Monday to Friday, ${i}` : `Every day ${i}`;
|
|
847
|
-
case "weekly":
|
|
848
|
-
return `Every ${ce(o.weekdays.map(c))} ${i}`;
|
|
849
|
-
case "monthly": {
|
|
850
|
-
const l = wt(o.interval, o.startMonth, t);
|
|
851
|
-
if (o.on.type === "weekday")
|
|
852
|
-
return `On the ${pe[o.on.ordinal]} ${c(o.on.weekday)} of ${l} ${i}`;
|
|
853
|
-
const m = o.on.days.map(
|
|
854
|
-
(d) => d === "last" ? "last day" : Dt(d)
|
|
855
|
-
);
|
|
856
|
-
return `On the ${ce(m)} of ${l} ${i}`;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
} catch {
|
|
860
|
-
return null;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
const Ee = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
864
|
-
function Ot(e, n) {
|
|
865
|
-
return e === "last" || n.some((t) => e <= Ee[t]);
|
|
866
|
-
}
|
|
867
|
-
function dr(e) {
|
|
868
|
-
if (e.frequency !== "monthly" || e.on.type !== "days") return null;
|
|
869
|
-
const n = e.on.days.filter((o) => o !== "last");
|
|
870
|
-
if (n.length === 0) return null;
|
|
871
|
-
const t = Math.max(...n), r = O(e.interval, e.startMonth).filter(
|
|
872
|
-
(o) => t > (o === 1 ? 28 : Ee[o])
|
|
873
|
-
);
|
|
874
|
-
return r.length > 0 ? { day: t, months: r } : null;
|
|
875
|
-
}
|
|
876
|
-
function Ft(e, n) {
|
|
877
|
-
return new Date(Date.UTC(e, n + 1, 0)).getUTCDate();
|
|
878
|
-
}
|
|
879
|
-
function Nt(e, n, t, r) {
|
|
880
|
-
const o = new Date(Date.UTC(n, t, r)).getUTCDay();
|
|
881
|
-
switch (e.frequency) {
|
|
882
|
-
case "daily":
|
|
883
|
-
return !e.weekdaysOnly || P.includes(o);
|
|
884
|
-
case "weekly":
|
|
885
|
-
return e.weekdays.includes(o);
|
|
886
|
-
case "monthly": {
|
|
887
|
-
if (!O(e.interval, e.startMonth).includes(t))
|
|
888
|
-
return !1;
|
|
889
|
-
const a = Ft(n, t);
|
|
890
|
-
return e.on.type === "days" ? e.on.days.some(
|
|
891
|
-
(i) => i === "last" ? r === a : i === r
|
|
892
|
-
) : o !== e.on.weekday ? !1 : e.on.ordinal === -1 ? r + 7 > a : Math.ceil(r / 7) === e.on.ordinal;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
function mr(e, n, t, r) {
|
|
897
|
-
const o = be(e);
|
|
898
|
-
if (!o.ok || !$t(n)) return [];
|
|
899
|
-
const a = o.value, i = new Intl.DateTimeFormat("en-US", {
|
|
900
|
-
timeZone: n,
|
|
901
|
-
hourCycle: "h23",
|
|
902
|
-
year: "numeric",
|
|
903
|
-
month: "numeric",
|
|
904
|
-
day: "numeric",
|
|
905
|
-
hour: "numeric",
|
|
906
|
-
minute: "numeric"
|
|
907
|
-
}).formatToParts(t), c = (d) => {
|
|
908
|
-
var f;
|
|
909
|
-
return Number((f = i.find((p) => p.type === d)) == null ? void 0 : f.value);
|
|
910
|
-
}, l = new Date(Date.UTC(c("year"), c("month") - 1, c("day")));
|
|
911
|
-
c("hour") * 60 + c("minute") >= a.hour * 60 + a.minute && l.setUTCDate(l.getUTCDate() + 1);
|
|
912
|
-
const m = [];
|
|
913
|
-
for (let d = 0; d < 366 * 4 * (r + 1) && m.length < r; d += 1)
|
|
914
|
-
Nt(a, l.getUTCFullYear(), l.getUTCMonth(), l.getUTCDate()) && m.push(l.toISOString().slice(0, 10)), l.setUTCDate(l.getUTCDate() + 1);
|
|
915
|
-
return m;
|
|
916
|
-
}
|
|
917
|
-
const Rt = Object.freeze([
|
|
918
|
-
"PDF_ROW_LIMIT_EXCEEDED",
|
|
919
|
-
"PDF_SIZE_LIMIT_EXCEEDED",
|
|
920
|
-
// More pages than one PDF holds (PDF capacity contract PC-D3).
|
|
921
|
-
"PDF_PAGE_LIMIT_EXCEEDED",
|
|
922
|
-
"TABLE_COMPLETENESS_UNVERIFIED",
|
|
923
|
-
"CARD_QUERY_FAILED",
|
|
924
|
-
"RENDER_NOT_READY",
|
|
925
|
-
"RENDER_TIMED_OUT",
|
|
926
|
-
"EXPORT_JOB_FAILED",
|
|
927
|
-
"ATTACHMENT_UNAVAILABLE",
|
|
928
|
-
// A Table or Detail Table export the server starts (Excel exports Phase 6).
|
|
929
|
-
"EXCEL_LIMIT_EXCEEDED",
|
|
930
|
-
"EXPORT_ROW_LIMIT_EXCEEDED",
|
|
931
|
-
"EXPORT_COUNT_UNAVAILABLE",
|
|
932
|
-
"EXPORT_NO_ROWS",
|
|
933
|
-
// A card CSV written from the card's one query holds up to 10,000 rows and
|
|
934
|
-
// must fit one stored file (card data attachments CD-D6, ledger P2-06).
|
|
935
|
-
"CARD_FILE_LIMIT_EXCEEDED",
|
|
936
|
-
// A dashboard sheet too tall for one image (PNG exports PN-D7).
|
|
937
|
-
"IMAGE_TOO_LARGE",
|
|
938
|
-
// A Document attachment, always a PDF (Document PDF reliability C2).
|
|
939
|
-
"DOCUMENT_PAGE_OVERFLOW",
|
|
940
|
-
"DOCUMENT_ROW_LIMIT_EXCEEDED",
|
|
941
|
-
"DOCUMENT_SECTION_SETUP",
|
|
942
|
-
"REPORT_INPUTS_MISSING",
|
|
943
|
-
// The report's saved presentation can't format what it prints; saving the
|
|
944
|
-
// report again captures it (value formatting Plan 05).
|
|
945
|
-
"REPORT_NEEDS_RESAVE"
|
|
946
|
-
]), Mt = new Set(Rt);
|
|
947
|
-
function Bt(e) {
|
|
948
|
-
return typeof e == "string" && Mt.has(e);
|
|
949
|
-
}
|
|
950
|
-
function Lt(e) {
|
|
951
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
952
|
-
const n = e;
|
|
953
|
-
return typeof n.index != "number" || !Number.isInteger(n.index) || n.index < 0 || typeof n.title != "string" || !Ie.includes(n.format) || !Bt(n.code) || typeof n.reason != "string" || typeof n.diagnostic != "string" ? null : {
|
|
954
|
-
index: n.index,
|
|
955
|
-
title: n.title,
|
|
956
|
-
format: n.format,
|
|
957
|
-
code: n.code,
|
|
958
|
-
reason: n.reason,
|
|
959
|
-
diagnostic: n.diagnostic
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
function ur(e) {
|
|
963
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return [];
|
|
964
|
-
const n = e.omittedAttachments;
|
|
965
|
-
return Array.isArray(n) ? n.flatMap((t) => {
|
|
966
|
-
const r = Lt(t);
|
|
967
|
-
return r ? [r] : [];
|
|
968
|
-
}) : [];
|
|
969
|
-
}
|
|
970
|
-
const fr = "Briefing run cancelled by user", Ut = [
|
|
971
|
-
"sent",
|
|
972
|
-
"partly_sent",
|
|
973
|
-
"failed",
|
|
974
|
-
"not_set_up"
|
|
975
|
-
];
|
|
976
|
-
function Pt(e, n) {
|
|
977
|
-
var i;
|
|
978
|
-
const t = n.sentCount ?? 0, r = n.failedCount ?? 0, o = e === "SLACK" && n.channelName || null, a = ((i = n.message) == null ? void 0 : i.trim()) || null;
|
|
979
|
-
switch (n.status) {
|
|
980
|
-
case "SENT":
|
|
981
|
-
return { channel: e, status: "sent", sent: t, failed: 0, destination: o, reason: null };
|
|
982
|
-
case "FAILED":
|
|
983
|
-
return {
|
|
984
|
-
channel: e,
|
|
985
|
-
status: t > 0 ? "partly_sent" : "failed",
|
|
986
|
-
sent: t,
|
|
987
|
-
failed: t > 0 ? r : Math.max(r, 1),
|
|
988
|
-
destination: o,
|
|
989
|
-
reason: a
|
|
990
|
-
};
|
|
991
|
-
case "NOT_CONFIGURED":
|
|
992
|
-
return { channel: e, status: "not_set_up", sent: 0, failed: 0, destination: o, reason: a };
|
|
993
|
-
default:
|
|
994
|
-
return null;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
function R(e) {
|
|
998
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
999
|
-
}
|
|
1000
|
-
function Vt(e) {
|
|
1001
|
-
if (!R(e)) return null;
|
|
1002
|
-
const { channel: n, status: t, sent: r, failed: o, destination: a, reason: i } = e;
|
|
1003
|
-
return n !== "EMAIL" && n !== "SLACK" || !Ut.includes(t) ? null : {
|
|
1004
|
-
channel: n,
|
|
1005
|
-
status: t,
|
|
1006
|
-
sent: typeof r == "number" ? r : 0,
|
|
1007
|
-
failed: typeof o == "number" ? o : 0,
|
|
1008
|
-
destination: typeof a == "string" && a ? a : null,
|
|
1009
|
-
reason: typeof i == "string" && i ? i : null
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
function zt(e) {
|
|
1013
|
-
return !R(e) || typeof e.status != "string" ? null : {
|
|
1014
|
-
status: e.status,
|
|
1015
|
-
sentCount: typeof e.sentCount == "number" ? e.sentCount : 0,
|
|
1016
|
-
failedCount: typeof e.failedCount == "number" ? e.failedCount : 0,
|
|
1017
|
-
message: typeof e.message == "string" ? e.message : "",
|
|
1018
|
-
channelName: typeof e.channelName == "string" ? e.channelName : null
|
|
1019
|
-
};
|
|
1020
|
-
}
|
|
1021
|
-
function jt(e) {
|
|
1022
|
-
return R(e) ? {
|
|
1023
|
-
channels: ("email" in e || "slack" in e ? [
|
|
1024
|
-
["EMAIL", e.email],
|
|
1025
|
-
["SLACK", e.slack]
|
|
1026
|
-
] : [[e.channel === "SLACK" ? "SLACK" : "EMAIL", e]]).flatMap(([t, r]) => {
|
|
1027
|
-
const o = zt(r), a = o ? Pt(t, o) : null;
|
|
1028
|
-
return a ? [a] : [];
|
|
1029
|
-
})
|
|
1030
|
-
} : null;
|
|
1031
|
-
}
|
|
1032
|
-
function pr(e) {
|
|
1033
|
-
return R(e) ? R(e.deliveryOutcome) && Array.isArray(e.deliveryOutcome.channels) ? {
|
|
1034
|
-
channels: e.deliveryOutcome.channels.flatMap((n) => {
|
|
1035
|
-
const t = Vt(n);
|
|
1036
|
-
return t ? [t] : [];
|
|
1037
|
-
})
|
|
1038
|
-
} : jt(e.deliveryResult) : null;
|
|
1039
|
-
}
|
|
1040
|
-
function hr(e) {
|
|
1041
|
-
return e != null && e.role ? e.type === "tenant" ? e.role === "POWER_USER" : ["AUTHOR", "ADMIN", "SUPER_ADMIN"].includes(e.role) : !1;
|
|
1042
|
-
}
|
|
1043
|
-
function yr(e) {
|
|
1044
|
-
return e.canCreate ? [
|
|
1045
|
-
...e.scheduledReportAvailable ? ["scheduled_report"] : [],
|
|
1046
|
-
...e.analyticalBriefingsEnabled ? ["analytical_briefing"] : []
|
|
1047
|
-
] : [];
|
|
1048
|
-
}
|
|
1049
|
-
function qt(e) {
|
|
1050
|
-
const n = (e == null ? void 0 : e.channels) ?? [];
|
|
1051
|
-
return n.length === 1 && n[0] === "EMAIL";
|
|
1052
|
-
}
|
|
1053
|
-
function Kt(e) {
|
|
1054
|
-
return e.body.type === "generated_analysis" ? "Analytical briefing" : e.body.type === "custom_message" && e.attachments.length > 0 && qt(e.deliveryConfig) ? e.scheduleExpr ? "Scheduled report" : "On-demand report" : "Plain briefing";
|
|
1055
|
-
}
|
|
1056
|
-
function gr(e) {
|
|
1057
|
-
const n = Kt(e), t = n === "Scheduled report" || n === "On-demand report" ? "report" : "briefing";
|
|
1058
|
-
return {
|
|
1059
|
-
typeLabel: n,
|
|
1060
|
-
noun: t,
|
|
1061
|
-
pluralNoun: t === "report" ? "reports" : "briefings"
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
const W = "BRIEFING", Gt = ["markdown", "html"], X = ["markdown"], q = 20, u = {
|
|
1065
|
-
name: 500,
|
|
1066
|
-
description: 2e3,
|
|
1067
|
-
instruction: 5e4,
|
|
1068
|
-
customMessage: 5e4,
|
|
1069
|
-
contentTitle: 500,
|
|
1070
|
-
contentSummary: 2e4,
|
|
1071
|
-
contentText: 5e3,
|
|
1072
|
-
contentSql: 5e4,
|
|
1073
|
-
contentItem: 2e3,
|
|
1074
|
-
contentCell: 500,
|
|
1075
|
-
attachmentTitle: 500,
|
|
1076
|
-
presentationAudience: 1e3,
|
|
1077
|
-
presentationTone: 500,
|
|
1078
|
-
presentationFormat: 2e3,
|
|
1079
|
-
id: 500
|
|
1080
|
-
}, $ = {
|
|
1081
|
-
maxBlocks: 50,
|
|
1082
|
-
maxTableRows: 100,
|
|
1083
|
-
maxTableColumns: 20,
|
|
1084
|
-
maxTableCellCharacters: u.contentCell,
|
|
1085
|
-
maxParagraphCharacters: u.contentText,
|
|
1086
|
-
maxFindingCharacters: u.contentText,
|
|
1087
|
-
maxListItems: 100,
|
|
1088
|
-
// A kpi_grid is rendered as a 2-up tile arrangement in emails. Cap at 8 so
|
|
1089
|
-
// the visual stays at most 4 rows (4 columns wide on desktop would force
|
|
1090
|
-
// tiny tiles in narrow client panels; 2-up was the chosen layout).
|
|
1091
|
-
maxKpiTiles: 8
|
|
1092
|
-
};
|
|
1093
|
-
function Ht(e) {
|
|
1094
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
1095
|
-
return !1;
|
|
1096
|
-
const n = e;
|
|
1097
|
-
if (typeof n.value != "number" || !Number.isFinite(n.value))
|
|
1098
|
-
return !1;
|
|
1099
|
-
const t = n.target;
|
|
1100
|
-
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
1101
|
-
return !1;
|
|
1102
|
-
const r = t;
|
|
1103
|
-
return (r.kind === "metric" && typeof r.metricId == "string" && !!r.metricId.trim() || r.kind === "column" && typeof r.columnKey == "string" && !!r.columnKey.trim() || r.kind === "matrix_measure" && typeof r.measureId == "string" && !!r.measureId.trim()) && se(n.format).ok;
|
|
1104
|
-
}
|
|
1105
|
-
function Wt(e) {
|
|
1106
|
-
return e == null ? "" : Ht(e) ? Me(e.value, e.format) : String(e);
|
|
1107
|
-
}
|
|
1108
|
-
function br(e) {
|
|
1109
|
-
return [e.delta, e.percentChange].filter(
|
|
1110
|
-
(n) => n != null
|
|
1111
|
-
).map(Wt).filter(Boolean).join(" / ");
|
|
1112
|
-
}
|
|
1113
|
-
const Ie = ["pdf", "png", "csv", "xlsx"], ve = new Set(Gt), Xt = /* @__PURE__ */ new Set([
|
|
1114
|
-
"EMAIL",
|
|
1115
|
-
"WEBHOOK",
|
|
1116
|
-
"SLACK",
|
|
1117
|
-
"IN_APP",
|
|
1118
|
-
"TELEGRAM"
|
|
1119
|
-
]), K = {
|
|
1120
|
-
maxToolCalls: { min: 1, max: 100 },
|
|
1121
|
-
maxPlanningIterations: { min: 1, max: 10 },
|
|
1122
|
-
maxRows: { min: 1, max: 1e5 },
|
|
1123
|
-
timeoutMs: { min: 1e3, max: 30 * 6e4 }
|
|
1124
|
-
}, Zt = /* @__PURE__ */ new Set([
|
|
1125
|
-
"letter",
|
|
1126
|
-
"legal",
|
|
1127
|
-
"a4",
|
|
1128
|
-
"a3",
|
|
1129
|
-
"tabloid"
|
|
1130
|
-
]), Yt = /* @__PURE__ */ new Set([
|
|
1131
|
-
"portrait",
|
|
1132
|
-
"landscape"
|
|
1133
|
-
]), Jt = /* @__PURE__ */ new Set([",", ";", " "]), Qt = new Set(Ve), en = /* @__PURE__ */ new Set([
|
|
1134
|
-
"current",
|
|
1135
|
-
"all"
|
|
1136
|
-
]), tn = /* @__PURE__ */ new Set([
|
|
1137
|
-
"concise",
|
|
1138
|
-
"balanced",
|
|
1139
|
-
"detailed"
|
|
1140
|
-
]), nn = /* @__PURE__ */ new Set([
|
|
1141
|
-
"info",
|
|
1142
|
-
"positive",
|
|
1143
|
-
"warning",
|
|
1144
|
-
"critical"
|
|
1145
|
-
]), rn = /* @__PURE__ */ new Set([
|
|
1146
|
-
"text",
|
|
1147
|
-
"number",
|
|
1148
|
-
"currency",
|
|
1149
|
-
"percent",
|
|
1150
|
-
"date",
|
|
1151
|
-
"boolean"
|
|
1152
|
-
]), on = /* @__PURE__ */ new Set([
|
|
1153
|
-
"left",
|
|
1154
|
-
"center",
|
|
1155
|
-
"right"
|
|
1156
|
-
]), an = [
|
|
1157
|
-
"matrix",
|
|
1158
|
-
"pageSize",
|
|
1159
|
-
"orientation",
|
|
1160
|
-
"includeFilters",
|
|
1161
|
-
"includeTimestamp",
|
|
1162
|
-
"delimiter",
|
|
1163
|
-
"csvEncoding",
|
|
1164
|
-
"includeHeaders",
|
|
1165
|
-
"useFormattedValues",
|
|
1166
|
-
"sheetSelection",
|
|
1167
|
-
"currentSheetId",
|
|
1168
|
-
"currentSheetName",
|
|
1169
|
-
"filterValues",
|
|
1170
|
-
"inlineFilterValues",
|
|
1171
|
-
"sheetFilterValues",
|
|
1172
|
-
// Saved by earlier versions and still accepted, then dropped: each run
|
|
1173
|
-
// builds its filter line from `filterValues` at its own time.
|
|
1174
|
-
"filterLine",
|
|
1175
|
-
"controlValues",
|
|
1176
|
-
"controlDefinitions",
|
|
1177
|
-
"cardControlDefinitions",
|
|
1178
|
-
"controlBindings",
|
|
1179
|
-
"tablePreferences",
|
|
1180
|
-
"dashboardInputExecutionSnapshot",
|
|
1181
|
-
"printInputCapture",
|
|
1182
|
-
"selectedSheetId",
|
|
1183
|
-
"cardType",
|
|
1184
|
-
"allowDownload",
|
|
1185
|
-
"theme"
|
|
1186
|
-
];
|
|
1187
|
-
class z extends Error {
|
|
1188
|
-
constructor(t) {
|
|
1189
|
-
super(t.map((r) => `${r.field}: ${r.message}`).join("; "));
|
|
1190
|
-
M(this, "issues");
|
|
1191
|
-
this.name = "BriefingContractError", this.issues = t;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
function $e(e) {
|
|
1195
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1196
|
-
}
|
|
1197
|
-
function s(e, n, t) {
|
|
1198
|
-
e.push({ field: n, message: t });
|
|
1199
|
-
}
|
|
1200
|
-
function I(e, n, t) {
|
|
1201
|
-
return $e(e) ? e : (s(t, n, "Expected an object."), {});
|
|
1202
|
-
}
|
|
1203
|
-
function h(e, n, t, r) {
|
|
1204
|
-
const o = new Set(t);
|
|
1205
|
-
Object.keys(e).forEach((a) => {
|
|
1206
|
-
o.has(a) || s(
|
|
1207
|
-
r,
|
|
1208
|
-
n ? `${n}.${a}` : a,
|
|
1209
|
-
`Unexpected field "${a}".`
|
|
1210
|
-
);
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
function b(e, n, t, r) {
|
|
1214
|
-
if (typeof e != "string")
|
|
1215
|
-
return s(r, n, "Expected a string."), "";
|
|
1216
|
-
const o = e.trim();
|
|
1217
|
-
return o ? (o.length > t && s(r, n, `Must be ${t} characters or fewer.`), o) : (s(r, n, "Required value cannot be empty."), "");
|
|
1218
|
-
}
|
|
1219
|
-
function E(e, n, t, r) {
|
|
1220
|
-
if (e == null)
|
|
1221
|
-
return;
|
|
1222
|
-
if (typeof e != "string") {
|
|
1223
|
-
s(r, n, "Expected a string.");
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
const o = e.trim();
|
|
1227
|
-
if (o)
|
|
1228
|
-
return o.length > t && s(r, n, `Must be ${t} characters or fewer.`), o;
|
|
1229
|
-
}
|
|
1230
|
-
function cn(e, n, t, r) {
|
|
1231
|
-
if (typeof e != "string")
|
|
1232
|
-
return s(r, n, "Expected a string."), "";
|
|
1233
|
-
const o = e.trim();
|
|
1234
|
-
return o.length > t && s(r, n, `Must be ${t} characters or fewer.`), o;
|
|
1235
|
-
}
|
|
1236
|
-
function ln(e, n, t) {
|
|
1237
|
-
if (e != null) {
|
|
1238
|
-
if (!Number.isInteger(e) || Number(e) < 0) {
|
|
1239
|
-
s(t, n, "Expected a non-negative integer.");
|
|
1240
|
-
return;
|
|
1241
|
-
}
|
|
1242
|
-
return Number(e);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
function T(e, n, t, r = {}) {
|
|
1246
|
-
if (e == null)
|
|
1247
|
-
return r.required ? (s(t, n, "Expected at least one evidence id."), []) : void 0;
|
|
1248
|
-
if (!Array.isArray(e))
|
|
1249
|
-
return s(t, n, "Expected an array."), r.required ? [] : void 0;
|
|
1250
|
-
const o = [];
|
|
1251
|
-
return e.forEach((a, i) => {
|
|
1252
|
-
const c = b(
|
|
1253
|
-
a,
|
|
1254
|
-
`${n}.${i}`,
|
|
1255
|
-
u.id,
|
|
1256
|
-
t
|
|
1257
|
-
);
|
|
1258
|
-
c && !o.includes(c) && o.push(c);
|
|
1259
|
-
}), r.required && o.length === 0 && s(t, n, "Expected at least one evidence id."), o.length > 0 || r.required ? o : void 0;
|
|
1260
|
-
}
|
|
1261
|
-
function w(e, n, t, r) {
|
|
1262
|
-
return e == null ? n : typeof e != "boolean" ? (s(r, t, "Expected a boolean."), n) : e;
|
|
1263
|
-
}
|
|
1264
|
-
function sn(e, n) {
|
|
1265
|
-
return e == null ? "ACTIVE" : e === "ACTIVE" || e === "PAUSED" || e === "DISABLED" ? e : (s(n, "status", "Expected ACTIVE, PAUSED, or DISABLED."), "ACTIVE");
|
|
1266
|
-
}
|
|
1267
|
-
function dn(e) {
|
|
1268
|
-
return e.includes("@") && e.includes(".") && !e.includes(" ");
|
|
1269
|
-
}
|
|
1270
|
-
function Ce(e, n) {
|
|
1271
|
-
if (e == null)
|
|
1272
|
-
return { type: "project" };
|
|
1273
|
-
const t = I(e, "source", n), r = t.type;
|
|
1274
|
-
return r === "project" ? (h(t, "source", ["type"], n), { type: "project" }) : r === "dashboard" ? (h(t, "source", ["type", "dashboardId"], n), {
|
|
1275
|
-
type: "dashboard",
|
|
1276
|
-
dashboardId: b(
|
|
1277
|
-
t.dashboardId,
|
|
1278
|
-
"source.dashboardId",
|
|
1279
|
-
u.id,
|
|
1280
|
-
n
|
|
1281
|
-
)
|
|
1282
|
-
}) : (s(n, "source.type", "Expected project or dashboard."), { type: "project" });
|
|
1283
|
-
}
|
|
1284
|
-
function Te(e, n) {
|
|
1285
|
-
const t = I(e, "body", n), r = t.type;
|
|
1286
|
-
return r === "generated_analysis" ? (h(t, "body", ["type", "instruction"], n), {
|
|
1287
|
-
type: "generated_analysis",
|
|
1288
|
-
instruction: b(
|
|
1289
|
-
t.instruction,
|
|
1290
|
-
"body.instruction",
|
|
1291
|
-
u.instruction,
|
|
1292
|
-
n
|
|
1293
|
-
)
|
|
1294
|
-
}) : r === "custom_message" ? (h(t, "body", ["type", "message"], n), {
|
|
1295
|
-
type: "custom_message",
|
|
1296
|
-
message: cn(
|
|
1297
|
-
t.message,
|
|
1298
|
-
"body.message",
|
|
1299
|
-
u.customMessage,
|
|
1300
|
-
n
|
|
1301
|
-
)
|
|
1302
|
-
}) : r === "none" ? (h(t, "body", ["type"], n), { type: "none" }) : (s(
|
|
1303
|
-
n,
|
|
1304
|
-
"body.type",
|
|
1305
|
-
"Expected generated_analysis, custom_message, or none."
|
|
1306
|
-
), { type: "none" });
|
|
1307
|
-
}
|
|
1308
|
-
function mn(e, n) {
|
|
1309
|
-
if (e == null)
|
|
1310
|
-
return [...X];
|
|
1311
|
-
if (!Array.isArray(e))
|
|
1312
|
-
return s(n, "presentation.artifactFormats", "Expected an array."), [...X];
|
|
1313
|
-
if (e.length === 0)
|
|
1314
|
-
return s(
|
|
1315
|
-
n,
|
|
1316
|
-
"presentation.artifactFormats",
|
|
1317
|
-
"Choose at least one artifact format."
|
|
1318
|
-
), [];
|
|
1319
|
-
const t = [];
|
|
1320
|
-
return e.forEach((r, o) => {
|
|
1321
|
-
if (typeof r != "string" || !ve.has(r)) {
|
|
1322
|
-
s(
|
|
1323
|
-
n,
|
|
1324
|
-
`presentation.artifactFormats.${o}`,
|
|
1325
|
-
"Expected markdown or html."
|
|
1326
|
-
);
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
t.includes(r) || t.push(r);
|
|
1330
|
-
}), t;
|
|
1331
|
-
}
|
|
1332
|
-
function xe(e, n) {
|
|
1333
|
-
if (e == null)
|
|
1334
|
-
return {
|
|
1335
|
-
artifactFormats: [...X],
|
|
1336
|
-
includeEvidence: !0,
|
|
1337
|
-
includeSql: !0
|
|
1338
|
-
};
|
|
1339
|
-
const t = I(e, "presentation", n);
|
|
1340
|
-
h(
|
|
1341
|
-
t,
|
|
1342
|
-
"presentation",
|
|
1343
|
-
[
|
|
1344
|
-
"artifactFormats",
|
|
1345
|
-
"includeEvidence",
|
|
1346
|
-
"includeSql",
|
|
1347
|
-
"audience",
|
|
1348
|
-
"tone",
|
|
1349
|
-
"format",
|
|
1350
|
-
"appearance",
|
|
1351
|
-
"brandOverrides",
|
|
1352
|
-
"fragments",
|
|
1353
|
-
"viewUrl"
|
|
1354
|
-
],
|
|
1355
|
-
n
|
|
1356
|
-
);
|
|
1357
|
-
const r = {
|
|
1358
|
-
artifactFormats: mn(t.artifactFormats, n),
|
|
1359
|
-
includeEvidence: w(
|
|
1360
|
-
t.includeEvidence,
|
|
1361
|
-
!0,
|
|
1362
|
-
"presentation.includeEvidence",
|
|
1363
|
-
n
|
|
1364
|
-
),
|
|
1365
|
-
includeSql: w(
|
|
1366
|
-
t.includeSql,
|
|
1367
|
-
!0,
|
|
1368
|
-
"presentation.includeSql",
|
|
1369
|
-
n
|
|
1370
|
-
)
|
|
1371
|
-
}, o = E(
|
|
1372
|
-
t.audience,
|
|
1373
|
-
"presentation.audience",
|
|
1374
|
-
u.presentationAudience,
|
|
1375
|
-
n
|
|
1376
|
-
), a = E(
|
|
1377
|
-
t.tone,
|
|
1378
|
-
"presentation.tone",
|
|
1379
|
-
u.presentationTone,
|
|
1380
|
-
n
|
|
1381
|
-
), i = E(
|
|
1382
|
-
t.format,
|
|
1383
|
-
"presentation.format",
|
|
1384
|
-
u.presentationFormat,
|
|
1385
|
-
n
|
|
1386
|
-
);
|
|
1387
|
-
o && (r.audience = o), a && (r.tone = a), i && (r.format = i);
|
|
1388
|
-
const c = vt(t);
|
|
1389
|
-
return c.issues.forEach((l) => s(n, l.field, l.message)), Object.assign(r, c.value), r;
|
|
1390
|
-
}
|
|
1391
|
-
function un(e, n, t) {
|
|
1392
|
-
return Array.isArray(e) ? (e.length === 0 && s(t, n, "Expected at least one item."), e.length > $.maxListItems && s(
|
|
1393
|
-
t,
|
|
1394
|
-
n,
|
|
1395
|
-
`Must have ${$.maxListItems} items or fewer.`
|
|
1396
|
-
), e.slice(0, $.maxListItems).map(
|
|
1397
|
-
(r, o) => b(
|
|
1398
|
-
r,
|
|
1399
|
-
`${n}.${o}`,
|
|
1400
|
-
u.contentItem,
|
|
1401
|
-
t
|
|
1402
|
-
)
|
|
1403
|
-
).filter(Boolean)) : (s(t, n, "Expected an array."), []);
|
|
1404
|
-
}
|
|
1405
|
-
function fn(e, n, t) {
|
|
1406
|
-
const r = I(e, n, t);
|
|
1407
|
-
if (r.kind === "metric")
|
|
1408
|
-
return h(r, n, ["kind", "metricId"], t), {
|
|
1409
|
-
kind: "metric",
|
|
1410
|
-
metricId: b(
|
|
1411
|
-
r.metricId,
|
|
1412
|
-
`${n}.metricId`,
|
|
1413
|
-
u.id,
|
|
1414
|
-
t
|
|
1415
|
-
)
|
|
1416
|
-
};
|
|
1417
|
-
if (r.kind === "column")
|
|
1418
|
-
return h(r, n, ["kind", "columnKey"], t), {
|
|
1419
|
-
kind: "column",
|
|
1420
|
-
columnKey: b(
|
|
1421
|
-
r.columnKey,
|
|
1422
|
-
`${n}.columnKey`,
|
|
1423
|
-
u.id,
|
|
1424
|
-
t
|
|
1425
|
-
)
|
|
1426
|
-
};
|
|
1427
|
-
if (r.kind === "matrix_measure")
|
|
1428
|
-
return h(r, n, ["kind", "measureId"], t), {
|
|
1429
|
-
kind: "matrix_measure",
|
|
1430
|
-
measureId: b(
|
|
1431
|
-
r.measureId,
|
|
1432
|
-
`${n}.measureId`,
|
|
1433
|
-
u.id,
|
|
1434
|
-
t
|
|
1435
|
-
)
|
|
1436
|
-
};
|
|
1437
|
-
s(
|
|
1438
|
-
t,
|
|
1439
|
-
`${n}.kind`,
|
|
1440
|
-
"Expected metric, column, or matrix_measure."
|
|
1441
|
-
);
|
|
1442
|
-
}
|
|
1443
|
-
function Se(e, n, t) {
|
|
1444
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
1445
|
-
return;
|
|
1446
|
-
const r = I(e, n, t);
|
|
1447
|
-
if (!Object.prototype.hasOwnProperty.call(r, "target") && !Object.prototype.hasOwnProperty.call(r, "format"))
|
|
1448
|
-
return;
|
|
1449
|
-
h(r, n, ["value", "target", "format"], t), (typeof r.value != "number" || !Number.isFinite(r.value)) && s(t, `${n}.value`, "Expected a finite number.");
|
|
1450
|
-
const o = fn(
|
|
1451
|
-
r.target,
|
|
1452
|
-
`${n}.target`,
|
|
1453
|
-
t
|
|
1454
|
-
), a = se(r.format);
|
|
1455
|
-
if (a.ok || a.issues.forEach(
|
|
1456
|
-
(i) => s(
|
|
1457
|
-
t,
|
|
1458
|
-
i.path === "$" ? `${n}.format` : `${n}.format.${i.path}`,
|
|
1459
|
-
i.message
|
|
1460
|
-
)
|
|
1461
|
-
), !(typeof r.value != "number" || !Number.isFinite(r.value) || !o || !a.ok))
|
|
1462
|
-
return { value: r.value, target: o, format: a.value };
|
|
1463
|
-
}
|
|
1464
|
-
function _(e, n, t) {
|
|
1465
|
-
if (typeof e == "string")
|
|
1466
|
-
return e;
|
|
1467
|
-
if (typeof e == "number") {
|
|
1468
|
-
if (!Number.isFinite(e)) {
|
|
1469
|
-
s(t, n, "Expected a finite number.");
|
|
1470
|
-
return;
|
|
1471
|
-
}
|
|
1472
|
-
return e;
|
|
1473
|
-
}
|
|
1474
|
-
const r = Se(e, n, t);
|
|
1475
|
-
if (r) return r;
|
|
1476
|
-
s(
|
|
1477
|
-
t,
|
|
1478
|
-
n,
|
|
1479
|
-
"Expected a string, number, or structured numeric value."
|
|
1480
|
-
);
|
|
1481
|
-
}
|
|
1482
|
-
function pn(e, n, t) {
|
|
1483
|
-
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
1484
|
-
return typeof e == "string" && e.length > u.contentCell ? (s(
|
|
1485
|
-
t,
|
|
1486
|
-
n,
|
|
1487
|
-
`Must be ${u.contentCell} characters or fewer.`
|
|
1488
|
-
), e.slice(0, u.contentCell)) : typeof e == "number" && !Number.isFinite(e) ? (s(t, n, "Expected a finite number."), null) : e;
|
|
1489
|
-
const r = Se(e, n, t);
|
|
1490
|
-
return r || (s(
|
|
1491
|
-
t,
|
|
1492
|
-
n,
|
|
1493
|
-
"Expected a string, number, boolean, structured numeric value, or null."
|
|
1494
|
-
), null);
|
|
1495
|
-
}
|
|
1496
|
-
function hn(e, n, t) {
|
|
1497
|
-
if (!Array.isArray(e))
|
|
1498
|
-
return s(t, n, "Expected an array."), [];
|
|
1499
|
-
e.length === 0 && s(t, n, "Expected at least one column."), e.length > $.maxTableColumns && s(
|
|
1500
|
-
t,
|
|
1501
|
-
n,
|
|
1502
|
-
`Must have ${$.maxTableColumns} columns or fewer.`
|
|
1503
|
-
);
|
|
1504
|
-
const r = /* @__PURE__ */ new Set();
|
|
1505
|
-
return e.slice(0, $.maxTableColumns).map((o, a) => {
|
|
1506
|
-
const i = `${n}.${a}`, c = I(o, i, t);
|
|
1507
|
-
h(c, i, ["key", "label", "kind", "align"], t);
|
|
1508
|
-
const l = b(
|
|
1509
|
-
c.key,
|
|
1510
|
-
`${i}.key`,
|
|
1511
|
-
u.id,
|
|
1512
|
-
t
|
|
1513
|
-
);
|
|
1514
|
-
l && (r.has(l) && s(t, `${i}.key`, "Column key must be unique."), r.add(l));
|
|
1515
|
-
const m = b(
|
|
1516
|
-
c.label,
|
|
1517
|
-
`${i}.label`,
|
|
1518
|
-
u.contentTitle,
|
|
1519
|
-
t
|
|
1520
|
-
), d = A(
|
|
1521
|
-
c.kind,
|
|
1522
|
-
`${i}.kind`,
|
|
1523
|
-
rn,
|
|
1524
|
-
"text, number, currency, percent, date, or boolean",
|
|
1525
|
-
t
|
|
1526
|
-
), f = A(
|
|
1527
|
-
c.align,
|
|
1528
|
-
`${i}.align`,
|
|
1529
|
-
on,
|
|
1530
|
-
"left, center, or right",
|
|
1531
|
-
t
|
|
1532
|
-
);
|
|
1533
|
-
return {
|
|
1534
|
-
key: l,
|
|
1535
|
-
label: m,
|
|
1536
|
-
...d ? { kind: d } : {},
|
|
1537
|
-
...f ? { align: f } : {}
|
|
1538
|
-
};
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
function yn(e, n, t, r) {
|
|
1542
|
-
if (!Array.isArray(e))
|
|
1543
|
-
return s(r, n, "Expected an array."), [];
|
|
1544
|
-
e.length > $.maxTableRows && s(
|
|
1545
|
-
r,
|
|
1546
|
-
n,
|
|
1547
|
-
`Must have ${$.maxTableRows} rows or fewer.`
|
|
1548
|
-
);
|
|
1549
|
-
const o = new Set(t.map((a) => a.key).filter(Boolean));
|
|
1550
|
-
return e.slice(0, $.maxTableRows).map((a, i) => {
|
|
1551
|
-
const c = `${n}.${i}`, l = I(a, c, r);
|
|
1552
|
-
return Object.keys(l).forEach((m) => {
|
|
1553
|
-
o.has(m) || s(r, `${c}.${m}`, `Unexpected table cell "${m}".`);
|
|
1554
|
-
}), Object.fromEntries(
|
|
1555
|
-
t.map((m) => [
|
|
1556
|
-
m.key,
|
|
1557
|
-
pn(l[m.key] ?? null, `${c}.${m.key}`, r)
|
|
1558
|
-
])
|
|
1559
|
-
);
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
function gn(e, n, t) {
|
|
1563
|
-
const r = `content.blocks.${n}`, o = I(e, r, t), a = o.type;
|
|
1564
|
-
if (a === "heading") {
|
|
1565
|
-
h(o, r, ["type", "text", "level", "evidenceIds"], t);
|
|
1566
|
-
const i = o.level === void 0 || o.level === null ? void 0 : o.level === 2 || o.level === 3 ? o.level : void 0;
|
|
1567
|
-
o.level !== void 0 && o.level !== null && i === void 0 && s(t, `${r}.level`, "Expected 2 or 3.");
|
|
1568
|
-
const c = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1569
|
-
return {
|
|
1570
|
-
type: "heading",
|
|
1571
|
-
text: b(
|
|
1572
|
-
o.text,
|
|
1573
|
-
`${r}.text`,
|
|
1574
|
-
u.contentTitle,
|
|
1575
|
-
t
|
|
1576
|
-
),
|
|
1577
|
-
...i ? { level: i } : {},
|
|
1578
|
-
...c ? { evidenceIds: c } : {}
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
if (a === "paragraph") {
|
|
1582
|
-
h(o, r, ["type", "text", "evidenceIds"], t);
|
|
1583
|
-
const i = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1584
|
-
return {
|
|
1585
|
-
type: "paragraph",
|
|
1586
|
-
text: b(
|
|
1587
|
-
o.text,
|
|
1588
|
-
`${r}.text`,
|
|
1589
|
-
u.contentText,
|
|
1590
|
-
t
|
|
1591
|
-
),
|
|
1592
|
-
...i ? { evidenceIds: i } : {}
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
if (a === "finding") {
|
|
1596
|
-
h(o, r, ["type", "title", "text", "severity", "evidenceIds"], t);
|
|
1597
|
-
const i = E(
|
|
1598
|
-
o.title,
|
|
1599
|
-
`${r}.title`,
|
|
1600
|
-
u.contentTitle,
|
|
1601
|
-
t
|
|
1602
|
-
), c = A(
|
|
1603
|
-
o.severity,
|
|
1604
|
-
`${r}.severity`,
|
|
1605
|
-
nn,
|
|
1606
|
-
"info, positive, warning, or critical",
|
|
1607
|
-
t
|
|
1608
|
-
);
|
|
1609
|
-
return {
|
|
1610
|
-
type: "finding",
|
|
1611
|
-
...i ? { title: i } : {},
|
|
1612
|
-
text: b(
|
|
1613
|
-
o.text,
|
|
1614
|
-
`${r}.text`,
|
|
1615
|
-
u.contentText,
|
|
1616
|
-
t
|
|
1617
|
-
),
|
|
1618
|
-
...c ? { severity: c } : {},
|
|
1619
|
-
evidenceIds: T(o.evidenceIds, `${r}.evidenceIds`, t, {
|
|
1620
|
-
required: !0
|
|
1621
|
-
}) ?? []
|
|
1622
|
-
};
|
|
1623
|
-
}
|
|
1624
|
-
if (a === "bullets" || a === "actions" || a === "limitations") {
|
|
1625
|
-
h(o, r, ["type", "title", "items", "evidenceIds"], t);
|
|
1626
|
-
const i = E(
|
|
1627
|
-
o.title,
|
|
1628
|
-
`${r}.title`,
|
|
1629
|
-
u.contentTitle,
|
|
1630
|
-
t
|
|
1631
|
-
), c = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1632
|
-
return {
|
|
1633
|
-
type: a,
|
|
1634
|
-
...i ? { title: i } : {},
|
|
1635
|
-
items: un(o.items, `${r}.items`, t),
|
|
1636
|
-
...c ? { evidenceIds: c } : {}
|
|
1637
|
-
};
|
|
1638
|
-
}
|
|
1639
|
-
if (a === "metric") {
|
|
1640
|
-
h(
|
|
1641
|
-
o,
|
|
1642
|
-
r,
|
|
1643
|
-
[
|
|
1644
|
-
"type",
|
|
1645
|
-
"label",
|
|
1646
|
-
"value",
|
|
1647
|
-
"previousValue",
|
|
1648
|
-
"delta",
|
|
1649
|
-
"percentChange",
|
|
1650
|
-
"unit",
|
|
1651
|
-
"evidenceIds"
|
|
1652
|
-
],
|
|
1653
|
-
t
|
|
1654
|
-
);
|
|
1655
|
-
const i = _(o.value, `${r}.value`, t) ?? "";
|
|
1656
|
-
i === "" && s(
|
|
1657
|
-
t,
|
|
1658
|
-
`${r}.value`,
|
|
1659
|
-
"Expected a non-empty string, number, or structured numeric value."
|
|
1660
|
-
);
|
|
1661
|
-
const c = o.previousValue === void 0 || o.previousValue === null ? o.previousValue : _(
|
|
1662
|
-
o.previousValue,
|
|
1663
|
-
`${r}.previousValue`,
|
|
1664
|
-
t
|
|
1665
|
-
), l = o.delta === void 0 || o.delta === null ? o.delta : _(
|
|
1666
|
-
o.delta,
|
|
1667
|
-
`${r}.delta`,
|
|
1668
|
-
t
|
|
1669
|
-
), m = o.percentChange === void 0 || o.percentChange === null ? o.percentChange : _(
|
|
1670
|
-
o.percentChange,
|
|
1671
|
-
`${r}.percentChange`,
|
|
1672
|
-
t
|
|
1673
|
-
), d = E(
|
|
1674
|
-
o.unit,
|
|
1675
|
-
`${r}.unit`,
|
|
1676
|
-
u.contentTitle,
|
|
1677
|
-
t
|
|
1678
|
-
), f = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1679
|
-
return {
|
|
1680
|
-
type: "metric",
|
|
1681
|
-
label: b(
|
|
1682
|
-
o.label,
|
|
1683
|
-
`${r}.label`,
|
|
1684
|
-
u.contentTitle,
|
|
1685
|
-
t
|
|
1686
|
-
),
|
|
1687
|
-
value: i,
|
|
1688
|
-
...c !== void 0 ? { previousValue: c } : {},
|
|
1689
|
-
...l !== void 0 ? { delta: l } : {},
|
|
1690
|
-
...m !== void 0 ? { percentChange: m } : {},
|
|
1691
|
-
...d ? { unit: d } : {},
|
|
1692
|
-
...f ? { evidenceIds: f } : {}
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
if (a === "kpi_grid") {
|
|
1696
|
-
h(o, r, ["type", "title", "tiles", "evidenceIds"], t);
|
|
1697
|
-
const i = E(
|
|
1698
|
-
o.title,
|
|
1699
|
-
`${r}.title`,
|
|
1700
|
-
u.contentTitle,
|
|
1701
|
-
t
|
|
1702
|
-
), c = Array.isArray(o.tiles) ? o.tiles : [];
|
|
1703
|
-
Array.isArray(o.tiles) || s(t, `${r}.tiles`, "Expected an array."), c.length === 0 && s(t, `${r}.tiles`, "Expected at least one tile."), c.length > $.maxKpiTiles && s(
|
|
1704
|
-
t,
|
|
1705
|
-
`${r}.tiles`,
|
|
1706
|
-
`Must have ${$.maxKpiTiles} tiles or fewer.`
|
|
1707
|
-
);
|
|
1708
|
-
const l = c.slice(0, $.maxKpiTiles).map((d, f) => {
|
|
1709
|
-
const p = `${r}.tiles.${f}`, g = I(d, p, t);
|
|
1710
|
-
h(
|
|
1711
|
-
g,
|
|
1712
|
-
p,
|
|
1713
|
-
[
|
|
1714
|
-
"label",
|
|
1715
|
-
"value",
|
|
1716
|
-
"previousValue",
|
|
1717
|
-
"delta",
|
|
1718
|
-
"percentChange",
|
|
1719
|
-
"unit",
|
|
1720
|
-
"evidenceIds"
|
|
1721
|
-
],
|
|
1722
|
-
t
|
|
1723
|
-
);
|
|
1724
|
-
const v = _(
|
|
1725
|
-
g.value,
|
|
1726
|
-
`${p}.value`,
|
|
1727
|
-
t
|
|
1728
|
-
) ?? "";
|
|
1729
|
-
v === "" && s(
|
|
1730
|
-
t,
|
|
1731
|
-
`${p}.value`,
|
|
1732
|
-
"Expected a non-empty string, number, or structured numeric value."
|
|
1733
|
-
);
|
|
1734
|
-
const k = g.previousValue === void 0 || g.previousValue === null ? g.previousValue : _(
|
|
1735
|
-
g.previousValue,
|
|
1736
|
-
`${p}.previousValue`,
|
|
1737
|
-
t
|
|
1738
|
-
), F = g.delta === void 0 || g.delta === null ? g.delta : _(
|
|
1739
|
-
g.delta,
|
|
1740
|
-
`${p}.delta`,
|
|
1741
|
-
t
|
|
1742
|
-
), te = g.percentChange === void 0 || g.percentChange === null ? g.percentChange : _(
|
|
1743
|
-
g.percentChange,
|
|
1744
|
-
`${p}.percentChange`,
|
|
1745
|
-
t
|
|
1746
|
-
), ne = E(
|
|
1747
|
-
g.unit,
|
|
1748
|
-
`${p}.unit`,
|
|
1749
|
-
u.contentTitle,
|
|
1750
|
-
t
|
|
1751
|
-
), re = T(
|
|
1752
|
-
g.evidenceIds,
|
|
1753
|
-
`${p}.evidenceIds`,
|
|
1754
|
-
t
|
|
1755
|
-
);
|
|
1756
|
-
return {
|
|
1757
|
-
label: b(
|
|
1758
|
-
g.label,
|
|
1759
|
-
`${p}.label`,
|
|
1760
|
-
u.contentTitle,
|
|
1761
|
-
t
|
|
1762
|
-
),
|
|
1763
|
-
value: v,
|
|
1764
|
-
...k !== void 0 ? { previousValue: k } : {},
|
|
1765
|
-
...F !== void 0 ? { delta: F } : {},
|
|
1766
|
-
...te !== void 0 ? { percentChange: te } : {},
|
|
1767
|
-
...ne ? { unit: ne } : {},
|
|
1768
|
-
...re ? { evidenceIds: re } : {}
|
|
1769
|
-
};
|
|
1770
|
-
}), m = T(
|
|
1771
|
-
o.evidenceIds,
|
|
1772
|
-
`${r}.evidenceIds`,
|
|
1773
|
-
t
|
|
1774
|
-
);
|
|
1775
|
-
return {
|
|
1776
|
-
type: "kpi_grid",
|
|
1777
|
-
...i ? { title: i } : {},
|
|
1778
|
-
tiles: l,
|
|
1779
|
-
...m ? { evidenceIds: m } : {}
|
|
1780
|
-
};
|
|
1781
|
-
}
|
|
1782
|
-
if (a === "progress") {
|
|
1783
|
-
h(o, r, ["type", "label", "value", "detail", "evidenceIds"], t);
|
|
1784
|
-
const i = typeof o.value == "number" && Number.isFinite(o.value) ? o.value : 0;
|
|
1785
|
-
(typeof o.value != "number" || !Number.isFinite(o.value)) && s(t, `${r}.value`, "Expected a finite number.");
|
|
1786
|
-
const c = E(
|
|
1787
|
-
o.detail,
|
|
1788
|
-
`${r}.detail`,
|
|
1789
|
-
u.contentText,
|
|
1790
|
-
t
|
|
1791
|
-
), l = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1792
|
-
return {
|
|
1793
|
-
type: "progress",
|
|
1794
|
-
label: b(
|
|
1795
|
-
o.label,
|
|
1796
|
-
`${r}.label`,
|
|
1797
|
-
u.contentTitle,
|
|
1798
|
-
t
|
|
1799
|
-
),
|
|
1800
|
-
value: i,
|
|
1801
|
-
...c ? { detail: c } : {},
|
|
1802
|
-
...l ? { evidenceIds: l } : {}
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
if (a === "table") {
|
|
1806
|
-
h(
|
|
1807
|
-
o,
|
|
1808
|
-
r,
|
|
1809
|
-
["type", "id", "title", "columns", "rows", "caption", "totalRows", "evidenceIds"],
|
|
1810
|
-
t
|
|
1811
|
-
);
|
|
1812
|
-
const i = hn(o.columns, `${r}.columns`, t), c = E(
|
|
1813
|
-
o.title,
|
|
1814
|
-
`${r}.title`,
|
|
1815
|
-
u.contentTitle,
|
|
1816
|
-
t
|
|
1817
|
-
), l = E(
|
|
1818
|
-
o.id,
|
|
1819
|
-
`${r}.id`,
|
|
1820
|
-
u.id,
|
|
1821
|
-
t
|
|
1822
|
-
), m = E(
|
|
1823
|
-
o.caption,
|
|
1824
|
-
`${r}.caption`,
|
|
1825
|
-
u.contentItem,
|
|
1826
|
-
t
|
|
1827
|
-
), d = ln(
|
|
1828
|
-
o.totalRows,
|
|
1829
|
-
`${r}.totalRows`,
|
|
1830
|
-
t
|
|
1831
|
-
), f = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1832
|
-
return {
|
|
1833
|
-
type: "table",
|
|
1834
|
-
...l ? { id: l } : {},
|
|
1835
|
-
...c ? { title: c } : {},
|
|
1836
|
-
columns: i,
|
|
1837
|
-
rows: yn(o.rows, `${r}.rows`, i, t),
|
|
1838
|
-
...m ? { caption: m } : {},
|
|
1839
|
-
...d !== void 0 ? { totalRows: d } : {},
|
|
1840
|
-
...f ? { evidenceIds: f } : {}
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
if (a === "evidence_appendix") {
|
|
1844
|
-
h(o, r, ["type", "title", "evidenceIds"], t);
|
|
1845
|
-
const i = E(
|
|
1846
|
-
o.title,
|
|
1847
|
-
`${r}.title`,
|
|
1848
|
-
u.contentTitle,
|
|
1849
|
-
t
|
|
1850
|
-
);
|
|
1851
|
-
return {
|
|
1852
|
-
type: "evidence_appendix",
|
|
1853
|
-
...i ? { title: i } : {},
|
|
1854
|
-
evidenceIds: T(o.evidenceIds, `${r}.evidenceIds`, t, {
|
|
1855
|
-
required: !0
|
|
1856
|
-
}) ?? []
|
|
1857
|
-
};
|
|
1858
|
-
}
|
|
1859
|
-
if (a === "sql") {
|
|
1860
|
-
h(o, r, ["type", "title", "sql", "evidenceIds"], t);
|
|
1861
|
-
const i = E(
|
|
1862
|
-
o.title,
|
|
1863
|
-
`${r}.title`,
|
|
1864
|
-
u.contentTitle,
|
|
1865
|
-
t
|
|
1866
|
-
), c = b(
|
|
1867
|
-
o.sql,
|
|
1868
|
-
`${r}.sql`,
|
|
1869
|
-
u.contentSql,
|
|
1870
|
-
t
|
|
1871
|
-
), l = T(o.evidenceIds, `${r}.evidenceIds`, t);
|
|
1872
|
-
return {
|
|
1873
|
-
type: "sql",
|
|
1874
|
-
...i ? { title: i } : {},
|
|
1875
|
-
sql: c,
|
|
1876
|
-
...l ? { evidenceIds: l } : {}
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
return s(
|
|
1880
|
-
t,
|
|
1881
|
-
`${r}.type`,
|
|
1882
|
-
"Expected heading, paragraph, finding, bullets, metric, kpi_grid, progress, table, actions, limitations, sql, or evidence_appendix."
|
|
1883
|
-
), {
|
|
1884
|
-
type: "paragraph",
|
|
1885
|
-
text: ""
|
|
1886
|
-
};
|
|
1887
|
-
}
|
|
1888
|
-
function bn(e) {
|
|
1889
|
-
const n = [], t = I(e, "content", n);
|
|
1890
|
-
h(t, "content", ["version", "title", "summary", "blocks"], n), t.version !== 1 && s(n, "content.version", "Expected version 1.");
|
|
1891
|
-
const r = E(
|
|
1892
|
-
t.title,
|
|
1893
|
-
"content.title",
|
|
1894
|
-
u.contentTitle,
|
|
1895
|
-
n
|
|
1896
|
-
), o = E(
|
|
1897
|
-
t.summary,
|
|
1898
|
-
"content.summary",
|
|
1899
|
-
u.contentSummary,
|
|
1900
|
-
n
|
|
1901
|
-
);
|
|
1902
|
-
Array.isArray(t.blocks) || s(n, "content.blocks", "Expected an array.");
|
|
1903
|
-
const a = Array.isArray(t.blocks) ? t.blocks : [];
|
|
1904
|
-
a.length === 0 && s(n, "content.blocks", "Expected at least one block."), a.length > $.maxBlocks && s(
|
|
1905
|
-
n,
|
|
1906
|
-
"content.blocks",
|
|
1907
|
-
`Must have ${$.maxBlocks} blocks or fewer.`
|
|
1908
|
-
);
|
|
1909
|
-
const i = a.slice(0, $.maxBlocks).map((c, l) => gn(c, l, n));
|
|
1910
|
-
return J(n), {
|
|
1911
|
-
version: 1,
|
|
1912
|
-
...r ? { title: r } : {},
|
|
1913
|
-
...o ? { summary: o } : {},
|
|
1914
|
-
blocks: i
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
function Er(e) {
|
|
1918
|
-
try {
|
|
1919
|
-
return {
|
|
1920
|
-
valid: !0,
|
|
1921
|
-
value: bn(e),
|
|
1922
|
-
issues: []
|
|
1923
|
-
};
|
|
1924
|
-
} catch (n) {
|
|
1925
|
-
if (n instanceof z)
|
|
1926
|
-
return { valid: !1, issues: n.issues };
|
|
1927
|
-
throw n;
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
function U(e, n, t, r) {
|
|
1931
|
-
return typeof e == "string" && t.includes(e) ? e : (s(r, n, `Expected ${t.join(" or ")}.`), t[0]);
|
|
1932
|
-
}
|
|
1933
|
-
function A(e, n, t, r, o) {
|
|
1934
|
-
if (e != null) {
|
|
1935
|
-
if (typeof e == "string" && t.has(e))
|
|
1936
|
-
return e;
|
|
1937
|
-
s(o, n, `Expected ${r}.`);
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
function En(e, n, t) {
|
|
1941
|
-
if (e != null) {
|
|
1942
|
-
if (!Array.isArray(e)) {
|
|
1943
|
-
s(t, n, "Expected an array.");
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
|
-
return e;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
function In(e, n, t) {
|
|
1950
|
-
if (e != null) {
|
|
1951
|
-
if (!$e(e)) {
|
|
1952
|
-
s(t, n, "Expected an object.");
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
return e;
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
function vn(e, n, t) {
|
|
1959
|
-
if (e == null)
|
|
1960
|
-
return;
|
|
1961
|
-
const r = I(e, n, t);
|
|
1962
|
-
h(r, n, an, t);
|
|
1963
|
-
const o = {};
|
|
1964
|
-
if (r.matrix !== void 0) {
|
|
1965
|
-
const d = I(r.matrix, `${n}.matrix`, t);
|
|
1966
|
-
h(d, `${n}.matrix`, ["config", "content"], t);
|
|
1967
|
-
const f = Ue.safeParse(d.config);
|
|
1968
|
-
f.success || s(t, `${n}.matrix.config`, "Expected a valid Matrix definition.");
|
|
1969
|
-
const p = A(
|
|
1970
|
-
d.content,
|
|
1971
|
-
`${n}.matrix.content`,
|
|
1972
|
-
/* @__PURE__ */ new Set(["current", "all", "flat"]),
|
|
1973
|
-
"current, all, or flat",
|
|
1974
|
-
t
|
|
1975
|
-
);
|
|
1976
|
-
p || s(t, `${n}.matrix.content`, "Choose Matrix export content."), f.success && p && (o.matrix = { config: f.data, content: p });
|
|
1977
|
-
}
|
|
1978
|
-
const a = A(
|
|
1979
|
-
r.pageSize,
|
|
1980
|
-
`${n}.pageSize`,
|
|
1981
|
-
Zt,
|
|
1982
|
-
"letter, legal, a4, a3, or tabloid",
|
|
1983
|
-
t
|
|
1984
|
-
), i = A(
|
|
1985
|
-
r.orientation,
|
|
1986
|
-
`${n}.orientation`,
|
|
1987
|
-
Yt,
|
|
1988
|
-
"portrait or landscape",
|
|
1989
|
-
t
|
|
1990
|
-
), c = A(
|
|
1991
|
-
r.delimiter,
|
|
1992
|
-
`${n}.delimiter`,
|
|
1993
|
-
Jt,
|
|
1994
|
-
"comma, semicolon, or tab",
|
|
1995
|
-
t
|
|
1996
|
-
), l = A(
|
|
1997
|
-
r.csvEncoding,
|
|
1998
|
-
`${n}.csvEncoding`,
|
|
1999
|
-
Qt,
|
|
2000
|
-
"utf-8-bom or utf-8",
|
|
2001
|
-
t
|
|
2002
|
-
), m = A(
|
|
2003
|
-
r.sheetSelection,
|
|
2004
|
-
`${n}.sheetSelection`,
|
|
2005
|
-
en,
|
|
2006
|
-
"current or all",
|
|
2007
|
-
t
|
|
2008
|
-
);
|
|
2009
|
-
a && (o.pageSize = a), i && (o.orientation = i), c && (o.delimiter = c), l && (o.csvEncoding = l), m && (o.sheetSelection = m);
|
|
2010
|
-
for (const d of [
|
|
2011
|
-
"includeFilters",
|
|
2012
|
-
"includeTimestamp",
|
|
2013
|
-
"includeHeaders",
|
|
2014
|
-
"useFormattedValues",
|
|
2015
|
-
"allowDownload"
|
|
2016
|
-
])
|
|
2017
|
-
if (!(r[d] === void 0 || r[d] === null)) {
|
|
2018
|
-
if (typeof r[d] != "boolean") {
|
|
2019
|
-
s(t, `${n}.${d}`, "Expected a boolean.");
|
|
2020
|
-
continue;
|
|
2021
|
-
}
|
|
2022
|
-
o[d] = r[d];
|
|
2023
|
-
}
|
|
2024
|
-
for (const d of [
|
|
2025
|
-
"currentSheetId",
|
|
2026
|
-
"currentSheetName",
|
|
2027
|
-
"selectedSheetId",
|
|
2028
|
-
"cardType",
|
|
2029
|
-
"theme"
|
|
2030
|
-
]) {
|
|
2031
|
-
const f = E(
|
|
2032
|
-
r[d],
|
|
2033
|
-
`${n}.${d}`,
|
|
2034
|
-
u.id,
|
|
2035
|
-
t
|
|
2036
|
-
);
|
|
2037
|
-
f && (o[d] = f);
|
|
2038
|
-
}
|
|
2039
|
-
for (const d of [
|
|
2040
|
-
"filterValues",
|
|
2041
|
-
"inlineFilterValues",
|
|
2042
|
-
"sheetFilterValues",
|
|
2043
|
-
"controlDefinitions",
|
|
2044
|
-
"cardControlDefinitions",
|
|
2045
|
-
"controlBindings"
|
|
2046
|
-
]) {
|
|
2047
|
-
const f = En(r[d], `${n}.${d}`, t);
|
|
2048
|
-
f && (o[d] = f);
|
|
2049
|
-
}
|
|
2050
|
-
for (const d of [
|
|
2051
|
-
"controlValues",
|
|
2052
|
-
"tablePreferences",
|
|
2053
|
-
"dashboardInputExecutionSnapshot",
|
|
2054
|
-
"printInputCapture"
|
|
2055
|
-
]) {
|
|
2056
|
-
const f = In(r[d], `${n}.${d}`, t);
|
|
2057
|
-
f && (o[d] = f);
|
|
2058
|
-
}
|
|
2059
|
-
return Object.keys(o).length > 0 ? o : void 0;
|
|
2060
|
-
}
|
|
2061
|
-
function G(e, n, t, r) {
|
|
2062
|
-
const o = E(
|
|
2063
|
-
n,
|
|
2064
|
-
t,
|
|
2065
|
-
u.attachmentTitle,
|
|
2066
|
-
r
|
|
2067
|
-
);
|
|
2068
|
-
return o && (e.title = o), e;
|
|
2069
|
-
}
|
|
2070
|
-
function H(e, n, t, r) {
|
|
2071
|
-
const o = vn(n, t, r);
|
|
2072
|
-
return o != null && o.printInputCapture && e.type !== "dashboard" && s(
|
|
2073
|
-
r,
|
|
2074
|
-
`${t}.printInputCapture`,
|
|
2075
|
-
"Only a full dashboard attachment can carry printInputCapture."
|
|
2076
|
-
), o && (e.settings = o), e;
|
|
2077
|
-
}
|
|
2078
|
-
function $n(e, n, t) {
|
|
2079
|
-
const r = `attachments.${n}`, o = I(e, r, t), a = o.type;
|
|
2080
|
-
if (a === "dashboard") {
|
|
2081
|
-
h(
|
|
2082
|
-
o,
|
|
2083
|
-
r,
|
|
2084
|
-
["type", "dashboardId", "format", "title", "settings"],
|
|
2085
|
-
t
|
|
2086
|
-
);
|
|
2087
|
-
const i = G(
|
|
2088
|
-
{
|
|
2089
|
-
type: "dashboard",
|
|
2090
|
-
dashboardId: b(
|
|
2091
|
-
o.dashboardId,
|
|
2092
|
-
`${r}.dashboardId`,
|
|
2093
|
-
u.id,
|
|
2094
|
-
t
|
|
2095
|
-
),
|
|
2096
|
-
format: U(o.format, `${r}.format`, ["pdf"], t)
|
|
2097
|
-
},
|
|
2098
|
-
o.title,
|
|
2099
|
-
`${r}.title`,
|
|
2100
|
-
t
|
|
2101
|
-
);
|
|
2102
|
-
return H(i, o.settings, `${r}.settings`, t);
|
|
2103
|
-
}
|
|
2104
|
-
if (a === "dashboard_sheet" || a === "document_sheet") {
|
|
2105
|
-
h(
|
|
2106
|
-
o,
|
|
2107
|
-
r,
|
|
2108
|
-
["type", "dashboardId", "sheetId", "format", "title", "settings"],
|
|
2109
|
-
t
|
|
2110
|
-
);
|
|
2111
|
-
const i = G(
|
|
2112
|
-
{
|
|
2113
|
-
type: a,
|
|
2114
|
-
dashboardId: b(
|
|
2115
|
-
o.dashboardId,
|
|
2116
|
-
`${r}.dashboardId`,
|
|
2117
|
-
u.id,
|
|
2118
|
-
t
|
|
2119
|
-
),
|
|
2120
|
-
sheetId: b(
|
|
2121
|
-
o.sheetId,
|
|
2122
|
-
`${r}.sheetId`,
|
|
2123
|
-
u.id,
|
|
2124
|
-
t
|
|
2125
|
-
),
|
|
2126
|
-
format: U(
|
|
2127
|
-
o.format,
|
|
2128
|
-
`${r}.format`,
|
|
2129
|
-
a === "dashboard_sheet" ? ["pdf", "png"] : ["pdf"],
|
|
2130
|
-
t
|
|
2131
|
-
)
|
|
2132
|
-
},
|
|
2133
|
-
o.title,
|
|
2134
|
-
`${r}.title`,
|
|
2135
|
-
t
|
|
2136
|
-
);
|
|
2137
|
-
return le(
|
|
2138
|
-
H(i, o.settings, `${r}.settings`, t)
|
|
2139
|
-
);
|
|
2140
|
-
}
|
|
2141
|
-
if (a === "card") {
|
|
2142
|
-
h(
|
|
2143
|
-
o,
|
|
2144
|
-
r,
|
|
2145
|
-
["type", "dashboardId", "cardId", "format", "title", "settings"],
|
|
2146
|
-
t
|
|
2147
|
-
);
|
|
2148
|
-
const i = G(
|
|
2149
|
-
{
|
|
2150
|
-
type: "card",
|
|
2151
|
-
dashboardId: b(
|
|
2152
|
-
o.dashboardId,
|
|
2153
|
-
`${r}.dashboardId`,
|
|
2154
|
-
u.id,
|
|
2155
|
-
t
|
|
2156
|
-
),
|
|
2157
|
-
cardId: b(
|
|
2158
|
-
o.cardId,
|
|
2159
|
-
`${r}.cardId`,
|
|
2160
|
-
u.id,
|
|
2161
|
-
t
|
|
2162
|
-
),
|
|
2163
|
-
format: U(
|
|
2164
|
-
o.format,
|
|
2165
|
-
`${r}.format`,
|
|
2166
|
-
Ie,
|
|
2167
|
-
t
|
|
2168
|
-
)
|
|
2169
|
-
},
|
|
2170
|
-
o.title,
|
|
2171
|
-
`${r}.title`,
|
|
2172
|
-
t
|
|
2173
|
-
);
|
|
2174
|
-
return le(
|
|
2175
|
-
H(i, o.settings, `${r}.settings`, t)
|
|
2176
|
-
);
|
|
2177
|
-
}
|
|
2178
|
-
return s(
|
|
2179
|
-
t,
|
|
2180
|
-
`${r}.type`,
|
|
2181
|
-
"Expected dashboard, dashboard_sheet, document_sheet, or card."
|
|
2182
|
-
), { type: "dashboard", dashboardId: "", format: "pdf" };
|
|
2183
|
-
}
|
|
2184
|
-
function le(e) {
|
|
2185
|
-
if (e.format !== "png" || !e.settings) return e;
|
|
2186
|
-
const {
|
|
2187
|
-
pageSize: n,
|
|
2188
|
-
orientation: t,
|
|
2189
|
-
includeFilters: r,
|
|
2190
|
-
...o
|
|
2191
|
-
} = e.settings, { settings: a, ...i } = e;
|
|
2192
|
-
return Object.keys(o).length > 0 ? { ...i, settings: o } : i;
|
|
2193
|
-
}
|
|
2194
|
-
function Cn(e) {
|
|
2195
|
-
switch (e.type) {
|
|
2196
|
-
case "dashboard":
|
|
2197
|
-
return `${e.type}:${e.dashboardId}:${e.format}`;
|
|
2198
|
-
case "dashboard_sheet":
|
|
2199
|
-
case "document_sheet":
|
|
2200
|
-
return `${e.type}:${e.dashboardId}:${e.sheetId}:${e.format}`;
|
|
2201
|
-
case "card":
|
|
2202
|
-
return `${e.type}:${e.dashboardId}:${e.cardId}:${e.format}`;
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
function Ae(e, n) {
|
|
2206
|
-
if (e == null)
|
|
2207
|
-
return [];
|
|
2208
|
-
if (!Array.isArray(e))
|
|
2209
|
-
return s(n, "attachments", "Expected an array."), [];
|
|
2210
|
-
e.length > q && s(
|
|
2211
|
-
n,
|
|
2212
|
-
"attachments",
|
|
2213
|
-
`Choose ${q} attachments or fewer.`
|
|
2214
|
-
);
|
|
2215
|
-
const t = e.slice(0, q).map((o, a) => $n(o, a, n)), r = /* @__PURE__ */ new Set();
|
|
2216
|
-
return t.forEach((o, a) => {
|
|
2217
|
-
var l, m, d, f;
|
|
2218
|
-
const i = o.type === "card" ? (l = o.settings) == null ? void 0 : l.cardType : void 0;
|
|
2219
|
-
(m = o.settings) != null && m.matrix && (o.type !== "card" || i !== void 0 && i !== "matrixTable" || o.settings.matrix.content === "flat" && o.format === "pdf") && s(n, `attachments.${a}.settings.matrix`, "Matrix settings require a matrixTable card attachment; flat content requires CSV or Excel."), o.format === "png" && ((d = o.settings) != null && d.matrix) && o.settings.matrix.content !== "current" && s(n, `attachments.${a}.settings.matrix.content`, "A Matrix PNG image shows the current layout."), o.format === "xlsx" && i !== void 0 && !((f = o.settings) != null && f.matrix) && !V(i) && s(n, `attachments.${a}.format`, "Excel attachments require a Table, Detail Table or Matrix card.");
|
|
2220
|
-
const c = Cn(o);
|
|
2221
|
-
r.has(c) && s(n, `attachments.${a}`, "Duplicate attachment."), r.add(c);
|
|
2222
|
-
}), t;
|
|
2223
|
-
}
|
|
2224
|
-
function ke(e, n) {
|
|
2225
|
-
if (e == null)
|
|
2226
|
-
return;
|
|
2227
|
-
const t = I(e, "limits", n);
|
|
2228
|
-
h(t, "limits", Object.keys(K), n);
|
|
2229
|
-
const r = {};
|
|
2230
|
-
return Object.keys(K).forEach((o) => {
|
|
2231
|
-
const a = t[o];
|
|
2232
|
-
if (a == null)
|
|
2233
|
-
return;
|
|
2234
|
-
const i = K[o];
|
|
2235
|
-
if (typeof a != "number" || !Number.isInteger(a) || a < i.min || a > i.max) {
|
|
2236
|
-
s(
|
|
2237
|
-
n,
|
|
2238
|
-
`limits.${o}`,
|
|
2239
|
-
`Expected an integer between ${i.min} and ${i.max}.`
|
|
2240
|
-
);
|
|
2241
|
-
return;
|
|
2242
|
-
}
|
|
2243
|
-
r[o] = a;
|
|
2244
|
-
}), Object.keys(r).length > 0 ? r : void 0;
|
|
2245
|
-
}
|
|
2246
|
-
function J(e) {
|
|
2247
|
-
if (e.length > 0)
|
|
2248
|
-
throw new z(e);
|
|
2249
|
-
}
|
|
2250
|
-
function _e(e, n, t) {
|
|
2251
|
-
!(e.type === "generated_analysis" || e.type === "custom_message" && !!e.message.trim()) && n.length === 0 && s(
|
|
2252
|
-
t,
|
|
2253
|
-
"body",
|
|
2254
|
-
"Add briefing instructions, a custom message, or at least one attachment."
|
|
2255
|
-
);
|
|
2256
|
-
}
|
|
2257
|
-
function Tn(e, n, t) {
|
|
2258
|
-
e == null || e.forEach((r, o) => {
|
|
2259
|
-
const a = `${t}.${o}.scope`, i = r.scope.attachmentIndex;
|
|
2260
|
-
if (i === void 0)
|
|
2261
|
-
throw new N(
|
|
2262
|
-
`${a}.attachmentIndex must identify the attachment that owns this presentation entry.`
|
|
2263
|
-
);
|
|
2264
|
-
const c = n[i];
|
|
2265
|
-
if (!c)
|
|
2266
|
-
throw new N(
|
|
2267
|
-
`${a}.attachmentIndex must identify an existing attachment.`
|
|
2268
|
-
);
|
|
2269
|
-
if (r.scope.dashboardId !== c.dashboardId)
|
|
2270
|
-
throw new N(
|
|
2271
|
-
`${a}.dashboardId must match the dashboard selected by the referenced attachment.`
|
|
2272
|
-
);
|
|
2273
|
-
if (c.type === "card" && r.scope.cardId !== c.cardId)
|
|
2274
|
-
throw new N(
|
|
2275
|
-
`${a}.cardId must match the card selected by the referenced attachment.`
|
|
2276
|
-
);
|
|
2277
|
-
});
|
|
2278
|
-
}
|
|
2279
|
-
function De(e) {
|
|
2280
|
-
const n = [], t = I(e, "jobConfig", n);
|
|
2281
|
-
h(
|
|
2282
|
-
t,
|
|
2283
|
-
"jobConfig",
|
|
2284
|
-
[
|
|
2285
|
-
"kind",
|
|
2286
|
-
"presentationExecutionSnapshot",
|
|
2287
|
-
"source",
|
|
2288
|
-
"body",
|
|
2289
|
-
"attachments",
|
|
2290
|
-
"presentation",
|
|
2291
|
-
"limits"
|
|
2292
|
-
],
|
|
2293
|
-
n
|
|
2294
|
-
), t.kind !== W && s(n, "kind", "Expected BRIEFING.");
|
|
2295
|
-
let r;
|
|
2296
|
-
try {
|
|
2297
|
-
r = Be(
|
|
2298
|
-
t.presentationExecutionSnapshot
|
|
2299
|
-
);
|
|
2300
|
-
} catch (m) {
|
|
2301
|
-
if (m instanceof N)
|
|
2302
|
-
throw m;
|
|
2303
|
-
s(
|
|
2304
|
-
n,
|
|
2305
|
-
"jobConfig.presentationExecutionSnapshot",
|
|
2306
|
-
m instanceof Error ? m.message : "Invalid presentation snapshot."
|
|
2307
|
-
);
|
|
2308
|
-
}
|
|
2309
|
-
const o = Ce(t.source, n), a = Te(t.body, n), i = Ae(t.attachments, n), c = xe(t.presentation, n), l = ke(t.limits, n);
|
|
2310
|
-
return _e(a, i, n), Tn(
|
|
2311
|
-
r == null ? void 0 : r.resolvedFormats,
|
|
2312
|
-
i,
|
|
2313
|
-
"jobConfig.presentationExecutionSnapshot.resolvedFormats"
|
|
2314
|
-
), J(n), {
|
|
2315
|
-
kind: W,
|
|
2316
|
-
presentationExecutionSnapshot: r,
|
|
2317
|
-
source: o,
|
|
2318
|
-
body: a,
|
|
2319
|
-
attachments: i,
|
|
2320
|
-
presentation: c,
|
|
2321
|
-
...l ? { limits: l } : {}
|
|
2322
|
-
};
|
|
2323
|
-
}
|
|
2324
|
-
function Ir(e) {
|
|
2325
|
-
return De({
|
|
2326
|
-
...e,
|
|
2327
|
-
kind: W
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
2330
|
-
function Q(e, n, t, r = "deliveryConfig.recipients") {
|
|
2331
|
-
const o = `${r}.${n}`, a = I(e, o, t), i = a.type;
|
|
2332
|
-
if (i === "email") {
|
|
2333
|
-
h(a, o, ["type", "address", "name"], t);
|
|
2334
|
-
const c = b(
|
|
2335
|
-
a.address,
|
|
2336
|
-
`${o}.address`,
|
|
2337
|
-
u.id,
|
|
2338
|
-
t
|
|
2339
|
-
), l = E(
|
|
2340
|
-
a.name,
|
|
2341
|
-
`${o}.name`,
|
|
2342
|
-
u.attachmentTitle,
|
|
2343
|
-
t
|
|
2344
|
-
);
|
|
2345
|
-
return c && !dn(c) && s(t, `${o}.address`, "Email address is invalid."), {
|
|
2346
|
-
type: "email",
|
|
2347
|
-
address: c,
|
|
2348
|
-
...l ? { name: l } : {}
|
|
2349
|
-
};
|
|
2350
|
-
}
|
|
2351
|
-
return i === "user" ? (h(a, o, ["type", "userId"], t), {
|
|
2352
|
-
type: "user",
|
|
2353
|
-
userId: b(
|
|
2354
|
-
a.userId,
|
|
2355
|
-
`${o}.userId`,
|
|
2356
|
-
u.id,
|
|
2357
|
-
t
|
|
2358
|
-
)
|
|
2359
|
-
}) : i === "tenant_user" ? (h(a, o, ["type", "tenantUserId"], t), {
|
|
2360
|
-
type: "tenant_user",
|
|
2361
|
-
tenantUserId: b(
|
|
2362
|
-
a.tenantUserId,
|
|
2363
|
-
`${o}.tenantUserId`,
|
|
2364
|
-
u.id,
|
|
2365
|
-
t
|
|
2366
|
-
)
|
|
2367
|
-
}) : i === "group" ? (h(a, o, ["type", "groupId"], t), {
|
|
2368
|
-
type: "group",
|
|
2369
|
-
groupId: b(
|
|
2370
|
-
a.groupId,
|
|
2371
|
-
`${o}.groupId`,
|
|
2372
|
-
u.id,
|
|
2373
|
-
t
|
|
2374
|
-
)
|
|
2375
|
-
}) : (s(
|
|
2376
|
-
t,
|
|
2377
|
-
`${o}.type`,
|
|
2378
|
-
"Expected email, user, tenant_user, or group."
|
|
2379
|
-
), { type: "email", address: "" });
|
|
2380
|
-
}
|
|
2381
|
-
function xn(e, n) {
|
|
2382
|
-
return e == null ? [] : Array.isArray(e) ? e.map(
|
|
2383
|
-
(t, r) => Q(t, r, n)
|
|
2384
|
-
) : (s(n, "deliveryConfig.recipients", "Expected an array."), []);
|
|
2385
|
-
}
|
|
2386
|
-
function Sn(e, n) {
|
|
2387
|
-
if (!Array.isArray(e))
|
|
2388
|
-
return s(n, "deliveryConfig.channels", "Expected an array."), [];
|
|
2389
|
-
const t = [];
|
|
2390
|
-
return e.forEach((r, o) => {
|
|
2391
|
-
if (!we(r)) {
|
|
2392
|
-
s(
|
|
2393
|
-
n,
|
|
2394
|
-
`deliveryConfig.channels.${o}`,
|
|
2395
|
-
"Expected EMAIL, WEBHOOK, SLACK, IN_APP, or TELEGRAM."
|
|
2396
|
-
);
|
|
2397
|
-
return;
|
|
2398
|
-
}
|
|
2399
|
-
t.includes(r) || t.push(r);
|
|
2400
|
-
}), t;
|
|
2401
|
-
}
|
|
2402
|
-
function An(e, n, t) {
|
|
2403
|
-
if (e == null)
|
|
2404
|
-
return;
|
|
2405
|
-
const r = I(e, n, t), o = {};
|
|
2406
|
-
return Object.entries(r).forEach(([a, i]) => {
|
|
2407
|
-
if (typeof i != "string") {
|
|
2408
|
-
s(t, `${n}.${a}`, "Expected a string.");
|
|
2409
|
-
return;
|
|
2410
|
-
}
|
|
2411
|
-
o[a] = i.trim();
|
|
2412
|
-
}), Object.keys(o).length > 0 ? o : void 0;
|
|
2413
|
-
}
|
|
2414
|
-
function kn(e, n, t) {
|
|
2415
|
-
if (e == null)
|
|
2416
|
-
return;
|
|
2417
|
-
const r = I(e, n, t);
|
|
2418
|
-
h(
|
|
2419
|
-
r,
|
|
2420
|
-
n,
|
|
2421
|
-
["url", "method", "headers", "secretEncrypted"],
|
|
2422
|
-
t
|
|
2423
|
-
);
|
|
2424
|
-
const o = r.method === void 0 || r.method === null ? void 0 : U(r.method, `${n}.method`, ["POST", "PUT"], t), a = An(r.headers, `${n}.headers`, t), i = E(
|
|
2425
|
-
r.secretEncrypted,
|
|
2426
|
-
`${n}.secretEncrypted`,
|
|
2427
|
-
2e3,
|
|
2428
|
-
t
|
|
2429
|
-
);
|
|
2430
|
-
return {
|
|
2431
|
-
url: b(r.url, `${n}.url`, 2e3, t),
|
|
2432
|
-
...o ? { method: o } : {},
|
|
2433
|
-
...a ? { headers: a } : {},
|
|
2434
|
-
...i ? { secretEncrypted: i } : {}
|
|
2435
|
-
};
|
|
2436
|
-
}
|
|
2437
|
-
function _n(e, n, t) {
|
|
2438
|
-
const r = I(e, n, t), o = r.type;
|
|
2439
|
-
if (o === "channel") {
|
|
2440
|
-
h(
|
|
2441
|
-
r,
|
|
2442
|
-
n,
|
|
2443
|
-
["type", "channelId", "channelName", "isPrivate"],
|
|
2444
|
-
t
|
|
2445
|
-
);
|
|
2446
|
-
const a = E(
|
|
2447
|
-
r.channelName,
|
|
2448
|
-
`${n}.channelName`,
|
|
2449
|
-
u.attachmentTitle,
|
|
2450
|
-
t
|
|
2451
|
-
), i = r.isPrivate === void 0 || r.isPrivate === null ? void 0 : w(
|
|
2452
|
-
r.isPrivate,
|
|
2453
|
-
!1,
|
|
2454
|
-
`${n}.isPrivate`,
|
|
2455
|
-
t
|
|
2456
|
-
);
|
|
2457
|
-
return {
|
|
2458
|
-
type: "channel",
|
|
2459
|
-
channelId: b(
|
|
2460
|
-
r.channelId,
|
|
2461
|
-
`${n}.channelId`,
|
|
2462
|
-
u.id,
|
|
2463
|
-
t
|
|
2464
|
-
),
|
|
2465
|
-
...a ? { channelName: a } : {},
|
|
2466
|
-
...i !== void 0 ? { isPrivate: i } : {}
|
|
2467
|
-
};
|
|
2468
|
-
}
|
|
2469
|
-
return o === "dm" ? (h(r, n, ["type", "recipient"], t), s(
|
|
2470
|
-
t,
|
|
2471
|
-
`${n}.type`,
|
|
2472
|
-
"Slack DM delivery is not supported in V1."
|
|
2473
|
-
), {
|
|
2474
|
-
type: "dm",
|
|
2475
|
-
recipient: Q(r.recipient, 0, t, `${n}.recipient`)
|
|
2476
|
-
}) : (s(t, `${n}.type`, "Expected channel."), { type: "channel", channelId: "" });
|
|
2477
|
-
}
|
|
2478
|
-
function Dn(e, n, t) {
|
|
2479
|
-
if (e == null)
|
|
2480
|
-
return;
|
|
2481
|
-
if (!Array.isArray(e)) {
|
|
2482
|
-
s(t, n, "Expected an array.");
|
|
2483
|
-
return;
|
|
2484
|
-
}
|
|
2485
|
-
const r = e.map(
|
|
2486
|
-
(o, a) => Q(o, a, t, n)
|
|
2487
|
-
);
|
|
2488
|
-
return r.length > 0 ? r : void 0;
|
|
2489
|
-
}
|
|
2490
|
-
function wn(e, n, t) {
|
|
2491
|
-
if (e == null)
|
|
2492
|
-
return;
|
|
2493
|
-
const r = I(e, n, t);
|
|
2494
|
-
h(
|
|
2495
|
-
r,
|
|
2496
|
-
n,
|
|
2497
|
-
[
|
|
2498
|
-
"destination",
|
|
2499
|
-
"threadMentions",
|
|
2500
|
-
"postThreadDetail",
|
|
2501
|
-
"includeDashboardLink",
|
|
2502
|
-
"includeBriefingLink"
|
|
2503
|
-
],
|
|
2504
|
-
t
|
|
2505
|
-
);
|
|
2506
|
-
const o = Dn(
|
|
2507
|
-
r.threadMentions,
|
|
2508
|
-
`${n}.threadMentions`,
|
|
2509
|
-
t
|
|
2510
|
-
), a = w(
|
|
2511
|
-
r.postThreadDetail,
|
|
2512
|
-
!0,
|
|
2513
|
-
`${n}.postThreadDetail`,
|
|
2514
|
-
t
|
|
2515
|
-
), i = w(
|
|
2516
|
-
r.includeDashboardLink,
|
|
2517
|
-
!0,
|
|
2518
|
-
`${n}.includeDashboardLink`,
|
|
2519
|
-
t
|
|
2520
|
-
), c = w(
|
|
2521
|
-
r.includeBriefingLink,
|
|
2522
|
-
!0,
|
|
2523
|
-
`${n}.includeBriefingLink`,
|
|
2524
|
-
t
|
|
2525
|
-
);
|
|
2526
|
-
return {
|
|
2527
|
-
destination: _n(
|
|
2528
|
-
r.destination,
|
|
2529
|
-
`${n}.destination`,
|
|
2530
|
-
t
|
|
2531
|
-
),
|
|
2532
|
-
...o ? { threadMentions: o } : {},
|
|
2533
|
-
...r.postThreadDetail !== void 0 ? { postThreadDetail: a } : {},
|
|
2534
|
-
...r.includeDashboardLink !== void 0 ? { includeDashboardLink: i } : {},
|
|
2535
|
-
...r.includeBriefingLink !== void 0 ? { includeBriefingLink: c } : {}
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
function On(e, n, t) {
|
|
2539
|
-
const r = I(e, n, t);
|
|
2540
|
-
h(
|
|
2541
|
-
r,
|
|
2542
|
-
n,
|
|
2543
|
-
[
|
|
2544
|
-
"subjectOverride",
|
|
2545
|
-
"titleOverride",
|
|
2546
|
-
"summaryOverride",
|
|
2547
|
-
"actionBlockVisible",
|
|
2548
|
-
"formatProfile",
|
|
2549
|
-
"slackConfig",
|
|
2550
|
-
"webhookConfig"
|
|
2551
|
-
],
|
|
2552
|
-
t
|
|
2553
|
-
);
|
|
2554
|
-
const o = A(
|
|
2555
|
-
r.formatProfile,
|
|
2556
|
-
`${n}.formatProfile`,
|
|
2557
|
-
tn,
|
|
2558
|
-
"concise, balanced, or detailed",
|
|
2559
|
-
t
|
|
2560
|
-
), a = E(
|
|
2561
|
-
r.subjectOverride,
|
|
2562
|
-
`${n}.subjectOverride`,
|
|
2563
|
-
500,
|
|
2564
|
-
t
|
|
2565
|
-
), i = E(
|
|
2566
|
-
r.titleOverride,
|
|
2567
|
-
`${n}.titleOverride`,
|
|
2568
|
-
500,
|
|
2569
|
-
t
|
|
2570
|
-
), c = E(
|
|
2571
|
-
r.summaryOverride,
|
|
2572
|
-
`${n}.summaryOverride`,
|
|
2573
|
-
2e3,
|
|
2574
|
-
t
|
|
2575
|
-
), l = w(
|
|
2576
|
-
r.actionBlockVisible,
|
|
2577
|
-
!0,
|
|
2578
|
-
`${n}.actionBlockVisible`,
|
|
2579
|
-
t
|
|
2580
|
-
), m = kn(
|
|
2581
|
-
r.webhookConfig,
|
|
2582
|
-
`${n}.webhookConfig`,
|
|
2583
|
-
t
|
|
2584
|
-
), d = wn(
|
|
2585
|
-
r.slackConfig,
|
|
2586
|
-
`${n}.slackConfig`,
|
|
2587
|
-
t
|
|
2588
|
-
);
|
|
2589
|
-
return {
|
|
2590
|
-
...o ? { formatProfile: o } : {},
|
|
2591
|
-
...a ? { subjectOverride: a } : {},
|
|
2592
|
-
...i ? { titleOverride: i } : {},
|
|
2593
|
-
...c ? { summaryOverride: c } : {},
|
|
2594
|
-
...r.actionBlockVisible !== void 0 ? { actionBlockVisible: l } : {},
|
|
2595
|
-
...d ? { slackConfig: d } : {},
|
|
2596
|
-
...m ? { webhookConfig: m } : {}
|
|
2597
|
-
};
|
|
2598
|
-
}
|
|
2599
|
-
function Fn(e, n) {
|
|
2600
|
-
if (e == null)
|
|
2601
|
-
return;
|
|
2602
|
-
const t = I(e, "deliveryConfig.channelConfigs", n), r = {};
|
|
2603
|
-
return Object.entries(t).forEach(([o, a]) => {
|
|
2604
|
-
if (!we(o)) {
|
|
2605
|
-
s(
|
|
2606
|
-
n,
|
|
2607
|
-
`deliveryConfig.channelConfigs.${o}`,
|
|
2608
|
-
"Expected a supported delivery channel."
|
|
2609
|
-
);
|
|
2610
|
-
return;
|
|
2611
|
-
}
|
|
2612
|
-
r[o] = On(
|
|
2613
|
-
a,
|
|
2614
|
-
`deliveryConfig.channelConfigs.${o}`,
|
|
2615
|
-
n
|
|
2616
|
-
);
|
|
2617
|
-
}), Object.keys(r).length > 0 ? r : void 0;
|
|
2618
|
-
}
|
|
2619
|
-
function Nn(e, n) {
|
|
2620
|
-
var l, m, d;
|
|
2621
|
-
if (e == null)
|
|
2622
|
-
return null;
|
|
2623
|
-
const t = I(e, "deliveryConfig", n);
|
|
2624
|
-
h(
|
|
2625
|
-
t,
|
|
2626
|
-
"deliveryConfig",
|
|
2627
|
-
["recipients", "channels", "channelConfigs"],
|
|
2628
|
-
n
|
|
2629
|
-
);
|
|
2630
|
-
const r = Fn(t.channelConfigs, n), o = xn(t.recipients, n), a = Sn(t.channels, n), i = ((m = (l = r == null ? void 0 : r.SLACK) == null ? void 0 : l.slackConfig) == null ? void 0 : m.destination.type) === "channel" && !!r.SLACK.slackConfig.destination.channelId.trim();
|
|
2631
|
-
return a.some(
|
|
2632
|
-
(f) => f !== "SLACK"
|
|
2633
|
-
) && o.length === 0 && s(
|
|
2634
|
-
n,
|
|
2635
|
-
"deliveryConfig.recipients",
|
|
2636
|
-
"Add at least one recipient or remove delivery config."
|
|
2637
|
-
), a.length === 0 && s(
|
|
2638
|
-
n,
|
|
2639
|
-
"deliveryConfig.channels",
|
|
2640
|
-
"Choose at least one delivery channel or remove delivery config."
|
|
2641
|
-
), a.includes("SLACK") && !i && s(
|
|
2642
|
-
n,
|
|
2643
|
-
"deliveryConfig.channelConfigs.SLACK.slackConfig.destination.channelId",
|
|
2644
|
-
"Choose a Slack channel destination."
|
|
2645
|
-
), !a.includes("SLACK") && ((d = r == null ? void 0 : r.SLACK) != null && d.slackConfig) && s(
|
|
2646
|
-
n,
|
|
2647
|
-
"deliveryConfig.channelConfigs.SLACK",
|
|
2648
|
-
"Slack config requires SLACK in deliveryConfig.channels."
|
|
2649
|
-
), {
|
|
2650
|
-
recipients: o,
|
|
2651
|
-
channels: a,
|
|
2652
|
-
...r ? { channelConfigs: r } : {}
|
|
2653
|
-
};
|
|
2654
|
-
}
|
|
2655
|
-
function ee(e) {
|
|
2656
|
-
const n = [], t = I(e, "draft", n);
|
|
2657
|
-
h(
|
|
2658
|
-
t,
|
|
2659
|
-
"draft",
|
|
2660
|
-
[
|
|
2661
|
-
"name",
|
|
2662
|
-
"description",
|
|
2663
|
-
"status",
|
|
2664
|
-
"scheduleExpr",
|
|
2665
|
-
"timezone",
|
|
2666
|
-
"source",
|
|
2667
|
-
"body",
|
|
2668
|
-
"attachments",
|
|
2669
|
-
"presentation",
|
|
2670
|
-
"limits",
|
|
2671
|
-
"deliveryConfig"
|
|
2672
|
-
],
|
|
2673
|
-
n
|
|
2674
|
-
);
|
|
2675
|
-
const r = b(
|
|
2676
|
-
t.name,
|
|
2677
|
-
"name",
|
|
2678
|
-
u.name,
|
|
2679
|
-
n
|
|
2680
|
-
), o = E(
|
|
2681
|
-
t.description,
|
|
2682
|
-
"description",
|
|
2683
|
-
u.description,
|
|
2684
|
-
n
|
|
2685
|
-
) ?? null, a = E(t.scheduleExpr, "scheduleExpr", 500, n) ?? null, i = E(t.timezone, "timezone", 200, n) ?? "UTC", c = sn(t.status, n), l = Ce(t.source, n), m = Te(t.body, n), d = Ae(t.attachments, n), f = xe(t.presentation, n), p = ke(t.limits, n), g = Nn(t.deliveryConfig, n);
|
|
2686
|
-
return _e(m, d, n), J(n), {
|
|
2687
|
-
name: r,
|
|
2688
|
-
description: o,
|
|
2689
|
-
status: c,
|
|
2690
|
-
scheduleExpr: a,
|
|
2691
|
-
timezone: i,
|
|
2692
|
-
source: l,
|
|
2693
|
-
body: m,
|
|
2694
|
-
attachments: d,
|
|
2695
|
-
presentation: f,
|
|
2696
|
-
...p ? { limits: p } : {},
|
|
2697
|
-
deliveryConfig: g
|
|
2698
|
-
};
|
|
2699
|
-
}
|
|
2700
|
-
function vr(e) {
|
|
2701
|
-
return ee(e);
|
|
2702
|
-
}
|
|
2703
|
-
function $r(e) {
|
|
2704
|
-
return ee(e);
|
|
2705
|
-
}
|
|
2706
|
-
function Cr(e) {
|
|
2707
|
-
try {
|
|
2708
|
-
return { valid: !0, value: ee(e), issues: [] };
|
|
2709
|
-
} catch (n) {
|
|
2710
|
-
if (n instanceof z)
|
|
2711
|
-
return { valid: !1, issues: n.issues };
|
|
2712
|
-
throw n;
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
function Tr(e) {
|
|
2716
|
-
try {
|
|
2717
|
-
return { valid: !0, value: De(e), issues: [] };
|
|
2718
|
-
} catch (n) {
|
|
2719
|
-
if (n instanceof z)
|
|
2720
|
-
return { valid: !1, issues: n.issues };
|
|
2721
|
-
throw n;
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
function xr(e) {
|
|
2725
|
-
return typeof e == "string" && ve.has(e);
|
|
2726
|
-
}
|
|
2727
|
-
function we(e) {
|
|
2728
|
-
return typeof e == "string" && Xt.has(e);
|
|
2729
|
-
}
|
|
2730
|
-
export {
|
|
2731
|
-
dt as $,
|
|
2732
|
-
or as A,
|
|
2733
|
-
fr as B,
|
|
2734
|
-
W as C,
|
|
2735
|
-
cr as D,
|
|
2736
|
-
Gt as E,
|
|
2737
|
-
X as F,
|
|
2738
|
-
u as G,
|
|
2739
|
-
$ as H,
|
|
2740
|
-
Ht as I,
|
|
2741
|
-
Wt as J,
|
|
2742
|
-
br as K,
|
|
2743
|
-
Ie as L,
|
|
2744
|
-
q as M,
|
|
2745
|
-
z as N,
|
|
2746
|
-
bn as O,
|
|
2747
|
-
Er as P,
|
|
2748
|
-
De as Q,
|
|
2749
|
-
Ir as R,
|
|
2750
|
-
ee as S,
|
|
2751
|
-
vr as T,
|
|
2752
|
-
$r as U,
|
|
2753
|
-
Cr as V,
|
|
2754
|
-
Tr as W,
|
|
2755
|
-
xr as X,
|
|
2756
|
-
we as Y,
|
|
2757
|
-
nr as Z,
|
|
2758
|
-
ft as _,
|
|
2759
|
-
yr as a,
|
|
2760
|
-
Qn as a0,
|
|
2761
|
-
st as a1,
|
|
2762
|
-
Jn as a2,
|
|
2763
|
-
ut as a3,
|
|
2764
|
-
V as a4,
|
|
2765
|
-
Rt as a5,
|
|
2766
|
-
Bt as a6,
|
|
2767
|
-
Ut as a7,
|
|
2768
|
-
Pt as a8,
|
|
2769
|
-
Kt as a9,
|
|
2770
|
-
mt as b,
|
|
2771
|
-
tr as c,
|
|
2772
|
-
sr as d,
|
|
2773
|
-
rr as e,
|
|
2774
|
-
ir as f,
|
|
2775
|
-
gr as g,
|
|
2776
|
-
Zn as h,
|
|
2777
|
-
lt as i,
|
|
2778
|
-
er as j,
|
|
2779
|
-
$t as k,
|
|
2780
|
-
lr as l,
|
|
2781
|
-
O as m,
|
|
2782
|
-
dr as n,
|
|
2783
|
-
Ot as o,
|
|
2784
|
-
be as p,
|
|
2785
|
-
mr as q,
|
|
2786
|
-
Yn as r,
|
|
2787
|
-
ye as s,
|
|
2788
|
-
qt as t,
|
|
2789
|
-
pr as u,
|
|
2790
|
-
ur as v,
|
|
2791
|
-
hr as w,
|
|
2792
|
-
pt as x,
|
|
2793
|
-
me as y,
|
|
2794
|
-
ar as z
|
|
2795
|
-
};
|