react-semaphor 0.1.602 → 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 -1451
- 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 -4491
- package/dist/format-utils/index.js +1 -424
- 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/components/ui-custom/date-range-presets.d.ts +8 -0
- package/dist/types/index.js +1 -88
- package/dist/types/lib/document/document-edits.d.ts +0 -4
- 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/dashboard-store.d.ts +0 -1
- package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
- package/dist/types/lib/types/common-types.d.ts +0 -2
- package/dist/types/lib/types/explorer-types.d.ts +1 -1
- 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/analytics-protocol/analytics-base-schemas.d.ts +18 -0
- package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
- package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
- package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
- package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
- package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
- package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
- 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/card-settings/card-display-write.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
- 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/kpi-date-context.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
- package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
- package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
- package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
- package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
- package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
- package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
- package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
- package/dist/types/shared/temporal/index.d.ts +2 -0
- package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
- package/dist/types/shared/temporal/temporal.d.ts +27 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
- package/dist/usage-events/index.js +1 -285
- package/dist/value-format-preferences/index.js +1 -635
- package/package.json +6 -2
- package/dist/chunks/add-to-dashboard-ClhEIFst.js +0 -291
- package/dist/chunks/analytics-base-schemas-DevrgqQb.js +0 -678
- 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-BWF3GYip.js +0 -6115
- package/dist/chunks/attribution-BvoKvhcj.js +0 -32
- package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
- package/dist/chunks/bookmark-impact-BF3iRx5a.js +0 -76
- package/dist/chunks/bookmark-state-CBSTdW6q.js +0 -1666
- package/dist/chunks/brand-BoUV0iHF.js +0 -54
- package/dist/chunks/card-filter-builder-B8XHwMY6.js +0 -4069
- package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
- package/dist/chunks/comparison-window-caption-W83qB4V5.js +0 -741
- package/dist/chunks/context-BJoEFgNl.js +0 -369
- package/dist/chunks/conversation-sQiWYUOb.js +0 -16
- package/dist/chunks/dashboard-DG5EIYYB.js +0 -14
- package/dist/chunks/dashboard-briefing-launcher-CBSrhyWZ.js +0 -4875
- package/dist/chunks/dashboard-controls-D6ECO4N1.js +0 -2290
- package/dist/chunks/dashboard-json-DrJftBSL.js +0 -66
- package/dist/chunks/dates-Bz-qM5px.js +0 -164
- package/dist/chunks/edit-9df1zOWe.js +0 -226
- package/dist/chunks/edit-dashboard-visual-BDYAJIbb.js +0 -18605
- package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
- package/dist/chunks/filter-line-BXT6y303.js +0 -703
- package/dist/chunks/filter-reach-copy-BukhZmzm.js +0 -5250
- package/dist/chunks/filter-value-text-D3-bf3_b.js +0 -153
- package/dist/chunks/index-BVKzKl5d.js +0 -90
- package/dist/chunks/index-BW0yozjs.js +0 -2795
- package/dist/chunks/index-CV_Kzou0.js +0 -595
- package/dist/chunks/layout-grid-Ds0diMeY.js +0 -16
- package/dist/chunks/matrix-analytical-definition-CgQgVeeI.js +0 -1162
- package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
- package/dist/chunks/matrix-operation-contract--DkNCOzd.js +0 -1412
- package/dist/chunks/metric-comparison-zMylnIkc.js +0 -541
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
- package/dist/chunks/paintbrush-CX8pao1j.js +0 -27
- package/dist/chunks/palette-CuA0HlzF.js +0 -23
- package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
- package/dist/chunks/pivot-result-contract-expectations-C8KL7hPx.js +0 -5046
- package/dist/chunks/pivot-result-identity-C1AOH1PS.js +0 -77
- package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
- package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
- package/dist/chunks/report-preferences-dialog-CbuVNDGi.js +0 -1637
- package/dist/chunks/report-runtime-context-E7USjN7E.js +0 -388
- package/dist/chunks/resolve-dashboard-input-context-CULCE_hM.js +0 -25172
- package/dist/chunks/resolver-DG_tfEpt.js +0 -156
- package/dist/chunks/save-BKHlDONy.js +0 -21
- package/dist/chunks/saved-dashboard-context-C1WlOx5z.js +0 -632
- package/dist/chunks/schema-C9NPiIru.js +0 -2568
- package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
- package/dist/chunks/semaphor-ready-indicator-CBIRcDWs.js +0 -145326
- package/dist/chunks/shelf-drop-preview-context-xR69SMA8.js +0 -2466
- package/dist/chunks/stored-dashboard-BuM8vnWf.js +0 -4070
- package/dist/chunks/style-sheet-parts-Bt9ZNre8.js +0 -8674
- package/dist/chunks/table-export-sheet-DVljtHkG.js +0 -949
- package/dist/chunks/token-types-D_xKgyVS.js +0 -8
- package/dist/chunks/upload-Dll_M7XQ.js +0 -15
- package/dist/chunks/validators-ClWHpYql.js +0 -3686
- package/dist/chunks/variable-draft-CDGGl53R.js +0 -242
- package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
|
@@ -1,635 +1 @@
|
|
|
1
|
-
const v = {
|
|
2
|
-
locale: "en-US",
|
|
3
|
-
dateStyle: "short",
|
|
4
|
-
dateTime: {
|
|
5
|
-
dateStyle: "short",
|
|
6
|
-
timeStyle: "short"
|
|
7
|
-
},
|
|
8
|
-
defaultCurrency: "USD"
|
|
9
|
-
}, F = [
|
|
10
|
-
"viewer_user",
|
|
11
|
-
"viewer_tenant_user",
|
|
12
|
-
"session_initial",
|
|
13
|
-
"viewer_tenant",
|
|
14
|
-
"viewer_organization",
|
|
15
|
-
"system_default"
|
|
16
|
-
], D = new Set(
|
|
17
|
-
F
|
|
18
|
-
);
|
|
19
|
-
function T(e) {
|
|
20
|
-
return typeof e == "string" && D.has(e);
|
|
21
|
-
}
|
|
22
|
-
const I = [
|
|
23
|
-
"locale",
|
|
24
|
-
"dateStyle",
|
|
25
|
-
"dateTime",
|
|
26
|
-
"defaultCurrency"
|
|
27
|
-
], C = ["dateStyle", "timeStyle"], U = [
|
|
28
|
-
"stored",
|
|
29
|
-
"inherited",
|
|
30
|
-
"inheritedSources",
|
|
31
|
-
"resolved",
|
|
32
|
-
"sources",
|
|
33
|
-
"diagnostics"
|
|
34
|
-
], V = [
|
|
35
|
-
"locale",
|
|
36
|
-
"dateStyle",
|
|
37
|
-
"dateTime",
|
|
38
|
-
"defaultCurrency"
|
|
39
|
-
], z = ["scope", "path", "code"], g = [
|
|
40
|
-
"locale",
|
|
41
|
-
"dateStyle",
|
|
42
|
-
"dateTime.dateStyle",
|
|
43
|
-
"dateTime.timeStyle",
|
|
44
|
-
"defaultCurrency"
|
|
45
|
-
], N = ["short", "medium", "long"];
|
|
46
|
-
let _, h;
|
|
47
|
-
function f(e) {
|
|
48
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
49
|
-
return !1;
|
|
50
|
-
const t = Object.getPrototypeOf(e);
|
|
51
|
-
return t === null || Object.getPrototypeOf(t) === null;
|
|
52
|
-
}
|
|
53
|
-
function u(e, t) {
|
|
54
|
-
return Object.prototype.hasOwnProperty.call(e, t);
|
|
55
|
-
}
|
|
56
|
-
function n(e, t, a) {
|
|
57
|
-
return { path: e, code: t, message: a };
|
|
58
|
-
}
|
|
59
|
-
function E(e, t) {
|
|
60
|
-
if (typeof e != "string")
|
|
61
|
-
return {
|
|
62
|
-
ok: !1,
|
|
63
|
-
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
64
|
-
};
|
|
65
|
-
const a = e.trim();
|
|
66
|
-
let s;
|
|
67
|
-
try {
|
|
68
|
-
s = Intl.getCanonicalLocales(a)[0] ?? "";
|
|
69
|
-
} catch {
|
|
70
|
-
return {
|
|
71
|
-
ok: !1,
|
|
72
|
-
issue: n(
|
|
73
|
-
t,
|
|
74
|
-
"invalid_locale",
|
|
75
|
-
`${t} must be a valid BCP 47 locale`
|
|
76
|
-
)
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
if (!s || new Intl.Locale(s).baseName !== s)
|
|
80
|
-
return {
|
|
81
|
-
ok: !1,
|
|
82
|
-
issue: n(
|
|
83
|
-
t,
|
|
84
|
-
"invalid_locale",
|
|
85
|
-
`${t} must be a base BCP 47 locale without extensions`
|
|
86
|
-
)
|
|
87
|
-
};
|
|
88
|
-
const r = Intl.DateTimeFormat.supportedLocalesOf([s]).length === 1, i = Intl.NumberFormat.supportedLocalesOf([s]).length === 1;
|
|
89
|
-
return !r || !i ? {
|
|
90
|
-
ok: !1,
|
|
91
|
-
issue: n(
|
|
92
|
-
t,
|
|
93
|
-
"unsupported_locale",
|
|
94
|
-
`${t} is not supported by this runtime`
|
|
95
|
-
)
|
|
96
|
-
} : { ok: !0, value: s };
|
|
97
|
-
}
|
|
98
|
-
function J(e) {
|
|
99
|
-
const t = E(e, "locale");
|
|
100
|
-
return t.ok ? t.value : void 0;
|
|
101
|
-
}
|
|
102
|
-
function L() {
|
|
103
|
-
if (_)
|
|
104
|
-
return _;
|
|
105
|
-
const e = Intl.supportedValuesOf;
|
|
106
|
-
if (typeof e != "function")
|
|
107
|
-
throw new Error(
|
|
108
|
-
'This runtime does not support Intl.supportedValuesOf("currency")'
|
|
109
|
-
);
|
|
110
|
-
return _ = new Set(e.call(Intl, "currency")), _;
|
|
111
|
-
}
|
|
112
|
-
function Q() {
|
|
113
|
-
return h || (h = Object.freeze(
|
|
114
|
-
[...L()].sort(
|
|
115
|
-
(e, t) => e.localeCompare(t)
|
|
116
|
-
)
|
|
117
|
-
)), h;
|
|
118
|
-
}
|
|
119
|
-
function Y(e) {
|
|
120
|
-
if (typeof e != "string")
|
|
121
|
-
return;
|
|
122
|
-
const t = e.trim().toUpperCase();
|
|
123
|
-
return L().has(t) ? t : void 0;
|
|
124
|
-
}
|
|
125
|
-
function A(e, t) {
|
|
126
|
-
if (typeof e != "string")
|
|
127
|
-
return {
|
|
128
|
-
ok: !1,
|
|
129
|
-
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
130
|
-
};
|
|
131
|
-
const a = Y(e);
|
|
132
|
-
return a ? { ok: !0, value: a } : {
|
|
133
|
-
ok: !1,
|
|
134
|
-
issue: n(
|
|
135
|
-
t,
|
|
136
|
-
"invalid_currency",
|
|
137
|
-
`${t} must be a supported ISO 4217 currency code`
|
|
138
|
-
)
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function S(e, t) {
|
|
142
|
-
return typeof e != "string" ? {
|
|
143
|
-
ok: !1,
|
|
144
|
-
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
145
|
-
} : N.includes(e) ? { ok: !0, value: e } : {
|
|
146
|
-
ok: !1,
|
|
147
|
-
issue: n(
|
|
148
|
-
t,
|
|
149
|
-
"invalid_style",
|
|
150
|
-
`${t} must be short, medium, or long`
|
|
151
|
-
)
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function m(e, t, a = "") {
|
|
155
|
-
const s = new Set(t);
|
|
156
|
-
return Object.keys(e).filter((r) => !s.has(r)).sort().map((r) => {
|
|
157
|
-
const i = a ? `${a}.${r}` : r;
|
|
158
|
-
return n(
|
|
159
|
-
i,
|
|
160
|
-
"unknown_property",
|
|
161
|
-
`${i} is not a recognized preference property`
|
|
162
|
-
);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
function O(e) {
|
|
166
|
-
if (!f(e))
|
|
167
|
-
return {
|
|
168
|
-
ok: !1,
|
|
169
|
-
issues: [
|
|
170
|
-
n(
|
|
171
|
-
"$",
|
|
172
|
-
"invalid_type",
|
|
173
|
-
"Value format preferences must be a plain object"
|
|
174
|
-
)
|
|
175
|
-
]
|
|
176
|
-
};
|
|
177
|
-
const t = m(e, I), a = {};
|
|
178
|
-
if (u(e, "locale")) {
|
|
179
|
-
const s = E(e.locale, "locale");
|
|
180
|
-
s.ok ? a.locale = s.value : t.push(s.issue);
|
|
181
|
-
}
|
|
182
|
-
if (u(e, "dateStyle")) {
|
|
183
|
-
const s = S(e.dateStyle, "dateStyle");
|
|
184
|
-
s.ok ? a.dateStyle = s.value : t.push(s.issue);
|
|
185
|
-
}
|
|
186
|
-
if (u(e, "dateTime"))
|
|
187
|
-
if (!f(e.dateTime))
|
|
188
|
-
t.push(
|
|
189
|
-
n(
|
|
190
|
-
"dateTime",
|
|
191
|
-
"invalid_type",
|
|
192
|
-
"dateTime must be a plain object"
|
|
193
|
-
)
|
|
194
|
-
);
|
|
195
|
-
else {
|
|
196
|
-
t.push(
|
|
197
|
-
...m(e.dateTime, C, "dateTime")
|
|
198
|
-
);
|
|
199
|
-
const s = {};
|
|
200
|
-
if (u(e.dateTime, "dateStyle")) {
|
|
201
|
-
const r = S(
|
|
202
|
-
e.dateTime.dateStyle,
|
|
203
|
-
"dateTime.dateStyle"
|
|
204
|
-
);
|
|
205
|
-
r.ok ? s.dateStyle = r.value : t.push(r.issue);
|
|
206
|
-
}
|
|
207
|
-
if (u(e.dateTime, "timeStyle")) {
|
|
208
|
-
const r = S(
|
|
209
|
-
e.dateTime.timeStyle,
|
|
210
|
-
"dateTime.timeStyle"
|
|
211
|
-
);
|
|
212
|
-
r.ok ? s.timeStyle = r.value : t.push(r.issue);
|
|
213
|
-
}
|
|
214
|
-
Object.keys(s).length > 0 && (a.dateTime = s);
|
|
215
|
-
}
|
|
216
|
-
if (u(e, "defaultCurrency")) {
|
|
217
|
-
const s = A(e.defaultCurrency, "defaultCurrency");
|
|
218
|
-
s.ok ? a.defaultCurrency = s.value : t.push(s.issue);
|
|
219
|
-
}
|
|
220
|
-
return t.length > 0 ? { ok: !1, issues: t } : { ok: !0, value: a };
|
|
221
|
-
}
|
|
222
|
-
function $(e, t) {
|
|
223
|
-
var r;
|
|
224
|
-
const a = O(e);
|
|
225
|
-
if (!a.ok)
|
|
226
|
-
return {
|
|
227
|
-
ok: !1,
|
|
228
|
-
issues: a.issues.map((i) => ({
|
|
229
|
-
...i,
|
|
230
|
-
path: i.path === "$" ? t : `${t}.${i.path}`
|
|
231
|
-
}))
|
|
232
|
-
};
|
|
233
|
-
const s = a.value;
|
|
234
|
-
return !s.locale || !s.dateStyle || !((r = s.dateTime) != null && r.dateStyle) || !s.dateTime.timeStyle || !s.defaultCurrency ? {
|
|
235
|
-
ok: !1,
|
|
236
|
-
issues: [
|
|
237
|
-
n(
|
|
238
|
-
t,
|
|
239
|
-
"invalid_type",
|
|
240
|
-
`${t} must contain every resolved preference`
|
|
241
|
-
)
|
|
242
|
-
]
|
|
243
|
-
} : {
|
|
244
|
-
ok: !0,
|
|
245
|
-
value: {
|
|
246
|
-
locale: s.locale,
|
|
247
|
-
dateStyle: s.dateStyle,
|
|
248
|
-
dateTime: s.dateTime,
|
|
249
|
-
defaultCurrency: s.defaultCurrency
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function P(e, t) {
|
|
254
|
-
if (!f(e))
|
|
255
|
-
return {
|
|
256
|
-
ok: !1,
|
|
257
|
-
issues: [
|
|
258
|
-
n(
|
|
259
|
-
t,
|
|
260
|
-
"invalid_type",
|
|
261
|
-
`${t} must contain a valid source for every preference`
|
|
262
|
-
)
|
|
263
|
-
]
|
|
264
|
-
};
|
|
265
|
-
const a = m(e, V, t);
|
|
266
|
-
f(e.dateTime) ? a.push(
|
|
267
|
-
...m(
|
|
268
|
-
e.dateTime,
|
|
269
|
-
C,
|
|
270
|
-
`${t}.dateTime`
|
|
271
|
-
)
|
|
272
|
-
) : a.push(
|
|
273
|
-
n(
|
|
274
|
-
`${t}.dateTime`,
|
|
275
|
-
"invalid_type",
|
|
276
|
-
`${t}.dateTime must contain valid date and time sources`
|
|
277
|
-
)
|
|
278
|
-
);
|
|
279
|
-
const s = f(e.dateTime) ? e.dateTime : void 0, r = T(e.locale) ? e.locale : void 0, i = T(e.dateStyle) ? e.dateStyle : void 0, o = T(s == null ? void 0 : s.dateStyle) ? s.dateStyle : void 0, l = T(s == null ? void 0 : s.timeStyle) ? s.timeStyle : void 0, d = T(e.defaultCurrency) ? e.defaultCurrency : void 0;
|
|
280
|
-
return (!r || !i || !o || !l || !d) && a.push(
|
|
281
|
-
n(
|
|
282
|
-
t,
|
|
283
|
-
"invalid_type",
|
|
284
|
-
`${t} must contain a valid source for every preference`
|
|
285
|
-
)
|
|
286
|
-
), a.length > 0 || !s || !r || !i || !o || !l || !d ? { ok: !1, issues: a } : {
|
|
287
|
-
ok: !0,
|
|
288
|
-
value: {
|
|
289
|
-
locale: r,
|
|
290
|
-
dateStyle: i,
|
|
291
|
-
dateTime: {
|
|
292
|
-
dateStyle: o,
|
|
293
|
-
timeStyle: l
|
|
294
|
-
},
|
|
295
|
-
defaultCurrency: d
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
const K = /* @__PURE__ */ new Set([
|
|
300
|
-
"viewer_user",
|
|
301
|
-
"viewer_tenant_user",
|
|
302
|
-
"viewer_tenant",
|
|
303
|
-
"viewer_organization"
|
|
304
|
-
]), M = new Set(g);
|
|
305
|
-
function x(e) {
|
|
306
|
-
if (!Array.isArray(e))
|
|
307
|
-
return {
|
|
308
|
-
ok: !1,
|
|
309
|
-
issues: [
|
|
310
|
-
n(
|
|
311
|
-
"diagnostics",
|
|
312
|
-
"invalid_type",
|
|
313
|
-
"diagnostics must be an array"
|
|
314
|
-
)
|
|
315
|
-
]
|
|
316
|
-
};
|
|
317
|
-
const t = [], a = [];
|
|
318
|
-
return e.forEach((s, r) => {
|
|
319
|
-
const i = f(s) ? m(
|
|
320
|
-
s,
|
|
321
|
-
z,
|
|
322
|
-
`diagnostics.${r}`
|
|
323
|
-
) : [];
|
|
324
|
-
if (a.push(...i), !f(s) || i.length > 0 || typeof s.scope != "string" || !K.has(s.scope) || s.path !== "$" && !M.has(
|
|
325
|
-
s.path
|
|
326
|
-
) || s.code !== "invalid_stored_preference") {
|
|
327
|
-
a.push(
|
|
328
|
-
n(
|
|
329
|
-
`diagnostics.${r}`,
|
|
330
|
-
"invalid_type",
|
|
331
|
-
"diagnostic entry is invalid"
|
|
332
|
-
)
|
|
333
|
-
);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
t.push(s);
|
|
337
|
-
}), a.length > 0 ? { ok: !1, issues: a } : { ok: !0, value: t };
|
|
338
|
-
}
|
|
339
|
-
function X(e) {
|
|
340
|
-
if (!f(e))
|
|
341
|
-
return {
|
|
342
|
-
ok: !1,
|
|
343
|
-
issues: [
|
|
344
|
-
n(
|
|
345
|
-
"$",
|
|
346
|
-
"invalid_type",
|
|
347
|
-
"Value format preference response must be a plain object"
|
|
348
|
-
)
|
|
349
|
-
]
|
|
350
|
-
};
|
|
351
|
-
const t = m(e, U), a = e.stored === null ? { ok: !0, value: null } : O(e.stored), s = $(e.inherited, "inherited"), r = $(e.resolved, "resolved"), i = P(
|
|
352
|
-
e.inheritedSources,
|
|
353
|
-
"inheritedSources"
|
|
354
|
-
), o = P(e.sources, "sources"), l = x(e.diagnostics), d = [
|
|
355
|
-
...t,
|
|
356
|
-
...a.ok ? [] : a.issues,
|
|
357
|
-
...s.ok ? [] : s.issues,
|
|
358
|
-
...r.ok ? [] : r.issues,
|
|
359
|
-
...i.ok ? [] : i.issues,
|
|
360
|
-
...o.ok ? [] : o.issues,
|
|
361
|
-
...l.ok ? [] : l.issues
|
|
362
|
-
];
|
|
363
|
-
return d.length > 0 || !a.ok || !s.ok || !r.ok || !i.ok || !o.ok || !l.ok ? { ok: !1, issues: d } : {
|
|
364
|
-
ok: !0,
|
|
365
|
-
value: {
|
|
366
|
-
stored: a.value,
|
|
367
|
-
inherited: s.value,
|
|
368
|
-
inheritedSources: i.value,
|
|
369
|
-
resolved: r.value,
|
|
370
|
-
sources: o.value,
|
|
371
|
-
diagnostics: l.value
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
function k(e) {
|
|
376
|
-
var a, s;
|
|
377
|
-
const t = /* @__PURE__ */ new Set();
|
|
378
|
-
return e.locale !== void 0 && t.add("locale"), e.dateStyle !== void 0 && t.add("dateStyle"), ((a = e.dateTime) == null ? void 0 : a.dateStyle) !== void 0 && t.add("dateTime.dateStyle"), ((s = e.dateTime) == null ? void 0 : s.timeStyle) !== void 0 && t.add("dateTime.timeStyle"), e.defaultCurrency !== void 0 && t.add("defaultCurrency"), t;
|
|
379
|
-
}
|
|
380
|
-
function B(e, t) {
|
|
381
|
-
return {
|
|
382
|
-
...e,
|
|
383
|
-
...t.locale !== void 0 ? { locale: t.locale } : {},
|
|
384
|
-
...t.dateStyle !== void 0 ? { dateStyle: t.dateStyle } : {},
|
|
385
|
-
...t.dateTime ? {
|
|
386
|
-
dateTime: {
|
|
387
|
-
...e.dateTime,
|
|
388
|
-
...t.dateTime
|
|
389
|
-
}
|
|
390
|
-
} : {},
|
|
391
|
-
...t.defaultCurrency !== void 0 ? { defaultCurrency: t.defaultCurrency } : {}
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
function G(e, t) {
|
|
395
|
-
var s, r;
|
|
396
|
-
const a = {
|
|
397
|
-
...e,
|
|
398
|
-
...e.dateTime ? { dateTime: { ...e.dateTime } } : {}
|
|
399
|
-
};
|
|
400
|
-
for (const i of t)
|
|
401
|
-
i === "locale" && delete a.locale, i === "dateStyle" && delete a.dateStyle, i === "dateTime.dateStyle" && ((s = a.dateTime) == null || delete s.dateStyle), i === "dateTime.timeStyle" && ((r = a.dateTime) == null || delete r.timeStyle), i === "defaultCurrency" && delete a.defaultCurrency;
|
|
402
|
-
return a.dateTime && Object.keys(a.dateTime).length === 0 && delete a.dateTime, a;
|
|
403
|
-
}
|
|
404
|
-
function H(e) {
|
|
405
|
-
if (e === void 0) return { paths: [], issues: [] };
|
|
406
|
-
if (!Array.isArray(e))
|
|
407
|
-
return {
|
|
408
|
-
paths: [],
|
|
409
|
-
issues: [
|
|
410
|
-
n("clear", "invalid_type", "clear must be an array")
|
|
411
|
-
]
|
|
412
|
-
};
|
|
413
|
-
const t = [], a = [], s = /* @__PURE__ */ new Set();
|
|
414
|
-
return e.forEach((r, i) => {
|
|
415
|
-
if (typeof r != "string" || !g.includes(r)) {
|
|
416
|
-
a.push(
|
|
417
|
-
n(
|
|
418
|
-
`clear.${i}`,
|
|
419
|
-
typeof r == "string" ? "unknown_property" : "invalid_type",
|
|
420
|
-
`clear.${i} must be a recognized preference path`
|
|
421
|
-
)
|
|
422
|
-
);
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
const o = r;
|
|
426
|
-
if (s.has(o)) {
|
|
427
|
-
a.push(
|
|
428
|
-
n(
|
|
429
|
-
o,
|
|
430
|
-
"duplicate_clear_path",
|
|
431
|
-
`${o} appears more than once in clear`
|
|
432
|
-
)
|
|
433
|
-
);
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
s.add(o), t.push(o);
|
|
437
|
-
}), { paths: t, issues: a };
|
|
438
|
-
}
|
|
439
|
-
function Z(e, t) {
|
|
440
|
-
if (!f(t))
|
|
441
|
-
return {
|
|
442
|
-
ok: !1,
|
|
443
|
-
issues: [
|
|
444
|
-
n(
|
|
445
|
-
"$",
|
|
446
|
-
"invalid_type",
|
|
447
|
-
"Preference mutation must be a plain object"
|
|
448
|
-
)
|
|
449
|
-
]
|
|
450
|
-
};
|
|
451
|
-
const a = m(t, ["set", "clear"]);
|
|
452
|
-
let s = {};
|
|
453
|
-
if (t.set !== void 0) {
|
|
454
|
-
const d = O(t.set);
|
|
455
|
-
d.ok ? s = d.value : a.push(...d.issues);
|
|
456
|
-
}
|
|
457
|
-
const r = H(t.clear);
|
|
458
|
-
a.push(...r.issues);
|
|
459
|
-
const i = k(s);
|
|
460
|
-
a.length === 0 && i.size === 0 && r.paths.length === 0 && a.push(
|
|
461
|
-
n(
|
|
462
|
-
"$",
|
|
463
|
-
"empty_mutation",
|
|
464
|
-
"Preference mutation must set or clear at least one leaf"
|
|
465
|
-
)
|
|
466
|
-
);
|
|
467
|
-
for (const d of r.paths)
|
|
468
|
-
i.has(d) && a.push(
|
|
469
|
-
n(
|
|
470
|
-
d,
|
|
471
|
-
"conflicting_operation",
|
|
472
|
-
`${d} cannot be set and cleared in the same mutation`
|
|
473
|
-
)
|
|
474
|
-
);
|
|
475
|
-
if (a.length > 0)
|
|
476
|
-
return { ok: !1, issues: a };
|
|
477
|
-
const o = W(e), l = G(B(o ?? {}, s), r.paths);
|
|
478
|
-
return {
|
|
479
|
-
ok: !0,
|
|
480
|
-
value: k(l).size === 0 ? null : l
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
function R(e, t) {
|
|
484
|
-
return { scope: e, path: t, code: "invalid_stored_preference" };
|
|
485
|
-
}
|
|
486
|
-
function w(e, t) {
|
|
487
|
-
if (e == null)
|
|
488
|
-
return { value: null, diagnostics: [] };
|
|
489
|
-
if (!f(e))
|
|
490
|
-
return { value: null, diagnostics: [R(t, "$")] };
|
|
491
|
-
const a = /* @__PURE__ */ new Set();
|
|
492
|
-
Object.keys(e).some((o) => !I.includes(o)) && a.add("$");
|
|
493
|
-
const s = {};
|
|
494
|
-
if (u(e, "locale")) {
|
|
495
|
-
const o = E(e.locale, "locale");
|
|
496
|
-
o.ok ? s.locale = o.value : a.add("locale");
|
|
497
|
-
}
|
|
498
|
-
if (u(e, "dateStyle")) {
|
|
499
|
-
const o = S(e.dateStyle, "dateStyle");
|
|
500
|
-
o.ok ? s.dateStyle = o.value : a.add("dateStyle");
|
|
501
|
-
}
|
|
502
|
-
if (u(e, "dateTime"))
|
|
503
|
-
if (!f(e.dateTime))
|
|
504
|
-
a.add("$");
|
|
505
|
-
else {
|
|
506
|
-
Object.keys(e.dateTime).some(
|
|
507
|
-
(l) => !C.includes(l)
|
|
508
|
-
) && a.add("$");
|
|
509
|
-
const o = {};
|
|
510
|
-
if (u(e.dateTime, "dateStyle")) {
|
|
511
|
-
const l = S(
|
|
512
|
-
e.dateTime.dateStyle,
|
|
513
|
-
"dateTime.dateStyle"
|
|
514
|
-
);
|
|
515
|
-
l.ok ? o.dateStyle = l.value : a.add("dateTime.dateStyle");
|
|
516
|
-
}
|
|
517
|
-
if (u(e.dateTime, "timeStyle")) {
|
|
518
|
-
const l = S(
|
|
519
|
-
e.dateTime.timeStyle,
|
|
520
|
-
"dateTime.timeStyle"
|
|
521
|
-
);
|
|
522
|
-
l.ok ? o.timeStyle = l.value : a.add("dateTime.timeStyle");
|
|
523
|
-
}
|
|
524
|
-
Object.keys(o).length > 0 && (s.dateTime = o);
|
|
525
|
-
}
|
|
526
|
-
if (u(e, "defaultCurrency")) {
|
|
527
|
-
const o = A(e.defaultCurrency, "defaultCurrency");
|
|
528
|
-
o.ok ? s.defaultCurrency = o.value : a.add("defaultCurrency");
|
|
529
|
-
}
|
|
530
|
-
const i = [
|
|
531
|
-
"$",
|
|
532
|
-
...g
|
|
533
|
-
].filter((o) => a.has(o)).map((o) => R(t, o));
|
|
534
|
-
return {
|
|
535
|
-
value: k(s).size === 0 ? null : s,
|
|
536
|
-
diagnostics: i
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
function W(e) {
|
|
540
|
-
return w(e, "viewer_user").value;
|
|
541
|
-
}
|
|
542
|
-
function q(e, t) {
|
|
543
|
-
return w(e, t);
|
|
544
|
-
}
|
|
545
|
-
function p(e, t, a) {
|
|
546
|
-
for (const s of e) {
|
|
547
|
-
if (!s.value) continue;
|
|
548
|
-
const r = t(s.value);
|
|
549
|
-
if (r !== void 0) return { value: r, source: s.source };
|
|
550
|
-
}
|
|
551
|
-
return { value: a, source: "system_default" };
|
|
552
|
-
}
|
|
553
|
-
function ee(e) {
|
|
554
|
-
if (e.user !== void 0 && e.tenantUser !== void 0)
|
|
555
|
-
throw new TypeError(
|
|
556
|
-
"Value format preference resolution cannot include both user and tenantUser"
|
|
557
|
-
);
|
|
558
|
-
const t = [], a = [], s = (c, y, j) => {
|
|
559
|
-
const b = w(c, y);
|
|
560
|
-
t.push({ value: b.value, source: j }), a.push(...b.diagnostics);
|
|
561
|
-
};
|
|
562
|
-
e.user !== void 0 ? s(e.user, "viewer_user", "viewer_user") : e.tenantUser !== void 0 && s(
|
|
563
|
-
e.tenantUser,
|
|
564
|
-
"viewer_tenant_user",
|
|
565
|
-
"viewer_tenant_user"
|
|
566
|
-
), e.sessionInitial && t.push({
|
|
567
|
-
value: e.sessionInitial,
|
|
568
|
-
source: "session_initial"
|
|
569
|
-
}), e.user === void 0 && (e.tenantUser !== void 0 || e.tenant !== void 0) && s(e.tenant, "viewer_tenant", "viewer_tenant"), s(
|
|
570
|
-
e.organization,
|
|
571
|
-
"viewer_organization",
|
|
572
|
-
"viewer_organization"
|
|
573
|
-
);
|
|
574
|
-
const r = p(
|
|
575
|
-
t,
|
|
576
|
-
(c) => c.locale,
|
|
577
|
-
v.locale
|
|
578
|
-
), i = p(
|
|
579
|
-
t,
|
|
580
|
-
(c) => c.dateStyle,
|
|
581
|
-
v.dateStyle
|
|
582
|
-
), o = p(
|
|
583
|
-
t,
|
|
584
|
-
(c) => {
|
|
585
|
-
var y;
|
|
586
|
-
return (y = c.dateTime) == null ? void 0 : y.dateStyle;
|
|
587
|
-
},
|
|
588
|
-
v.dateTime.dateStyle
|
|
589
|
-
), l = p(
|
|
590
|
-
t,
|
|
591
|
-
(c) => {
|
|
592
|
-
var y;
|
|
593
|
-
return (y = c.dateTime) == null ? void 0 : y.timeStyle;
|
|
594
|
-
},
|
|
595
|
-
v.dateTime.timeStyle
|
|
596
|
-
), d = p(
|
|
597
|
-
t,
|
|
598
|
-
(c) => c.defaultCurrency,
|
|
599
|
-
v.defaultCurrency
|
|
600
|
-
);
|
|
601
|
-
return {
|
|
602
|
-
preferences: {
|
|
603
|
-
locale: r.value,
|
|
604
|
-
dateStyle: i.value,
|
|
605
|
-
dateTime: {
|
|
606
|
-
dateStyle: o.value,
|
|
607
|
-
timeStyle: l.value
|
|
608
|
-
},
|
|
609
|
-
defaultCurrency: d.value
|
|
610
|
-
},
|
|
611
|
-
sources: {
|
|
612
|
-
locale: r.source,
|
|
613
|
-
dateStyle: i.source,
|
|
614
|
-
dateTime: {
|
|
615
|
-
dateStyle: o.source,
|
|
616
|
-
timeStyle: l.source
|
|
617
|
-
},
|
|
618
|
-
defaultCurrency: d.source
|
|
619
|
-
},
|
|
620
|
-
diagnostics: a
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
export {
|
|
624
|
-
v as DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES,
|
|
625
|
-
F as REPORT_PREFERENCE_SOURCES,
|
|
626
|
-
Z as applyValueFormatPreferenceMutation,
|
|
627
|
-
Y as canonicalizeSupportedCurrencyCode,
|
|
628
|
-
J as canonicalizeSupportedLocale,
|
|
629
|
-
q as decodeStoredValueFormatPreferences,
|
|
630
|
-
Q as getSupportedCurrencyCodes,
|
|
631
|
-
T as isReportPreferenceSource,
|
|
632
|
-
O as parseValueFormatPreferences,
|
|
633
|
-
X as parseValueFormatPreferencesResponse,
|
|
634
|
-
ee as resolveValueFormatPreferences
|
|
635
|
-
};
|
|
1
|
+
const v={locale:"en-US",dateStyle:"short",dateTime:{dateStyle:"short",timeStyle:"short"},defaultCurrency:"USD"},F=["viewer_user","viewer_tenant_user","session_initial","viewer_tenant","viewer_organization","system_default"],D=new Set(F);function T(e){return typeof e=="string"&&D.has(e);}const I=["locale","dateStyle","dateTime","defaultCurrency"],C=["dateStyle","timeStyle"],U=["stored","inherited","inheritedSources","resolved","sources","diagnostics"],V=["locale","dateStyle","dateTime","defaultCurrency"],z=["scope","path","code"],g=["locale","dateStyle","dateTime.dateStyle","dateTime.timeStyle","defaultCurrency"],N=["short","medium","long"];let _,h;function f(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null;}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t);}function n(e,t,a){return{path:e,code:t,message:a};}function E(e,t){if(typeof e!="string")return{ok:!1,issue:n(t,"invalid_type",`${t} must be a string`)};const a=e.trim();let s;try{s=Intl.getCanonicalLocales(a)[0]??"";}catch{return{ok:!1,issue:n(t,"invalid_locale",`${t} must be a valid BCP 47 locale`)};}if(!s||new Intl.Locale(s).baseName!==s)return{ok:!1,issue:n(t,"invalid_locale",`${t} must be a base BCP 47 locale without extensions`)};const r=Intl.DateTimeFormat.supportedLocalesOf([s]).length===1,i=Intl.NumberFormat.supportedLocalesOf([s]).length===1;return!r||!i?{ok:!1,issue:n(t,"unsupported_locale",`${t} is not supported by this runtime`)}:{ok:!0,value:s};}function J(e){const t=E(e,"locale");return t.ok?t.value:void 0;}function L(){if(_)return _;const e=Intl.supportedValuesOf;if(typeof e!="function")throw new Error('This runtime does not support Intl.supportedValuesOf("currency")');return _=new Set(e.call(Intl,"currency")),_;}function Q(){return h||(h=Object.freeze([...L()].sort((e,t)=>e.localeCompare(t)))),h;}function Y(e){if(typeof e!="string")return;const t=e.trim().toUpperCase();return L().has(t)?t:void 0;}function A(e,t){if(typeof e!="string")return{ok:!1,issue:n(t,"invalid_type",`${t} must be a string`)};const a=Y(e);return a?{ok:!0,value:a}:{ok:!1,issue:n(t,"invalid_currency",`${t} must be a supported ISO 4217 currency code`)};}function S(e,t){return typeof e!="string"?{ok:!1,issue:n(t,"invalid_type",`${t} must be a string`)}:N.includes(e)?{ok:!0,value:e}:{ok:!1,issue:n(t,"invalid_style",`${t} must be short, medium, or long`)};}function m(e,t,a=""){const s=new Set(t);return Object.keys(e).filter(r=>!s.has(r)).sort().map(r=>{const i=a?`${a}.${r}`:r;return n(i,"unknown_property",`${i} is not a recognized preference property`);});}function O(e){if(!f(e))return{ok:!1,issues:[n("$","invalid_type","Value format preferences must be a plain object")]};const t=m(e,I),a={};if(u(e,"locale")){const s=E(e.locale,"locale");s.ok?a.locale=s.value:t.push(s.issue);}if(u(e,"dateStyle")){const s=S(e.dateStyle,"dateStyle");s.ok?a.dateStyle=s.value:t.push(s.issue);}if(u(e,"dateTime"))if(!f(e.dateTime))t.push(n("dateTime","invalid_type","dateTime must be a plain object"));else{t.push(...m(e.dateTime,C,"dateTime"));const s={};if(u(e.dateTime,"dateStyle")){const r=S(e.dateTime.dateStyle,"dateTime.dateStyle");r.ok?s.dateStyle=r.value:t.push(r.issue);}if(u(e.dateTime,"timeStyle")){const r=S(e.dateTime.timeStyle,"dateTime.timeStyle");r.ok?s.timeStyle=r.value:t.push(r.issue);}Object.keys(s).length>0&&(a.dateTime=s);}if(u(e,"defaultCurrency")){const s=A(e.defaultCurrency,"defaultCurrency");s.ok?a.defaultCurrency=s.value:t.push(s.issue);}return t.length>0?{ok:!1,issues:t}:{ok:!0,value:a};}function $(e,t){var r;const a=O(e);if(!a.ok)return{ok:!1,issues:a.issues.map(i=>({...i,path:i.path==="$"?t:`${t}.${i.path}`}))};const s=a.value;return!s.locale||!s.dateStyle||!((r=s.dateTime)!=null&&r.dateStyle)||!s.dateTime.timeStyle||!s.defaultCurrency?{ok:!1,issues:[n(t,"invalid_type",`${t} must contain every resolved preference`)]}:{ok:!0,value:{locale:s.locale,dateStyle:s.dateStyle,dateTime:s.dateTime,defaultCurrency:s.defaultCurrency}};}function P(e,t){if(!f(e))return{ok:!1,issues:[n(t,"invalid_type",`${t} must contain a valid source for every preference`)]};const a=m(e,V,t);f(e.dateTime)?a.push(...m(e.dateTime,C,`${t}.dateTime`)):a.push(n(`${t}.dateTime`,"invalid_type",`${t}.dateTime must contain valid date and time sources`));const s=f(e.dateTime)?e.dateTime:void 0,r=T(e.locale)?e.locale:void 0,i=T(e.dateStyle)?e.dateStyle:void 0,o=T(s==null?void 0:s.dateStyle)?s.dateStyle:void 0,l=T(s==null?void 0:s.timeStyle)?s.timeStyle:void 0,d=T(e.defaultCurrency)?e.defaultCurrency:void 0;return(!r||!i||!o||!l||!d)&&a.push(n(t,"invalid_type",`${t} must contain a valid source for every preference`)),a.length>0||!s||!r||!i||!o||!l||!d?{ok:!1,issues:a}:{ok:!0,value:{locale:r,dateStyle:i,dateTime:{dateStyle:o,timeStyle:l},defaultCurrency:d}};}const K=/* @__PURE__ */new Set(["viewer_user","viewer_tenant_user","viewer_tenant","viewer_organization"]),M=new Set(g);function x(e){if(!Array.isArray(e))return{ok:!1,issues:[n("diagnostics","invalid_type","diagnostics must be an array")]};const t=[],a=[];return e.forEach((s,r)=>{const i=f(s)?m(s,z,`diagnostics.${r}`):[];if(a.push(...i),!f(s)||i.length>0||typeof s.scope!="string"||!K.has(s.scope)||s.path!=="$"&&!M.has(s.path)||s.code!=="invalid_stored_preference"){a.push(n(`diagnostics.${r}`,"invalid_type","diagnostic entry is invalid"));return;}t.push(s);}),a.length>0?{ok:!1,issues:a}:{ok:!0,value:t};}function X(e){if(!f(e))return{ok:!1,issues:[n("$","invalid_type","Value format preference response must be a plain object")]};const t=m(e,U),a=e.stored===null?{ok:!0,value:null}:O(e.stored),s=$(e.inherited,"inherited"),r=$(e.resolved,"resolved"),i=P(e.inheritedSources,"inheritedSources"),o=P(e.sources,"sources"),l=x(e.diagnostics),d=[...t,...(a.ok?[]:a.issues),...(s.ok?[]:s.issues),...(r.ok?[]:r.issues),...(i.ok?[]:i.issues),...(o.ok?[]:o.issues),...(l.ok?[]:l.issues)];return d.length>0||!a.ok||!s.ok||!r.ok||!i.ok||!o.ok||!l.ok?{ok:!1,issues:d}:{ok:!0,value:{stored:a.value,inherited:s.value,inheritedSources:i.value,resolved:r.value,sources:o.value,diagnostics:l.value}};}function k(e){var a,s;const t=/* @__PURE__ */new Set();return e.locale!==void 0&&t.add("locale"),e.dateStyle!==void 0&&t.add("dateStyle"),((a=e.dateTime)==null?void 0:a.dateStyle)!==void 0&&t.add("dateTime.dateStyle"),((s=e.dateTime)==null?void 0:s.timeStyle)!==void 0&&t.add("dateTime.timeStyle"),e.defaultCurrency!==void 0&&t.add("defaultCurrency"),t;}function B(e,t){return{...e,...(t.locale!==void 0?{locale:t.locale}:{}),...(t.dateStyle!==void 0?{dateStyle:t.dateStyle}:{}),...(t.dateTime?{dateTime:{...e.dateTime,...t.dateTime}}:{}),...(t.defaultCurrency!==void 0?{defaultCurrency:t.defaultCurrency}:{})};}function G(e,t){var s,r;const a={...e,...(e.dateTime?{dateTime:{...e.dateTime}}:{})};for(const i of t)i==="locale"&&delete a.locale,i==="dateStyle"&&delete a.dateStyle,i==="dateTime.dateStyle"&&((s=a.dateTime)==null||delete s.dateStyle),i==="dateTime.timeStyle"&&((r=a.dateTime)==null||delete r.timeStyle),i==="defaultCurrency"&&delete a.defaultCurrency;return a.dateTime&&Object.keys(a.dateTime).length===0&&delete a.dateTime,a;}function H(e){if(e===void 0)return{paths:[],issues:[]};if(!Array.isArray(e))return{paths:[],issues:[n("clear","invalid_type","clear must be an array")]};const t=[],a=[],s=/* @__PURE__ */new Set();return e.forEach((r,i)=>{if(typeof r!="string"||!g.includes(r)){a.push(n(`clear.${i}`,typeof r=="string"?"unknown_property":"invalid_type",`clear.${i} must be a recognized preference path`));return;}const o=r;if(s.has(o)){a.push(n(o,"duplicate_clear_path",`${o} appears more than once in clear`));return;}s.add(o),t.push(o);}),{paths:t,issues:a};}function Z(e,t){if(!f(t))return{ok:!1,issues:[n("$","invalid_type","Preference mutation must be a plain object")]};const a=m(t,["set","clear"]);let s={};if(t.set!==void 0){const d=O(t.set);d.ok?s=d.value:a.push(...d.issues);}const r=H(t.clear);a.push(...r.issues);const i=k(s);a.length===0&&i.size===0&&r.paths.length===0&&a.push(n("$","empty_mutation","Preference mutation must set or clear at least one leaf"));for(const d of r.paths)i.has(d)&&a.push(n(d,"conflicting_operation",`${d} cannot be set and cleared in the same mutation`));if(a.length>0)return{ok:!1,issues:a};const o=W(e),l=G(B(o??{},s),r.paths);return{ok:!0,value:k(l).size===0?null:l};}function R(e,t){return{scope:e,path:t,code:"invalid_stored_preference"};}function w(e,t){if(e==null)return{value:null,diagnostics:[]};if(!f(e))return{value:null,diagnostics:[R(t,"$")]};const a=/* @__PURE__ */new Set();Object.keys(e).some(o=>!I.includes(o))&&a.add("$");const s={};if(u(e,"locale")){const o=E(e.locale,"locale");o.ok?s.locale=o.value:a.add("locale");}if(u(e,"dateStyle")){const o=S(e.dateStyle,"dateStyle");o.ok?s.dateStyle=o.value:a.add("dateStyle");}if(u(e,"dateTime"))if(!f(e.dateTime))a.add("$");else{Object.keys(e.dateTime).some(l=>!C.includes(l))&&a.add("$");const o={};if(u(e.dateTime,"dateStyle")){const l=S(e.dateTime.dateStyle,"dateTime.dateStyle");l.ok?o.dateStyle=l.value:a.add("dateTime.dateStyle");}if(u(e.dateTime,"timeStyle")){const l=S(e.dateTime.timeStyle,"dateTime.timeStyle");l.ok?o.timeStyle=l.value:a.add("dateTime.timeStyle");}Object.keys(o).length>0&&(s.dateTime=o);}if(u(e,"defaultCurrency")){const o=A(e.defaultCurrency,"defaultCurrency");o.ok?s.defaultCurrency=o.value:a.add("defaultCurrency");}const i=["$",...g].filter(o=>a.has(o)).map(o=>R(t,o));return{value:k(s).size===0?null:s,diagnostics:i};}function W(e){return w(e,"viewer_user").value;}function q(e,t){return w(e,t);}function p(e,t,a){for(const s of e){if(!s.value)continue;const r=t(s.value);if(r!==void 0)return{value:r,source:s.source};}return{value:a,source:"system_default"};}function ee(e){if(e.user!==void 0&&e.tenantUser!==void 0)throw new TypeError("Value format preference resolution cannot include both user and tenantUser");const t=[],a=[],s=(c,y,j)=>{const b=w(c,y);t.push({value:b.value,source:j}),a.push(...b.diagnostics);};e.user!==void 0?s(e.user,"viewer_user","viewer_user"):e.tenantUser!==void 0&&s(e.tenantUser,"viewer_tenant_user","viewer_tenant_user"),e.sessionInitial&&t.push({value:e.sessionInitial,source:"session_initial"}),e.user===void 0&&(e.tenantUser!==void 0||e.tenant!==void 0)&&s(e.tenant,"viewer_tenant","viewer_tenant"),s(e.organization,"viewer_organization","viewer_organization");const r=p(t,c=>c.locale,v.locale),i=p(t,c=>c.dateStyle,v.dateStyle),o=p(t,c=>{var y;return(y=c.dateTime)==null?void 0:y.dateStyle;},v.dateTime.dateStyle),l=p(t,c=>{var y;return(y=c.dateTime)==null?void 0:y.timeStyle;},v.dateTime.timeStyle),d=p(t,c=>c.defaultCurrency,v.defaultCurrency);return{preferences:{locale:r.value,dateStyle:i.value,dateTime:{dateStyle:o.value,timeStyle:l.value},defaultCurrency:d.value},sources:{locale:r.source,dateStyle:i.source,dateTime:{dateStyle:o.source,timeStyle:l.source},defaultCurrency:d.source},diagnostics:a};}export{v as DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES,F as REPORT_PREFERENCE_SOURCES,Z as applyValueFormatPreferenceMutation,Y as canonicalizeSupportedCurrencyCode,J as canonicalizeSupportedLocale,q as decodeStoredValueFormatPreferences,Q as getSupportedCurrencyCodes,T as isReportPreferenceSource,O as parseValueFormatPreferences,X as parseValueFormatPreferencesResponse,ee as resolveValueFormatPreferences};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.604",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"build": "node scripts/build.mjs",
|
|
118
118
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
119
119
|
"lint:regressions": "node scripts/lint-regressions.mjs",
|
|
120
|
-
"check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs",
|
|
120
|
+
"check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs && node scripts/comparison-words.mjs",
|
|
121
121
|
"preview": "vite preview",
|
|
122
122
|
"test": "vitest run",
|
|
123
123
|
"test:changed": "vitest run --changed",
|
|
@@ -222,6 +222,7 @@
|
|
|
222
222
|
"sonner": "^1.5.0",
|
|
223
223
|
"tailwind-merge": "^2.1.0",
|
|
224
224
|
"tailwindcss-animate": "^1.0.7",
|
|
225
|
+
"temporal-polyfill": "1.0.8",
|
|
225
226
|
"uuid": "^9.0.1",
|
|
226
227
|
"zod": "^3.25.76",
|
|
227
228
|
"zustand": "^5.0.9"
|
|
@@ -244,10 +245,13 @@
|
|
|
244
245
|
"react-is": "19.3.0"
|
|
245
246
|
},
|
|
246
247
|
"devDependencies": {
|
|
248
|
+
"@babel/generator": "^7.28.5",
|
|
249
|
+
"@babel/parser": "^7.28.5",
|
|
247
250
|
"@tanstack/react-query-devtools": "^5.62.15",
|
|
248
251
|
"@testing-library/jest-dom": "^6.9.1",
|
|
249
252
|
"@testing-library/react": "^16.3.0",
|
|
250
253
|
"@testing-library/user-event": "^14.6.1",
|
|
254
|
+
"@types/babel__generator": "^7.27.0",
|
|
251
255
|
"@types/culori": "^4.0.1",
|
|
252
256
|
"@types/lodash.merge": "^4.6.9",
|
|
253
257
|
"@types/ms": "^0.7.34",
|