react-semaphor 0.1.537 → 0.1.539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.js +352 -341
- package/dist/assistant-context/index.js +10 -0
- package/dist/assistant-protocol/index.js +104 -0
- package/dist/brand-studio/index.js +35 -31
- package/dist/briefings/index.js +46 -45
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
- package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
- package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
- package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
- package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
- package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
- package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
- package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
- package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
- package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
- package/dist/chunks/context-HD9usB1P.js +349 -0
- package/dist/chunks/conversation-sQiWYUOb.js +16 -0
- package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
- package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
- package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
- package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
- package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
- package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
- package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
- package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
- package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
- package/dist/chunks/index-CqMiAkay.js +3164 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
- package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
- package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
- package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
- package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
- package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
- package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
- package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
- package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
- package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
- package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
- package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
- package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
- package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
- package/dist/chunks/save-CfJpQQ68.js +21 -0
- package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
- package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
- package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
- package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
- package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
- package/dist/chunks/switch-CvItuC1Q.js +8199 -0
- package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
- package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
- package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
- package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
- package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
- package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
- package/dist/chunks/x-4f5U2XwU.js +100 -0
- package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +823 -661
- package/dist/data-app-sdk/index.js +32 -30
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +23 -22
- package/dist/format-utils/index.js +173 -168
- package/dist/index.js +267 -258
- package/dist/layouts/index.js +236 -24
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/assistant-context.d.ts +2 -0
- package/dist/types/assistant-protocol.d.ts +2 -0
- package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
- package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
- package/dist/types/components/assistant/assistant-store.d.ts +52 -0
- package/dist/types/components/assistant/use-assistant.d.ts +38 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/surfboard/filter/types.d.ts +5 -2
- package/dist/types/index.js +50 -51
- package/dist/types/lib/api/invalidate-token.d.ts +7 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
- package/dist/types/lib/charts/types.d.ts +7 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
- package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
- package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
- package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
- package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
- package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
- package/dist/types/lib/print/print-inputs.d.ts +4 -2
- package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
- package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
- package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
- package/dist/types/lib/stores/editor-store.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +11 -0
- package/dist/types/lib/utils/card-type-change.d.ts +30 -0
- package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
- package/dist/types/shared/assistant-context/index.d.ts +9 -0
- package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
- package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
- package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
- package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
- package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
- package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
- package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
- package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
- package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
- package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
- package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
- package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
- package/dist/types/shared/format-utils/index.d.ts +3 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
- package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
- package/dist/types/shared/layouts/index.d.ts +1 -0
- package/package.json +12 -2
- package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
- package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
- package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
- package/dist/chunks/constants-DNWVy8Y3.js +0 -9
- package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
- package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
- package/dist/chunks/index-DTcTAGGM.js +0 -4101
- package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
- package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
- package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
- package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
- package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
- package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
- package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
- package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
- package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
- package/dist/chunks/save-kO6cIaob.js +0 -34
- package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
- package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
- package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
- package/dist/chunks/x-CXDkqdur.js +0 -149
- package/dist/types/lib/class-utils.d.ts +0 -2
- package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
- package/dist/types/lib/utils.d.ts +0 -51
|
@@ -0,0 +1,1464 @@
|
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var Me = (e, t, r) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var A = (e, t, r) => Me(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { aK as re, aL as _e } from "./validators-Ej1DdCXa.js";
|
|
5
|
+
import { canonicalizeSupportedLocale as P, canonicalizeSupportedCurrencyCode as k } from "../value-format-preferences/index.js";
|
|
6
|
+
import { g as y, t as ne } from "./temporal-bucket-D8JF7zKz.js";
|
|
7
|
+
import { i as N } from "./analytics-base-schemas-BFAoRlkU.js";
|
|
8
|
+
import { p as Ie } from "./raw-temporal-contract-C51YG48G.js";
|
|
9
|
+
function pe(e) {
|
|
10
|
+
if (!e || typeof e != "object") return !1;
|
|
11
|
+
const t = e.type;
|
|
12
|
+
return t === "number" || t === "currency" || t === "percent" || t === "scientific";
|
|
13
|
+
}
|
|
14
|
+
function Et(e) {
|
|
15
|
+
return pe(e) || !!e && typeof e == "object" && e.type === "duration";
|
|
16
|
+
}
|
|
17
|
+
const ae = [
|
|
18
|
+
"day",
|
|
19
|
+
"hour",
|
|
20
|
+
"minute",
|
|
21
|
+
"second",
|
|
22
|
+
"millisecond"
|
|
23
|
+
], C = {
|
|
24
|
+
day: 864e5,
|
|
25
|
+
hour: 36e5,
|
|
26
|
+
minute: 6e4,
|
|
27
|
+
second: 1e3,
|
|
28
|
+
millisecond: 1
|
|
29
|
+
}, Fe = {
|
|
30
|
+
day: "d",
|
|
31
|
+
hour: "hr",
|
|
32
|
+
minute: "min",
|
|
33
|
+
second: "s",
|
|
34
|
+
millisecond: "ms"
|
|
35
|
+
}, ze = {
|
|
36
|
+
day: ["day", "days"],
|
|
37
|
+
hour: ["hour", "hours"],
|
|
38
|
+
minute: ["minute", "minutes"],
|
|
39
|
+
second: ["second", "seconds"],
|
|
40
|
+
millisecond: ["millisecond", "milliseconds"]
|
|
41
|
+
};
|
|
42
|
+
function $e(e) {
|
|
43
|
+
return e === "day" || e === "hour" || e === "minute" || e === "second" || e === "millisecond";
|
|
44
|
+
}
|
|
45
|
+
function ie(e, t) {
|
|
46
|
+
return $e(e) ? e : t;
|
|
47
|
+
}
|
|
48
|
+
function L(e, t) {
|
|
49
|
+
return ae.indexOf(ie(e, t));
|
|
50
|
+
}
|
|
51
|
+
function ke(e, t) {
|
|
52
|
+
const r = L(e, "day"), n = L(t, "second"), i = Math.min(r, n), a = Math.max(r, n);
|
|
53
|
+
return ae.slice(i, a + 1);
|
|
54
|
+
}
|
|
55
|
+
function Ce(e, t) {
|
|
56
|
+
return e * C[ie(t, "second")];
|
|
57
|
+
}
|
|
58
|
+
function be(e, t) {
|
|
59
|
+
const r = ke(t.largestUnit, t.smallestUnit), n = r[r.length - 1], i = C[n];
|
|
60
|
+
let a = Math.round(e / i) * i;
|
|
61
|
+
return r.map((c) => {
|
|
62
|
+
const s = C[c], u = Math.floor(a / s);
|
|
63
|
+
return a -= u * s, { unit: c, value: u };
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function Ee(e, t) {
|
|
67
|
+
const r = e.filter((a) => a.value !== 0), n = r.length > 0 ? r : [e[e.length - 1]], i = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : n.length;
|
|
68
|
+
return n.slice(0, i).map((a) => `${a.value}${Fe[a.unit]}`).join(" ");
|
|
69
|
+
}
|
|
70
|
+
function Ye(e, t) {
|
|
71
|
+
const r = e.filter((a) => a.value !== 0), n = r.length > 0 ? r : [e[e.length - 1]], i = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : n.length;
|
|
72
|
+
return n.slice(0, i).map((a) => {
|
|
73
|
+
const [c, s] = ze[a.unit];
|
|
74
|
+
return `${a.value} ${a.value === 1 ? c : s}`;
|
|
75
|
+
}).join(" ");
|
|
76
|
+
}
|
|
77
|
+
function Pe(e) {
|
|
78
|
+
const t = e.some(
|
|
79
|
+
(u) => u.unit === "day" && u.value !== 0
|
|
80
|
+
), r = e.some((u) => u.unit === "millisecond"), n = e.findIndex((u) => u.value !== 0), i = Math.max(0, e.length - 2), a = t ? 0 : n === -1 ? i : Math.min(n, i), c = n === -1 ? e.slice(i) : e.slice(a);
|
|
81
|
+
if (c.length === 0)
|
|
82
|
+
return "0";
|
|
83
|
+
const s = c.map((u, o) => u.unit === "millisecond" ? String(u.value).padStart(3, "0") : o === 0 ? String(u.value) : String(u.value).padStart(2, "0")).join(":");
|
|
84
|
+
return r ? s.replace(/:(\d{3})$/, ".$1") : s;
|
|
85
|
+
}
|
|
86
|
+
function Ue(e, t, r) {
|
|
87
|
+
const n = `${r.prefix || ""}${e}${r.suffix || ""}`;
|
|
88
|
+
return t ? r.negativeInParentheses ? `(${n})` : `-${n}` : n;
|
|
89
|
+
}
|
|
90
|
+
function Oe(e, t = {}) {
|
|
91
|
+
if (e == null)
|
|
92
|
+
return "";
|
|
93
|
+
const r = typeof e == "number" ? e : typeof e == "string" && e.trim() ? Number(e) : NaN;
|
|
94
|
+
if (!Number.isFinite(r))
|
|
95
|
+
return "";
|
|
96
|
+
const n = t.inputUnit || "second", i = t.outputStyle === "digital" || t.outputStyle === "long" ? t.outputStyle : "compact", a = r < 0, c = Math.abs(Ce(r, n)), s = be(c, t), u = i === "digital" ? Pe(s) : i === "long" ? Ye(s, t.maxUnits) : Ee(s, t.maxUnits);
|
|
97
|
+
return Ue(u, a, t);
|
|
98
|
+
}
|
|
99
|
+
function ce(e, t) {
|
|
100
|
+
return Oe(
|
|
101
|
+
e !== null && typeof e == "object" ? e.value : e,
|
|
102
|
+
{
|
|
103
|
+
inputUnit: t.inputUnit,
|
|
104
|
+
outputStyle: t.outputStyle,
|
|
105
|
+
largestUnit: t.largestUnit,
|
|
106
|
+
smallestUnit: t.smallestUnit,
|
|
107
|
+
maxUnits: t.maxUnits,
|
|
108
|
+
prefix: t.prefix,
|
|
109
|
+
suffix: t.suffix,
|
|
110
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
let R;
|
|
115
|
+
function H(e, t) {
|
|
116
|
+
const r = e.format;
|
|
117
|
+
return r(t);
|
|
118
|
+
}
|
|
119
|
+
function Ae(e, t) {
|
|
120
|
+
if (R ?? (R = H(
|
|
121
|
+
new Intl.NumberFormat("en-US", { useGrouping: !1, maximumFractionDigits: 6 }),
|
|
122
|
+
"9007199254740993.000009"
|
|
123
|
+
) === "9007199254740993.000009"), !R)
|
|
124
|
+
throw new RangeError("This runtime cannot format exact decimal strings.");
|
|
125
|
+
const r = Number(e);
|
|
126
|
+
if (!Number.isFinite(r) || r === 0 && e !== "0")
|
|
127
|
+
throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");
|
|
128
|
+
return H(t, e);
|
|
129
|
+
}
|
|
130
|
+
function _(e) {
|
|
131
|
+
return typeof e == "number" ? e < 0 : e.value.startsWith("-");
|
|
132
|
+
}
|
|
133
|
+
function v(e) {
|
|
134
|
+
return typeof e == "number" ? Math.abs(e) : _(e) ? { ...e, value: e.value.slice(1) } : e;
|
|
135
|
+
}
|
|
136
|
+
function se(e, t) {
|
|
137
|
+
return typeof e == "number" ? e * t : {
|
|
138
|
+
kind: "exact_number",
|
|
139
|
+
type: "decimal",
|
|
140
|
+
value: re(e.value, t)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function M(e, t) {
|
|
144
|
+
return t === 0 ? e : typeof e == "number" ? e / 10 ** t : {
|
|
145
|
+
kind: "exact_number",
|
|
146
|
+
type: "decimal",
|
|
147
|
+
value: re(e.value, `1e-${t}`)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function D(e, t) {
|
|
151
|
+
return typeof e == "number" ? t.format(e) : Ae(e.value, t);
|
|
152
|
+
}
|
|
153
|
+
function Z(e) {
|
|
154
|
+
if (!e) return !1;
|
|
155
|
+
const t = e.toLowerCase().replace("_", "-");
|
|
156
|
+
return t === "en-in" || t.startsWith("en-in-");
|
|
157
|
+
}
|
|
158
|
+
function K(e, t) {
|
|
159
|
+
const r = v(e), n = (i) => typeof r == "number" ? r >= i : _e(r.value, String(i)) >= 0;
|
|
160
|
+
return n(1e12) ? { power: 12, suffix: "T" } : n(1e9) ? { power: 9, suffix: "B" } : Z(t) && n(1e7) ? { power: 7, suffix: "Cr" } : n(1e6) ? { power: 6, suffix: "M" } : Z(t) && n(1e5) ? { power: 5, suffix: "L" } : n(1e3) ? { power: 3, suffix: "K" } : { power: 0, suffix: "" };
|
|
161
|
+
}
|
|
162
|
+
function b(e, t) {
|
|
163
|
+
try {
|
|
164
|
+
const r = S(t);
|
|
165
|
+
return K(e, r);
|
|
166
|
+
} catch {
|
|
167
|
+
return K(e, "en-US");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function Le(e) {
|
|
171
|
+
try {
|
|
172
|
+
return new Intl.NumberFormat(e), !0;
|
|
173
|
+
} catch {
|
|
174
|
+
return !1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function S(e) {
|
|
178
|
+
return e && Le(e) ? e : "en-US";
|
|
179
|
+
}
|
|
180
|
+
function U(e, t) {
|
|
181
|
+
if (e == null || Number.isNaN(e))
|
|
182
|
+
return "";
|
|
183
|
+
const r = S(t == null ? void 0 : t.locale);
|
|
184
|
+
let n = e;
|
|
185
|
+
if (t != null && t.multiplyBy && (n = se(n, t.multiplyBy)), t != null && t.useSuffix) {
|
|
186
|
+
const { power: a, suffix: c } = b(n, r);
|
|
187
|
+
n = M(n, a);
|
|
188
|
+
const s = D(n, new Intl.NumberFormat(r, {
|
|
189
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
190
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
191
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
192
|
+
}));
|
|
193
|
+
return `${(t == null ? void 0 : t.prefix) ?? ""}${s}${c}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
194
|
+
}
|
|
195
|
+
const i = D(n, new Intl.NumberFormat(r, {
|
|
196
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
197
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
198
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
199
|
+
}));
|
|
200
|
+
if (t != null && t.negativeInParentheses && _(n)) {
|
|
201
|
+
const a = i.replace("-", "");
|
|
202
|
+
return `(${(t == null ? void 0 : t.prefix) ?? ""}${a}${(t == null ? void 0 : t.suffix) ?? ""})`;
|
|
203
|
+
}
|
|
204
|
+
return `${(t == null ? void 0 : t.prefix) ?? ""}${i}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
205
|
+
}
|
|
206
|
+
function ue(e, t) {
|
|
207
|
+
if (e == null || Number.isNaN(e))
|
|
208
|
+
return "";
|
|
209
|
+
const r = S(t == null ? void 0 : t.locale), n = (t == null ? void 0 : t.currency) || "USD", i = _(e), a = !!(t != null && t.negativeInParentheses && i), c = a ? v(e) : e;
|
|
210
|
+
try {
|
|
211
|
+
if (t != null && t.useSuffix) {
|
|
212
|
+
const { power: u, suffix: o } = b(c, r), l = M(c, u), d = `${D(l, new Intl.NumberFormat(r, {
|
|
213
|
+
style: "currency",
|
|
214
|
+
currency: n,
|
|
215
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
216
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
217
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
218
|
+
}))}${o}`;
|
|
219
|
+
return a ? `(${d})` : d;
|
|
220
|
+
}
|
|
221
|
+
const s = D(c, new Intl.NumberFormat(r, {
|
|
222
|
+
style: "currency",
|
|
223
|
+
currency: n,
|
|
224
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
225
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
226
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
227
|
+
}));
|
|
228
|
+
return a ? `(${s})` : s;
|
|
229
|
+
} catch {
|
|
230
|
+
const s = v(e), u = t != null && t.useSuffix ? b(s, r) : { power: 0, suffix: "" }, o = U(
|
|
231
|
+
M(s, u.power),
|
|
232
|
+
{
|
|
233
|
+
locale: r,
|
|
234
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
235
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
236
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
237
|
+
}
|
|
238
|
+
), l = `${n} ${o}${u.suffix}`;
|
|
239
|
+
return i ? t != null && t.negativeInParentheses ? `(${l})` : `-${l}` : l;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function oe(e, t) {
|
|
243
|
+
if (e == null || Number.isNaN(e))
|
|
244
|
+
return "";
|
|
245
|
+
const r = S(t == null ? void 0 : t.locale), i = (t == null ? void 0 : t.alreadyPercent) ?? (t == null ? void 0 : t.percentValueMode) === "whole" ? M(e, 2) : e;
|
|
246
|
+
return D(i, new Intl.NumberFormat(r, {
|
|
247
|
+
style: "percent",
|
|
248
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
249
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
250
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
function le(e, t) {
|
|
254
|
+
if (e == null || Number.isNaN(e))
|
|
255
|
+
return "";
|
|
256
|
+
const r = S(t == null ? void 0 : t.locale);
|
|
257
|
+
return D(e, new Intl.NumberFormat(r, {
|
|
258
|
+
notation: "scientific",
|
|
259
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
260
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
function me(e, t) {
|
|
264
|
+
if (e == null || Number.isNaN(e))
|
|
265
|
+
return "";
|
|
266
|
+
const r = t.scale === void 0 ? e : se(e, t.scale), n = t.negativeStyle === "parentheses" && _(r), i = n ? v(r) : r, a = {
|
|
267
|
+
style: t.type === "number" ? "decimal" : t.type,
|
|
268
|
+
locale: t.locale,
|
|
269
|
+
currency: t.currency,
|
|
270
|
+
minimumFractionDigits: t.minimumFractionDigits,
|
|
271
|
+
maximumFractionDigits: t.maximumFractionDigits,
|
|
272
|
+
useGrouping: t.useGrouping,
|
|
273
|
+
percentValueMode: t.percentValueMode,
|
|
274
|
+
useSuffix: t.compact
|
|
275
|
+
};
|
|
276
|
+
let c;
|
|
277
|
+
switch (t.type) {
|
|
278
|
+
case "currency":
|
|
279
|
+
c = ue(i, a);
|
|
280
|
+
break;
|
|
281
|
+
case "percent":
|
|
282
|
+
c = oe(i, a);
|
|
283
|
+
break;
|
|
284
|
+
case "scientific":
|
|
285
|
+
c = le(i, a);
|
|
286
|
+
break;
|
|
287
|
+
default:
|
|
288
|
+
c = U(i, a);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
const s = `${t.prefix ?? ""}${c}${t.suffix ?? ""}`;
|
|
292
|
+
return n ? `(${s})` : s;
|
|
293
|
+
}
|
|
294
|
+
function Yt(e, t) {
|
|
295
|
+
return t.type === "duration" ? e == null ? "" : ce(e, t) : me(e, t);
|
|
296
|
+
}
|
|
297
|
+
function Pt(e, t, r = "en-US") {
|
|
298
|
+
if (e == null || typeof e == "number" && isNaN(e))
|
|
299
|
+
return "";
|
|
300
|
+
if ((t == null ? void 0 : t.style) === "duration")
|
|
301
|
+
return ce(e, {
|
|
302
|
+
...t.duration,
|
|
303
|
+
prefix: t.prefix,
|
|
304
|
+
suffix: t.suffix,
|
|
305
|
+
negativeStyle: t.negativeStyle
|
|
306
|
+
});
|
|
307
|
+
const n = S((t == null ? void 0 : t.locale) || r), i = (t == null ? void 0 : t.style) || "decimal", a = i === "decimal" ? "number" : i;
|
|
308
|
+
return a === "currency" && new Intl.NumberFormat(n, {
|
|
309
|
+
style: "currency",
|
|
310
|
+
currency: (t == null ? void 0 : t.currency) || "USD"
|
|
311
|
+
}), me(e, {
|
|
312
|
+
type: a,
|
|
313
|
+
locale: n,
|
|
314
|
+
currency: a === "currency" ? (t == null ? void 0 : t.currency) || "USD" : void 0,
|
|
315
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
316
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
317
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0,
|
|
318
|
+
percentValueMode: a === "percent" ? (t == null ? void 0 : t.percentValueMode) ?? "whole" : void 0,
|
|
319
|
+
scale: t == null ? void 0 : t.scale,
|
|
320
|
+
compact: t == null ? void 0 : t.compact,
|
|
321
|
+
negativeStyle: t == null ? void 0 : t.negativeStyle,
|
|
322
|
+
prefix: t == null ? void 0 : t.prefix,
|
|
323
|
+
suffix: t == null ? void 0 : t.suffix
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function Ut(e, t, r) {
|
|
327
|
+
const n = {
|
|
328
|
+
style: t === "currency" ? "currency" : t === "percent" ? "percent" : "decimal",
|
|
329
|
+
locale: r == null ? void 0 : r.locale,
|
|
330
|
+
currency: r == null ? void 0 : r.currency,
|
|
331
|
+
minimumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
332
|
+
maximumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
333
|
+
useSuffix: r == null ? void 0 : r.useSuffix,
|
|
334
|
+
prefix: r == null ? void 0 : r.prefix,
|
|
335
|
+
suffix: r == null ? void 0 : r.suffix,
|
|
336
|
+
negativeInParentheses: r == null ? void 0 : r.negativeInParentheses,
|
|
337
|
+
multiplyBy: r == null ? void 0 : r.multiplyBy
|
|
338
|
+
};
|
|
339
|
+
switch (t) {
|
|
340
|
+
case "currency":
|
|
341
|
+
return ue(e, n);
|
|
342
|
+
case "percent":
|
|
343
|
+
return oe(e, n);
|
|
344
|
+
case "scientific":
|
|
345
|
+
return le(e, n);
|
|
346
|
+
default:
|
|
347
|
+
return U(e, n);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function Re(e, t) {
|
|
351
|
+
const r = Ge(t);
|
|
352
|
+
return "formatToParts" in r ? Ze(r, e) : Ke(r, e);
|
|
353
|
+
}
|
|
354
|
+
const He = {
|
|
355
|
+
year: 0,
|
|
356
|
+
month: 1,
|
|
357
|
+
day: 2,
|
|
358
|
+
hour: 3,
|
|
359
|
+
minute: 4,
|
|
360
|
+
second: 5
|
|
361
|
+
};
|
|
362
|
+
function Ze(e, t) {
|
|
363
|
+
try {
|
|
364
|
+
const r = e.formatToParts(t), n = [];
|
|
365
|
+
for (let i = 0; i < r.length; i++) {
|
|
366
|
+
const a = He[r[i].type];
|
|
367
|
+
a !== void 0 && (n[a] = parseInt(r[i].value, 10));
|
|
368
|
+
}
|
|
369
|
+
return n;
|
|
370
|
+
} catch (r) {
|
|
371
|
+
if (r instanceof RangeError)
|
|
372
|
+
return [NaN];
|
|
373
|
+
throw r;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function Ke(e, t) {
|
|
377
|
+
const r = e.format(t), n = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r);
|
|
378
|
+
return [
|
|
379
|
+
parseInt(n[3], 10),
|
|
380
|
+
parseInt(n[1], 10),
|
|
381
|
+
parseInt(n[2], 10),
|
|
382
|
+
parseInt(n[4], 10),
|
|
383
|
+
parseInt(n[5], 10),
|
|
384
|
+
parseInt(n[6], 10)
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
const I = {}, V = new Intl.DateTimeFormat("en-US", {
|
|
388
|
+
hourCycle: "h23",
|
|
389
|
+
timeZone: "America/New_York",
|
|
390
|
+
year: "numeric",
|
|
391
|
+
month: "2-digit",
|
|
392
|
+
day: "2-digit",
|
|
393
|
+
hour: "2-digit",
|
|
394
|
+
minute: "2-digit",
|
|
395
|
+
second: "2-digit"
|
|
396
|
+
}).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), Ve = V === "06/25/2014, 00:00:00" || V === "06/25/2014 00:00:00";
|
|
397
|
+
function Ge(e) {
|
|
398
|
+
return I[e] || (I[e] = Ve ? new Intl.DateTimeFormat("en-US", {
|
|
399
|
+
hourCycle: "h23",
|
|
400
|
+
timeZone: e,
|
|
401
|
+
year: "numeric",
|
|
402
|
+
month: "numeric",
|
|
403
|
+
day: "2-digit",
|
|
404
|
+
hour: "2-digit",
|
|
405
|
+
minute: "2-digit",
|
|
406
|
+
second: "2-digit"
|
|
407
|
+
}) : new Intl.DateTimeFormat("en-US", {
|
|
408
|
+
hour12: !1,
|
|
409
|
+
timeZone: e,
|
|
410
|
+
year: "numeric",
|
|
411
|
+
month: "numeric",
|
|
412
|
+
day: "2-digit",
|
|
413
|
+
hour: "2-digit",
|
|
414
|
+
minute: "2-digit",
|
|
415
|
+
second: "2-digit"
|
|
416
|
+
})), I[e];
|
|
417
|
+
}
|
|
418
|
+
function O(e, t, r, n, i, a, c) {
|
|
419
|
+
const s = /* @__PURE__ */ new Date(0);
|
|
420
|
+
return s.setUTCFullYear(e, t, r), s.setUTCHours(n, i, a, c), s;
|
|
421
|
+
}
|
|
422
|
+
const G = 36e5, je = 6e4, p = {
|
|
423
|
+
timezoneZ: /^(Z)$/,
|
|
424
|
+
timezoneHH: /^([+-]\d{2})$/,
|
|
425
|
+
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
|
|
426
|
+
};
|
|
427
|
+
function fe(e, t, r) {
|
|
428
|
+
if (!e)
|
|
429
|
+
return 0;
|
|
430
|
+
let n = p.timezoneZ.exec(e);
|
|
431
|
+
if (n)
|
|
432
|
+
return 0;
|
|
433
|
+
let i, a;
|
|
434
|
+
if (n = p.timezoneHH.exec(e), n)
|
|
435
|
+
return i = parseInt(n[1], 10), j(i) ? -(i * G) : NaN;
|
|
436
|
+
if (n = p.timezoneHHMM.exec(e), n) {
|
|
437
|
+
i = parseInt(n[2], 10);
|
|
438
|
+
const c = parseInt(n[3], 10);
|
|
439
|
+
return j(i, c) ? (a = Math.abs(i) * G + c * je, n[1] === "+" ? -a : a) : NaN;
|
|
440
|
+
}
|
|
441
|
+
if (Be(e)) {
|
|
442
|
+
t = new Date(t || Date.now());
|
|
443
|
+
const c = r ? t : We(t), s = E(c, e);
|
|
444
|
+
return -(r ? s : qe(t, s, e));
|
|
445
|
+
}
|
|
446
|
+
return NaN;
|
|
447
|
+
}
|
|
448
|
+
function We(e) {
|
|
449
|
+
return O(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
|
|
450
|
+
}
|
|
451
|
+
function E(e, t) {
|
|
452
|
+
const r = Re(e, t), n = O(r[0], r[1] - 1, r[2], r[3] % 24, r[4], r[5], 0).getTime();
|
|
453
|
+
let i = e.getTime();
|
|
454
|
+
const a = i % 1e3;
|
|
455
|
+
return i -= a >= 0 ? a : 1e3 + a, n - i;
|
|
456
|
+
}
|
|
457
|
+
function qe(e, t, r) {
|
|
458
|
+
let i = e.getTime() - t;
|
|
459
|
+
const a = E(new Date(i), r);
|
|
460
|
+
if (t === a)
|
|
461
|
+
return t;
|
|
462
|
+
i -= a - t;
|
|
463
|
+
const c = E(new Date(i), r);
|
|
464
|
+
return a === c ? a : Math.max(a, c);
|
|
465
|
+
}
|
|
466
|
+
function j(e, t) {
|
|
467
|
+
return -23 <= e && e <= 23 && (t == null || 0 <= t && t <= 59);
|
|
468
|
+
}
|
|
469
|
+
const W = {};
|
|
470
|
+
function Be(e) {
|
|
471
|
+
if (W[e])
|
|
472
|
+
return !0;
|
|
473
|
+
try {
|
|
474
|
+
return new Intl.DateTimeFormat(void 0, { timeZone: e }), W[e] = !0, !0;
|
|
475
|
+
} catch {
|
|
476
|
+
return !1;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function q(e) {
|
|
480
|
+
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
|
|
481
|
+
return t.setUTCFullYear(e.getFullYear()), +e - +t;
|
|
482
|
+
}
|
|
483
|
+
const de = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/, F = 36e5, B = 6e4, Xe = 2, g = {
|
|
484
|
+
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
|
|
485
|
+
datePattern: /^([0-9W+-]+)(.*)/,
|
|
486
|
+
// year tokens
|
|
487
|
+
YY: /^(\d{2})$/,
|
|
488
|
+
YYY: [
|
|
489
|
+
/^([+-]\d{2})$/,
|
|
490
|
+
// 0 additional digits
|
|
491
|
+
/^([+-]\d{3})$/,
|
|
492
|
+
// 1 additional digit
|
|
493
|
+
/^([+-]\d{4})$/
|
|
494
|
+
// 2 additional digits
|
|
495
|
+
],
|
|
496
|
+
YYYY: /^(\d{4})/,
|
|
497
|
+
YYYYY: [
|
|
498
|
+
/^([+-]\d{4})/,
|
|
499
|
+
// 0 additional digits
|
|
500
|
+
/^([+-]\d{5})/,
|
|
501
|
+
// 1 additional digit
|
|
502
|
+
/^([+-]\d{6})/
|
|
503
|
+
// 2 additional digits
|
|
504
|
+
],
|
|
505
|
+
// date tokens
|
|
506
|
+
MM: /^-(\d{2})$/,
|
|
507
|
+
DDD: /^-?(\d{3})$/,
|
|
508
|
+
MMDD: /^-?(\d{2})-?(\d{2})$/,
|
|
509
|
+
Www: /^-?W(\d{2})$/,
|
|
510
|
+
WwwD: /^-?W(\d{2})-?(\d{1})$/,
|
|
511
|
+
HH: /^(\d{2}([.,]\d*)?)$/,
|
|
512
|
+
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
513
|
+
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
514
|
+
// time zone tokens (to identify the presence of a tz)
|
|
515
|
+
timeZone: de
|
|
516
|
+
};
|
|
517
|
+
function X(e, t = {}) {
|
|
518
|
+
if (arguments.length < 1)
|
|
519
|
+
throw new TypeError("1 argument required, but only " + arguments.length + " present");
|
|
520
|
+
if (e === null)
|
|
521
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
522
|
+
const r = t.additionalDigits == null ? Xe : Number(t.additionalDigits);
|
|
523
|
+
if (r !== 2 && r !== 1 && r !== 0)
|
|
524
|
+
throw new RangeError("additionalDigits must be 0, 1 or 2");
|
|
525
|
+
if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
|
|
526
|
+
return new Date(e.getTime());
|
|
527
|
+
if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
|
|
528
|
+
return new Date(e);
|
|
529
|
+
if (Object.prototype.toString.call(e) !== "[object String]")
|
|
530
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
531
|
+
const n = Je(e), { year: i, restDateString: a } = Qe(n.date, r), c = et(a, i);
|
|
532
|
+
if (c === null || isNaN(c.getTime()))
|
|
533
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
534
|
+
if (c) {
|
|
535
|
+
const s = c.getTime();
|
|
536
|
+
let u = 0, o;
|
|
537
|
+
if (n.time && (u = tt(n.time), u === null || isNaN(u)))
|
|
538
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
539
|
+
if (n.timeZone || t.timeZone) {
|
|
540
|
+
if (o = fe(n.timeZone || t.timeZone, new Date(s + u)), isNaN(o))
|
|
541
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
542
|
+
} else
|
|
543
|
+
o = q(new Date(s + u)), o = q(new Date(s + u + o));
|
|
544
|
+
return new Date(s + u + o);
|
|
545
|
+
} else
|
|
546
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
547
|
+
}
|
|
548
|
+
function Je(e) {
|
|
549
|
+
const t = {};
|
|
550
|
+
let r = g.dateTimePattern.exec(e), n;
|
|
551
|
+
if (r ? (t.date = r[1], n = r[3]) : (r = g.datePattern.exec(e), r ? (t.date = r[1], n = r[2]) : (t.date = null, n = e)), n) {
|
|
552
|
+
const i = g.timeZone.exec(n);
|
|
553
|
+
i ? (t.time = n.replace(i[1], ""), t.timeZone = i[1].trim()) : t.time = n;
|
|
554
|
+
}
|
|
555
|
+
return t;
|
|
556
|
+
}
|
|
557
|
+
function Qe(e, t) {
|
|
558
|
+
if (e) {
|
|
559
|
+
const r = g.YYY[t], n = g.YYYYY[t];
|
|
560
|
+
let i = g.YYYY.exec(e) || n.exec(e);
|
|
561
|
+
if (i) {
|
|
562
|
+
const a = i[1];
|
|
563
|
+
return {
|
|
564
|
+
year: parseInt(a, 10),
|
|
565
|
+
restDateString: e.slice(a.length)
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
if (i = g.YY.exec(e) || r.exec(e), i) {
|
|
569
|
+
const a = i[1];
|
|
570
|
+
return {
|
|
571
|
+
year: parseInt(a, 10) * 100,
|
|
572
|
+
restDateString: e.slice(a.length)
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
year: null
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
function et(e, t) {
|
|
581
|
+
if (t === null)
|
|
582
|
+
return null;
|
|
583
|
+
let r, n, i;
|
|
584
|
+
if (!e || !e.length)
|
|
585
|
+
return r = /* @__PURE__ */ new Date(0), r.setUTCFullYear(t), r;
|
|
586
|
+
let a = g.MM.exec(e);
|
|
587
|
+
if (a)
|
|
588
|
+
return r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1, Q(t, n) ? (r.setUTCFullYear(t, n), r) : /* @__PURE__ */ new Date(NaN);
|
|
589
|
+
if (a = g.DDD.exec(e), a) {
|
|
590
|
+
r = /* @__PURE__ */ new Date(0);
|
|
591
|
+
const c = parseInt(a[1], 10);
|
|
592
|
+
return at(t, c) ? (r.setUTCFullYear(t, 0, c), r) : /* @__PURE__ */ new Date(NaN);
|
|
593
|
+
}
|
|
594
|
+
if (a = g.MMDD.exec(e), a) {
|
|
595
|
+
r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1;
|
|
596
|
+
const c = parseInt(a[2], 10);
|
|
597
|
+
return Q(t, n, c) ? (r.setUTCFullYear(t, n, c), r) : /* @__PURE__ */ new Date(NaN);
|
|
598
|
+
}
|
|
599
|
+
if (a = g.Www.exec(e), a)
|
|
600
|
+
return i = parseInt(a[1], 10) - 1, ee(i) ? J(t, i) : /* @__PURE__ */ new Date(NaN);
|
|
601
|
+
if (a = g.WwwD.exec(e), a) {
|
|
602
|
+
i = parseInt(a[1], 10) - 1;
|
|
603
|
+
const c = parseInt(a[2], 10) - 1;
|
|
604
|
+
return ee(i, c) ? J(t, i, c) : /* @__PURE__ */ new Date(NaN);
|
|
605
|
+
}
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
function tt(e) {
|
|
609
|
+
let t, r, n = g.HH.exec(e);
|
|
610
|
+
if (n)
|
|
611
|
+
return t = parseFloat(n[1].replace(",", ".")), z(t) ? t % 24 * F : NaN;
|
|
612
|
+
if (n = g.HHMM.exec(e), n)
|
|
613
|
+
return t = parseInt(n[1], 10), r = parseFloat(n[2].replace(",", ".")), z(t, r) ? t % 24 * F + r * B : NaN;
|
|
614
|
+
if (n = g.HHMMSS.exec(e), n) {
|
|
615
|
+
t = parseInt(n[1], 10), r = parseInt(n[2], 10);
|
|
616
|
+
const i = parseFloat(n[3].replace(",", "."));
|
|
617
|
+
return z(t, r, i) ? t % 24 * F + r * B + i * 1e3 : NaN;
|
|
618
|
+
}
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
function J(e, t, r) {
|
|
622
|
+
t = t || 0, r = r || 0;
|
|
623
|
+
const n = /* @__PURE__ */ new Date(0);
|
|
624
|
+
n.setUTCFullYear(e, 0, 4);
|
|
625
|
+
const i = n.getUTCDay() || 7, a = t * 7 + r + 1 - i;
|
|
626
|
+
return n.setUTCDate(n.getUTCDate() + a), n;
|
|
627
|
+
}
|
|
628
|
+
const rt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], nt = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
629
|
+
function ge(e) {
|
|
630
|
+
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
631
|
+
}
|
|
632
|
+
function Q(e, t, r) {
|
|
633
|
+
if (t < 0 || t > 11)
|
|
634
|
+
return !1;
|
|
635
|
+
if (r != null) {
|
|
636
|
+
if (r < 1)
|
|
637
|
+
return !1;
|
|
638
|
+
const n = ge(e);
|
|
639
|
+
if (n && r > nt[t] || !n && r > rt[t])
|
|
640
|
+
return !1;
|
|
641
|
+
}
|
|
642
|
+
return !0;
|
|
643
|
+
}
|
|
644
|
+
function at(e, t) {
|
|
645
|
+
if (t < 1)
|
|
646
|
+
return !1;
|
|
647
|
+
const r = ge(e);
|
|
648
|
+
return !(r && t > 366 || !r && t > 365);
|
|
649
|
+
}
|
|
650
|
+
function ee(e, t) {
|
|
651
|
+
return !(e < 0 || e > 52 || t != null && (t < 0 || t > 6));
|
|
652
|
+
}
|
|
653
|
+
function z(e, t, r) {
|
|
654
|
+
return !(e < 0 || e >= 25 || t != null && (t < 0 || t >= 60) || r != null && (r < 0 || r >= 60));
|
|
655
|
+
}
|
|
656
|
+
function it(e, t, r) {
|
|
657
|
+
if (typeof e == "string" && !e.match(de))
|
|
658
|
+
return X(e, { ...r, timeZone: t });
|
|
659
|
+
e = X(e, r);
|
|
660
|
+
const n = O(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()).getTime(), i = fe(t, new Date(n));
|
|
661
|
+
return new Date(n + i);
|
|
662
|
+
}
|
|
663
|
+
const ct = [
|
|
664
|
+
"type",
|
|
665
|
+
"locale",
|
|
666
|
+
"minimumFractionDigits",
|
|
667
|
+
"maximumFractionDigits",
|
|
668
|
+
"useGrouping",
|
|
669
|
+
"prefix",
|
|
670
|
+
"suffix",
|
|
671
|
+
"negativeStyle",
|
|
672
|
+
"compact",
|
|
673
|
+
"scale",
|
|
674
|
+
"currency",
|
|
675
|
+
"percentValueMode"
|
|
676
|
+
];
|
|
677
|
+
function st(e) {
|
|
678
|
+
if (!y(e))
|
|
679
|
+
return {
|
|
680
|
+
ok: !1,
|
|
681
|
+
issues: [{ path: "$", message: "Numeric format must be an object." }]
|
|
682
|
+
};
|
|
683
|
+
const t = [], r = new Set(ct);
|
|
684
|
+
Object.keys(e).filter((a) => !r.has(a)).forEach(
|
|
685
|
+
(a) => t.push({ path: a, message: `Unknown property "${a}".` })
|
|
686
|
+
), e.type !== "number" && e.type !== "currency" && e.type !== "percent" && e.type !== "scientific" && t.push({
|
|
687
|
+
path: "type",
|
|
688
|
+
message: "Expected number, currency, percent, or scientific."
|
|
689
|
+
});
|
|
690
|
+
const n = e.locale === void 0 ? void 0 : P(e.locale);
|
|
691
|
+
e.locale !== void 0 && !n && t.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
|
|
692
|
+
const i = e.currency === void 0 ? void 0 : k(e.currency);
|
|
693
|
+
e.currency !== void 0 && !i && t.push({
|
|
694
|
+
path: "currency",
|
|
695
|
+
message: "Expected a supported ISO 4217 currency code."
|
|
696
|
+
});
|
|
697
|
+
for (const a of ["minimumFractionDigits", "maximumFractionDigits"]) {
|
|
698
|
+
const c = e[a];
|
|
699
|
+
c !== void 0 && (!Number.isInteger(c) || typeof c != "number" || c < 0 || c > 20) && t.push({
|
|
700
|
+
path: a,
|
|
701
|
+
message: "Expected an integer from 0 to 20."
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
typeof e.minimumFractionDigits == "number" && typeof e.maximumFractionDigits == "number" && e.minimumFractionDigits > e.maximumFractionDigits && t.push({
|
|
705
|
+
path: "maximumFractionDigits",
|
|
706
|
+
message: "Must be greater than or equal to minimumFractionDigits."
|
|
707
|
+
});
|
|
708
|
+
for (const a of ["useGrouping", "compact"])
|
|
709
|
+
e[a] !== void 0 && typeof e[a] != "boolean" && t.push({ path: a, message: "Expected a boolean." });
|
|
710
|
+
for (const a of ["prefix", "suffix"])
|
|
711
|
+
e[a] !== void 0 && typeof e[a] != "string" && t.push({ path: a, message: "Expected a string." });
|
|
712
|
+
return e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && t.push({
|
|
713
|
+
path: "negativeStyle",
|
|
714
|
+
message: "Expected minus or parentheses."
|
|
715
|
+
}), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && t.push({
|
|
716
|
+
path: "percentValueMode",
|
|
717
|
+
message: "Expected fraction or whole."
|
|
718
|
+
}), e.scale !== void 0 && (typeof e.scale != "number" || !Number.isFinite(e.scale)) && t.push({ path: "scale", message: "Expected a finite number." }), t.length > 0 ? { ok: !1, issues: t } : {
|
|
719
|
+
ok: !0,
|
|
720
|
+
value: {
|
|
721
|
+
type: e.type,
|
|
722
|
+
...n ? { locale: n } : {},
|
|
723
|
+
...e.minimumFractionDigits !== void 0 ? { minimumFractionDigits: e.minimumFractionDigits } : {},
|
|
724
|
+
...e.maximumFractionDigits !== void 0 ? { maximumFractionDigits: e.maximumFractionDigits } : {},
|
|
725
|
+
...e.useGrouping !== void 0 ? { useGrouping: e.useGrouping } : {},
|
|
726
|
+
...e.prefix !== void 0 ? { prefix: e.prefix } : {},
|
|
727
|
+
...e.suffix !== void 0 ? { suffix: e.suffix } : {},
|
|
728
|
+
...e.negativeStyle !== void 0 ? {
|
|
729
|
+
negativeStyle: e.negativeStyle
|
|
730
|
+
} : {},
|
|
731
|
+
...e.compact !== void 0 ? { compact: e.compact } : {},
|
|
732
|
+
...e.scale !== void 0 ? { scale: e.scale } : {},
|
|
733
|
+
...i ? { currency: i } : {},
|
|
734
|
+
...e.percentValueMode !== void 0 ? {
|
|
735
|
+
percentValueMode: e.percentValueMode
|
|
736
|
+
} : {}
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function Ot(e) {
|
|
741
|
+
const t = st(e);
|
|
742
|
+
if (!t.ok)
|
|
743
|
+
return t;
|
|
744
|
+
const r = [];
|
|
745
|
+
return t.value.locale || r.push({
|
|
746
|
+
path: "locale",
|
|
747
|
+
message: "Resolved numeric formats require an explicit locale."
|
|
748
|
+
}), t.value.minimumFractionDigits === void 0 && r.push({
|
|
749
|
+
path: "minimumFractionDigits",
|
|
750
|
+
message: "Resolved numeric formats require minimumFractionDigits."
|
|
751
|
+
}), t.value.maximumFractionDigits === void 0 && r.push({
|
|
752
|
+
path: "maximumFractionDigits",
|
|
753
|
+
message: "Resolved numeric formats require maximumFractionDigits."
|
|
754
|
+
}), t.value.type === "currency" && !t.value.currency && r.push({
|
|
755
|
+
path: "currency",
|
|
756
|
+
message: "Resolved currency formats require an explicit currency."
|
|
757
|
+
}), r.length > 0 ? { ok: !1, issues: r } : t;
|
|
758
|
+
}
|
|
759
|
+
function At(e) {
|
|
760
|
+
var n;
|
|
761
|
+
const t = /* @__PURE__ */ new Set();
|
|
762
|
+
if (e.snapshot.resolvedFormats.forEach((i, a) => {
|
|
763
|
+
if (i.format.type !== "temporal_bucket") {
|
|
764
|
+
if (i.scope.attachmentIndex !== void 0)
|
|
765
|
+
throw new Error(
|
|
766
|
+
`resolvedFormats.${a}.scope.attachmentIndex is not valid for a card export`
|
|
767
|
+
);
|
|
768
|
+
if (i.scope.dashboardId !== e.expectedScope.dashboardId || i.scope.cardId !== e.expectedScope.cardId)
|
|
769
|
+
throw new Error(
|
|
770
|
+
`resolvedFormats.${a}.scope must match the executing dashboard/card`
|
|
771
|
+
);
|
|
772
|
+
if (i.target.kind !== "column")
|
|
773
|
+
throw new Error(
|
|
774
|
+
`resolvedFormats.${a}.target must identify an export column`
|
|
775
|
+
);
|
|
776
|
+
if (t.has(i.target.columnKey))
|
|
777
|
+
throw new Error(
|
|
778
|
+
`resolvedFormats.${a} duplicates export column "${i.target.columnKey}"`
|
|
779
|
+
);
|
|
780
|
+
t.add(i.target.columnKey);
|
|
781
|
+
}
|
|
782
|
+
}), !e.useFormattedValues)
|
|
783
|
+
return;
|
|
784
|
+
if (!((n = e.visibleColumns) != null && n.length))
|
|
785
|
+
throw new Error(
|
|
786
|
+
"visibleColumns must identify every formatted export column"
|
|
787
|
+
);
|
|
788
|
+
const r = e.visibleColumns.find(
|
|
789
|
+
(i) => !t.has(i)
|
|
790
|
+
);
|
|
791
|
+
if (r)
|
|
792
|
+
throw new Error(
|
|
793
|
+
`resolvedFormats is missing visible export column "${r}"`
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
function ut(e, t) {
|
|
797
|
+
const r = new Intl.NumberFormat(e, {
|
|
798
|
+
style: "currency",
|
|
799
|
+
currency: t
|
|
800
|
+
}).resolvedOptions();
|
|
801
|
+
return {
|
|
802
|
+
minimumFractionDigits: r.minimumFractionDigits,
|
|
803
|
+
maximumFractionDigits: r.maximumFractionDigits
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function ot(e) {
|
|
807
|
+
if (e.minimumFractionDigits !== void 0 || e.maximumFractionDigits !== void 0) {
|
|
808
|
+
const r = e.minimumFractionDigits ?? 0;
|
|
809
|
+
return {
|
|
810
|
+
minimumFractionDigits: r,
|
|
811
|
+
maximumFractionDigits: e.maximumFractionDigits ?? Math.max(r, 2)
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
const t = e.type === "percent" ? 1 : e.type === "scientific" ? 2 : 0;
|
|
815
|
+
return {
|
|
816
|
+
minimumFractionDigits: t,
|
|
817
|
+
maximumFractionDigits: t
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
function Lt(e, t, r) {
|
|
821
|
+
const n = P(e.locale) ?? t.locale, i = e.type === "number" || e.type === "currency" ? k(r) : void 0;
|
|
822
|
+
if (!(e.type === "currency" || i !== void 0))
|
|
823
|
+
return {
|
|
824
|
+
...e,
|
|
825
|
+
locale: n,
|
|
826
|
+
...ot(e)
|
|
827
|
+
};
|
|
828
|
+
const c = i ?? k(e.currency) ?? t.defaultCurrency, s = ut(
|
|
829
|
+
n,
|
|
830
|
+
c
|
|
831
|
+
), u = s.minimumFractionDigits ?? 0, o = s.maximumFractionDigits ?? u, l = e.minimumFractionDigits ?? Math.min(
|
|
832
|
+
u,
|
|
833
|
+
e.maximumFractionDigits ?? u
|
|
834
|
+
), f = e.maximumFractionDigits ?? Math.max(
|
|
835
|
+
l,
|
|
836
|
+
o
|
|
837
|
+
);
|
|
838
|
+
return {
|
|
839
|
+
...e,
|
|
840
|
+
type: "currency",
|
|
841
|
+
locale: n,
|
|
842
|
+
currency: c,
|
|
843
|
+
minimumFractionDigits: l,
|
|
844
|
+
maximumFractionDigits: f
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
class w extends Error {
|
|
848
|
+
constructor(r, n) {
|
|
849
|
+
super(n);
|
|
850
|
+
A(this, "code");
|
|
851
|
+
this.name = "RawTemporalFormatContractError", this.code = r;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
const lt = [
|
|
855
|
+
"SSSSSSSSS",
|
|
856
|
+
"SSSSSSSS",
|
|
857
|
+
"SSSSSSS",
|
|
858
|
+
"SSSSSS",
|
|
859
|
+
"SSSSS",
|
|
860
|
+
"SSSS",
|
|
861
|
+
"SSS",
|
|
862
|
+
"SS",
|
|
863
|
+
"S"
|
|
864
|
+
], ye = /^(\d{4})-(\d{2})-(\d{2})$/, he = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, De = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/, mt = [
|
|
865
|
+
"yyyy",
|
|
866
|
+
"MMMM",
|
|
867
|
+
"LLLL",
|
|
868
|
+
"zzz",
|
|
869
|
+
"XXX",
|
|
870
|
+
"MMM",
|
|
871
|
+
"LLL",
|
|
872
|
+
"yy",
|
|
873
|
+
"MM",
|
|
874
|
+
"dd",
|
|
875
|
+
"HH",
|
|
876
|
+
"hh",
|
|
877
|
+
"mm",
|
|
878
|
+
"ss",
|
|
879
|
+
"M",
|
|
880
|
+
"d",
|
|
881
|
+
"H",
|
|
882
|
+
"h",
|
|
883
|
+
"m",
|
|
884
|
+
"s",
|
|
885
|
+
"a"
|
|
886
|
+
], ft = /* @__PURE__ */ new Set([
|
|
887
|
+
"HH",
|
|
888
|
+
"H",
|
|
889
|
+
"hh",
|
|
890
|
+
"h",
|
|
891
|
+
"mm",
|
|
892
|
+
"m",
|
|
893
|
+
"ss",
|
|
894
|
+
"s",
|
|
895
|
+
"a",
|
|
896
|
+
...lt
|
|
897
|
+
]), dt = /* @__PURE__ */ new Set(["zzz", "XXX"]), $ = /* @__PURE__ */ new Set(["short", "medium", "long"]);
|
|
898
|
+
function h(e, t) {
|
|
899
|
+
return Object.keys(e).length === t.length && t.every((n) => n in e);
|
|
900
|
+
}
|
|
901
|
+
function m(e) {
|
|
902
|
+
throw new w(
|
|
903
|
+
"invalid_raw_temporal_format",
|
|
904
|
+
e
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
function we(e) {
|
|
908
|
+
if (!e || e.trim() !== e || e.length > 256)
|
|
909
|
+
return m(
|
|
910
|
+
"date_fns patterns must be non-empty, trimmed, and at most 256 characters."
|
|
911
|
+
);
|
|
912
|
+
const t = [], r = (i) => {
|
|
913
|
+
const a = t[t.length - 1];
|
|
914
|
+
(a == null ? void 0 : a.kind) === "literal" ? a.value += i : t.push({ kind: "literal", value: i });
|
|
915
|
+
};
|
|
916
|
+
let n = 0;
|
|
917
|
+
for (; n < e.length; ) {
|
|
918
|
+
if (e[n] === "'") {
|
|
919
|
+
if (e[n + 1] === "'") {
|
|
920
|
+
r("'"), n += 2;
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
let c = "", s = !1;
|
|
924
|
+
for (n += 1; n < e.length; ) {
|
|
925
|
+
if (e[n] === "'") {
|
|
926
|
+
if (e[n + 1] === "'") {
|
|
927
|
+
c += "'", n += 2;
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
s = !0, n += 1;
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
c += e[n], n += 1;
|
|
934
|
+
}
|
|
935
|
+
if (!s)
|
|
936
|
+
return m("date_fns pattern has an unclosed quote.");
|
|
937
|
+
r(c);
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
if (e[n] === "S") {
|
|
941
|
+
let c = n + 1;
|
|
942
|
+
for (; e[c] === "S"; ) c += 1;
|
|
943
|
+
const s = e.slice(n, c);
|
|
944
|
+
if (s.length > 9)
|
|
945
|
+
return m(
|
|
946
|
+
"date_fns fractional-second tokens support at most nine digits."
|
|
947
|
+
);
|
|
948
|
+
t.push({
|
|
949
|
+
kind: "token",
|
|
950
|
+
value: s
|
|
951
|
+
}), n = c;
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
const i = mt.find(
|
|
955
|
+
(c) => e.startsWith(c, n)
|
|
956
|
+
);
|
|
957
|
+
if (i) {
|
|
958
|
+
t.push({ kind: "token", value: i }), n += i.length;
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
const a = e[n];
|
|
962
|
+
if (/[A-Za-z]/.test(a))
|
|
963
|
+
return m(
|
|
964
|
+
`Unsupported date_fns pattern token beginning at "${e.slice(n)}".`
|
|
965
|
+
);
|
|
966
|
+
r(a), n += 1;
|
|
967
|
+
}
|
|
968
|
+
return t.some((i) => i.kind === "token") ? t : m("date_fns patterns must contain at least one token.");
|
|
969
|
+
}
|
|
970
|
+
function Se(e, t) {
|
|
971
|
+
if (e === "semaphor_tokens") {
|
|
972
|
+
const r = ne(t);
|
|
973
|
+
r.ok || m(r.message);
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
we(t);
|
|
977
|
+
}
|
|
978
|
+
function gt(e) {
|
|
979
|
+
return !y(e) || !h(e, ["dateStyle", "dateTime"]) ? m("Automatic raw temporal styles are incomplete.") : $.has(e.dateStyle) ? !y(e.dateTime) || !h(e.dateTime, ["dateStyle", "timeStyle"]) || !$.has(e.dateTime.dateStyle) || !$.has(e.dateTime.timeStyle) ? m(
|
|
980
|
+
"Automatic dateTime styles are incomplete or invalid."
|
|
981
|
+
) : {
|
|
982
|
+
dateStyle: e.dateStyle,
|
|
983
|
+
dateTime: {
|
|
984
|
+
dateStyle: e.dateTime.dateStyle,
|
|
985
|
+
timeStyle: e.dateTime.timeStyle
|
|
986
|
+
}
|
|
987
|
+
} : m("Automatic dateStyle is invalid.");
|
|
988
|
+
}
|
|
989
|
+
function xe(e) {
|
|
990
|
+
const t = ["type", "locale", "calendarTimezone", "presentation"], r = [...t, "sourceTimezone"];
|
|
991
|
+
if (!y(e) || !h(e, t) && !h(e, r) || e.type !== "raw_temporal")
|
|
992
|
+
return m("Resolved raw temporal format has an invalid shape.");
|
|
993
|
+
const n = P(e.locale);
|
|
994
|
+
return n ? typeof e.calendarTimezone != "string" || !N(e.calendarTimezone) ? m(
|
|
995
|
+
"Raw temporal calendarTimezone must be a valid IANA timezone."
|
|
996
|
+
) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !N(e.sourceTimezone)) ? m(
|
|
997
|
+
"Raw temporal sourceTimezone must be a valid IANA timezone."
|
|
998
|
+
) : y(e.presentation) ? e.presentation.mode === "auto" ? h(e.presentation, ["mode", "styles"]) ? {
|
|
999
|
+
type: "raw_temporal",
|
|
1000
|
+
locale: n,
|
|
1001
|
+
calendarTimezone: e.calendarTimezone,
|
|
1002
|
+
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
1003
|
+
presentation: {
|
|
1004
|
+
mode: "auto",
|
|
1005
|
+
styles: gt(e.presentation.styles)
|
|
1006
|
+
}
|
|
1007
|
+
} : m(
|
|
1008
|
+
"Automatic raw temporal presentation has unknown fields."
|
|
1009
|
+
) : e.presentation.mode !== "pattern" || !h(e.presentation, ["mode", "dialect", "pattern"]) || e.presentation.dialect !== "semaphor_tokens" && e.presentation.dialect !== "date_fns" || typeof e.presentation.pattern != "string" ? m(
|
|
1010
|
+
"Pattern raw temporal presentation has an invalid shape."
|
|
1011
|
+
) : (Se(e.presentation.dialect, e.presentation.pattern), {
|
|
1012
|
+
type: "raw_temporal",
|
|
1013
|
+
locale: n,
|
|
1014
|
+
calendarTimezone: e.calendarTimezone,
|
|
1015
|
+
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
1016
|
+
presentation: {
|
|
1017
|
+
mode: "pattern",
|
|
1018
|
+
dialect: e.presentation.dialect,
|
|
1019
|
+
pattern: e.presentation.pattern
|
|
1020
|
+
}
|
|
1021
|
+
}) : m("Raw temporal presentation must be an object.") : m("Raw temporal locale is invalid or unsupported.");
|
|
1022
|
+
}
|
|
1023
|
+
function Rt(e) {
|
|
1024
|
+
var s, u, o;
|
|
1025
|
+
if (e.format) {
|
|
1026
|
+
if (!y(e.format))
|
|
1027
|
+
return m(
|
|
1028
|
+
"Authored raw temporal format has an invalid shape."
|
|
1029
|
+
);
|
|
1030
|
+
const l = Object.keys(e.format);
|
|
1031
|
+
if (!l.includes("type") || !l.includes("presentation") || l.some(
|
|
1032
|
+
(d) => d !== "type" && d !== "presentation" && d !== "timezone" && d !== "sourceTimezone"
|
|
1033
|
+
) || e.format.type !== "raw_temporal" || !y(e.format.presentation))
|
|
1034
|
+
return m(
|
|
1035
|
+
"Authored raw temporal format has an invalid shape."
|
|
1036
|
+
);
|
|
1037
|
+
const f = e.format.presentation;
|
|
1038
|
+
if (f.mode === "auto") {
|
|
1039
|
+
if (!h(f, ["mode"]))
|
|
1040
|
+
return m(
|
|
1041
|
+
"Automatic authored raw temporal format has unknown fields."
|
|
1042
|
+
);
|
|
1043
|
+
} else {
|
|
1044
|
+
if (f.mode !== "pattern" || !h(f, ["mode", "dialect", "pattern"]) || f.dialect !== "semaphor_tokens" && f.dialect !== "date_fns" || typeof f.pattern != "string")
|
|
1045
|
+
return m(
|
|
1046
|
+
"Authored raw temporal pattern has an invalid shape."
|
|
1047
|
+
);
|
|
1048
|
+
Se(f.dialect, f.pattern);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
const t = (s = e.format) == null ? void 0 : s.timezone, r = (u = e.format) == null ? void 0 : u.sourceTimezone, n = t && t !== "auto" ? t : e.calendar.tz, i = r && r !== "auto" ? r === "local" ? Intl.DateTimeFormat().resolvedOptions().timeZone : r : void 0;
|
|
1052
|
+
if (t !== void 0 && t !== "auto" && !N(n) || i !== void 0 && !N(i))
|
|
1053
|
+
return m("Authored raw temporal timezone is invalid.");
|
|
1054
|
+
const a = ((o = e.format) == null ? void 0 : o.presentation) ?? { mode: "auto" }, c = {
|
|
1055
|
+
type: "raw_temporal",
|
|
1056
|
+
locale: e.preferences.locale,
|
|
1057
|
+
calendarTimezone: n,
|
|
1058
|
+
...i ? { sourceTimezone: i } : {},
|
|
1059
|
+
presentation: a.mode === "pattern" ? { ...a } : {
|
|
1060
|
+
mode: "auto",
|
|
1061
|
+
styles: {
|
|
1062
|
+
dateStyle: e.preferences.dateStyle,
|
|
1063
|
+
dateTime: { ...e.preferences.dateTime }
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
return xe(c);
|
|
1068
|
+
}
|
|
1069
|
+
function yt(e) {
|
|
1070
|
+
if (ye.test(e)) return "date";
|
|
1071
|
+
if (De.test(e)) return "instant";
|
|
1072
|
+
if (he.test(e)) return "wall_datetime";
|
|
1073
|
+
}
|
|
1074
|
+
function Ht(e) {
|
|
1075
|
+
const t = /* @__PURE__ */ new Set();
|
|
1076
|
+
let r = !1;
|
|
1077
|
+
for (const n of e.values) {
|
|
1078
|
+
if (n === null) continue;
|
|
1079
|
+
r = !0;
|
|
1080
|
+
const i = yt(n);
|
|
1081
|
+
i && t.add(i);
|
|
1082
|
+
}
|
|
1083
|
+
if (!r) return { status: "empty" };
|
|
1084
|
+
if (t.size === 0) return { status: "invalid_only" };
|
|
1085
|
+
if (t.size > 1)
|
|
1086
|
+
throw new w(
|
|
1087
|
+
"mixed_sql_temporal_semantics",
|
|
1088
|
+
`Declared SQL temporal column "${e.columnKey}" mixes date, wall-datetime, or instant semantics. Normalize it to one kind.`
|
|
1089
|
+
);
|
|
1090
|
+
return {
|
|
1091
|
+
status: "classified",
|
|
1092
|
+
metadata: {
|
|
1093
|
+
kind: "raw_temporal",
|
|
1094
|
+
valueKind: [...t][0]
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
function Zt(e) {
|
|
1099
|
+
return {
|
|
1100
|
+
version: 1,
|
|
1101
|
+
columns: Object.fromEntries(
|
|
1102
|
+
[...e].map(([t, r]) => [
|
|
1103
|
+
t,
|
|
1104
|
+
r.status === "classified" ? r.metadata.valueKind : r.status
|
|
1105
|
+
])
|
|
1106
|
+
)
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
function ht(e) {
|
|
1110
|
+
if (!y(e) || e.version !== 1 || !y(e.columns) || Object.keys(e).some((n) => n !== "version" && n !== "columns"))
|
|
1111
|
+
throw new w(
|
|
1112
|
+
"invalid_raw_temporal_format",
|
|
1113
|
+
"Raw temporal chunk classification evidence is malformed."
|
|
1114
|
+
);
|
|
1115
|
+
const t = {}, r = /* @__PURE__ */ new Set([
|
|
1116
|
+
"empty",
|
|
1117
|
+
"invalid_only",
|
|
1118
|
+
"date",
|
|
1119
|
+
"wall_datetime",
|
|
1120
|
+
"instant"
|
|
1121
|
+
]);
|
|
1122
|
+
for (const [n, i] of Object.entries(e.columns)) {
|
|
1123
|
+
if (!n.trim() || !r.has(i))
|
|
1124
|
+
throw new w(
|
|
1125
|
+
"invalid_raw_temporal_format",
|
|
1126
|
+
"Raw temporal chunk classification evidence contains an invalid column or status."
|
|
1127
|
+
);
|
|
1128
|
+
t[n] = i;
|
|
1129
|
+
}
|
|
1130
|
+
return { version: 1, columns: t };
|
|
1131
|
+
}
|
|
1132
|
+
function Kt(e) {
|
|
1133
|
+
if (e.length === 0) return;
|
|
1134
|
+
const t = e.map(ht), r = Object.keys(t[0].columns).sort();
|
|
1135
|
+
for (let n = 1; n < t.length; n += 1) {
|
|
1136
|
+
const i = Object.keys(t[n].columns).sort();
|
|
1137
|
+
if (i.length !== r.length || i.some((a, c) => a !== r[c]))
|
|
1138
|
+
throw new w(
|
|
1139
|
+
"invalid_raw_temporal_format",
|
|
1140
|
+
"Raw temporal chunk classification evidence has inconsistent columns."
|
|
1141
|
+
);
|
|
1142
|
+
}
|
|
1143
|
+
for (const n of r)
|
|
1144
|
+
if (new Set(
|
|
1145
|
+
t.map((a) => a.columns[n]).filter(
|
|
1146
|
+
(a) => a !== "empty" && a !== "invalid_only"
|
|
1147
|
+
)
|
|
1148
|
+
).size > 1)
|
|
1149
|
+
throw new w(
|
|
1150
|
+
"mixed_sql_temporal_semantics",
|
|
1151
|
+
`Declared SQL temporal column "${n}" has inconsistent semantics across export chunks. Normalize it to one kind.`
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
function Dt(e) {
|
|
1155
|
+
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
|
|
1156
|
+
}
|
|
1157
|
+
function wt(e, t) {
|
|
1158
|
+
return t === 2 ? Dt(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
|
|
1159
|
+
}
|
|
1160
|
+
function St(e) {
|
|
1161
|
+
return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= wt(e.year, e.month) && e.hour >= 0 && e.hour <= 23 && e.minute >= 0 && e.minute <= 59 && e.second >= 0 && e.second <= 59;
|
|
1162
|
+
}
|
|
1163
|
+
function xt(e) {
|
|
1164
|
+
return {
|
|
1165
|
+
year: Number(e[1]),
|
|
1166
|
+
month: Number(e[2]),
|
|
1167
|
+
day: Number(e[3]),
|
|
1168
|
+
hour: Number(e[4] ?? 0),
|
|
1169
|
+
minute: Number(e[5] ?? 0),
|
|
1170
|
+
second: Number(e[6] ?? 0),
|
|
1171
|
+
fraction: e[7] ?? ""
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
function Tt(e, t) {
|
|
1175
|
+
const r = t === "date" ? e.match(ye) : t === "wall_datetime" ? e.match(he) : e.match(De);
|
|
1176
|
+
if (!r) return { status: "invalid_shape" };
|
|
1177
|
+
const n = xt(r);
|
|
1178
|
+
if (!St(n)) return { status: "out_of_range" };
|
|
1179
|
+
if (t === "instant") {
|
|
1180
|
+
const i = r[8];
|
|
1181
|
+
if (i && i !== "Z") {
|
|
1182
|
+
const [c, s] = i.slice(1).split(":").map(Number);
|
|
1183
|
+
if (c > 23 || s > 59) return { status: "out_of_range" };
|
|
1184
|
+
}
|
|
1185
|
+
const a = new Date(e.replace(" ", "T"));
|
|
1186
|
+
return Number.isNaN(a.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: a };
|
|
1187
|
+
}
|
|
1188
|
+
return { status: "valid", fields: n };
|
|
1189
|
+
}
|
|
1190
|
+
function Y(e) {
|
|
1191
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
1192
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
|
|
1193
|
+
}
|
|
1194
|
+
function Te(e, t) {
|
|
1195
|
+
const r = e.fraction ? `.${e.fraction.padEnd(3, "0").slice(0, 3)}` : "";
|
|
1196
|
+
return it(
|
|
1197
|
+
`${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}T${String(e.hour).padStart(2, "0")}:${String(e.minute).padStart(2, "0")}:${String(e.second).padStart(2, "0")}${r}`,
|
|
1198
|
+
t
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
function Nt(e, t) {
|
|
1202
|
+
const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1203
|
+
let i, a, c, s;
|
|
1204
|
+
return {
|
|
1205
|
+
number(u, o = 1) {
|
|
1206
|
+
let l = r.get(o);
|
|
1207
|
+
return l || (l = new Intl.NumberFormat(e, {
|
|
1208
|
+
useGrouping: !1,
|
|
1209
|
+
minimumIntegerDigits: o,
|
|
1210
|
+
maximumFractionDigits: 0
|
|
1211
|
+
}), r.set(o, l)), l.format(u);
|
|
1212
|
+
},
|
|
1213
|
+
month(u, o, l) {
|
|
1214
|
+
var x;
|
|
1215
|
+
const f = `${o}:${l ? "standalone" : "contextual"}`;
|
|
1216
|
+
let d = n.get(f);
|
|
1217
|
+
if (!d) {
|
|
1218
|
+
const T = {
|
|
1219
|
+
calendar: "gregory",
|
|
1220
|
+
timeZone: "UTC",
|
|
1221
|
+
month: o
|
|
1222
|
+
};
|
|
1223
|
+
l || (T.day = "numeric"), d = new Intl.DateTimeFormat(e, T), n.set(f, d);
|
|
1224
|
+
}
|
|
1225
|
+
return ((x = d.formatToParts(u).find((T) => T.type === "month")) == null ? void 0 : x.value) ?? "";
|
|
1226
|
+
},
|
|
1227
|
+
dayPeriod(u) {
|
|
1228
|
+
var o;
|
|
1229
|
+
return i ?? (i = new Intl.DateTimeFormat(e, {
|
|
1230
|
+
calendar: "gregory",
|
|
1231
|
+
timeZone: "UTC",
|
|
1232
|
+
hour: "numeric",
|
|
1233
|
+
hour12: !0
|
|
1234
|
+
})), ((o = i.formatToParts(u).find((l) => l.type === "dayPeriod")) == null ? void 0 : o.value) ?? "";
|
|
1235
|
+
},
|
|
1236
|
+
instantFields(u) {
|
|
1237
|
+
a ?? (a = new Intl.DateTimeFormat("en-CA", {
|
|
1238
|
+
calendar: "gregory",
|
|
1239
|
+
numberingSystem: "latn",
|
|
1240
|
+
timeZone: t,
|
|
1241
|
+
year: "numeric",
|
|
1242
|
+
month: "2-digit",
|
|
1243
|
+
day: "2-digit",
|
|
1244
|
+
hour: "2-digit",
|
|
1245
|
+
minute: "2-digit",
|
|
1246
|
+
second: "2-digit",
|
|
1247
|
+
hourCycle: "h23"
|
|
1248
|
+
}));
|
|
1249
|
+
const o = a.formatToParts(u), l = (f) => {
|
|
1250
|
+
var d;
|
|
1251
|
+
return Number((d = o.find((x) => x.type === f)) == null ? void 0 : d.value);
|
|
1252
|
+
};
|
|
1253
|
+
return {
|
|
1254
|
+
year: l("year"),
|
|
1255
|
+
month: l("month"),
|
|
1256
|
+
day: l("day"),
|
|
1257
|
+
hour: l("hour"),
|
|
1258
|
+
minute: l("minute"),
|
|
1259
|
+
second: l("second"),
|
|
1260
|
+
fraction: ""
|
|
1261
|
+
};
|
|
1262
|
+
},
|
|
1263
|
+
timezoneName(u) {
|
|
1264
|
+
var o;
|
|
1265
|
+
return c ?? (c = new Intl.DateTimeFormat(e, {
|
|
1266
|
+
calendar: "gregory",
|
|
1267
|
+
timeZone: t,
|
|
1268
|
+
timeZoneName: "short"
|
|
1269
|
+
})), ((o = c.formatToParts(u).find((l) => l.type === "timeZoneName")) == null ? void 0 : o.value) ?? "";
|
|
1270
|
+
},
|
|
1271
|
+
timezoneOffset(u) {
|
|
1272
|
+
var f;
|
|
1273
|
+
s ?? (s = new Intl.DateTimeFormat("en-US", {
|
|
1274
|
+
calendar: "gregory",
|
|
1275
|
+
timeZone: t,
|
|
1276
|
+
timeZoneName: "longOffset"
|
|
1277
|
+
}));
|
|
1278
|
+
const o = (f = s.formatToParts(u).find((d) => d.type === "timeZoneName")) == null ? void 0 : f.value;
|
|
1279
|
+
if (!o)
|
|
1280
|
+
return m("Unable to resolve the instant timezone offset.");
|
|
1281
|
+
const l = o.replace(/^GMT/, "");
|
|
1282
|
+
return l === "" || /^[+-]00:00$/.test(l) ? "Z" : l;
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
function vt(e, t, r, n, i) {
|
|
1287
|
+
if (/^S{1,9}$/.test(e)) {
|
|
1288
|
+
const a = t.fraction.padEnd(e.length, "0").slice(0, e.length);
|
|
1289
|
+
return n.number(Number(a), e.length);
|
|
1290
|
+
}
|
|
1291
|
+
switch (e) {
|
|
1292
|
+
case "YYYY":
|
|
1293
|
+
case "yyyy":
|
|
1294
|
+
return n.number(t.year, 4);
|
|
1295
|
+
case "YY":
|
|
1296
|
+
case "yy":
|
|
1297
|
+
return n.number(t.year % 100, 2);
|
|
1298
|
+
case "MMMM":
|
|
1299
|
+
return n.month(r, "long", !1);
|
|
1300
|
+
case "LLLL":
|
|
1301
|
+
return n.month(r, "long", !0);
|
|
1302
|
+
case "MMM":
|
|
1303
|
+
return n.month(r, "short", !1);
|
|
1304
|
+
case "LLL":
|
|
1305
|
+
return n.month(r, "short", !0);
|
|
1306
|
+
case "MM":
|
|
1307
|
+
return n.number(t.month, 2);
|
|
1308
|
+
case "M":
|
|
1309
|
+
return n.number(t.month);
|
|
1310
|
+
case "DD":
|
|
1311
|
+
case "dd":
|
|
1312
|
+
return n.number(t.day, 2);
|
|
1313
|
+
case "d":
|
|
1314
|
+
return n.number(t.day);
|
|
1315
|
+
case "HH":
|
|
1316
|
+
return n.number(t.hour, 2);
|
|
1317
|
+
case "H":
|
|
1318
|
+
return n.number(t.hour);
|
|
1319
|
+
case "hh":
|
|
1320
|
+
return n.number(t.hour % 12 || 12, 2);
|
|
1321
|
+
case "h":
|
|
1322
|
+
return n.number(t.hour % 12 || 12);
|
|
1323
|
+
case "mm":
|
|
1324
|
+
return n.number(t.minute, 2);
|
|
1325
|
+
case "m":
|
|
1326
|
+
return n.number(t.minute);
|
|
1327
|
+
case "ss":
|
|
1328
|
+
return n.number(t.second, 2);
|
|
1329
|
+
case "s":
|
|
1330
|
+
return n.number(t.second);
|
|
1331
|
+
case "a":
|
|
1332
|
+
return n.dayPeriod(r);
|
|
1333
|
+
case "zzz":
|
|
1334
|
+
return i ? n.timezoneName(i) : m(
|
|
1335
|
+
"Timezone pattern tokens require an instant value."
|
|
1336
|
+
);
|
|
1337
|
+
case "XXX":
|
|
1338
|
+
return i ? n.timezoneOffset(i) : m(
|
|
1339
|
+
"Timezone pattern tokens require an instant value."
|
|
1340
|
+
);
|
|
1341
|
+
default:
|
|
1342
|
+
return m(
|
|
1343
|
+
`Unsupported raw temporal pattern token "${e}".`
|
|
1344
|
+
);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function Mt(e, t, r, n) {
|
|
1348
|
+
const i = Y(t);
|
|
1349
|
+
return e.map(
|
|
1350
|
+
(a) => a.kind === "literal" ? a.value : vt(a.value, t, i, r, n)
|
|
1351
|
+
).join("");
|
|
1352
|
+
}
|
|
1353
|
+
function Ne(e, t, r) {
|
|
1354
|
+
const n = t === "date_fns" ? we(r) : (() => {
|
|
1355
|
+
const a = ne(r);
|
|
1356
|
+
return a.ok ? a.segments : m(a.message);
|
|
1357
|
+
})(), i = n.filter((a) => a.kind === "token").map((a) => a.value);
|
|
1358
|
+
return e === "date" && i.some((a) => ft.has(a)) ? m("Date patterns cannot contain time tokens.") : e !== "instant" && i.some((a) => dt.has(a)) ? m("Timezone pattern tokens require an instant value.") : n;
|
|
1359
|
+
}
|
|
1360
|
+
function Vt(e) {
|
|
1361
|
+
Ne(
|
|
1362
|
+
e.valueKind ?? "instant",
|
|
1363
|
+
e.dialect,
|
|
1364
|
+
e.pattern
|
|
1365
|
+
);
|
|
1366
|
+
}
|
|
1367
|
+
function _t(e, t, r, n) {
|
|
1368
|
+
const i = Ne(
|
|
1369
|
+
e.valueKind,
|
|
1370
|
+
r,
|
|
1371
|
+
n
|
|
1372
|
+
), a = Nt(t.locale, t.calendarTimezone);
|
|
1373
|
+
return (c) => {
|
|
1374
|
+
const s = e.valueKind === "wall_datetime" && t.sourceTimezone ? Te(c.fields, t.sourceTimezone) : void 0, u = e.valueKind === "instant" ? {
|
|
1375
|
+
...a.instantFields(c.instant),
|
|
1376
|
+
fraction: c.fields.fraction
|
|
1377
|
+
} : s ? {
|
|
1378
|
+
...a.instantFields(s),
|
|
1379
|
+
fraction: c.fields.fraction
|
|
1380
|
+
} : c.fields;
|
|
1381
|
+
return Mt(i, u, a, c.instant ?? s);
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function It(e, t) {
|
|
1385
|
+
const r = t.presentation.mode === "auto" ? t.presentation.styles : m("Automatic raw temporal formatting requires styles.");
|
|
1386
|
+
if (e.valueKind === "date") {
|
|
1387
|
+
const c = new Intl.DateTimeFormat(t.locale, {
|
|
1388
|
+
calendar: "gregory",
|
|
1389
|
+
timeZone: "UTC",
|
|
1390
|
+
dateStyle: r.dateStyle
|
|
1391
|
+
});
|
|
1392
|
+
return (s) => c.format(Y(s.fields));
|
|
1393
|
+
}
|
|
1394
|
+
const n = e.valueKind === "instant", i = !n && r.dateTime.timeStyle === "long" ? "medium" : r.dateTime.timeStyle, a = new Intl.DateTimeFormat(t.locale, {
|
|
1395
|
+
calendar: "gregory",
|
|
1396
|
+
timeZone: n || e.valueKind === "wall_datetime" && t.sourceTimezone ? t.calendarTimezone : "UTC",
|
|
1397
|
+
dateStyle: r.dateTime.dateStyle,
|
|
1398
|
+
timeStyle: i
|
|
1399
|
+
});
|
|
1400
|
+
return (c) => n ? a.format(c.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? a.format(Te(c.fields, t.sourceTimezone)) : a.format(Y(c.fields));
|
|
1401
|
+
}
|
|
1402
|
+
function te(e, t, r) {
|
|
1403
|
+
return {
|
|
1404
|
+
ok: !1,
|
|
1405
|
+
text: e,
|
|
1406
|
+
diagnostic: {
|
|
1407
|
+
code: r,
|
|
1408
|
+
message: `Raw temporal ${t.valueKind} value is ${r === "invalid_raw_temporal_value" ? "malformed" : "out of range"}.`
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
function pt(e) {
|
|
1413
|
+
const t = Ie(e.metadata), r = xe(e.format), n = r.presentation.mode === "auto" ? It(t, r) : _t(
|
|
1414
|
+
t,
|
|
1415
|
+
r,
|
|
1416
|
+
r.presentation.dialect,
|
|
1417
|
+
r.presentation.pattern
|
|
1418
|
+
);
|
|
1419
|
+
return (i) => {
|
|
1420
|
+
if (i === null)
|
|
1421
|
+
return { ok: !0, text: "", status: "empty" };
|
|
1422
|
+
const a = Tt(i, t.valueKind);
|
|
1423
|
+
return a.status === "invalid_shape" ? te(i, t, "invalid_raw_temporal_value") : a.status === "out_of_range" ? te(i, t, "out_of_range_raw_temporal_value") : { ok: !0, text: n(a), status: "formatted" };
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
function Gt(e) {
|
|
1427
|
+
return pt({
|
|
1428
|
+
metadata: e.metadata,
|
|
1429
|
+
format: e.format
|
|
1430
|
+
})(e.value);
|
|
1431
|
+
}
|
|
1432
|
+
export {
|
|
1433
|
+
Gt as A,
|
|
1434
|
+
it as B,
|
|
1435
|
+
fe as C,
|
|
1436
|
+
X as D,
|
|
1437
|
+
w as R,
|
|
1438
|
+
Et as a,
|
|
1439
|
+
U as b,
|
|
1440
|
+
ue as c,
|
|
1441
|
+
oe as d,
|
|
1442
|
+
le as e,
|
|
1443
|
+
Yt as f,
|
|
1444
|
+
me as g,
|
|
1445
|
+
Pt as h,
|
|
1446
|
+
pe as i,
|
|
1447
|
+
Ut as j,
|
|
1448
|
+
Oe as k,
|
|
1449
|
+
ce as l,
|
|
1450
|
+
Ot as m,
|
|
1451
|
+
Lt as n,
|
|
1452
|
+
xe as o,
|
|
1453
|
+
st as p,
|
|
1454
|
+
Rt as q,
|
|
1455
|
+
ut as r,
|
|
1456
|
+
yt as s,
|
|
1457
|
+
Ht as t,
|
|
1458
|
+
Zt as u,
|
|
1459
|
+
At as v,
|
|
1460
|
+
ht as w,
|
|
1461
|
+
Kt as x,
|
|
1462
|
+
Vt as y,
|
|
1463
|
+
pt as z
|
|
1464
|
+
};
|