react-semaphor 0.1.514 → 0.1.515
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/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +1 -1
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-BzPD50QD.cjs → dashboard-briefing-launcher-B7zqm8P1.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-e3s3MuSs.js → dashboard-briefing-launcher-BA_bl05p.js} +5 -5
- package/dist/chunks/{dashboard-controls-DAOABnks.js → dashboard-controls-QMW17RKx.js} +6 -6
- package/dist/chunks/{dashboard-controls-DQBfOqmC.cjs → dashboard-controls-x_v9wLOU.cjs} +1 -1
- package/dist/chunks/{dashboard-json-1jZycd5h.cjs → dashboard-json-0ZLLBlHj.cjs} +1 -1
- package/dist/chunks/{dashboard-json-S5Eq2GAg.js → dashboard-json-DRnpkNwO.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-Bkm0ciHG.js → edit-dashboard-visual-1ISjhwry.js} +1377 -1380
- package/dist/chunks/{edit-dashboard-visual-BwJ2Eljw.cjs → edit-dashboard-visual-CI0EqzKj.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-Bvv16QA-.js → editor-action-buttons-BTCKZERI.js} +3 -3
- package/dist/chunks/{editor-action-buttons-B2NCSsDw.cjs → editor-action-buttons-Czq5SnA9.cjs} +1 -1
- package/dist/chunks/{index-DhlVxvyI.cjs → index-BMMXKK3G.cjs} +1 -1
- package/dist/chunks/{index-DrOFJOCq.cjs → index-C6_xef4P.cjs} +147 -147
- package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
- package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
- package/dist/chunks/{index-nhUr9xBz.js → index-Dlic9KZs.js} +31494 -31379
- package/dist/chunks/{index-CnGVjyF8.js → index-v1OE4-eA.js} +2 -2
- package/dist/chunks/matrix-formatter-BdIsE7Qu.js +341 -0
- package/dist/chunks/matrix-formatter-Dajj91Ni.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-Dm9dUQsl.js → pivot-header-presentation-BIf4HW3L.js} +35 -36
- package/dist/chunks/{pivot-header-presentation-Cxz8-06f.cjs → pivot-header-presentation-B_N11CgN.cjs} +3 -3
- package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-CEmyU2At.js} +207 -148
- package/dist/chunks/pivot-result-lifecycle-vg_suUNb.cjs +1 -0
- package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-Bj6_w9cG.js} +471 -361
- package/dist/chunks/raw-temporal-CeblVJbu.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-DcLkVqni.cjs → report-preferences-dialog-Dr1BYwuf.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-B2fzQH1T.js → report-preferences-dialog-b8J6KjSy.js} +2 -2
- package/dist/chunks/semantic-format-DFI1iszk.cjs +1 -0
- package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-Dt-nUxFB.js} +23 -29
- package/dist/chunks/switch-Ced9ZZwI.cjs +134 -0
- package/dist/chunks/{switch-QfKb0Iwe.js → switch-D5_tjsIS.js} +3139 -3087
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +131 -126
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/visual/aggregated-table/utils/metric-format-resolver.d.ts +3 -3
- package/dist/types/components/visual/data-table/types/data-table.d.ts +4 -1
- package/dist/types/components/visual/pivot-table/utils/pivot-metric-formatting.d.ts +2 -2
- package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
- package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
- package/dist/types/shared/format-utils/formatters/duration-formatter.d.ts +4 -1
- package/dist/types/shared/format-utils/formatters/index.d.ts +2 -2
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
- package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
- package/package.json +1 -1
- package/dist/chunks/index-F25jnH0p.cjs +0 -1
- package/dist/chunks/matrix-formatter-BLunke3R.js +0 -424
- package/dist/chunks/matrix-formatter-CveLJo6S.cjs +0 -1
- package/dist/chunks/pivot-result-lifecycle-BiERyXnS.cjs +0 -1
- package/dist/chunks/raw-temporal-BUeTpG76.cjs +0 -1
- package/dist/chunks/semantic-format-BzH69TRq.cjs +0 -1
- package/dist/chunks/switch--Re1K566.cjs +0 -134
|
@@ -1,143 +1,240 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (e, t, r) =>
|
|
4
|
-
import { b8 as
|
|
5
|
-
import { canonicalizeSupportedLocale as
|
|
6
|
-
import { i as g, t as
|
|
7
|
-
import { p as
|
|
8
|
-
import { f as
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var ae = (e, t, r) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var b = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { b8 as p, b9 as ie, i as D } from "./validators-CkHsAvwB.js";
|
|
5
|
+
import { canonicalizeSupportedLocale as I, canonicalizeSupportedCurrencyCode as F } from "../value-format-preferences/index.js";
|
|
6
|
+
import { i as g, t as K } from "./temporal-bucket-B9hMwemw.js";
|
|
7
|
+
import { p as ce } from "./raw-temporal-contract-CFLGwTiI.js";
|
|
8
|
+
import { f as se } from "./index-C8w91oj4.js";
|
|
9
|
+
const O = [
|
|
10
|
+
"day",
|
|
11
|
+
"hour",
|
|
12
|
+
"minute",
|
|
13
|
+
"second",
|
|
14
|
+
"millisecond"
|
|
15
|
+
], k = {
|
|
16
|
+
day: 864e5,
|
|
17
|
+
hour: 36e5,
|
|
18
|
+
minute: 6e4,
|
|
19
|
+
second: 1e3,
|
|
20
|
+
millisecond: 1
|
|
21
|
+
}, ue = {
|
|
22
|
+
day: "d",
|
|
23
|
+
hour: "hr",
|
|
24
|
+
minute: "min",
|
|
25
|
+
second: "s",
|
|
26
|
+
millisecond: "ms"
|
|
27
|
+
}, me = {
|
|
28
|
+
day: ["day", "days"],
|
|
29
|
+
hour: ["hour", "hours"],
|
|
30
|
+
minute: ["minute", "minutes"],
|
|
31
|
+
second: ["second", "seconds"],
|
|
32
|
+
millisecond: ["millisecond", "milliseconds"]
|
|
33
|
+
};
|
|
34
|
+
function oe(e) {
|
|
35
|
+
return e === "day" || e === "hour" || e === "minute" || e === "second" || e === "millisecond";
|
|
36
|
+
}
|
|
37
|
+
function V(e, t) {
|
|
38
|
+
return oe(e) ? e : t;
|
|
39
|
+
}
|
|
40
|
+
function P(e, t) {
|
|
41
|
+
return O.indexOf(V(e, t));
|
|
42
|
+
}
|
|
43
|
+
function le(e, t) {
|
|
44
|
+
const r = P(e, "day"), n = P(t, "second"), i = Math.min(r, n), a = Math.max(r, n);
|
|
45
|
+
return O.slice(i, a + 1);
|
|
46
|
+
}
|
|
47
|
+
function fe(e, t) {
|
|
48
|
+
return e * k[V(t, "second")];
|
|
49
|
+
}
|
|
50
|
+
function de(e, t) {
|
|
51
|
+
const r = le(t.largestUnit, t.smallestUnit), n = r[r.length - 1], i = k[n];
|
|
52
|
+
let a = Math.round(e / i) * i;
|
|
53
|
+
return r.map((c) => {
|
|
54
|
+
const s = k[c], u = Math.floor(a / s);
|
|
55
|
+
return a -= u * s, { unit: c, value: u };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function ge(e, t) {
|
|
59
|
+
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;
|
|
60
|
+
return n.slice(0, i).map((a) => `${a.value}${ue[a.unit]}`).join(" ");
|
|
61
|
+
}
|
|
62
|
+
function ye(e, t) {
|
|
63
|
+
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;
|
|
64
|
+
return n.slice(0, i).map((a) => {
|
|
65
|
+
const [c, s] = me[a.unit];
|
|
66
|
+
return `${a.value} ${a.value === 1 ? c : s}`;
|
|
67
|
+
}).join(" ");
|
|
68
|
+
}
|
|
69
|
+
function he(e) {
|
|
70
|
+
const t = e.some(
|
|
71
|
+
(u) => u.unit === "day" && u.value !== 0
|
|
72
|
+
), 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);
|
|
73
|
+
if (c.length === 0)
|
|
74
|
+
return "0";
|
|
75
|
+
const s = c.map((u, l) => u.unit === "millisecond" ? String(u.value).padStart(3, "0") : l === 0 ? String(u.value) : String(u.value).padStart(2, "0")).join(":");
|
|
76
|
+
return r ? s.replace(/:(\d{3})$/, ".$1") : s;
|
|
77
|
+
}
|
|
78
|
+
function Se(e, t, r) {
|
|
79
|
+
const n = `${r.prefix || ""}${e}${r.suffix || ""}`;
|
|
80
|
+
return t ? r.negativeInParentheses ? `(${n})` : `-${n}` : n;
|
|
81
|
+
}
|
|
82
|
+
function xe(e, t = {}) {
|
|
83
|
+
if (e == null)
|
|
84
|
+
return "";
|
|
85
|
+
const r = typeof e == "number" ? e : typeof e == "string" && e.trim() ? Number(e) : NaN;
|
|
86
|
+
if (!Number.isFinite(r))
|
|
87
|
+
return "";
|
|
88
|
+
const n = t.inputUnit || "second", i = t.outputStyle === "digital" || t.outputStyle === "long" ? t.outputStyle : "compact", a = r < 0, c = Math.abs(fe(r, n)), s = de(c, t), u = i === "digital" ? he(s) : i === "long" ? ye(s, t.maxUnits) : ge(s, t.maxUnits);
|
|
89
|
+
return Se(u, a, t);
|
|
90
|
+
}
|
|
91
|
+
function G(e, t) {
|
|
92
|
+
return xe(
|
|
93
|
+
e !== null && typeof e == "object" ? e.value : e,
|
|
94
|
+
{
|
|
95
|
+
inputUnit: t.inputUnit,
|
|
96
|
+
outputStyle: t.outputStyle,
|
|
97
|
+
largestUnit: t.largestUnit,
|
|
98
|
+
smallestUnit: t.smallestUnit,
|
|
99
|
+
maxUnits: t.maxUnits,
|
|
100
|
+
prefix: t.prefix,
|
|
101
|
+
suffix: t.suffix,
|
|
102
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
let C;
|
|
107
|
+
function R(e, t) {
|
|
11
108
|
const r = e.format;
|
|
12
109
|
return r(t);
|
|
13
110
|
}
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
111
|
+
function we(e, t) {
|
|
112
|
+
if (C ?? (C = R(
|
|
16
113
|
new Intl.NumberFormat("en-US", { useGrouping: !1, maximumFractionDigits: 6 }),
|
|
17
114
|
"9007199254740993.000009"
|
|
18
|
-
) === "9007199254740993.000009"), !
|
|
115
|
+
) === "9007199254740993.000009"), !C)
|
|
19
116
|
throw new RangeError("This runtime cannot format exact decimal strings.");
|
|
20
117
|
const r = Number(e);
|
|
21
118
|
if (!Number.isFinite(r) || r === 0 && e !== "0")
|
|
22
119
|
throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");
|
|
23
|
-
return
|
|
120
|
+
return R(t, e);
|
|
24
121
|
}
|
|
25
|
-
function
|
|
122
|
+
function _(e) {
|
|
26
123
|
return typeof e == "number" ? e < 0 : e.value.startsWith("-");
|
|
27
124
|
}
|
|
28
|
-
function
|
|
29
|
-
return typeof e == "number" ? Math.abs(e) :
|
|
125
|
+
function T(e) {
|
|
126
|
+
return typeof e == "number" ? Math.abs(e) : _(e) ? { ...e, value: e.value.slice(1) } : e;
|
|
30
127
|
}
|
|
31
|
-
function
|
|
128
|
+
function Z(e, t) {
|
|
32
129
|
return typeof e == "number" ? e * t : {
|
|
33
130
|
kind: "exact_number",
|
|
34
131
|
type: "decimal",
|
|
35
|
-
value:
|
|
132
|
+
value: p(e.value, t)
|
|
36
133
|
};
|
|
37
134
|
}
|
|
38
|
-
function
|
|
135
|
+
function N(e, t) {
|
|
39
136
|
return t === 0 ? e : typeof e == "number" ? e / 10 ** t : {
|
|
40
137
|
kind: "exact_number",
|
|
41
138
|
type: "decimal",
|
|
42
|
-
value:
|
|
139
|
+
value: p(e.value, `1e-${t}`)
|
|
43
140
|
};
|
|
44
141
|
}
|
|
45
142
|
function h(e, t) {
|
|
46
|
-
return typeof e == "number" ? t.format(e) :
|
|
143
|
+
return typeof e == "number" ? t.format(e) : we(e.value, t);
|
|
47
144
|
}
|
|
48
|
-
function
|
|
145
|
+
function A(e) {
|
|
49
146
|
if (!e) return !1;
|
|
50
147
|
const t = e.toLowerCase().replace("_", "-");
|
|
51
148
|
return t === "en-in" || t.startsWith("en-in-");
|
|
52
149
|
}
|
|
53
|
-
function
|
|
54
|
-
const r =
|
|
55
|
-
return
|
|
150
|
+
function L(e, t) {
|
|
151
|
+
const r = T(e), n = (i) => typeof r == "number" ? r >= i : ie(r.value, String(i)) >= 0;
|
|
152
|
+
return n(1e12) ? { power: 12, suffix: "T" } : n(1e9) ? { power: 9, suffix: "B" } : A(t) && n(1e7) ? { power: 7, suffix: "Cr" } : n(1e6) ? { power: 6, suffix: "M" } : A(t) && n(1e5) ? { power: 5, suffix: "L" } : n(1e3) ? { power: 3, suffix: "K" } : { power: 0, suffix: "" };
|
|
56
153
|
}
|
|
57
|
-
function
|
|
154
|
+
function z(e, t) {
|
|
58
155
|
try {
|
|
59
|
-
const r =
|
|
60
|
-
return
|
|
156
|
+
const r = x(t);
|
|
157
|
+
return L(e, r);
|
|
61
158
|
} catch {
|
|
62
|
-
return
|
|
159
|
+
return L(e, "en-US");
|
|
63
160
|
}
|
|
64
161
|
}
|
|
65
|
-
function
|
|
162
|
+
function ve(e) {
|
|
66
163
|
try {
|
|
67
164
|
return new Intl.NumberFormat(e), !0;
|
|
68
165
|
} catch {
|
|
69
166
|
return !1;
|
|
70
167
|
}
|
|
71
168
|
}
|
|
72
|
-
function
|
|
73
|
-
return e &&
|
|
169
|
+
function x(e) {
|
|
170
|
+
return e && ve(e) ? e : "en-US";
|
|
74
171
|
}
|
|
75
|
-
function
|
|
172
|
+
function E(e, t) {
|
|
76
173
|
if (e == null || Number.isNaN(e))
|
|
77
174
|
return "";
|
|
78
|
-
const r =
|
|
79
|
-
let
|
|
80
|
-
if (t != null && t.multiplyBy && (
|
|
81
|
-
const { power:
|
|
82
|
-
|
|
83
|
-
const
|
|
175
|
+
const r = x(t == null ? void 0 : t.locale);
|
|
176
|
+
let n = e;
|
|
177
|
+
if (t != null && t.multiplyBy && (n = Z(n, t.multiplyBy)), t != null && t.useSuffix) {
|
|
178
|
+
const { power: a, suffix: c } = z(n, r);
|
|
179
|
+
n = N(n, a);
|
|
180
|
+
const s = h(n, new Intl.NumberFormat(r, {
|
|
84
181
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
85
182
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
86
183
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
87
184
|
}));
|
|
88
|
-
return `${(t == null ? void 0 : t.prefix) ?? ""}${
|
|
185
|
+
return `${(t == null ? void 0 : t.prefix) ?? ""}${s}${c}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
89
186
|
}
|
|
90
|
-
const i = h(
|
|
187
|
+
const i = h(n, new Intl.NumberFormat(r, {
|
|
91
188
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
92
189
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
93
190
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
94
191
|
}));
|
|
95
|
-
if (t != null && t.negativeInParentheses &&
|
|
96
|
-
const
|
|
97
|
-
return `(${(t == null ? void 0 : t.prefix) ?? ""}${
|
|
192
|
+
if (t != null && t.negativeInParentheses && _(n)) {
|
|
193
|
+
const a = i.replace("-", "");
|
|
194
|
+
return `(${(t == null ? void 0 : t.prefix) ?? ""}${a}${(t == null ? void 0 : t.suffix) ?? ""})`;
|
|
98
195
|
}
|
|
99
196
|
return `${(t == null ? void 0 : t.prefix) ?? ""}${i}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
100
197
|
}
|
|
101
|
-
function
|
|
198
|
+
function j(e, t) {
|
|
102
199
|
if (e == null || Number.isNaN(e))
|
|
103
200
|
return "";
|
|
104
|
-
const r =
|
|
201
|
+
const r = x(t == null ? void 0 : t.locale), n = (t == null ? void 0 : t.currency) || "USD", i = _(e), a = !!(t != null && t.negativeInParentheses && i), c = a ? T(e) : e;
|
|
105
202
|
try {
|
|
106
203
|
if (t != null && t.useSuffix) {
|
|
107
|
-
const { power:
|
|
204
|
+
const { power: u, suffix: l } = z(c, r), m = N(c, u), d = `${h(m, new Intl.NumberFormat(r, {
|
|
108
205
|
style: "currency",
|
|
109
|
-
currency:
|
|
206
|
+
currency: n,
|
|
110
207
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
111
208
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
112
209
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
113
|
-
}))}${
|
|
114
|
-
return
|
|
210
|
+
}))}${l}`;
|
|
211
|
+
return a ? `(${d})` : d;
|
|
115
212
|
}
|
|
116
|
-
const
|
|
213
|
+
const s = h(c, new Intl.NumberFormat(r, {
|
|
117
214
|
style: "currency",
|
|
118
|
-
currency:
|
|
215
|
+
currency: n,
|
|
119
216
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
120
217
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
121
218
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
122
219
|
}));
|
|
123
|
-
return
|
|
220
|
+
return a ? `(${s})` : s;
|
|
124
221
|
} catch {
|
|
125
|
-
const
|
|
126
|
-
|
|
222
|
+
const s = T(e), u = t != null && t.useSuffix ? z(s, r) : { power: 0, suffix: "" }, l = E(
|
|
223
|
+
N(s, u.power),
|
|
127
224
|
{
|
|
128
225
|
locale: r,
|
|
129
226
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
130
227
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
131
228
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
132
229
|
}
|
|
133
|
-
),
|
|
134
|
-
return i ? t != null && t.negativeInParentheses ? `(${
|
|
230
|
+
), m = `${n} ${l}${u.suffix}`;
|
|
231
|
+
return i ? t != null && t.negativeInParentheses ? `(${m})` : `-${m}` : m;
|
|
135
232
|
}
|
|
136
233
|
}
|
|
137
|
-
function
|
|
234
|
+
function q(e, t) {
|
|
138
235
|
if (e == null || Number.isNaN(e))
|
|
139
236
|
return "";
|
|
140
|
-
const r =
|
|
237
|
+
const r = x(t == null ? void 0 : t.locale), i = (t == null ? void 0 : t.alreadyPercent) ?? (t == null ? void 0 : t.percentValueMode) === "whole" ? N(e, 2) : e;
|
|
141
238
|
return h(i, new Intl.NumberFormat(r, {
|
|
142
239
|
style: "percent",
|
|
143
240
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
@@ -145,20 +242,20 @@ function p(e, t) {
|
|
|
145
242
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
146
243
|
}));
|
|
147
244
|
}
|
|
148
|
-
function
|
|
245
|
+
function B(e, t) {
|
|
149
246
|
if (e == null || Number.isNaN(e))
|
|
150
247
|
return "";
|
|
151
|
-
const r =
|
|
248
|
+
const r = x(t == null ? void 0 : t.locale);
|
|
152
249
|
return h(e, new Intl.NumberFormat(r, {
|
|
153
250
|
notation: "scientific",
|
|
154
251
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
155
252
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2
|
|
156
253
|
}));
|
|
157
254
|
}
|
|
158
|
-
function
|
|
255
|
+
function H(e, t) {
|
|
159
256
|
if (e == null || Number.isNaN(e))
|
|
160
257
|
return "";
|
|
161
|
-
const r = t.scale === void 0 ? e :
|
|
258
|
+
const r = t.scale === void 0 ? e : Z(e, t.scale), n = t.negativeStyle === "parentheses" && _(r), i = n ? T(r) : r, a = {
|
|
162
259
|
style: t.type === "number" ? "decimal" : t.type,
|
|
163
260
|
locale: t.locale,
|
|
164
261
|
currency: t.currency,
|
|
@@ -171,36 +268,46 @@ function ne(e, t) {
|
|
|
171
268
|
let c;
|
|
172
269
|
switch (t.type) {
|
|
173
270
|
case "currency":
|
|
174
|
-
c =
|
|
271
|
+
c = j(i, a);
|
|
175
272
|
break;
|
|
176
273
|
case "percent":
|
|
177
|
-
c =
|
|
274
|
+
c = q(i, a);
|
|
178
275
|
break;
|
|
179
276
|
case "scientific":
|
|
180
|
-
c =
|
|
277
|
+
c = B(i, a);
|
|
181
278
|
break;
|
|
182
279
|
default:
|
|
183
|
-
c =
|
|
280
|
+
c = E(i, a);
|
|
184
281
|
break;
|
|
185
282
|
}
|
|
186
|
-
const
|
|
187
|
-
return
|
|
283
|
+
const s = `${t.prefix ?? ""}${c}${t.suffix ?? ""}`;
|
|
284
|
+
return n ? `(${s})` : s;
|
|
188
285
|
}
|
|
189
|
-
function
|
|
286
|
+
function Ye(e, t) {
|
|
287
|
+
return t.type === "duration" ? e == null ? "" : G(e, t) : H(e, t);
|
|
288
|
+
}
|
|
289
|
+
function Xe(e, t, r = "en-US") {
|
|
190
290
|
if (e == null || typeof e == "number" && isNaN(e))
|
|
191
291
|
return "";
|
|
192
|
-
|
|
193
|
-
|
|
292
|
+
if ((t == null ? void 0 : t.style) === "duration")
|
|
293
|
+
return G(e, {
|
|
294
|
+
...t.duration,
|
|
295
|
+
prefix: t.prefix,
|
|
296
|
+
suffix: t.suffix,
|
|
297
|
+
negativeStyle: t.negativeStyle
|
|
298
|
+
});
|
|
299
|
+
const n = x((t == null ? void 0 : t.locale) || r), i = (t == null ? void 0 : t.style) || "decimal", a = i === "decimal" ? "number" : i;
|
|
300
|
+
return a === "currency" && new Intl.NumberFormat(n, {
|
|
194
301
|
style: "currency",
|
|
195
302
|
currency: (t == null ? void 0 : t.currency) || "USD"
|
|
196
|
-
}),
|
|
197
|
-
type:
|
|
198
|
-
locale:
|
|
199
|
-
currency:
|
|
303
|
+
}), H(e, {
|
|
304
|
+
type: a,
|
|
305
|
+
locale: n,
|
|
306
|
+
currency: a === "currency" ? (t == null ? void 0 : t.currency) || "USD" : void 0,
|
|
200
307
|
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
201
308
|
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
202
309
|
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0,
|
|
203
|
-
percentValueMode:
|
|
310
|
+
percentValueMode: a === "percent" ? (t == null ? void 0 : t.percentValueMode) ?? "whole" : void 0,
|
|
204
311
|
scale: t == null ? void 0 : t.scale,
|
|
205
312
|
compact: t == null ? void 0 : t.compact,
|
|
206
313
|
negativeStyle: t == null ? void 0 : t.negativeStyle,
|
|
@@ -208,8 +315,8 @@ function Ce(e, t, r = "en-US") {
|
|
|
208
315
|
suffix: t == null ? void 0 : t.suffix
|
|
209
316
|
});
|
|
210
317
|
}
|
|
211
|
-
function
|
|
212
|
-
const
|
|
318
|
+
function We(e, t, r) {
|
|
319
|
+
const n = {
|
|
213
320
|
style: t === "currency" ? "currency" : t === "percent" ? "percent" : "decimal",
|
|
214
321
|
locale: r == null ? void 0 : r.locale,
|
|
215
322
|
currency: r == null ? void 0 : r.currency,
|
|
@@ -223,16 +330,16 @@ function Pe(e, t, r) {
|
|
|
223
330
|
};
|
|
224
331
|
switch (t) {
|
|
225
332
|
case "currency":
|
|
226
|
-
return
|
|
333
|
+
return j(e, n);
|
|
227
334
|
case "percent":
|
|
228
|
-
return
|
|
335
|
+
return q(e, n);
|
|
229
336
|
case "scientific":
|
|
230
|
-
return
|
|
337
|
+
return B(e, n);
|
|
231
338
|
default:
|
|
232
|
-
return
|
|
339
|
+
return E(e, n);
|
|
233
340
|
}
|
|
234
341
|
}
|
|
235
|
-
const
|
|
342
|
+
const De = [
|
|
236
343
|
"type",
|
|
237
344
|
"locale",
|
|
238
345
|
"minimumFractionDigits",
|
|
@@ -246,30 +353,30 @@ const ie = [
|
|
|
246
353
|
"currency",
|
|
247
354
|
"percentValueMode"
|
|
248
355
|
];
|
|
249
|
-
function
|
|
356
|
+
function Te(e) {
|
|
250
357
|
if (!g(e))
|
|
251
358
|
return {
|
|
252
359
|
ok: !1,
|
|
253
360
|
issues: [{ path: "$", message: "Numeric format must be an object." }]
|
|
254
361
|
};
|
|
255
|
-
const t = [], r = new Set(
|
|
256
|
-
Object.keys(e).filter((
|
|
257
|
-
(
|
|
362
|
+
const t = [], r = new Set(De);
|
|
363
|
+
Object.keys(e).filter((a) => !r.has(a)).forEach(
|
|
364
|
+
(a) => t.push({ path: a, message: `Unknown property "${a}".` })
|
|
258
365
|
), e.type !== "number" && e.type !== "currency" && e.type !== "percent" && e.type !== "scientific" && t.push({
|
|
259
366
|
path: "type",
|
|
260
367
|
message: "Expected number, currency, percent, or scientific."
|
|
261
368
|
});
|
|
262
|
-
const
|
|
263
|
-
e.locale !== void 0 && !
|
|
264
|
-
const i = e.currency === void 0 ? void 0 :
|
|
369
|
+
const n = e.locale === void 0 ? void 0 : I(e.locale);
|
|
370
|
+
e.locale !== void 0 && !n && t.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
|
|
371
|
+
const i = e.currency === void 0 ? void 0 : F(e.currency);
|
|
265
372
|
e.currency !== void 0 && !i && t.push({
|
|
266
373
|
path: "currency",
|
|
267
374
|
message: "Expected a supported ISO 4217 currency code."
|
|
268
375
|
});
|
|
269
|
-
for (const
|
|
270
|
-
const c = e[
|
|
376
|
+
for (const a of ["minimumFractionDigits", "maximumFractionDigits"]) {
|
|
377
|
+
const c = e[a];
|
|
271
378
|
c !== void 0 && (!Number.isInteger(c) || typeof c != "number" || c < 0 || c > 20) && t.push({
|
|
272
|
-
path:
|
|
379
|
+
path: a,
|
|
273
380
|
message: "Expected an integer from 0 to 20."
|
|
274
381
|
});
|
|
275
382
|
}
|
|
@@ -277,10 +384,10 @@ function ce(e) {
|
|
|
277
384
|
path: "maximumFractionDigits",
|
|
278
385
|
message: "Must be greater than or equal to minimumFractionDigits."
|
|
279
386
|
});
|
|
280
|
-
for (const
|
|
281
|
-
e[
|
|
282
|
-
for (const
|
|
283
|
-
e[
|
|
387
|
+
for (const a of ["useGrouping", "compact"])
|
|
388
|
+
e[a] !== void 0 && typeof e[a] != "boolean" && t.push({ path: a, message: "Expected a boolean." });
|
|
389
|
+
for (const a of ["prefix", "suffix"])
|
|
390
|
+
e[a] !== void 0 && typeof e[a] != "string" && t.push({ path: a, message: "Expected a string." });
|
|
284
391
|
return e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && t.push({
|
|
285
392
|
path: "negativeStyle",
|
|
286
393
|
message: "Expected minus or parentheses."
|
|
@@ -291,7 +398,7 @@ function ce(e) {
|
|
|
291
398
|
ok: !0,
|
|
292
399
|
value: {
|
|
293
400
|
type: e.type,
|
|
294
|
-
...
|
|
401
|
+
...n ? { locale: n } : {},
|
|
295
402
|
...e.minimumFractionDigits !== void 0 ? { minimumFractionDigits: e.minimumFractionDigits } : {},
|
|
296
403
|
...e.maximumFractionDigits !== void 0 ? { maximumFractionDigits: e.maximumFractionDigits } : {},
|
|
297
404
|
...e.useGrouping !== void 0 ? { useGrouping: e.useGrouping } : {},
|
|
@@ -309,8 +416,8 @@ function ce(e) {
|
|
|
309
416
|
}
|
|
310
417
|
};
|
|
311
418
|
}
|
|
312
|
-
function
|
|
313
|
-
const t =
|
|
419
|
+
function Qe(e) {
|
|
420
|
+
const t = Te(e);
|
|
314
421
|
if (!t.ok)
|
|
315
422
|
return t;
|
|
316
423
|
const r = [];
|
|
@@ -328,32 +435,32 @@ function Re(e) {
|
|
|
328
435
|
message: "Resolved currency formats require an explicit currency."
|
|
329
436
|
}), r.length > 0 ? { ok: !1, issues: r } : t;
|
|
330
437
|
}
|
|
331
|
-
function
|
|
332
|
-
var
|
|
438
|
+
function Je(e) {
|
|
439
|
+
var n;
|
|
333
440
|
const t = /* @__PURE__ */ new Set();
|
|
334
|
-
if (e.snapshot.resolvedFormats.forEach((i,
|
|
441
|
+
if (e.snapshot.resolvedFormats.forEach((i, a) => {
|
|
335
442
|
if (i.format.type !== "temporal_bucket") {
|
|
336
443
|
if (i.scope.attachmentIndex !== void 0)
|
|
337
444
|
throw new Error(
|
|
338
|
-
`resolvedFormats.${
|
|
445
|
+
`resolvedFormats.${a}.scope.attachmentIndex is not valid for a card export`
|
|
339
446
|
);
|
|
340
447
|
if (i.scope.dashboardId !== e.expectedScope.dashboardId || i.scope.cardId !== e.expectedScope.cardId)
|
|
341
448
|
throw new Error(
|
|
342
|
-
`resolvedFormats.${
|
|
449
|
+
`resolvedFormats.${a}.scope must match the executing dashboard/card`
|
|
343
450
|
);
|
|
344
451
|
if (i.target.kind !== "column")
|
|
345
452
|
throw new Error(
|
|
346
|
-
`resolvedFormats.${
|
|
453
|
+
`resolvedFormats.${a}.target must identify an export column`
|
|
347
454
|
);
|
|
348
455
|
if (t.has(i.target.columnKey))
|
|
349
456
|
throw new Error(
|
|
350
|
-
`resolvedFormats.${
|
|
457
|
+
`resolvedFormats.${a} duplicates export column "${i.target.columnKey}"`
|
|
351
458
|
);
|
|
352
459
|
t.add(i.target.columnKey);
|
|
353
460
|
}
|
|
354
461
|
}), !e.useFormattedValues)
|
|
355
462
|
return;
|
|
356
|
-
if (!((
|
|
463
|
+
if (!((n = e.visibleColumns) != null && n.length))
|
|
357
464
|
throw new Error(
|
|
358
465
|
"visibleColumns must identify every formatted export column"
|
|
359
466
|
);
|
|
@@ -365,7 +472,7 @@ function Ae(e) {
|
|
|
365
472
|
`resolvedFormats is missing visible export column "${r}"`
|
|
366
473
|
);
|
|
367
474
|
}
|
|
368
|
-
function
|
|
475
|
+
function Ne(e, t) {
|
|
369
476
|
const r = new Intl.NumberFormat(e, {
|
|
370
477
|
style: "currency",
|
|
371
478
|
currency: t
|
|
@@ -375,7 +482,7 @@ function se(e, t) {
|
|
|
375
482
|
maximumFractionDigits: r.maximumFractionDigits
|
|
376
483
|
};
|
|
377
484
|
}
|
|
378
|
-
function
|
|
485
|
+
function _e(e) {
|
|
379
486
|
if (e.minimumFractionDigits !== void 0 || e.maximumFractionDigits !== void 0) {
|
|
380
487
|
const r = e.minimumFractionDigits ?? 0;
|
|
381
488
|
return {
|
|
@@ -389,41 +496,41 @@ function me(e) {
|
|
|
389
496
|
maximumFractionDigits: t
|
|
390
497
|
};
|
|
391
498
|
}
|
|
392
|
-
function
|
|
393
|
-
const
|
|
499
|
+
function et(e, t, r) {
|
|
500
|
+
const n = I(e.locale) ?? t.locale, i = e.type === "number" || e.type === "currency" ? F(r) : void 0;
|
|
394
501
|
if (!(e.type === "currency" || i !== void 0))
|
|
395
502
|
return {
|
|
396
503
|
...e,
|
|
397
|
-
locale:
|
|
398
|
-
...
|
|
504
|
+
locale: n,
|
|
505
|
+
..._e(e)
|
|
399
506
|
};
|
|
400
|
-
const c = i ??
|
|
401
|
-
|
|
507
|
+
const c = i ?? F(e.currency) ?? t.defaultCurrency, s = Ne(
|
|
508
|
+
n,
|
|
402
509
|
c
|
|
403
|
-
),
|
|
404
|
-
|
|
405
|
-
e.maximumFractionDigits ??
|
|
510
|
+
), u = s.minimumFractionDigits ?? 0, l = s.maximumFractionDigits ?? u, m = e.minimumFractionDigits ?? Math.min(
|
|
511
|
+
u,
|
|
512
|
+
e.maximumFractionDigits ?? u
|
|
406
513
|
), f = e.maximumFractionDigits ?? Math.max(
|
|
407
|
-
|
|
408
|
-
|
|
514
|
+
m,
|
|
515
|
+
l
|
|
409
516
|
);
|
|
410
517
|
return {
|
|
411
518
|
...e,
|
|
412
519
|
type: "currency",
|
|
413
|
-
locale:
|
|
520
|
+
locale: n,
|
|
414
521
|
currency: c,
|
|
415
|
-
minimumFractionDigits:
|
|
522
|
+
minimumFractionDigits: m,
|
|
416
523
|
maximumFractionDigits: f
|
|
417
524
|
};
|
|
418
525
|
}
|
|
419
526
|
class S extends Error {
|
|
420
|
-
constructor(r,
|
|
421
|
-
super(
|
|
527
|
+
constructor(r, n) {
|
|
528
|
+
super(n);
|
|
422
529
|
b(this, "code");
|
|
423
530
|
this.name = "RawTemporalFormatContractError", this.code = r;
|
|
424
531
|
}
|
|
425
532
|
}
|
|
426
|
-
const
|
|
533
|
+
const Me = [
|
|
427
534
|
"SSSSSSSSS",
|
|
428
535
|
"SSSSSSSS",
|
|
429
536
|
"SSSSSSS",
|
|
@@ -433,7 +540,7 @@ const ue = [
|
|
|
433
540
|
"SSS",
|
|
434
541
|
"SS",
|
|
435
542
|
"S"
|
|
436
|
-
],
|
|
543
|
+
], Y = /^(\d{4})-(\d{2})-(\d{2})$/, X = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, W = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/, Fe = [
|
|
437
544
|
"yyyy",
|
|
438
545
|
"MMMM",
|
|
439
546
|
"LLLL",
|
|
@@ -455,7 +562,7 @@ const ue = [
|
|
|
455
562
|
"m",
|
|
456
563
|
"s",
|
|
457
564
|
"a"
|
|
458
|
-
],
|
|
565
|
+
], ke = /* @__PURE__ */ new Set([
|
|
459
566
|
"HH",
|
|
460
567
|
"H",
|
|
461
568
|
"hh",
|
|
@@ -465,90 +572,90 @@ const ue = [
|
|
|
465
572
|
"ss",
|
|
466
573
|
"s",
|
|
467
574
|
"a",
|
|
468
|
-
...
|
|
469
|
-
]),
|
|
575
|
+
...Me
|
|
576
|
+
]), ze = /* @__PURE__ */ new Set(["zzz", "XXX"]), M = /* @__PURE__ */ new Set(["short", "medium", "long"]);
|
|
470
577
|
function y(e, t) {
|
|
471
|
-
return Object.keys(e).length === t.length && t.every((
|
|
578
|
+
return Object.keys(e).length === t.length && t.every((n) => n in e);
|
|
472
579
|
}
|
|
473
|
-
function
|
|
580
|
+
function o(e) {
|
|
474
581
|
throw new S(
|
|
475
582
|
"invalid_raw_temporal_format",
|
|
476
583
|
e
|
|
477
584
|
);
|
|
478
585
|
}
|
|
479
|
-
function
|
|
586
|
+
function Q(e) {
|
|
480
587
|
if (!e || e.trim() !== e || e.length > 256)
|
|
481
|
-
return
|
|
588
|
+
return o(
|
|
482
589
|
"date_fns patterns must be non-empty, trimmed, and at most 256 characters."
|
|
483
590
|
);
|
|
484
591
|
const t = [], r = (i) => {
|
|
485
|
-
const
|
|
486
|
-
(
|
|
592
|
+
const a = t[t.length - 1];
|
|
593
|
+
(a == null ? void 0 : a.kind) === "literal" ? a.value += i : t.push({ kind: "literal", value: i });
|
|
487
594
|
};
|
|
488
|
-
let
|
|
489
|
-
for (;
|
|
490
|
-
if (e[
|
|
491
|
-
if (e[
|
|
492
|
-
r("'"),
|
|
595
|
+
let n = 0;
|
|
596
|
+
for (; n < e.length; ) {
|
|
597
|
+
if (e[n] === "'") {
|
|
598
|
+
if (e[n + 1] === "'") {
|
|
599
|
+
r("'"), n += 2;
|
|
493
600
|
continue;
|
|
494
601
|
}
|
|
495
|
-
let c = "",
|
|
496
|
-
for (
|
|
497
|
-
if (e[
|
|
498
|
-
if (e[
|
|
499
|
-
c += "'",
|
|
602
|
+
let c = "", s = !1;
|
|
603
|
+
for (n += 1; n < e.length; ) {
|
|
604
|
+
if (e[n] === "'") {
|
|
605
|
+
if (e[n + 1] === "'") {
|
|
606
|
+
c += "'", n += 2;
|
|
500
607
|
continue;
|
|
501
608
|
}
|
|
502
|
-
|
|
609
|
+
s = !0, n += 1;
|
|
503
610
|
break;
|
|
504
611
|
}
|
|
505
|
-
c += e[
|
|
612
|
+
c += e[n], n += 1;
|
|
506
613
|
}
|
|
507
|
-
if (!
|
|
508
|
-
return
|
|
614
|
+
if (!s)
|
|
615
|
+
return o("date_fns pattern has an unclosed quote.");
|
|
509
616
|
r(c);
|
|
510
617
|
continue;
|
|
511
618
|
}
|
|
512
|
-
if (e[
|
|
513
|
-
let c =
|
|
619
|
+
if (e[n] === "S") {
|
|
620
|
+
let c = n + 1;
|
|
514
621
|
for (; e[c] === "S"; ) c += 1;
|
|
515
|
-
const
|
|
516
|
-
if (
|
|
517
|
-
return
|
|
622
|
+
const s = e.slice(n, c);
|
|
623
|
+
if (s.length > 9)
|
|
624
|
+
return o(
|
|
518
625
|
"date_fns fractional-second tokens support at most nine digits."
|
|
519
626
|
);
|
|
520
627
|
t.push({
|
|
521
628
|
kind: "token",
|
|
522
|
-
value:
|
|
523
|
-
}),
|
|
629
|
+
value: s
|
|
630
|
+
}), n = c;
|
|
524
631
|
continue;
|
|
525
632
|
}
|
|
526
|
-
const i =
|
|
527
|
-
(c) => e.startsWith(c,
|
|
633
|
+
const i = Fe.find(
|
|
634
|
+
(c) => e.startsWith(c, n)
|
|
528
635
|
);
|
|
529
636
|
if (i) {
|
|
530
|
-
t.push({ kind: "token", value: i }),
|
|
637
|
+
t.push({ kind: "token", value: i }), n += i.length;
|
|
531
638
|
continue;
|
|
532
639
|
}
|
|
533
|
-
const
|
|
534
|
-
if (/[A-Za-z]/.test(
|
|
535
|
-
return
|
|
536
|
-
`Unsupported date_fns pattern token beginning at "${e.slice(
|
|
640
|
+
const a = e[n];
|
|
641
|
+
if (/[A-Za-z]/.test(a))
|
|
642
|
+
return o(
|
|
643
|
+
`Unsupported date_fns pattern token beginning at "${e.slice(n)}".`
|
|
537
644
|
);
|
|
538
|
-
r(
|
|
645
|
+
r(a), n += 1;
|
|
539
646
|
}
|
|
540
|
-
return t.some((i) => i.kind === "token") ? t :
|
|
647
|
+
return t.some((i) => i.kind === "token") ? t : o("date_fns patterns must contain at least one token.");
|
|
541
648
|
}
|
|
542
|
-
function
|
|
649
|
+
function J(e, t) {
|
|
543
650
|
if (e === "semaphor_tokens") {
|
|
544
|
-
const r =
|
|
545
|
-
r.ok ||
|
|
651
|
+
const r = K(t);
|
|
652
|
+
r.ok || o(r.message);
|
|
546
653
|
return;
|
|
547
654
|
}
|
|
548
|
-
|
|
655
|
+
Q(t);
|
|
549
656
|
}
|
|
550
|
-
function
|
|
551
|
-
return !g(e) || !y(e, ["dateStyle", "dateTime"]) ?
|
|
657
|
+
function $e(e) {
|
|
658
|
+
return !g(e) || !y(e, ["dateStyle", "dateTime"]) ? o("Automatic raw temporal styles are incomplete.") : M.has(e.dateStyle) ? !g(e.dateTime) || !y(e.dateTime, ["dateStyle", "timeStyle"]) || !M.has(e.dateTime.dateStyle) || !M.has(e.dateTime.timeStyle) ? o(
|
|
552
659
|
"Automatic dateTime styles are incomplete or invalid."
|
|
553
660
|
) : {
|
|
554
661
|
dateStyle: e.dateStyle,
|
|
@@ -556,33 +663,33 @@ function de(e) {
|
|
|
556
663
|
dateStyle: e.dateTime.dateStyle,
|
|
557
664
|
timeStyle: e.dateTime.timeStyle
|
|
558
665
|
}
|
|
559
|
-
} :
|
|
666
|
+
} : o("Automatic dateStyle is invalid.");
|
|
560
667
|
}
|
|
561
|
-
function
|
|
668
|
+
function ee(e) {
|
|
562
669
|
const t = ["type", "locale", "calendarTimezone", "presentation"], r = [...t, "sourceTimezone"];
|
|
563
670
|
if (!g(e) || !y(e, t) && !y(e, r) || e.type !== "raw_temporal")
|
|
564
|
-
return
|
|
565
|
-
const
|
|
566
|
-
return
|
|
671
|
+
return o("Resolved raw temporal format has an invalid shape.");
|
|
672
|
+
const n = I(e.locale);
|
|
673
|
+
return n ? typeof e.calendarTimezone != "string" || !D(e.calendarTimezone) ? o(
|
|
567
674
|
"Raw temporal calendarTimezone must be a valid IANA timezone."
|
|
568
|
-
) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !
|
|
675
|
+
) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !D(e.sourceTimezone)) ? o(
|
|
569
676
|
"Raw temporal sourceTimezone must be a valid IANA timezone."
|
|
570
677
|
) : g(e.presentation) ? e.presentation.mode === "auto" ? y(e.presentation, ["mode", "styles"]) ? {
|
|
571
678
|
type: "raw_temporal",
|
|
572
|
-
locale:
|
|
679
|
+
locale: n,
|
|
573
680
|
calendarTimezone: e.calendarTimezone,
|
|
574
681
|
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
575
682
|
presentation: {
|
|
576
683
|
mode: "auto",
|
|
577
|
-
styles:
|
|
684
|
+
styles: $e(e.presentation.styles)
|
|
578
685
|
}
|
|
579
|
-
} :
|
|
686
|
+
} : o(
|
|
580
687
|
"Automatic raw temporal presentation has unknown fields."
|
|
581
|
-
) : e.presentation.mode !== "pattern" || !y(e.presentation, ["mode", "dialect", "pattern"]) || e.presentation.dialect !== "semaphor_tokens" && e.presentation.dialect !== "date_fns" || typeof e.presentation.pattern != "string" ?
|
|
688
|
+
) : e.presentation.mode !== "pattern" || !y(e.presentation, ["mode", "dialect", "pattern"]) || e.presentation.dialect !== "semaphor_tokens" && e.presentation.dialect !== "date_fns" || typeof e.presentation.pattern != "string" ? o(
|
|
582
689
|
"Pattern raw temporal presentation has an invalid shape."
|
|
583
|
-
) : (
|
|
690
|
+
) : (J(e.presentation.dialect, e.presentation.pattern), {
|
|
584
691
|
type: "raw_temporal",
|
|
585
|
-
locale:
|
|
692
|
+
locale: n,
|
|
586
693
|
calendarTimezone: e.calendarTimezone,
|
|
587
694
|
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
588
695
|
presentation: {
|
|
@@ -590,45 +697,45 @@ function H(e) {
|
|
|
590
697
|
dialect: e.presentation.dialect,
|
|
591
698
|
pattern: e.presentation.pattern
|
|
592
699
|
}
|
|
593
|
-
}) :
|
|
700
|
+
}) : o("Raw temporal presentation must be an object.") : o("Raw temporal locale is invalid or unsupported.");
|
|
594
701
|
}
|
|
595
|
-
function
|
|
596
|
-
var
|
|
702
|
+
function tt(e) {
|
|
703
|
+
var s, u, l;
|
|
597
704
|
if (e.format) {
|
|
598
705
|
if (!g(e.format))
|
|
599
|
-
return
|
|
706
|
+
return o(
|
|
600
707
|
"Authored raw temporal format has an invalid shape."
|
|
601
708
|
);
|
|
602
|
-
const
|
|
603
|
-
if (!
|
|
709
|
+
const m = Object.keys(e.format);
|
|
710
|
+
if (!m.includes("type") || !m.includes("presentation") || m.some(
|
|
604
711
|
(d) => d !== "type" && d !== "presentation" && d !== "timezone" && d !== "sourceTimezone"
|
|
605
712
|
) || e.format.type !== "raw_temporal" || !g(e.format.presentation))
|
|
606
|
-
return
|
|
713
|
+
return o(
|
|
607
714
|
"Authored raw temporal format has an invalid shape."
|
|
608
715
|
);
|
|
609
716
|
const f = e.format.presentation;
|
|
610
717
|
if (f.mode === "auto") {
|
|
611
718
|
if (!y(f, ["mode"]))
|
|
612
|
-
return
|
|
719
|
+
return o(
|
|
613
720
|
"Automatic authored raw temporal format has unknown fields."
|
|
614
721
|
);
|
|
615
722
|
} else {
|
|
616
723
|
if (f.mode !== "pattern" || !y(f, ["mode", "dialect", "pattern"]) || f.dialect !== "semaphor_tokens" && f.dialect !== "date_fns" || typeof f.pattern != "string")
|
|
617
|
-
return
|
|
724
|
+
return o(
|
|
618
725
|
"Authored raw temporal pattern has an invalid shape."
|
|
619
726
|
);
|
|
620
|
-
|
|
727
|
+
J(f.dialect, f.pattern);
|
|
621
728
|
}
|
|
622
729
|
}
|
|
623
|
-
const t = (
|
|
624
|
-
if (t !== void 0 && t !== "auto" && !
|
|
625
|
-
return
|
|
626
|
-
const
|
|
730
|
+
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;
|
|
731
|
+
if (t !== void 0 && t !== "auto" && !D(n) || i !== void 0 && !D(i))
|
|
732
|
+
return o("Authored raw temporal timezone is invalid.");
|
|
733
|
+
const a = ((l = e.format) == null ? void 0 : l.presentation) ?? { mode: "auto" }, c = {
|
|
627
734
|
type: "raw_temporal",
|
|
628
735
|
locale: e.preferences.locale,
|
|
629
|
-
calendarTimezone:
|
|
736
|
+
calendarTimezone: n,
|
|
630
737
|
...i ? { sourceTimezone: i } : {},
|
|
631
|
-
presentation:
|
|
738
|
+
presentation: a.mode === "pattern" ? { ...a } : {
|
|
632
739
|
mode: "auto",
|
|
633
740
|
styles: {
|
|
634
741
|
dateStyle: e.preferences.dateStyle,
|
|
@@ -636,20 +743,20 @@ function Le(e) {
|
|
|
636
743
|
}
|
|
637
744
|
}
|
|
638
745
|
};
|
|
639
|
-
return
|
|
746
|
+
return ee(c);
|
|
640
747
|
}
|
|
641
|
-
function
|
|
642
|
-
if (
|
|
643
|
-
if (
|
|
644
|
-
if (
|
|
748
|
+
function Ie(e) {
|
|
749
|
+
if (Y.test(e)) return "date";
|
|
750
|
+
if (W.test(e)) return "instant";
|
|
751
|
+
if (X.test(e)) return "wall_datetime";
|
|
645
752
|
}
|
|
646
|
-
function
|
|
753
|
+
function rt(e) {
|
|
647
754
|
const t = /* @__PURE__ */ new Set();
|
|
648
755
|
let r = !1;
|
|
649
|
-
for (const
|
|
650
|
-
if (
|
|
756
|
+
for (const n of e.values) {
|
|
757
|
+
if (n === null) continue;
|
|
651
758
|
r = !0;
|
|
652
|
-
const i =
|
|
759
|
+
const i = Ie(n);
|
|
653
760
|
i && t.add(i);
|
|
654
761
|
}
|
|
655
762
|
if (!r) return { status: "empty" };
|
|
@@ -667,7 +774,7 @@ function Ve(e) {
|
|
|
667
774
|
}
|
|
668
775
|
};
|
|
669
776
|
}
|
|
670
|
-
function
|
|
777
|
+
function nt(e) {
|
|
671
778
|
return {
|
|
672
779
|
version: 1,
|
|
673
780
|
columns: Object.fromEntries(
|
|
@@ -678,8 +785,8 @@ function Oe(e) {
|
|
|
678
785
|
)
|
|
679
786
|
};
|
|
680
787
|
}
|
|
681
|
-
function
|
|
682
|
-
if (!g(e) || e.version !== 1 || !g(e.columns) || Object.keys(e).some((
|
|
788
|
+
function Ee(e) {
|
|
789
|
+
if (!g(e) || e.version !== 1 || !g(e.columns) || Object.keys(e).some((n) => n !== "version" && n !== "columns"))
|
|
683
790
|
throw new S(
|
|
684
791
|
"invalid_raw_temporal_format",
|
|
685
792
|
"Raw temporal chunk classification evidence is malformed."
|
|
@@ -691,48 +798,48 @@ function ye(e) {
|
|
|
691
798
|
"wall_datetime",
|
|
692
799
|
"instant"
|
|
693
800
|
]);
|
|
694
|
-
for (const [
|
|
695
|
-
if (!
|
|
801
|
+
for (const [n, i] of Object.entries(e.columns)) {
|
|
802
|
+
if (!n.trim() || !r.has(i))
|
|
696
803
|
throw new S(
|
|
697
804
|
"invalid_raw_temporal_format",
|
|
698
805
|
"Raw temporal chunk classification evidence contains an invalid column or status."
|
|
699
806
|
);
|
|
700
|
-
t[
|
|
807
|
+
t[n] = i;
|
|
701
808
|
}
|
|
702
809
|
return { version: 1, columns: t };
|
|
703
810
|
}
|
|
704
|
-
function
|
|
811
|
+
function at(e) {
|
|
705
812
|
if (e.length === 0) return;
|
|
706
|
-
const t = e.map(
|
|
707
|
-
for (let
|
|
708
|
-
const i = Object.keys(t[
|
|
709
|
-
if (i.length !== r.length || i.some((
|
|
813
|
+
const t = e.map(Ee), r = Object.keys(t[0].columns).sort();
|
|
814
|
+
for (let n = 1; n < t.length; n += 1) {
|
|
815
|
+
const i = Object.keys(t[n].columns).sort();
|
|
816
|
+
if (i.length !== r.length || i.some((a, c) => a !== r[c]))
|
|
710
817
|
throw new S(
|
|
711
818
|
"invalid_raw_temporal_format",
|
|
712
819
|
"Raw temporal chunk classification evidence has inconsistent columns."
|
|
713
820
|
);
|
|
714
821
|
}
|
|
715
|
-
for (const
|
|
822
|
+
for (const n of r)
|
|
716
823
|
if (new Set(
|
|
717
|
-
t.map((
|
|
718
|
-
(
|
|
824
|
+
t.map((a) => a.columns[n]).filter(
|
|
825
|
+
(a) => a !== "empty" && a !== "invalid_only"
|
|
719
826
|
)
|
|
720
827
|
).size > 1)
|
|
721
828
|
throw new S(
|
|
722
829
|
"mixed_sql_temporal_semantics",
|
|
723
|
-
`Declared SQL temporal column "${
|
|
830
|
+
`Declared SQL temporal column "${n}" has inconsistent semantics across export chunks. Normalize it to one kind.`
|
|
724
831
|
);
|
|
725
832
|
}
|
|
726
|
-
function
|
|
833
|
+
function be(e) {
|
|
727
834
|
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
|
|
728
835
|
}
|
|
729
|
-
function
|
|
730
|
-
return t === 2 ?
|
|
836
|
+
function Pe(e, t) {
|
|
837
|
+
return t === 2 ? be(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
|
|
731
838
|
}
|
|
732
|
-
function
|
|
733
|
-
return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <=
|
|
839
|
+
function Ce(e) {
|
|
840
|
+
return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= Pe(e.year, e.month) && e.hour >= 0 && e.hour <= 23 && e.minute >= 0 && e.minute <= 59 && e.second >= 0 && e.second <= 59;
|
|
734
841
|
}
|
|
735
|
-
function
|
|
842
|
+
function Re(e) {
|
|
736
843
|
return {
|
|
737
844
|
year: Number(e[1]),
|
|
738
845
|
month: Number(e[2]),
|
|
@@ -743,70 +850,70 @@ function xe(e) {
|
|
|
743
850
|
fraction: e[7] ?? ""
|
|
744
851
|
};
|
|
745
852
|
}
|
|
746
|
-
function
|
|
747
|
-
const r = t === "date" ? e.match(
|
|
853
|
+
function Ae(e, t) {
|
|
854
|
+
const r = t === "date" ? e.match(Y) : t === "wall_datetime" ? e.match(X) : e.match(W);
|
|
748
855
|
if (!r) return { status: "invalid_shape" };
|
|
749
|
-
const
|
|
750
|
-
if (!
|
|
856
|
+
const n = Re(r);
|
|
857
|
+
if (!Ce(n)) return { status: "out_of_range" };
|
|
751
858
|
if (t === "instant") {
|
|
752
859
|
const i = r[8];
|
|
753
860
|
if (i && i !== "Z") {
|
|
754
|
-
const [c,
|
|
755
|
-
if (c > 23 ||
|
|
861
|
+
const [c, s] = i.slice(1).split(":").map(Number);
|
|
862
|
+
if (c > 23 || s > 59) return { status: "out_of_range" };
|
|
756
863
|
}
|
|
757
|
-
const
|
|
758
|
-
return Number.isNaN(
|
|
864
|
+
const a = new Date(e.replace(" ", "T"));
|
|
865
|
+
return Number.isNaN(a.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: a };
|
|
759
866
|
}
|
|
760
|
-
return { status: "valid", fields:
|
|
867
|
+
return { status: "valid", fields: n };
|
|
761
868
|
}
|
|
762
|
-
function
|
|
869
|
+
function $(e) {
|
|
763
870
|
const t = /* @__PURE__ */ new Date(0);
|
|
764
871
|
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
|
|
765
872
|
}
|
|
766
|
-
function
|
|
873
|
+
function te(e, t) {
|
|
767
874
|
const r = e.fraction ? `.${e.fraction.padEnd(3, "0").slice(0, 3)}` : "";
|
|
768
|
-
return
|
|
875
|
+
return se(
|
|
769
876
|
`${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}`,
|
|
770
877
|
t
|
|
771
878
|
);
|
|
772
879
|
}
|
|
773
|
-
function
|
|
774
|
-
const r = /* @__PURE__ */ new Map(),
|
|
775
|
-
let i,
|
|
880
|
+
function Le(e, t) {
|
|
881
|
+
const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
882
|
+
let i, a, c, s;
|
|
776
883
|
return {
|
|
777
|
-
number(
|
|
778
|
-
let
|
|
779
|
-
return
|
|
884
|
+
number(u, l = 1) {
|
|
885
|
+
let m = r.get(l);
|
|
886
|
+
return m || (m = new Intl.NumberFormat(e, {
|
|
780
887
|
useGrouping: !1,
|
|
781
|
-
minimumIntegerDigits:
|
|
888
|
+
minimumIntegerDigits: l,
|
|
782
889
|
maximumFractionDigits: 0
|
|
783
|
-
}), r.set(
|
|
890
|
+
}), r.set(l, m)), m.format(u);
|
|
784
891
|
},
|
|
785
|
-
month(
|
|
786
|
-
var
|
|
787
|
-
const f = `${
|
|
788
|
-
let d =
|
|
892
|
+
month(u, l, m) {
|
|
893
|
+
var w;
|
|
894
|
+
const f = `${l}:${m ? "standalone" : "contextual"}`;
|
|
895
|
+
let d = n.get(f);
|
|
789
896
|
if (!d) {
|
|
790
897
|
const v = {
|
|
791
898
|
calendar: "gregory",
|
|
792
899
|
timeZone: "UTC",
|
|
793
|
-
month:
|
|
900
|
+
month: l
|
|
794
901
|
};
|
|
795
|
-
|
|
902
|
+
m || (v.day = "numeric"), d = new Intl.DateTimeFormat(e, v), n.set(f, d);
|
|
796
903
|
}
|
|
797
|
-
return ((
|
|
904
|
+
return ((w = d.formatToParts(u).find((v) => v.type === "month")) == null ? void 0 : w.value) ?? "";
|
|
798
905
|
},
|
|
799
|
-
dayPeriod(
|
|
800
|
-
var
|
|
906
|
+
dayPeriod(u) {
|
|
907
|
+
var l;
|
|
801
908
|
return i ?? (i = new Intl.DateTimeFormat(e, {
|
|
802
909
|
calendar: "gregory",
|
|
803
910
|
timeZone: "UTC",
|
|
804
911
|
hour: "numeric",
|
|
805
912
|
hour12: !0
|
|
806
|
-
})), ((
|
|
913
|
+
})), ((l = i.formatToParts(u).find((m) => m.type === "dayPeriod")) == null ? void 0 : l.value) ?? "";
|
|
807
914
|
},
|
|
808
|
-
instantFields(
|
|
809
|
-
|
|
915
|
+
instantFields(u) {
|
|
916
|
+
a ?? (a = new Intl.DateTimeFormat("en-CA", {
|
|
810
917
|
calendar: "gregory",
|
|
811
918
|
numberingSystem: "latn",
|
|
812
919
|
timeZone: t,
|
|
@@ -818,160 +925,160 @@ function Te(e, t) {
|
|
|
818
925
|
second: "2-digit",
|
|
819
926
|
hourCycle: "h23"
|
|
820
927
|
}));
|
|
821
|
-
const
|
|
928
|
+
const l = a.formatToParts(u), m = (f) => {
|
|
822
929
|
var d;
|
|
823
|
-
return Number((d =
|
|
930
|
+
return Number((d = l.find((w) => w.type === f)) == null ? void 0 : d.value);
|
|
824
931
|
};
|
|
825
932
|
return {
|
|
826
|
-
year:
|
|
827
|
-
month:
|
|
828
|
-
day:
|
|
829
|
-
hour:
|
|
830
|
-
minute:
|
|
831
|
-
second:
|
|
933
|
+
year: m("year"),
|
|
934
|
+
month: m("month"),
|
|
935
|
+
day: m("day"),
|
|
936
|
+
hour: m("hour"),
|
|
937
|
+
minute: m("minute"),
|
|
938
|
+
second: m("second"),
|
|
832
939
|
fraction: ""
|
|
833
940
|
};
|
|
834
941
|
},
|
|
835
|
-
timezoneName(
|
|
836
|
-
var
|
|
942
|
+
timezoneName(u) {
|
|
943
|
+
var l;
|
|
837
944
|
return c ?? (c = new Intl.DateTimeFormat(e, {
|
|
838
945
|
calendar: "gregory",
|
|
839
946
|
timeZone: t,
|
|
840
947
|
timeZoneName: "short"
|
|
841
|
-
})), ((
|
|
948
|
+
})), ((l = c.formatToParts(u).find((m) => m.type === "timeZoneName")) == null ? void 0 : l.value) ?? "";
|
|
842
949
|
},
|
|
843
|
-
timezoneOffset(
|
|
950
|
+
timezoneOffset(u) {
|
|
844
951
|
var f;
|
|
845
|
-
|
|
952
|
+
s ?? (s = new Intl.DateTimeFormat("en-US", {
|
|
846
953
|
calendar: "gregory",
|
|
847
954
|
timeZone: t,
|
|
848
955
|
timeZoneName: "longOffset"
|
|
849
956
|
}));
|
|
850
|
-
const
|
|
851
|
-
if (!
|
|
852
|
-
return
|
|
853
|
-
const
|
|
854
|
-
return
|
|
957
|
+
const l = (f = s.formatToParts(u).find((d) => d.type === "timeZoneName")) == null ? void 0 : f.value;
|
|
958
|
+
if (!l)
|
|
959
|
+
return o("Unable to resolve the instant timezone offset.");
|
|
960
|
+
const m = l.replace(/^GMT/, "");
|
|
961
|
+
return m === "" || /^[+-]00:00$/.test(m) ? "Z" : m;
|
|
855
962
|
}
|
|
856
963
|
};
|
|
857
964
|
}
|
|
858
|
-
function
|
|
965
|
+
function Ue(e, t, r, n, i) {
|
|
859
966
|
if (/^S{1,9}$/.test(e)) {
|
|
860
|
-
const
|
|
861
|
-
return
|
|
967
|
+
const a = t.fraction.padEnd(e.length, "0").slice(0, e.length);
|
|
968
|
+
return n.number(Number(a), e.length);
|
|
862
969
|
}
|
|
863
970
|
switch (e) {
|
|
864
971
|
case "YYYY":
|
|
865
972
|
case "yyyy":
|
|
866
|
-
return
|
|
973
|
+
return n.number(t.year, 4);
|
|
867
974
|
case "YY":
|
|
868
975
|
case "yy":
|
|
869
|
-
return
|
|
976
|
+
return n.number(t.year % 100, 2);
|
|
870
977
|
case "MMMM":
|
|
871
|
-
return
|
|
978
|
+
return n.month(r, "long", !1);
|
|
872
979
|
case "LLLL":
|
|
873
|
-
return
|
|
980
|
+
return n.month(r, "long", !0);
|
|
874
981
|
case "MMM":
|
|
875
|
-
return
|
|
982
|
+
return n.month(r, "short", !1);
|
|
876
983
|
case "LLL":
|
|
877
|
-
return
|
|
984
|
+
return n.month(r, "short", !0);
|
|
878
985
|
case "MM":
|
|
879
|
-
return
|
|
986
|
+
return n.number(t.month, 2);
|
|
880
987
|
case "M":
|
|
881
|
-
return
|
|
988
|
+
return n.number(t.month);
|
|
882
989
|
case "DD":
|
|
883
990
|
case "dd":
|
|
884
|
-
return
|
|
991
|
+
return n.number(t.day, 2);
|
|
885
992
|
case "d":
|
|
886
|
-
return
|
|
993
|
+
return n.number(t.day);
|
|
887
994
|
case "HH":
|
|
888
|
-
return
|
|
995
|
+
return n.number(t.hour, 2);
|
|
889
996
|
case "H":
|
|
890
|
-
return
|
|
997
|
+
return n.number(t.hour);
|
|
891
998
|
case "hh":
|
|
892
|
-
return
|
|
999
|
+
return n.number(t.hour % 12 || 12, 2);
|
|
893
1000
|
case "h":
|
|
894
|
-
return
|
|
1001
|
+
return n.number(t.hour % 12 || 12);
|
|
895
1002
|
case "mm":
|
|
896
|
-
return
|
|
1003
|
+
return n.number(t.minute, 2);
|
|
897
1004
|
case "m":
|
|
898
|
-
return
|
|
1005
|
+
return n.number(t.minute);
|
|
899
1006
|
case "ss":
|
|
900
|
-
return
|
|
1007
|
+
return n.number(t.second, 2);
|
|
901
1008
|
case "s":
|
|
902
|
-
return
|
|
1009
|
+
return n.number(t.second);
|
|
903
1010
|
case "a":
|
|
904
|
-
return
|
|
1011
|
+
return n.dayPeriod(r);
|
|
905
1012
|
case "zzz":
|
|
906
|
-
return i ?
|
|
1013
|
+
return i ? n.timezoneName(i) : o(
|
|
907
1014
|
"Timezone pattern tokens require an instant value."
|
|
908
1015
|
);
|
|
909
1016
|
case "XXX":
|
|
910
|
-
return i ?
|
|
1017
|
+
return i ? n.timezoneOffset(i) : o(
|
|
911
1018
|
"Timezone pattern tokens require an instant value."
|
|
912
1019
|
);
|
|
913
1020
|
default:
|
|
914
|
-
return
|
|
1021
|
+
return o(
|
|
915
1022
|
`Unsupported raw temporal pattern token "${e}".`
|
|
916
1023
|
);
|
|
917
1024
|
}
|
|
918
1025
|
}
|
|
919
|
-
function
|
|
920
|
-
const i =
|
|
1026
|
+
function pe(e, t, r, n) {
|
|
1027
|
+
const i = $(t);
|
|
921
1028
|
return e.map(
|
|
922
|
-
(
|
|
1029
|
+
(a) => a.kind === "literal" ? a.value : Ue(a.value, t, i, r, n)
|
|
923
1030
|
).join("");
|
|
924
1031
|
}
|
|
925
|
-
function
|
|
926
|
-
const
|
|
927
|
-
const
|
|
928
|
-
return
|
|
929
|
-
})(), i =
|
|
930
|
-
return e === "date" && i.some((
|
|
1032
|
+
function re(e, t, r) {
|
|
1033
|
+
const n = t === "date_fns" ? Q(r) : (() => {
|
|
1034
|
+
const a = K(r);
|
|
1035
|
+
return a.ok ? a.segments : o(a.message);
|
|
1036
|
+
})(), i = n.filter((a) => a.kind === "token").map((a) => a.value);
|
|
1037
|
+
return e === "date" && i.some((a) => ke.has(a)) ? o("Date patterns cannot contain time tokens.") : e !== "instant" && i.some((a) => ze.has(a)) ? o("Timezone pattern tokens require an instant value.") : n;
|
|
931
1038
|
}
|
|
932
|
-
function
|
|
933
|
-
|
|
1039
|
+
function it(e) {
|
|
1040
|
+
re(
|
|
934
1041
|
e.valueKind ?? "instant",
|
|
935
1042
|
e.dialect,
|
|
936
1043
|
e.pattern
|
|
937
1044
|
);
|
|
938
1045
|
}
|
|
939
|
-
function
|
|
940
|
-
const i =
|
|
1046
|
+
function Ke(e, t, r, n) {
|
|
1047
|
+
const i = re(
|
|
941
1048
|
e.valueKind,
|
|
942
1049
|
r,
|
|
943
|
-
|
|
944
|
-
),
|
|
1050
|
+
n
|
|
1051
|
+
), a = Le(t.locale, t.calendarTimezone);
|
|
945
1052
|
return (c) => {
|
|
946
|
-
const
|
|
947
|
-
...
|
|
1053
|
+
const s = e.valueKind === "wall_datetime" && t.sourceTimezone ? te(c.fields, t.sourceTimezone) : void 0, u = e.valueKind === "instant" ? {
|
|
1054
|
+
...a.instantFields(c.instant),
|
|
948
1055
|
fraction: c.fields.fraction
|
|
949
|
-
} :
|
|
950
|
-
...
|
|
1056
|
+
} : s ? {
|
|
1057
|
+
...a.instantFields(s),
|
|
951
1058
|
fraction: c.fields.fraction
|
|
952
1059
|
} : c.fields;
|
|
953
|
-
return
|
|
1060
|
+
return pe(i, u, a, c.instant ?? s);
|
|
954
1061
|
};
|
|
955
1062
|
}
|
|
956
|
-
function
|
|
957
|
-
const r = t.presentation.mode === "auto" ? t.presentation.styles :
|
|
1063
|
+
function Oe(e, t) {
|
|
1064
|
+
const r = t.presentation.mode === "auto" ? t.presentation.styles : o("Automatic raw temporal formatting requires styles.");
|
|
958
1065
|
if (e.valueKind === "date") {
|
|
959
1066
|
const c = new Intl.DateTimeFormat(t.locale, {
|
|
960
1067
|
calendar: "gregory",
|
|
961
1068
|
timeZone: "UTC",
|
|
962
1069
|
dateStyle: r.dateStyle
|
|
963
1070
|
});
|
|
964
|
-
return (
|
|
1071
|
+
return (s) => c.format($(s.fields));
|
|
965
1072
|
}
|
|
966
|
-
const
|
|
1073
|
+
const n = e.valueKind === "instant", i = !n && r.dateTime.timeStyle === "long" ? "medium" : r.dateTime.timeStyle, a = new Intl.DateTimeFormat(t.locale, {
|
|
967
1074
|
calendar: "gregory",
|
|
968
|
-
timeZone:
|
|
1075
|
+
timeZone: n || e.valueKind === "wall_datetime" && t.sourceTimezone ? t.calendarTimezone : "UTC",
|
|
969
1076
|
dateStyle: r.dateTime.dateStyle,
|
|
970
1077
|
timeStyle: i
|
|
971
1078
|
});
|
|
972
|
-
return (c) =>
|
|
1079
|
+
return (c) => n ? a.format(c.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? a.format(te(c.fields, t.sourceTimezone)) : a.format($(c.fields));
|
|
973
1080
|
}
|
|
974
|
-
function
|
|
1081
|
+
function U(e, t, r) {
|
|
975
1082
|
return {
|
|
976
1083
|
ok: !1,
|
|
977
1084
|
text: e,
|
|
@@ -981,8 +1088,8 @@ function A(e, t, r) {
|
|
|
981
1088
|
}
|
|
982
1089
|
};
|
|
983
1090
|
}
|
|
984
|
-
function
|
|
985
|
-
const t =
|
|
1091
|
+
function Ve(e) {
|
|
1092
|
+
const t = ce(e.metadata), r = ee(e.format), n = r.presentation.mode === "auto" ? Oe(t, r) : Ke(
|
|
986
1093
|
t,
|
|
987
1094
|
r,
|
|
988
1095
|
r.presentation.dialect,
|
|
@@ -991,37 +1098,40 @@ function ze(e) {
|
|
|
991
1098
|
return (i) => {
|
|
992
1099
|
if (i === null)
|
|
993
1100
|
return { ok: !0, text: "", status: "empty" };
|
|
994
|
-
const
|
|
995
|
-
return
|
|
1101
|
+
const a = Ae(i, t.valueKind);
|
|
1102
|
+
return a.status === "invalid_shape" ? U(i, t, "invalid_raw_temporal_value") : a.status === "out_of_range" ? U(i, t, "out_of_range_raw_temporal_value") : { ok: !0, text: n(a), status: "formatted" };
|
|
996
1103
|
};
|
|
997
1104
|
}
|
|
998
|
-
function
|
|
999
|
-
return
|
|
1105
|
+
function ct(e) {
|
|
1106
|
+
return Ve({
|
|
1000
1107
|
metadata: e.metadata,
|
|
1001
1108
|
format: e.format
|
|
1002
1109
|
})(e.value);
|
|
1003
1110
|
}
|
|
1004
1111
|
export {
|
|
1005
1112
|
S as R,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1113
|
+
ee as a,
|
|
1114
|
+
Ye as b,
|
|
1115
|
+
E as c,
|
|
1116
|
+
j as d,
|
|
1117
|
+
q as e,
|
|
1118
|
+
Xe as f,
|
|
1119
|
+
B as g,
|
|
1120
|
+
H as h,
|
|
1121
|
+
We as i,
|
|
1122
|
+
xe as j,
|
|
1123
|
+
G as k,
|
|
1124
|
+
Te as l,
|
|
1125
|
+
et as m,
|
|
1126
|
+
tt as n,
|
|
1127
|
+
rt as o,
|
|
1128
|
+
Qe as p,
|
|
1129
|
+
nt as q,
|
|
1130
|
+
Ne as r,
|
|
1131
|
+
Ee as s,
|
|
1132
|
+
at as t,
|
|
1133
|
+
it as u,
|
|
1134
|
+
Je as v,
|
|
1135
|
+
Ve as w,
|
|
1136
|
+
ct as x
|
|
1027
1137
|
};
|